diff --git a/src/const/ApiConst.js b/src/const/ApiConst.js index f8ef23b..8d48366 100644 --- a/src/const/ApiConst.js +++ b/src/const/ApiConst.js @@ -122,6 +122,9 @@ export let BASE_OSPRO = "http://localhost:8444/generic-ospro-backend"; export let BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`; export let BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`; export let BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`; +export let BASE_SIMPRO_LUMEN_FILE_COMPANY = (file, company_name)=>{ + return `${BASE_OSPRO}/assets/${company_name}/file/project/${file}`; +} // switch (APP_MODE) { // case 'KIT': @@ -281,6 +284,10 @@ export const USER_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/human-resource/delete/${id}`; }; +export const HUMAN_RESOURCE_LIST = `${BASE_SIMPRO_LUMEN}/human-resource` +export const USER_TO_ACTIVITY_ADD = `${BASE_SIMPRO_LUMEN}/user-to-activity/add` +export const USER_TO_ACTIVITY_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/user-to-activity/delete/${id}` } + export const ABSENSI_ADD = `${BASE_SIMPRO_LUMEN}/permit/add`; export const ABSENSI_SEARCH = `${BASE_SIMPRO_LUMEN}/permit/search`; export const ABSENSI_EDIT = (id) => { @@ -307,11 +314,11 @@ export const DOCUMENT_SEARCH = `${BASE_SIMPRO_LUMEN}/document-project/search`; export const DOCUMENT_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/document-project/update/${id}`; }; -export const DOCUMENT_DELETE = (id) => { - return `${BASE_SIMPRO_LUMEN}/document-project/delete/${id}`; +export const DOCUMENT_DELETE = (id, company_id) => { + return `${BASE_SIMPRO_LUMEN}/document-project/delete/${id}/${company_id}`; }; -export const DOCUMENT_DOWNLOAD = (id) => { - return `${BASE_SIMPRO_LUMEN}/document-project/download/${id}`; +export const DOCUMENT_DOWNLOAD = (id, company_id) => { + return `${BASE_SIMPRO_LUMEN}/document-project/download/${id}/${company_id}`; }; export const ROLE_ADD = `${BASE_SIMPRO_LUMEN}/role/add`; @@ -423,8 +430,8 @@ export const PROYEK_GET_ID = (id) => { export const PROYEK_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/project/update/${id}`; }; -export const PROYEK_DELETE = (id) => { - return `${BASE_SIMPRO_LUMEN}/project/delete/${id}`; +export const PROYEK_DELETE = (id, company_id) => { + return `${BASE_SIMPRO_LUMEN}/project/delete/${id}/${company_id}`; }; export const PROJECT_ROLE_ADD = `${BASE_SIMPRO_LUMEN}/project-role/add`; @@ -576,6 +583,15 @@ export const DIVISI_DELETE = (id) => { }; export const DIVISI_LIST = `${BASE_SIMPRO_LUMEN}/divisi/list`; +export const KANBAN_BOARD_LIST = `${BASE_SIMPRO_LUMEN}/kanban-board/list` +export const KANBAN_BOARD_ADD = `${BASE_SIMPRO_LUMEN}/kanban-board/add` +export const KANBAN_BOARD_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/kanban-board/update/${id}` } +export const KANBAN_BOARD_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/kanban-board/delete/${id}` } + +export const KANBAN_CARD_LIST = `${BASE_SIMPRO_LUMEN}/kanban-card/get-data` +export const KANBAN_CARD_ADD = `${BASE_SIMPRO_LUMEN}/task` +export const KANBAN_CARD_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/kanban-card/update/${id}` } + export const SHIFT_ADD = `${BASE_SIMPRO_LUMEN}/shift/add`; export const SHIFT_SEARCH = `${BASE_SIMPRO_LUMEN}/shift/search`; export const SHIFT_EDIT = (id) => { @@ -700,8 +716,8 @@ export const ASSIGN_HR_PROJECT_SEARCH = `${BASE_SIMPRO_LUMEN}/user-to-proyek/sea export const ASSIGN_HR_PROJECT_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/user-to-proyek/update/${id}`; }; -export const ASSIGN_HR_PROJECT_DELETE = (id) => { - return `${BASE_SIMPRO_LUMEN}/user-to-proyek/delete/${id}`; +export const ASSIGN_HR_PROJECT_DELETE = (id, company_id) => { + return `${BASE_SIMPRO_LUMEN}/user-to-proyek/delete/${id}/${company_id}`; }; export const ASSIGN_HR_PROJECT_LIST = `${BASE_SIMPRO_LUMEN}/user-to-proyek/list`; @@ -772,11 +788,11 @@ export const WAYPOINT_SEARCH = `${BASE_SIMPRO_LUMEN}/waypoint/search`; export const IMAGE_UPLOAD = `${BASE_SIMPRO_LUMEN}/image/upload`; export const IMAGE_MULTIPLE_UPLOAD = `${BASE_SIMPRO_LUMEN}/image/multiple-upload`; -export const IMAGE_MULTIPLE_DELETE = (id, category) => { - return `${BASE_SIMPRO_LUMEN}/image/multiple-delete/${id}/${category}`; +export const IMAGE_MULTIPLE_DELETE = (id, category, company_id) => { + return `${BASE_SIMPRO_LUMEN}/image/multiple-delete/${id}/${category}/${company_id}`; } -export const IMAGE_DELETE = (id, category) => { - return `${BASE_SIMPRO_LUMEN}/image/delete/${id}/${category}`; +export const IMAGE_DELETE = (id, category, company_id) => { + return `${BASE_SIMPRO_LUMEN}/image/delete/${id}/${category}/${company_id}`; } diff --git a/src/routes.js b/src/routes.js index 6847782..eb71b0f 100644 --- a/src/routes.js +++ b/src/routes.js @@ -47,6 +47,7 @@ const Shift = React.lazy(() => import('./views/SimproV2/Shift')); const TestGantt = React.lazy(() => import('./views/testgantt')); const UserAdmin = React.lazy(() => import('./views/Master/UserAdmin')); const UserShift = React.lazy(() => import('./views/SimproV2/UserShift')); +const Kanban = React.lazy(() => import('./views/SimproV2/Kanban')); // const DashboardProject = React.lazy(() => import('./views/DashboardProject')); const DashboardBOD = React.lazy(() => import('./views/Dashboard/DashboardBOD')); const DashboardCustomer = React.lazy(() => import('./views/Dashboard/DashboardCustomer')); @@ -71,7 +72,6 @@ const routes = [ { path: '/human-resource', exact: true, name: 'Human Resource', component: ResourceWorker }, { path: '/material-resource', exact: true, name: 'Material Resource', component: ResourceMaterial }, { path: '/tools-resource', exact: true, name: 'Tools Resource', component: ResourceTools }, - { path: '/control-monitoring', exact: true, name: 'Control Monitoring', component: ControlMonitoring }, { path: '/control-monitoring-gantt', exact: true, name: 'Control Monitoring Gantt', component: ControlMonitoringGantt }, { path: '/presensi-resource', exact: true, name: 'Presensi Resource', component: Presensi }, @@ -79,9 +79,9 @@ const routes = [ { path: '/laporan-k3', exact: true, name: 'Laporan K3', component: K3 }, { path: '/broadcast', exact: true, name: 'Broadcast', component: Broadcast }, { path: '/panic-button', exact: true, name: 'Tombol Darurat', component: PanicButton }, - + { path: '/kanban', exact: true, name: 'Kanban', component: Kanban }, + { path: '/kanban/:proyek_id/:version_gantt_id', exact: true, name: 'Kanban', component: Kanban }, { path: '/closing', exact: true, name: 'Closing', component: Closing }, - { path: '/menu', exact: true, name: 'Menu', component: Menu }, { path: '/roles', exact: true, name: 'Roles', component: Roles }, { path: '/project-role', exact: true, name: 'Project Role', component: ProjectRole }, diff --git a/src/views/ControlMonitoringGantt/index.js b/src/views/ControlMonitoringGantt/index.js index 95a5376..fc3c1b4 100644 --- a/src/views/ControlMonitoringGantt/index.js +++ b/src/views/ControlMonitoringGantt/index.js @@ -1,247 +1,247 @@ -import React, { useEffect, useMemo, useState } from 'react'; -import Timeline from 'react-calendar-timeline' -import 'react-calendar-timeline/lib/Timeline.css' -import moment from 'moment'; -import { BASE_SIMPRO, PROYEK_ADD, PROYEK_SEARCH_DETAIL, GANTT_CONTROL_MONITORING_SEARCH, PROYEK_EDIT, PROYEK_DELETE } from '../../const/ApiConst'; -import axios from 'axios'; -import { NotificationContainer, NotificationManager } from 'react-notifications'; -import { Button } from 'antd'; -import { - Container, Col, Row, UncontrolledTooltip, - Card, - CardBody, - CardHeader, - Table, - Modal, ModalHeader, ModalBody, ModalFooter -} from 'reactstrap'; -import GanttFull from './GanttDhtmlx2'; -import DialogForm from '../Master/Proyek/DialogForm'; -import DialogFormSub from '../Master/Proyek/DialogFormSub'; -import Iframe from "@nicholasadamou/react-iframe"; - -const getUrlParameter = (sParam) => { - var sPageURL = window.location.search.substring(1), - sURLVariables = sPageURL.split('&'), - sParameterName, - i; - - for (i = 0; i < sURLVariables.length; i++) { - sParameterName = sURLVariables[i].split('='); - - if (sParameterName[0] === sParam) { - return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); - } - } - return false; -}; - -const GanttTimeLine = () => { - const token = localStorage.getItem("token") - const HEADER = { - headers: { - "Content-Type": "application/json", - "Authorization": `Bearer ${token}` - } - } - - const [proyekId, setProyekId] = useState(15); - const [dataGantt, setDataGantt] = useState([]); - const [prevProyekId, setPrevProyekId] = useState(0); - const [dataGroupGantt, setDataGroupGantt] = useState([]); - const [maxDateGantt, setMaxDateGantt] = useState(null); - const [minDateGantt, setMinDateGantt] = useState(null); - const [dataAllTimeLine, setDataAllTimeLine] = useState([]); - const [prevDataAllTimeLine, setPrevDataAllTimeLine] = useState(null); - - const [idTask, setidTask] = useState(0); - const [dataTable, setDatatable] = useState([]) - const [search, setSearch] = useState('') - const [currentPage, setCurrentPage] = useState(1) - const [totalPage, setTotalPage] = useState(0) - const [openDialog, setOpenDialog] = useState(false) - const [openDialogSub, setOpenDialogSub] = useState(false) - const [typeDialog, setTypeDialog] = useState('Save'); - const [typeDialogSub, setTypeDialogSub] = useState('Save') - const [idDelete, setIdDelete] = useState(0) - const [alertDelete, setAlertDelete] = useState(false) - const [dataEdit, setDataEdit] = useState([]) - const [dataEditSub, setDataEditSub] = useState([]) - const [rowsPerPage, setRowsPerPage] = useState(10) - const [clickOpenModal, setClickOpenModal] = useState(false) - const [dataExport, setDataExport] = useState([]) - const [allDataMenu, setAllDataMenu] = useState([]) - const [idSubtask, setIdSubtask] = useState(0); - - const handleMappingDataGantt = (data) => { - const minDates = data.map(res => moment(res.mulai_proyek)), - minDate = moment.min(minDates) - const maxDates = data.map(res => moment(res.akhir_proyek)), - maxDate = moment.max(maxDates) - - let groups = [] - let items = [] - data.map((res, idx) => { - let group = { - id: res.id, - title: res.nama, - stackItems: true, - height: 50 - } - let item = { - id: res.id, - group: res.id, - title: res.pic, - start_time: moment(res.mulai_proyek), - end_time: moment(res.akhir_proyek), - } - groups.push(group) - items.push(item) - }) - setDataGantt(items) - setDataGroupGantt(groups) - setMaxDateGantt(maxDate) - setMinDateGantt(minDate) - } - - const handleGetDataProyek = async () => { - - const payload = { - "columns": [ - { "name": "nama", "logic_operator": "ilike", "value": "", "operator": "AND" } - ], - "joins": [ - { "name": "subproyeks.m_proyek", "column_join": "proyek_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual"] }, - { "name": "subproyeks.m_subproyek", "column_join": "parent_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual"] } - ], - "orders": { "columns": ["id"], "ascending": true }, - "paging": { "start": 0, "length": 25 } - } - - const result = await axios - .post(GANTT_CONTROL_MONITORING_SEARCH, payload, HEADER) - .then(res => res) - .catch((error) => error.response); - - - if (result && result.data && result.data.code == 200) { - const { data } = result.data - setDataAllTimeLine(data) - setPrevDataAllTimeLine(data) - handleMappingDataGantt(data) - - } else { - NotificationManager.error('Gagal Export Data!!', 'Failed'); - } - } - - useEffect(() => { - let proyek_id = getUrlParameter('proyek_id'); - if (proyek_id) { - setProyekId(proyek_id); - } - handleGetDataProyek() - }, []); - - const handleClickGroupGantt = param => { - const row = prevDataAllTimeLine.filter(res => res.id === param) - if (row.length > 0) { - const { subproyeks, proyek_id, parent_id } = row[0] - setPrevProyekId(parent_id || proyek_id) - handleMappingDataGantt(subproyeks) - setDataAllTimeLine(subproyeks) - } - - } - - const handleOpenDialog = (type) => { - setOpenDialog(true) - setTypeDialog(type) - } - - const handleOpenDialogSub = (type, param) => { - const { id, parent_id, proyek_id, parent } = param - const idParent = parent == 0 ? 0 : parent == proyek_id ? id : parent_id - setidTask(proyek_id) - setIdSubtask(idParent) - setOpenDialogSub(true) - setTypeDialogSub(type) - } - - const handleCloseDialog = (type, data) => { - if (type === "save") { - saveProyek(data); - } - - setDataEdit([]) - setOpenDialog(false) - } - - const handleCloseDialogSub = (type, data) => { - setDataEditSub([]) - setOpenDialogSub(false) - if (type !== "cancel") { - handleGetDataProyek() - } - - } - - const toggleAddDialog = () => { - setOpenDialog(!openDialog) - } - - const toggleAddDialogSub = () => { - setOpenDialogSub(!openDialogSub) - } - - const saveProyek = async (data) => { - const formData = data - - const result = await axios.post(PROYEK_ADD, formData, HEADER) - .then(res => res) - .catch((error) => error.response); - - if (result && result.data && result.data.code === 200) { - handleGetDataProyek() - NotificationManager.success(`Data proyek berhasil ditambah`, 'Success!!'); - } else { - NotificationManager.error(`${result.data.message}`, 'Failed!!'); - } - - } - - const RenderGantt = useMemo(() => ( - - ), [dataAllTimeLine, maxDateGantt, minDateGantt]) - - return ( -
- {/* {RenderGantt} */} - {/* */} - */} +