Browse Source

filter by hierarchy

pull/2/head
farhan048 1 year ago
parent
commit
4de2693554
  1. 1
      src/views/Pages/Login/Login.js
  2. 46
      src/views/SimproV2/CreatedProyek/index.js

1
src/views/Pages/Login/Login.js

@ -217,6 +217,7 @@ class Login extends Component {
window.localStorage.setItem('role_id', data_user.role_id); window.localStorage.setItem('role_id', data_user.role_id);
window.localStorage.setItem('company_id', data_user.company_id); window.localStorage.setItem('company_id', data_user.company_id);
window.localStorage.setItem('role_name', data_user.role.name); window.localStorage.setItem('role_name', data_user.role.name);
window.localStorage.setItem('hierarchy', JSON.stringify(data_user.hierarchy));
} else { } else {
console.log("kode : ", doLogin.data.code); console.log("kode : ", doLogin.data.code);
// NotificationManager.error('Cek username atau password anda!', 'Gagal Login!'); // NotificationManager.error('Cek username atau password anda!', 'Gagal Login!');

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

@ -292,7 +292,8 @@ const CreatedProyek = ({ params, ...props }) => {
const getDataProyek = async () => { const getDataProyek = async () => {
let start = 0; let start = 0;
let hierarchy = [];
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy")));
if (currentPage !== 1 && currentPage > 1) { if (currentPage !== 1 && currentPage > 1) {
start = currentPage * rowsPerPage - rowsPerPage; start = currentPage * rowsPerPage - rowsPerPage;
} }
@ -335,6 +336,7 @@ const CreatedProyek = ({ params, ...props }) => {
if (parseInt(role_id) !== 1) { if (parseInt(role_id) !== 1) {
payload["columns"] = [ payload["columns"] = [
{ name: "id", logic_operator: "=", value: proyek_id, operator: "AND" }, { name: "id", logic_operator: "=", value: proyek_id, operator: "AND" },
{ name: "created_by_id", logic_operator: "IN", value: hierarchy, operator: "AND" }
]; ];
} }
@ -574,7 +576,7 @@ const CreatedProyek = ({ params, ...props }) => {
"checklist_k3_id" "checklist_k3_id"
], ],
"columns": [ "columns": [
{ "name": "proyek_id", "logic_operator": "=", "value": id, "operator": "AND" } { "name": "proyek_id", "logic_operator": "=", "value": id, "operator": "AND" }
] ]
} }
const URL = `${BASE_OSPRO}/api/project-to-checklist-k3/search`; const URL = `${BASE_OSPRO}/api/project-to-checklist-k3/search`;
@ -583,11 +585,11 @@ const CreatedProyek = ({ params, ...props }) => {
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if(result && result.status==200){ if (result && result.status == 200) {
console.log("cek get project to checklist k3",result.data.data) console.log("cek get project to checklist k3", result.data.data)
let dataRes = result.data.data; let dataRes = result.data.data;
if (dataRes.length > 0) { if (dataRes.length > 0) {
setK3Search(dataRes); setK3Search(dataRes);
} }
} }
} }
@ -611,8 +613,8 @@ 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) {
const {value_proyek,area_kerja,scoupe_of_work, kode_sortname,nama,mulai_proyek,rencana_biaya,keterangan,durasi_proyek,project_objectives,potential_risk,currency_symbol, nama_divisi, late_consequence, assumtion, considered_success_when} = result.data.data; const { value_proyek, area_kerja, scoupe_of_work, kode_sortname, nama, mulai_proyek, rencana_biaya, keterangan, durasi_proyek, project_objectives, potential_risk, currency_symbol, nama_divisi, late_consequence, assumtion, considered_success_when } = result.data.data;
const dataToSend = {value_proyek,area_kerja,scoupe_of_work, kode_sortname, nama, mulai_proyek, rencana_biaya, keterangan, durasi_proyek, project_objectives, potential_risk, currency_symbol, nama_divisi, late_consequence, assumtion, considered_success_when}; const dataToSend = { value_proyek, area_kerja, scoupe_of_work, kode_sortname, nama, mulai_proyek, rencana_biaya, keterangan, durasi_proyek, project_objectives, potential_risk, currency_symbol, nama_divisi, late_consequence, assumtion, considered_success_when };
setProjectCharter(dataToSend); setProjectCharter(dataToSend);
} else { } else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); NotificationManager.error("Gagal Mengambil Data!!", "Failed");
@ -1096,7 +1098,7 @@ const CreatedProyek = ({ params, ...props }) => {
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) .post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
return "berhasil"; return "berhasil";
}; };
const deleteImage = async (id) => { const deleteImage = async (id) => {
@ -1106,7 +1108,7 @@ const CreatedProyek = ({ params, ...props }) => {
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
return "berhasil"; return "berhasil";
}; };
const editProyek = async (data) => { const editProyek = async (data) => {
@ -1501,16 +1503,16 @@ const CreatedProyek = ({ params, ...props }) => {
<span className="menu-text">Request Tools</span> <span className="menu-text">Request Tools</span>
</div> */} </div> */}
{/* <Link to={`/project-charter/${text.id}/gantt`}> */} {/* <Link to={`/project-charter/${text.id}/gantt`}> */}
{ {
/*text.type_proyek_id != 9 ?*/ /*text.type_proyek_id != 9 ?*/
<div className="menu-list" onClick={() => handleOpenDialogGantt(text)}> <div className="menu-list" onClick={() => handleOpenDialogGantt(text)}>
<span className="menu-icon"> <span className="menu-icon">
<i className="fa fa-bars"></i> <i className="fa fa-bars"></i>
</span> </span>
<span className="menu-text">Gantt</span> <span className="menu-text">Gantt</span>
</div> </div>
/*: null*/ /*: null*/
} }
<div className="menu-list" onClick={() => handleSCurve(text)}> <div className="menu-list" onClick={() => handleSCurve(text)}>
<span className="menu-icon"> <span className="menu-icon">
<i className="fa fa-line-chart"></i> <i className="fa fa-line-chart"></i>
@ -2026,12 +2028,12 @@ const CreatedProyek = ({ params, ...props }) => {
</Button> </Button>
</> </>
} }
// visible={visible} // visible={visible}
// onVisibleChange={handleVisibleChange} // onVisibleChange={handleVisibleChange}
> >
<Button <Button
style={{ marginLeft: "5px" }} style={{ marginLeft: "5px" }}
// onClick={() => handleExportExcel()} // onClick={() => handleExportExcel()}
> >
<i className="fa fa-print"></i> <i className="fa fa-print"></i>
</Button> </Button>

Loading…
Cancel
Save