diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js index f2bcc41..697901a 100644 --- a/src/views/Dashboard/DashboardProject.js +++ b/src/views/Dashboard/DashboardProject.js @@ -126,6 +126,7 @@ const DashboardProject = () => { const [isReadyGanttParents, setIsReadyGanttParents] = useState(false); const [calculationStatus, setCalculationStatus] = useState(false); const [isHierarchy, setIsHierarchy] = useState(false); + const [isScurve, setIsScurve] = useState(false); let history = useHistory(); useEffect(() => { @@ -136,6 +137,12 @@ const DashboardProject = () => { getComments(); getGantt(); getGanttParents(); + const currentURL = window.location.href; + if (currentURL.includes("dashboard-project")) { + setIsScurve(true); + } else { + setIsScurve(false); + } return () => { console.log("unmount RenderMap"); }; @@ -1018,7 +1025,7 @@ const DashboardProject = () => { - +
{
- {/* -
+ {isScurve === true ? ( + +
{
- */} + + ) : ''}
{ - {/* - -
*/} - {/*
Health By Schedule
-
-
On Budget
-
*/} - {/* - Total Invoice - - {isReadyIntegrationInvoice ? ( - totalInvoice ? ( - renderFormatRupiah(totalInvoice, "Rp.") + + {isScurve === true ? ( + +
+ {/*
Health By Schedule
+
+
On Budget
+
*/} + + Total Invoice + + {isReadyIntegrationInvoice ? ( + totalInvoice ? ( + renderFormatRupiah(totalInvoice, "Rp.") + ) : ( + "-" + ) ) : ( - "-" - ) - ) : ( - - )} - - - - Cash In - - {isReadyIntegrationInvoice ? ( - cashIn ? ( - renderFormatRupiah(cashIn, "Rp.") + + )} + + + + Cash In + + {isReadyIntegrationInvoice ? ( + cashIn ? ( + renderFormatRupiah(cashIn, "Rp.") + ) : ( + "-" + ) ) : ( - "-" - ) - ) : ( - - )} - - - - -
- -
- - Outstanding Balance - - {isReadyIntegrationInvoice ? ( - outstandingBalance ? ( - renderFormatRupiah(outstandingBalance, "Rp.") + + )} + + + + +
+ +
+ + Outstanding Balance + + {isReadyIntegrationInvoice ? ( + outstandingBalance ? ( + renderFormatRupiah(outstandingBalance, "Rp.") + ) : ( + "-" + ) ) : ( - "-" - ) - ) : ( - - )} - - -
- -
*/} + + )} + +
+
+ + ):''} +
{ const payload = { "paging": { "start": start, "length": rowsPerPage }, "columns": [ - { "name": "name", "logic_operator": "ilike", "value": search, "operator": "AND" }, - { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, + { "name": "name", "logic_operator": "ilike", "value": search, "operator": "AND" } ], "joins": [{ "name": "m_menu", @@ -106,6 +106,16 @@ const Index = ({ params }) => { }], "orders": { "columns": ["id"], "ascending": false } } + if (role_name !== "Super Admin") { + payload.columns.push( + { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, + ) + } else { + payload.columns.push( + { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, + ) + } + const result = await axios .post(MENU_SEARCH, payload, config) diff --git a/src/views/Master/MasterRoles/index.js b/src/views/Master/MasterRoles/index.js index 6331d38..af94704 100644 --- a/src/views/Master/MasterRoles/index.js +++ b/src/views/Master/MasterRoles/index.js @@ -13,6 +13,7 @@ import { withTranslation } from 'react-i18next'; const token = window.localStorage.getItem('token'); const company_id = window.localStorage.getItem('company_id'); +const role_name = window.localStorage.getItem('role_name'); const BASE_URL = "http://siopas.co.id/custom-php/api/geohr/"; @@ -112,12 +113,19 @@ class index extends Component { "paging": { "start": start, "length": this.state.rowsPerPage }, "columns": [ { "name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND" }, - { "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" } ], "joins": [], "orders": { "columns": ["id"], "ascending": false } } - + if (role_name !== "Super Admin") { + formData.columns.push( + { "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" }, + ) + } else { + formData.columns.push( + { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, + ) + } const result = await axios .post(ROLE_SEARCH, formData, config) .then(res => res) diff --git a/src/views/Master/ProjectPhase/index.js b/src/views/Master/ProjectPhase/index.js index fb05186..56a3821 100644 --- a/src/views/Master/ProjectPhase/index.js +++ b/src/views/Master/ProjectPhase/index.js @@ -11,6 +11,7 @@ import { Pagination, Button, Tooltip, Table } from 'antd'; import { useTranslation } from 'react-i18next'; const token = window.localStorage.getItem('token'); const company_id = window.localStorage.getItem('company_id'); +const role_name = window.localStorage.getItem('role_name'); const config = { headers: { @@ -76,12 +77,6 @@ const ProjectPhase = ({ params }) => { "logic_operator": "ilike", "value": search, "operator": "AND" - }, - { - "name": "company_id", - "logic_operator": "=", - "value": company_id, - "operator": "AND" } ], "orders": { @@ -95,7 +90,15 @@ const ProjectPhase = ({ params }) => { "start": start } } - // let url = `${BASE_OSPRO}/api/project-phase/list?start=${start}&length=${rowsPerPage}&orderby=id&asc=false&column=name&logic=ilike&value=${search}` + if (role_name !== "Super Admin") { + payload.columns.push( + { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, + ) + } else { + payload.columns.push( + { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, + ) + } const result = await axios .post(PROJECT_PHASE_SEARCH, payload, HEADER) .then((res) => res) diff --git a/src/views/Pages/Login/Login.js b/src/views/Pages/Login/Login.js index 4dfc8ba..9ce73a5 100644 --- a/src/views/Pages/Login/Login.js +++ b/src/views/Pages/Login/Login.js @@ -216,6 +216,7 @@ class Login extends Component { window.localStorage.setItem('user_name', data_user.name); window.localStorage.setItem('role_id', data_user.role_id); window.localStorage.setItem('company_id', data_user.company_id); + window.localStorage.setItem('role_name', data_user.role.name); } else { console.log("kode : ", doLogin.data.code); // NotificationManager.error('Cek username atau password anda!', 'Gagal Login!'); diff --git a/src/views/SimproV2/ChecklistK3/index.js b/src/views/SimproV2/ChecklistK3/index.js index 1f6c540..1b65b7f 100644 --- a/src/views/SimproV2/ChecklistK3/index.js +++ b/src/views/SimproV2/ChecklistK3/index.js @@ -12,6 +12,8 @@ import { import { useTranslation } from 'react-i18next'; const token = window.localStorage.getItem('token'); +const role_name = window.localStorage.getItem('role_name'); +const company_id = window.localStorage.getItem('company_id'); const config = { headers: { @@ -87,6 +89,17 @@ const ChecklistK3 = ({ params }) => { "start": start } } + + if (role_name !== "Super Admin") { + payload.columns.push( + { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, + ) + } else { + payload.columns.push( + { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, + ) + } + const result = await axios .post(CHECKLIST_K3_SEARCH, payload, config) .then(res => res) diff --git a/src/views/SimproV2/Divisi/index.js b/src/views/SimproV2/Divisi/index.js index a24594f..89b0b79 100644 --- a/src/views/SimproV2/Divisi/index.js +++ b/src/views/SimproV2/Divisi/index.js @@ -13,6 +13,7 @@ const url = ""; const proyek_id = localStorage.getItem('proyek_id'); const role_id = localStorage.getItem('role_id'); const company_id = localStorage.getItem("company_id") +const role_name = window.localStorage.getItem('role_name'); const format = "DD-MM-YYYY"; const token = window.localStorage.getItem('token'); const config = { @@ -97,12 +98,6 @@ const ProjectType = ({ params }) => { value: search, operator: "AND" }, - { - name: "company_id", - logic_operator: "=", - value: company_id, - operator: "AND" - } ], "orders": { "ascending": true, @@ -115,6 +110,16 @@ const ProjectType = ({ params }) => { "start": start } } + + if (role_name !== "Super Admin") { + payload.columns.push( + { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, + ) + } else { + payload.columns.push( + { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, + ) + } const result = await axios .post(DIVISI_SEARCH, payload, HEADER) .then(res => res) diff --git a/src/views/SimproV2/Satuan/index.js b/src/views/SimproV2/Satuan/index.js index d28fea6..6db7072 100644 --- a/src/views/SimproV2/Satuan/index.js +++ b/src/views/SimproV2/Satuan/index.js @@ -11,6 +11,7 @@ import { useTranslation } from 'react-i18next'; const token = window.localStorage.getItem('token'); const company_id = window.localStorage.getItem('company_id'); +const role_name = window.localStorage.getItem('role_name'); const config = { headers: { @@ -74,12 +75,6 @@ const Satuan = ({ params }) => { "logic_operator": "ilike", "value": search, "operator": "AND" - }, - { - "name": "company_id", - "logic_operator": "=", - "value": company_id, - "operator": "AND" } ], "orders": { @@ -94,6 +89,17 @@ const Satuan = ({ params }) => { } } + if (role_name !== "Super Admin") { + payload.columns.push( + { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, + ) + } else { + payload.columns.push( + { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, + ) + } + + const result = await axios .post(SATUAN_SEARCH, payload, config) .then(res => res)