From ce4c9bde506dec3ef7ec4fa2e4caa8aae8e6a4de Mon Sep 17 00:00:00 2001 From: farhan048 Date: Fri, 20 Oct 2023 17:14:38 +0700 Subject: [PATCH] update filter company id in human resource --- src/views/SimproV2/ResourceWorker/index.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/views/SimproV2/ResourceWorker/index.js b/src/views/SimproV2/ResourceWorker/index.js index 4451a32..8b42928 100644 --- a/src/views/SimproV2/ResourceWorker/index.js +++ b/src/views/SimproV2/ResourceWorker/index.js @@ -25,7 +25,8 @@ const config = { "Content-type": `application/json` } }; - +const role_name = window.localStorage.getItem('role_name'); +const company_id = window.localStorage.getItem('company_id'); const ResourceWorker = ({ params }) => { const token = localStorage.getItem("token") const company_id = localStorage.getItem("company_id") @@ -172,11 +173,6 @@ const ResourceWorker = ({ params }) => { "logic_operator": "~*", "value": search }, - { - "name": "company_id", - "logic_operator": "=", - "value": company_id - }, ] }, "joins": [ @@ -204,6 +200,16 @@ const ResourceWorker = ({ params }) => { } } + if (role_name !== "Super Admin") { + payload.group_column.where.push( + { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, + ) + } else { + payload.group_column.where.push( + { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, + ) + } + const result = await axios .post(USER_SEARCH, payload, config) .then(res => res)