|
|
@ -89,17 +89,27 @@ import AssignK3Project from "./AssignK3Project"; |
|
|
|
import ViewProject from "./ViewProject"; |
|
|
|
import ViewProject from "./ViewProject"; |
|
|
|
import ReportAnalysis from "./ReportAnalysis"; |
|
|
|
import ReportAnalysis from "./ReportAnalysis"; |
|
|
|
import { Icon } from "@iconify/react"; |
|
|
|
import { Icon } from "@iconify/react"; |
|
|
|
// import { Link } from 'react-router-dom';
|
|
|
|
|
|
|
|
// import SubProyekComp from './SubProyekComp';
|
|
|
|
// import SubProyekComp from './SubProyekComp';
|
|
|
|
import { Link, useHistory } from "react-router-dom"; |
|
|
|
import { Link, useHistory, withRouter } from "react-router-dom"; |
|
|
|
|
|
|
|
|
|
|
|
const url = ""; |
|
|
|
const url = ""; |
|
|
|
const proyek_id = localStorage.getItem("proyek_id"); |
|
|
|
// const proyek_id = localStorage.getItem("proyek_id");
|
|
|
|
const role_id = localStorage.getItem("role_id"); |
|
|
|
// const role_id = localStorage.getItem("role_id");
|
|
|
|
const user_id = localStorage.getItem("user_id"); |
|
|
|
// const user_id = localStorage.getItem("user_id");
|
|
|
|
const format = "DD-MM-YYYY"; |
|
|
|
const format = "DD-MM-YYYY"; |
|
|
|
|
|
|
|
|
|
|
|
const CreatedProyek = ({ params, ...props }) => { |
|
|
|
const CreatedProyek = ({ params, ...props }) => { |
|
|
|
|
|
|
|
let role_id = '', user_id='',proyek_id=''; |
|
|
|
|
|
|
|
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { |
|
|
|
|
|
|
|
role_id = props.location.state.role_id; |
|
|
|
|
|
|
|
user_id = props.location.state.user_id; |
|
|
|
|
|
|
|
console.log('role_id:', role_id); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
role_id = localStorage.getItem("role_id"); |
|
|
|
|
|
|
|
proyek_id = localStorage.getItem("proyek_id"); |
|
|
|
|
|
|
|
user_id = localStorage.getItem("user_id"); |
|
|
|
|
|
|
|
console.error('Role ID is undefined in props.location.state'); |
|
|
|
|
|
|
|
} |
|
|
|
const history = useHistory(); |
|
|
|
const history = useHistory(); |
|
|
|
const token = localStorage.getItem("token"); |
|
|
|
const token = localStorage.getItem("token"); |
|
|
|
const HEADER = { |
|
|
|
const HEADER = { |
|
|
@ -200,7 +210,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
}, [openDialogProyek]); |
|
|
|
}, [openDialogProyek]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
role_id !== "44" ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
parseInt(role_id) !== 44 ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
}, [search, rowsPerPage, currentPage]); |
|
|
|
}, [search, rowsPerPage, currentPage]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
@ -894,7 +904,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
.catch((error) => error.response); |
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code === 200) { |
|
|
|
if (result && result.data && result.data.code === 200) { |
|
|
|
role_id !== "44" ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
parseInt(role_id) !== 44 ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
getProjectImage(idDelete); |
|
|
|
getProjectImage(idDelete); |
|
|
|
deleteImage(idDelete); |
|
|
|
deleteImage(idDelete); |
|
|
|
setIdDelete(0); |
|
|
|
setIdDelete(0); |
|
|
@ -965,7 +975,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
NotificationManager.success(`${result.data.message}`, "Success!!"); |
|
|
|
NotificationManager.success(`${result.data.message}`, "Success!!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
role_id !== "44" ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
parseInt(role_id) !== 44 ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
NotificationManager.error(`${result.data.message}`, "Failed!!"); |
|
|
|
NotificationManager.error(`${result.data.message}`, "Failed!!"); |
|
|
|
} |
|
|
|
} |
|
|
@ -1144,7 +1154,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
if (result && result.status === 200) { |
|
|
|
if (result && result.status === 200) { |
|
|
|
role_id !== "44" ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
parseInt(role_id) !== 44 ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
NotificationManager.success(`Data proyek berhasil Ubah`, "Success!!"); |
|
|
|
NotificationManager.success(`Data proyek berhasil Ubah`, "Success!!"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
NotificationManager.error(`${result.data.message}`, "Failed!!"); |
|
|
|
NotificationManager.error(`${result.data.message}`, "Failed!!"); |
|
|
@ -1618,7 +1628,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
dataIndex: "", |
|
|
|
dataIndex: "", |
|
|
|
key: "x", |
|
|
|
key: "x", |
|
|
|
render: (text, record) => |
|
|
|
render: (text, record) => |
|
|
|
role_id == "44" ? ( |
|
|
|
parseInt(role_id) == 44 ? ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<Tooltip title="Dashboard Project"> |
|
|
|
<Tooltip title="Dashboard Project"> |
|
|
|
<Button |
|
|
|
<Button |
|
|
@ -1997,7 +2007,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
/> |
|
|
|
/> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
<Col> |
|
|
|
<Col> |
|
|
|
{role_id == "44" ? null : ( // role kustomer
|
|
|
|
{parseInt(role_id) == 44 ? null : ( // role kustomer
|
|
|
|
<Tooltip title="Add Project"> |
|
|
|
<Tooltip title="Add Project"> |
|
|
|
<Button |
|
|
|
<Button |
|
|
|
style={{ background: "#4caf50", color: "#fff" }} |
|
|
|
style={{ background: "#4caf50", color: "#fff" }} |
|
|
@ -2068,5 +2078,4 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
export default withRouter(CreatedProyek); |
|
|
|
export default CreatedProyek; |
|
|
|
|
|
|
|