Browse Source

filter by company

pull/1/head
farhantock 1 year ago
parent
commit
1f9f52dfc0
  1. 34
      src/views/SimproV2/ResourceWorker/index.js

34
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 }) => {
<Tooltip title={t('hradd')}>
<Button style={{ background: "#4caf50", color: "#fff" }} onClick={() => handleOpenDialog('Save')}><i className="fa fa-plus"></i></Button>
</Tooltip>
<Tooltip title="HR Sync">
<Button style={{ background: "#007bff ", color: "#fff", marginLeft: "5px" }} onClick={() => handleSync()}><i className="fa fa-spinner"></i></Button>
</Tooltip>
<Tooltip title={t('exportExcel')}>
<Button style={{ marginLeft: "5px" }} onClick={() => handleExportExcel()}><i className="fa fa-print"></i></Button>
</Tooltip>

Loading…
Cancel
Save