Browse Source

filter by superAdmin

pull/2/head
farhan048 1 year ago
parent
commit
2915274cf0
  1. 14
      src/views/Master/MasterMenu/index.js
  2. 12
      src/views/Master/MasterRoles/index.js
  3. 17
      src/views/Master/ProjectPhase/index.js
  4. 1
      src/views/Pages/Login/Login.js
  5. 13
      src/views/SimproV2/ChecklistK3/index.js
  6. 17
      src/views/SimproV2/Divisi/index.js
  7. 18
      src/views/SimproV2/Satuan/index.js

14
src/views/Master/MasterMenu/index.js

@ -11,6 +11,7 @@ import { Pagination, 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 column = [
{ name: "Nama" },
{ name: "Url" },
@ -94,8 +95,7 @@ const Index = ({ params }) => {
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)

12
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)

17
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)

1
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!');

13
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)

17
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)

18
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)

Loading…
Cancel
Save