From 1f9f52dfc05b7182b7e2c588cc4430f802055188 Mon Sep 17 00:00:00 2001 From: farhantock Date: Tue, 5 Dec 2023 13:56:36 +0700 Subject: [PATCH] filter by company --- src/views/SimproV2/ResourceWorker/index.js | 34 +++++++++++++++------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/views/SimproV2/ResourceWorker/index.js b/src/views/SimproV2/ResourceWorker/index.js index e7e9c78..ada1de8 100644 --- a/src/views/SimproV2/ResourceWorker/index.js +++ b/src/views/SimproV2/ResourceWorker/index.js @@ -87,7 +87,17 @@ const ResourceWorker = ({ params, ...props }) => { const getRoleList = async () => { const formData = { "paging": { "start": 0, "length": -1 }, - "orders": { "columns": ["id"], "ascending": false } + "orders": { "columns": ["id"], "ascending": false }, + "columns": [], + } + if (role_name !== "Super Admin") { + formData.columns.push( + { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, + ) + } else { + formData.columns.push( + { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, + ) } const result = await axios @@ -103,7 +113,18 @@ const ResourceWorker = ({ params, ...props }) => { const getDivisiList = async () => { const formData = { "paging": { "start": 0, "length": -1 }, - "orders": { "columns": ["id"], "ascending": false } + "orders": { "columns": ["id"], "ascending": false }, + "columns": [], + } + + if (role_name !== "Super Admin") { + formData.columns.push( + { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, + ) + } else { + formData.columns.push( + { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, + ) } const result = await axios @@ -248,12 +269,6 @@ const ResourceWorker = ({ params, ...props }) => { } - const handleSync = async () => { - await axios.get(USER_SYNC, HEADER) - .then(res => res) - .catch((error) => error.response) - } - const handleExportExcel = async () => { let start = 0; @@ -580,9 +595,6 @@ const ResourceWorker = ({ params, ...props }) => { - - -