diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js
index 7dcc71c..ac105d5 100644
--- a/src/views/Dashboard/DashboardProject.js
+++ b/src/views/Dashboard/DashboardProject.js
@@ -625,54 +625,11 @@ const DashboardProject = () => {
.then((res) => res)
.catch((err) => err.response);
- const RenderBehindTasks = useMemo(() => {
- return (
-
- {!isReadyOverdueActivities &&
}
- {isReadyOverdueActivities &&
- overdueActivities &&
- overdueActivities.length < 1 && (
-
- No overdue activity found.
-
- )}
- {isReadyOverdueActivities &&
- overdueActivities &&
- overdueActivities.length > 0 &&
- overdueActivities.map((item, idx) => {
- let end_date;
- let planned_end;
- let diffDays = 0;
- let message = "";
- if (item.end_date && item.end_date !== null) {
- end_date = moment(item.end_date);
- planned_end = moment(item.planned_end);
- diffDays = end_date.diff(planned_end, "days");
- if (isNaN(diffDays)) {
- return null;
- } else {
- if (diffDays > 0) {
- message = `Overdue by ${diffDays + 1} days`;
- } else {
- return null;
- }
- }
- }
- return (
-
- );
- })}
-
- );
- }, [overdueActivities, isReadyOverdueActivities]);
+ if (!result) {
+ NotificationManager.error(`Could not connect to internet.`, "Failed");
+ setIsSendingComment(false);
+ return;
+ }
if (result.status !== 200) {
NotificationManager.error(
@@ -835,15 +792,23 @@ const DashboardProject = () => {
overdueActivities &&
overdueActivities.length > 0 &&
overdueActivities.map((item, idx) => {
- let end_date = null;
- let today = null;
+ let end_date;
+ let planned_end;
let diffDays = 0;
let message = "";
if (item.end_date && item.end_date !== null) {
end_date = moment(item.end_date);
- today = moment(new Date());
- diffDays = today.diff(end_date, "days");
- message = `Overdue by ${diffDays} days`;
+ planned_end = moment(item.planned_end);
+ diffDays = end_date.diff(planned_end, "days");
+ if (isNaN(diffDays)) {
+ return null;
+ } else {
+ if (diffDays > 0) {
+ message = `Overdue by ${diffDays + 1} days`;
+ } else {
+ return null;
+ }
+ }
}
return (
diff --git a/src/views/SimproV2/CreatedProyek/DataRequestMaterial.js b/src/views/SimproV2/CreatedProyek/DataRequestMaterial.js
index 9609392..349d2b8 100644
--- a/src/views/SimproV2/CreatedProyek/DataRequestMaterial.js
+++ b/src/views/SimproV2/CreatedProyek/DataRequestMaterial.js
@@ -1,239 +1,239 @@
-import React, { useEffect, useState, useMemo } from 'react'
-import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
-import { Button } from 'reactstrap';
-import { Table, Tooltip } from 'antd';
-import 'antd/dist/antd.css';
-import moment from 'moment';
-import SweetAlert from 'react-bootstrap-sweetalert';
-import { REQUEST_MATERIAL_SEARCH, REQUEST_MATERIAL_ADD, REQUEST_MATERIAL_DELETE, REQUEST_MATERIAL_EDIT } from '../../../const/ApiConst';
-import axios from "../../../const/interceptorApi"
-import { NotificationContainer, NotificationManager } from 'react-notifications';
-import DialogRequest from './FormRequestMaterial';
-import { renderLabelStatus } from '../../../const/CustomFunc';
-const DialogFormMaterial = ({ openDialog, closeDialog, toggleDialog, idTask, materialResource, proyekName }) => {
- const token = localStorage.getItem("token")
- const HEADER = {
- headers: {
- "Content-Type": "application/json",
- "Authorization": `Bearer ${token}`
- }
- }
- const [dataResource, setDataResource] = useState([])
- const [openDialogReq, setOpenDialogReq] = useState(false)
- const [alertDelete, setAlertDelete] = useState(false)
- const [idDelete, setIdDelete] = useState(0)
- const [dataEdit, setDataEdit] = useState(null)
-
- useEffect(() => {
- if (idTask > 0) {
- getDataRequestMaterial();
- }
- }, [idTask])
-
- useEffect(() => {
- if (!openDialog) {
- setDataResource([]);
- } else {
-
- }
- }, [openDialog])
-
-
- const getDataRequestMaterial = async () => {
- const payload = {
- "columns": [
- { "name": "description", "logic_operator": "ilike", "value": "", "operator": "AND" },
- { "name": "proyek_id", "logic_operator": "=", "value": idTask, "operator": "AND" }
- ],
- "joins": [],
- "orders": { "columns": ["id"], "ascending": true },
- "paging": { "start": 0, "length": 25 }
- }
-
- const result = await axios
- .post(REQUEST_MATERIAL_SEARCH, payload, HEADER)
- .then(res => res)
- .catch((error) => error.response);
- console.log("result", result)
- if (result && result.status == 200) {
- setDataResource(result.data.data);
- } else {
-
- }
- }
-
- const handleCancel = () => {
- setDataResource([]);
- setDataEdit(null)
- closeDialog('cancel', 'none')
- }
-
- const handleDelete = (id) => {
- setIdDelete(id)
- setAlertDelete(true)
- }
-
- const handleEdit = async (data) => {
- await setDataEdit(data)
- setOpenDialogReq(true)
- }
-
- const RenderTable = useMemo(() => {
- const columns = [
- {
- title: 'Action',
- dataIndex: '',
- key: 'id',
- className: "nowrap",
- render: (text, record) => <>
-
- {text.status == "fom" ? <>
-
- {" "}
-
- > : "-"}
- >,
- },
- { title: 'Status', dataIndex: 'status', key: 'status', render: (text, record) => renderLabelStatus(text) },
- { title: 'Description', dataIndex: 'description', key: 'description' },
- { title: 'Required Date', dataIndex: 'required_date', key: 'required_date', className: "nowrap", render: (text, record) => ({moment(text).format("D-M-YYYY")}
) },
- { title: 'QTY', dataIndex: 'qty', key: 'qty', render: (text, record) => ({text ? text : "-"}
) },
- { title: 'UOM', dataIndex: 'uom', key: 'uom', render: (text, record) => ({text ? text : "-"}
) },
- { title: 'QTY Received', dataIndex: 'qty_received', key: 'qty_received', className: "nowrap", render: (text, record) => ({text ? text : "-"}
) },
- { title: 'FOM Date', dataIndex: 'fom_date', key: 'fom_date', className: "nowrap", render: (text, record) => ({moment(text).format("D-M-YYYY")}
) },
- { title: 'PR Date', dataIndex: 'pr_date', key: 'pr_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
- { title: 'PO Date', dataIndex: 'po_date', key: 'po_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
- { title: 'Received Date', dataIndex: 'received_date', key: 'received_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
- { title: 'Delivery Date', dataIndex: 'delivery_date', key: 'delivery_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
- ];
-
- return (
-
- )
- }, [dataResource])
-
- const closeDialogReq = (type, data) => {
- if (type == "add") {
- saveRequestMaterial(data);
- } else if (type == "edit") {
- updateRequestMaterial(data);
- } else {
- setOpenDialogReq(false);
- setDataEdit(null)
- }
-
- }
-
- const toggleDialogReq = () => {
- setOpenDialogReq(!openDialogReq)
- }
-
- const openDialogRequest = () => {
- setOpenDialogReq(true)
- }
-
- const saveRequestMaterial = async (data) => {
- const result = await axios
- .post(REQUEST_MATERIAL_ADD, data, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- getDataRequestMaterial();
- NotificationManager.success('Data request material berhasill ditambahkan!!', 'Success');
- setOpenDialogReq(false);
- setDataEdit(null)
- } else {
- NotificationManager.error('Data request material gagal ditambahkan!!', 'Failed');
- }
- }
-
- const updateRequestMaterial = async (data) => {
- let url = REQUEST_MATERIAL_EDIT(data.id)
- const result = await axios
- .put(url, data, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- getDataRequestMaterial();
- NotificationManager.success('Data request material berhasill diedit!!', 'Success');
- setOpenDialogReq(false);
- setDataEdit(null)
- } else {
- NotificationManager.error('Data request material gagal diedit!!', 'Failed');
- }
- }
-
- const cancelDelete = () => {
- setAlertDelete(false)
- setIdDelete(0)
- }
-
- const onConfirmDelete = async () => {
- let urlDel = REQUEST_MATERIAL_DELETE(idDelete)
- const result = await axios.delete(urlDel, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code === 200) {
- getDataRequestMaterial()
- setIdDelete(0)
- setAlertDelete(false)
- NotificationManager.success(`Data request material berhasil dihapus`, 'Success!!');
- } else {
- setIdDelete(0)
- setAlertDelete(false)
- NotificationManager.error(`Data request material gagal dihapus`, 'Failed!!');
- }
- }
-
- return (
- <>
-
-
- Request Material Resource - {proyekName}
-
-
-
- {RenderTable}
-
-
- {/*
-
- */}
-
-
- cancelDelete()}
- focusCancelBtn
- >
- Delete this data
-
-
- >
- )
-
-}
-
-export default DialogFormMaterial;
\ No newline at end of file
+import React, { useEffect, useState, useMemo } from 'react'
+import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
+import { Button } from 'reactstrap';
+import { Table, Tooltip } from 'antd';
+import 'antd/dist/antd.css';
+import moment from 'moment';
+import SweetAlert from 'react-bootstrap-sweetalert';
+import { REQUEST_MATERIAL_SEARCH, REQUEST_MATERIAL_ADD, REQUEST_MATERIAL_DELETE, REQUEST_MATERIAL_EDIT } from '../../../const/ApiConst';
+import axios from "../../../const/interceptorApi"
+import { NotificationContainer, NotificationManager } from 'react-notifications';
+import DialogRequest from './FormRequestMaterial';
+import { renderLabelStatus } from '../../../const/CustomFunc';
+const DialogFormMaterial = ({ openDialog, closeDialog, toggleDialog, idTask, materialResource, proyekName }) => {
+ const token = localStorage.getItem("token")
+ const HEADER = {
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${token}`
+ }
+ }
+ const [dataResource, setDataResource] = useState([])
+ const [openDialogReq, setOpenDialogReq] = useState(false)
+ const [alertDelete, setAlertDelete] = useState(false)
+ const [idDelete, setIdDelete] = useState(0)
+ const [dataEdit, setDataEdit] = useState(null)
+
+ useEffect(() => {
+ if (idTask > 0) {
+ // getDataRequestMaterial();
+ }
+ }, [idTask])
+
+ useEffect(() => {
+ if (!openDialog) {
+ setDataResource([]);
+ } else {
+
+ }
+ }, [openDialog])
+
+
+ const getDataRequestMaterial = async () => {
+ const payload = {
+ "columns": [
+ { "name": "description", "logic_operator": "ilike", "value": "", "operator": "AND" },
+ { "name": "proyek_id", "logic_operator": "=", "value": idTask, "operator": "AND" }
+ ],
+ "joins": [],
+ "orders": { "columns": ["id"], "ascending": true },
+ "paging": { "start": 0, "length": 25 }
+ }
+
+ const result = await axios
+ .post(REQUEST_MATERIAL_SEARCH, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+ console.log("result", result)
+ if (result && result.status == 200) {
+ setDataResource(result.data.data);
+ } else {
+
+ }
+ }
+
+ const handleCancel = () => {
+ setDataResource([]);
+ setDataEdit(null)
+ closeDialog('cancel', 'none')
+ }
+
+ const handleDelete = (id) => {
+ setIdDelete(id)
+ setAlertDelete(true)
+ }
+
+ const handleEdit = async (data) => {
+ await setDataEdit(data)
+ setOpenDialogReq(true)
+ }
+
+ const RenderTable = useMemo(() => {
+ const columns = [
+ {
+ title: 'Action',
+ dataIndex: '',
+ key: 'id',
+ className: "nowrap",
+ render: (text, record) => <>
+
+ {text.status == "fom" ? <>
+
+ {" "}
+
+ > : "-"}
+ >,
+ },
+ { title: 'Status', dataIndex: 'status', key: 'status', render: (text, record) => renderLabelStatus(text) },
+ { title: 'Description', dataIndex: 'description', key: 'description' },
+ { title: 'Required Date', dataIndex: 'required_date', key: 'required_date', className: "nowrap", render: (text, record) => ({moment(text).format("D-M-YYYY")}
) },
+ { title: 'QTY', dataIndex: 'qty', key: 'qty', render: (text, record) => ({text ? text : "-"}
) },
+ { title: 'UOM', dataIndex: 'uom', key: 'uom', render: (text, record) => ({text ? text : "-"}
) },
+ { title: 'QTY Received', dataIndex: 'qty_received', key: 'qty_received', className: "nowrap", render: (text, record) => ({text ? text : "-"}
) },
+ { title: 'FOM Date', dataIndex: 'fom_date', key: 'fom_date', className: "nowrap", render: (text, record) => ({moment(text).format("D-M-YYYY")}
) },
+ { title: 'PR Date', dataIndex: 'pr_date', key: 'pr_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
+ { title: 'PO Date', dataIndex: 'po_date', key: 'po_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
+ { title: 'Received Date', dataIndex: 'received_date', key: 'received_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
+ { title: 'Delivery Date', dataIndex: 'delivery_date', key: 'delivery_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
+ ];
+
+ return (
+
+ )
+ }, [dataResource])
+
+ const closeDialogReq = (type, data) => {
+ if (type == "add") {
+ saveRequestMaterial(data);
+ } else if (type == "edit") {
+ updateRequestMaterial(data);
+ } else {
+ setOpenDialogReq(false);
+ setDataEdit(null)
+ }
+
+ }
+
+ const toggleDialogReq = () => {
+ setOpenDialogReq(!openDialogReq)
+ }
+
+ const openDialogRequest = () => {
+ setOpenDialogReq(true)
+ }
+
+ const saveRequestMaterial = async (data) => {
+ const result = await axios
+ .post(REQUEST_MATERIAL_ADD, data, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ getDataRequestMaterial();
+ NotificationManager.success('Data request material berhasill ditambahkan!!', 'Success');
+ setOpenDialogReq(false);
+ setDataEdit(null)
+ } else {
+ NotificationManager.error('Data request material gagal ditambahkan!!', 'Failed');
+ }
+ }
+
+ const updateRequestMaterial = async (data) => {
+ let url = REQUEST_MATERIAL_EDIT(data.id)
+ const result = await axios
+ .put(url, data, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ getDataRequestMaterial();
+ NotificationManager.success('Data request material berhasill diedit!!', 'Success');
+ setOpenDialogReq(false);
+ setDataEdit(null)
+ } else {
+ NotificationManager.error('Data request material gagal diedit!!', 'Failed');
+ }
+ }
+
+ const cancelDelete = () => {
+ setAlertDelete(false)
+ setIdDelete(0)
+ }
+
+ const onConfirmDelete = async () => {
+ let urlDel = REQUEST_MATERIAL_DELETE(idDelete)
+ const result = await axios.delete(urlDel, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ getDataRequestMaterial()
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.success(`Data request material berhasil dihapus`, 'Success!!');
+ } else {
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.error(`Data request material gagal dihapus`, 'Failed!!');
+ }
+ }
+
+ return (
+ <>
+
+
+ Request Material Resource - {proyekName}
+
+
+
+ {RenderTable}
+
+
+ {/*
+
+ */}
+
+
+ cancelDelete()}
+ focusCancelBtn
+ >
+ Delete this data
+
+
+ >
+ )
+
+}
+
+export default DialogFormMaterial;
diff --git a/src/views/SimproV2/CreatedProyek/index.js b/src/views/SimproV2/CreatedProyek/index.js
index 2c0180b..a26c26c 100644
--- a/src/views/SimproV2/CreatedProyek/index.js
+++ b/src/views/SimproV2/CreatedProyek/index.js
@@ -71,6 +71,7 @@ import DialogGantt from "./DialogGantt";
import DialogHierarchy from "./DialogHierarchy";
// import DialogAsignHr from './AsignHrProject';
import AssignHrProject from "./AsignHrProject";
+import AssignCustProject from "./AsignCustProject";
import AssignK3Project from "./AssignK3Project";
import ViewProject from "./ViewProject";
import { Icon } from "@iconify/react";
@@ -106,6 +107,7 @@ const CreatedProyek = ({ params, ...props }) => {
const [openDialogGantt, setOpenDialogGantt] = useState(false);
const [openDialogHierarchy, setOpenDialogHierarchy] = useState(false);
const [openDialogAsignHR, setOpenDialogAsignHR] = useState(false);
+ const [openDialogAsignCust, setOpenDialogAsignCust] = useState(false);
const [openDialogAssignK3, setOpenDialogAssignK3] = useState(false);
const [dataK3, setDataK3] = useState([]); // transfer list
const [idDelete, setIdDelete] = useState(0);
@@ -469,6 +471,12 @@ const CreatedProyek = ({ params, ...props }) => {
setOpenDialogAsignHR(true);
};
+ const handleOpenAsignCust = (data) => {
+ setidTask(data.id);
+ setProyekName(data.nama);
+ setOpenDialogAsignCust(true);
+ };
+
const handleOpenAssignK3 = (data) => {
setidTask(data.id);
setProyekName(data.nama);
@@ -1045,6 +1053,12 @@ const CreatedProyek = ({ params, ...props }) => {
Assign Human Resource
+ handleOpenAsignCust(text)}>
+
+
+
+ Assign Customer
+
handleOpenAssignK3(text)}>
@@ -1277,6 +1291,11 @@ const CreatedProyek = ({ params, ...props }) => {
setOpenDialogAsignHR(false);
};
+ const handleCloseDialogAsignCust = () => {
+ setidTask(0);
+ setOpenDialogAsignCust(false);
+ };
+
const handleCloseDialogAssignK3 = (status) => {
if (status == "success") {
NotificationManager.success(
@@ -1384,6 +1403,21 @@ const CreatedProyek = ({ params, ...props }) => {
[openDialogAsignHR]
);
+ // DialogAsignCust
+ const RenderDialogAsignCust = useMemo(
+ () => (
+ setOpenDialogAsignCust(false)}
+ toggleDialog={() => setOpenDialogAsignCust(!openDialogAsignCust)}
+ handleClose={handleCloseDialogAsignCust}
+ idTask={idTask}
+ proyekName={proyekName}
+ />
+ ),
+ [openDialogAsignCust]
+ );
+
// DialogAssignK3
const RenderDialogAssignK3 = useMemo(
() => (
@@ -1484,6 +1518,7 @@ const CreatedProyek = ({ params, ...props }) => {
{renderDialogGantt}
{renderDialogHierarchy}
{RenderDialogAsignHr}
+ {RenderDialogAsignCust}
{RenderDialogAssignK3}