Browse Source

add Assign Customer Menu

pull/2/head
wahyuun 1 year ago
parent
commit
cd095c37ad
  1. 69
      src/views/Dashboard/DashboardProject.js
  2. 2
      src/views/SimproV2/CreatedProyek/DataRequestMaterial.js
  3. 35
      src/views/SimproV2/CreatedProyek/index.js

69
src/views/Dashboard/DashboardProject.js

@ -625,54 +625,11 @@ const DashboardProject = () => {
.then((res) => res) .then((res) => res)
.catch((err) => err.response); .catch((err) => err.response);
const RenderBehindTasks = useMemo(() => { if (!result) {
return ( NotificationManager.error(`Could not connect to internet.`, "Failed");
<div> setIsSendingComment(false);
{!isReadyOverdueActivities && <ListLoader />} return;
{isReadyOverdueActivities &&
overdueActivities &&
overdueActivities.length < 1 && (
<div
style={{
flex: 1,
textAlign: "center",
color: "#E80053",
marginTop: 50,
marginBottom: 50,
}}
>
No overdue activity found.
</div>
)}
{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 (
<BehindTaskItem key={idx} name={item.name} message={message} />
);
})}
</div>
);
}, [overdueActivities, isReadyOverdueActivities]);
if (result.status !== 200) { if (result.status !== 200) {
NotificationManager.error( NotificationManager.error(
@ -835,15 +792,23 @@ const DashboardProject = () => {
overdueActivities && overdueActivities &&
overdueActivities.length > 0 && overdueActivities.length > 0 &&
overdueActivities.map((item, idx) => { overdueActivities.map((item, idx) => {
let end_date = null; let end_date;
let today = null; let planned_end;
let diffDays = 0; let diffDays = 0;
let message = ""; let message = "";
if (item.end_date && item.end_date !== null) { if (item.end_date && item.end_date !== null) {
end_date = moment(item.end_date); end_date = moment(item.end_date);
today = moment(new Date()); planned_end = moment(item.planned_end);
diffDays = today.diff(end_date, "days"); diffDays = end_date.diff(planned_end, "days");
message = `Overdue by ${diffDays} days`; if (isNaN(diffDays)) {
return null;
} else {
if (diffDays > 0) {
message = `Overdue by ${diffDays + 1} days`;
} else {
return null;
}
}
} }
return ( return (
<BehindTaskItem key={idx} name={item.name} message={message} /> <BehindTaskItem key={idx} name={item.name} message={message} />

2
src/views/SimproV2/CreatedProyek/DataRequestMaterial.js

@ -26,7 +26,7 @@ const DialogFormMaterial = ({ openDialog, closeDialog, toggleDialog, idTask, mat
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (idTask > 0) {
getDataRequestMaterial(); // getDataRequestMaterial();
} }
}, [idTask]) }, [idTask])

35
src/views/SimproV2/CreatedProyek/index.js

@ -71,6 +71,7 @@ import DialogGantt from "./DialogGantt";
import DialogHierarchy from "./DialogHierarchy"; import DialogHierarchy from "./DialogHierarchy";
// import DialogAsignHr from './AsignHrProject'; // import DialogAsignHr from './AsignHrProject';
import AssignHrProject from "./AsignHrProject"; import AssignHrProject from "./AsignHrProject";
import AssignCustProject from "./AsignCustProject";
import AssignK3Project from "./AssignK3Project"; import AssignK3Project from "./AssignK3Project";
import ViewProject from "./ViewProject"; import ViewProject from "./ViewProject";
import { Icon } from "@iconify/react"; import { Icon } from "@iconify/react";
@ -106,6 +107,7 @@ const CreatedProyek = ({ params, ...props }) => {
const [openDialogGantt, setOpenDialogGantt] = useState(false); const [openDialogGantt, setOpenDialogGantt] = useState(false);
const [openDialogHierarchy, setOpenDialogHierarchy] = useState(false); const [openDialogHierarchy, setOpenDialogHierarchy] = useState(false);
const [openDialogAsignHR, setOpenDialogAsignHR] = useState(false); const [openDialogAsignHR, setOpenDialogAsignHR] = useState(false);
const [openDialogAsignCust, setOpenDialogAsignCust] = useState(false);
const [openDialogAssignK3, setOpenDialogAssignK3] = useState(false); const [openDialogAssignK3, setOpenDialogAssignK3] = useState(false);
const [dataK3, setDataK3] = useState([]); // transfer list const [dataK3, setDataK3] = useState([]); // transfer list
const [idDelete, setIdDelete] = useState(0); const [idDelete, setIdDelete] = useState(0);
@ -469,6 +471,12 @@ const CreatedProyek = ({ params, ...props }) => {
setOpenDialogAsignHR(true); setOpenDialogAsignHR(true);
}; };
const handleOpenAsignCust = (data) => {
setidTask(data.id);
setProyekName(data.nama);
setOpenDialogAsignCust(true);
};
const handleOpenAssignK3 = (data) => { const handleOpenAssignK3 = (data) => {
setidTask(data.id); setidTask(data.id);
setProyekName(data.nama); setProyekName(data.nama);
@ -1045,6 +1053,12 @@ const CreatedProyek = ({ params, ...props }) => {
</span> </span>
<span className="menu-text">Assign Human Resource</span> <span className="menu-text">Assign Human Resource</span>
</div> </div>
<div className="menu-list" onClick={() => handleOpenAsignCust(text)}>
<span className="menu-icon">
<i className="fa fa-user-circle-o"></i>
</span>
<span className="menu-text">Assign Customer</span>
</div>
<div className="menu-list" onClick={() => handleOpenAssignK3(text)}> <div className="menu-list" onClick={() => handleOpenAssignK3(text)}>
<span className="menu-icon"> <span className="menu-icon">
<i className="fa fa-plus-circle"></i> <i className="fa fa-plus-circle"></i>
@ -1277,6 +1291,11 @@ const CreatedProyek = ({ params, ...props }) => {
setOpenDialogAsignHR(false); setOpenDialogAsignHR(false);
}; };
const handleCloseDialogAsignCust = () => {
setidTask(0);
setOpenDialogAsignCust(false);
};
const handleCloseDialogAssignK3 = (status) => { const handleCloseDialogAssignK3 = (status) => {
if (status == "success") { if (status == "success") {
NotificationManager.success( NotificationManager.success(
@ -1384,6 +1403,21 @@ const CreatedProyek = ({ params, ...props }) => {
[openDialogAsignHR] [openDialogAsignHR]
); );
// DialogAsignCust
const RenderDialogAsignCust = useMemo(
() => (
<AssignCustProject
openDialog={openDialogAsignCust}
closeDialog={() => setOpenDialogAsignCust(false)}
toggleDialog={() => setOpenDialogAsignCust(!openDialogAsignCust)}
handleClose={handleCloseDialogAsignCust}
idTask={idTask}
proyekName={proyekName}
/>
),
[openDialogAsignCust]
);
// DialogAssignK3 // DialogAssignK3
const RenderDialogAssignK3 = useMemo( const RenderDialogAssignK3 = useMemo(
() => ( () => (
@ -1484,6 +1518,7 @@ const CreatedProyek = ({ params, ...props }) => {
{renderDialogGantt} {renderDialogGantt}
{renderDialogHierarchy} {renderDialogHierarchy}
{RenderDialogAsignHr} {RenderDialogAsignHr}
{RenderDialogAsignCust}
{RenderDialogAssignK3} {RenderDialogAssignK3}
<Card> <Card>
<CardHeader <CardHeader

Loading…
Cancel
Save