From 6230479a738585e332bcd6c837b13c0d9dac06c1 Mon Sep 17 00:00:00 2001 From: farhan048 Date: Thu, 19 Oct 2023 15:48:22 +0700 Subject: [PATCH] update filter by company id --- src/views/Master/MasterMenu/DialogForm.js | 14 ++--- src/views/Master/MasterMenu/index.js | 21 ++++---- src/views/Master/MasterRoles/DialogForm.js | 25 +++++---- src/views/Master/MasterRoles/index.js | 17 ++++--- src/views/Master/ProjectPhase/DialogForm.js | 7 ++- src/views/Master/ProjectPhase/index.js | 8 +++ src/views/Master/RoleProject/DialogForm.js | 12 +++-- src/views/Master/RoleProject/index.js | 12 +++-- src/views/Pages/Login/Login.js | 29 ++++++----- src/views/SimproV2/Divisi/index.js | 51 +++++++++++-------- src/views/SimproV2/ProjectType/DialogForm.js | 7 ++- src/views/SimproV2/ProjectType/index.js | 7 +++ .../SimproV2/ResourceWorker/DialogForm.js | 27 +++++----- src/views/SimproV2/ResourceWorker/index.js | 10 +++- src/views/SimproV2/Satuan/DialogForm.js | 7 ++- src/views/SimproV2/Satuan/index.js | 8 +++ 16 files changed, 167 insertions(+), 95 deletions(-) diff --git a/src/views/Master/MasterMenu/DialogForm.js b/src/views/Master/MasterMenu/DialogForm.js index 60b8134..0aed72e 100644 --- a/src/views/Master/MasterMenu/DialogForm.js +++ b/src/views/Master/MasterMenu/DialogForm.js @@ -7,7 +7,7 @@ import 'antd/dist/antd.css'; import { useTranslation } from 'react-i18next'; const { Option } = Select - +const company_id = window.localStorage.getItem('company_id'); const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataMenu }) => { const [id, setId] = useState(0) const [name, setName] = useState('') @@ -68,7 +68,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi url, sequence: parseInt(sequence), icon, - alias_name: aliasName + alias_name: aliasName, + company_id } if (parentId && parentId > 0) { @@ -83,7 +84,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi url, sequence: parseInt(sequence), icon, - alias_name: aliasName + alias_name: aliasName, + company_id } if (parentId && parentId > 0) { @@ -133,9 +135,9 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi return (
- - * Wajib diisi. - + + * Wajib diisi. + diff --git a/src/views/Master/MasterMenu/index.js b/src/views/Master/MasterMenu/index.js index 7c0e9bc..a5343c0 100644 --- a/src/views/Master/MasterMenu/index.js +++ b/src/views/Master/MasterMenu/index.js @@ -10,7 +10,7 @@ import { NotificationContainer, NotificationManager } from 'react-notifications' 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 column = [ { name: "Nama" }, { name: "Url" }, @@ -68,20 +68,20 @@ const Index = ({ params }) => { const getDataAllMenu = async () => { const result = await axios - .get(MENU_LIST, config) - .then(res => res) - .catch((error) => error.response); + .get(MENU_LIST, config) + .then(res => res) + .catch((error) => error.response); if (result && result.data && result.data.code == 200) { let arr = [] let dataRes = result.data.data; for (const v in dataRes) { - arr.push(dataRes[v]) - } + arr.push(dataRes[v]) + } setAllDataMenu(arr); - }else { - NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); - } + } else { + NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); + } } const getDataMenu = async () => { @@ -94,7 +94,8 @@ const Index = ({ params }) => { const payload = { "paging": { "start": start, "length": rowsPerPage }, "columns": [ - { "name": "name", "logic_operator": "ilike", "value": search, "operator": "AND" } + { "name": "name", "logic_operator": "ilike", "value": search, "operator": "AND" }, + { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, ], "joins": [{ "name": "m_menu", diff --git a/src/views/Master/MasterRoles/DialogForm.js b/src/views/Master/MasterRoles/DialogForm.js index a33f686..4bc3ab1 100644 --- a/src/views/Master/MasterRoles/DialogForm.js +++ b/src/views/Master/MasterRoles/DialogForm.js @@ -9,6 +9,7 @@ import { MENU_SEARCH } from '../../../const/ApiConst.js'; const { Option } = Select const token = window.localStorage.getItem('token'); +const company_id = localStorage.getItem("company_id") const config = { headers: { @@ -27,7 +28,8 @@ class DialogForm extends Component { openDialog: false, isParentClick: false, menu: [], - selectedMenu: null + selectedMenu: null, + company_id } } @@ -44,7 +46,8 @@ class DialogForm extends Component { id: dataEdit.id, name: dataEdit.name, description: dataEdit.description, - selectedMenu: dataEdit.default_page + selectedMenu: dataEdit.default_page, + company_id }) } else { this.setState({ @@ -96,26 +99,30 @@ class DialogForm extends Component { id, name, description, - selectedMenu + selectedMenu, + company_id } = this.state let data = ''; const err = this.validation(); - if(!err) { + if (!err) { if (this.props.typeDialog === "Save") { data = { id, name, description, - selectedMenu + selectedMenu, + company_id } + // console.log('data', data); this.props.closeDialog('save', data); } else { data = { id, name, description, - selectedMenu + selectedMenu, + company_id } this.props.closeDialog('edit', data); } @@ -144,13 +151,13 @@ class DialogForm extends Component { this.setState({ name: e.target.value })} placeholder={this.props.t('inputName')} /> - + this.setState({ description: e.target.value })} placeholder={this.props.t('inputDescription')} /> - + @@ -165,7 +172,7 @@ class DialogForm extends Component { ))} - +
) diff --git a/src/views/Master/MasterRoles/index.js b/src/views/Master/MasterRoles/index.js index 332f3c8..6331d38 100644 --- a/src/views/Master/MasterRoles/index.js +++ b/src/views/Master/MasterRoles/index.js @@ -12,6 +12,8 @@ import { ROLE_ADD, ROLE_SEARCH, ROLE_EDIT, ROLE_DELETE, ROLEMENU_ADD, ROLEMENU_S import { withTranslation } from 'react-i18next'; const token = window.localStorage.getItem('token'); +const company_id = window.localStorage.getItem('company_id'); + const BASE_URL = "http://siopas.co.id/custom-php/api/geohr/"; @@ -55,6 +57,7 @@ class index extends Component { tooltipTambah: false, totalPage: 0, typeDialog: 'Save', + company_id: company_id } this.columns = [ @@ -108,7 +111,8 @@ class index extends Component { const formData = { "paging": { "start": start, "length": this.state.rowsPerPage }, "columns": [ - { "name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND" } + { "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 } @@ -165,9 +169,9 @@ class index extends Component { .catch((error) => error.response); if (result && result.data && result.data.code === 200) { - await this.deleteCurrentRoleMenu(idDelete); - this.getDataRoles(); - this.setState({ idDelete: 0, alertDelete: false }) + await this.deleteCurrentRoleMenu(idDelete); + this.getDataRoles(); + this.setState({ idDelete: 0, alertDelete: false }) NotificationManager.success(`Data role berhasil dihapus`, 'Success!!'); } else { this.setState({ idDelete: 0, alertDelete: false }) @@ -180,7 +184,8 @@ class index extends Component { const formData = { name: data.name, description: data.description, - default_page : data.selectedMenu + default_page: data.selectedMenu, + company_id: company_id } const result = await axios.post(ROLE_ADD, formData, config) @@ -200,7 +205,7 @@ class index extends Component { const formData = { name: data.name, description: data.description, - default_page: data.selectedMenu + default_page: data.selectedMenu } const url = ROLE_EDIT(data.id) const result = await axios.put(url, formData, config) diff --git a/src/views/Master/ProjectPhase/DialogForm.js b/src/views/Master/ProjectPhase/DialogForm.js index 6010f09..c079bba 100644 --- a/src/views/Master/ProjectPhase/DialogForm.js +++ b/src/views/Master/ProjectPhase/DialogForm.js @@ -8,6 +8,7 @@ import InputColor from "./InputColor"; import "./styles.css"; import "rc-color-picker/assets/index.css"; import { useTranslation } from 'react-i18next'; +const company_id = localStorage.getItem("company_id") const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const [id, setId] = useState(0) const [projectType, setProjectType] = useState('') @@ -31,14 +32,16 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi if (typeDialog === "Save") { data = { name: projectType, - color + color, + company_id } closeDialog('save', data); } else { data = { id, name: projectType, - color + color, + company_id } closeDialog('edit', data); } diff --git a/src/views/Master/ProjectPhase/index.js b/src/views/Master/ProjectPhase/index.js index 5df51ef..fb05186 100644 --- a/src/views/Master/ProjectPhase/index.js +++ b/src/views/Master/ProjectPhase/index.js @@ -10,6 +10,7 @@ import { PROJECT_PHASE_ADD, PROJECT_PHASE_EDIT, PROJECT_PHASE_DELETE, PROJECT_PH 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 config = { headers: { @@ -20,6 +21,7 @@ const config = { const ProjectPhase = ({ params }) => { const token = localStorage.getItem("token") + const company_id = localStorage.getItem("company_id") /*const HEADER = { headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", @@ -74,6 +76,12 @@ const ProjectPhase = ({ params }) => { "logic_operator": "ilike", "value": search, "operator": "AND" + }, + { + "name": "company_id", + "logic_operator": "=", + "value": company_id, + "operator": "AND" } ], "orders": { diff --git a/src/views/Master/RoleProject/DialogForm.js b/src/views/Master/RoleProject/DialogForm.js index 307ed1b..c7a417e 100644 --- a/src/views/Master/RoleProject/DialogForm.js +++ b/src/views/Master/RoleProject/DialogForm.js @@ -3,7 +3,7 @@ import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { Button, Form, FormGroup, Label, Input } from 'reactstrap'; import 'antd/dist/antd.css'; import { withTranslation } from 'react-i18next'; - +const company_id = localStorage.getItem("company_id") class DialogForm extends Component { constructor(props) { super(props) @@ -13,6 +13,7 @@ class DialogForm extends Component { description: "", openDialog: false, isParentClick: false, + company_id } } @@ -27,7 +28,8 @@ class DialogForm extends Component { this.setState({ id: dataEdit.id, name: dataEdit.name, - description: dataEdit.description + description: dataEdit.description, + company_id }) } else { this.setState({ @@ -58,14 +60,16 @@ class DialogForm extends Component { data = { id, name, - description + description, + company_id } this.props.closeDialog('save', data); } else { data = { id, name, - description + description, + company_id } this.props.closeDialog('edit', data); } diff --git a/src/views/Master/RoleProject/index.js b/src/views/Master/RoleProject/index.js index 01b6663..0337895 100644 --- a/src/views/Master/RoleProject/index.js +++ b/src/views/Master/RoleProject/index.js @@ -10,7 +10,7 @@ import { PROJECT_ROLE_ADD, PROJECT_ROLE_SEARCH, PROJECT_ROLE_EDIT, PROJECT_ROLE_ import { Pagination, Tooltip, Table } from 'antd'; import { withTranslation } from 'react-i18next'; const token = window.localStorage.getItem('token'); - +const company_id = localStorage.getItem("company_id") const BASE_URL = "http://siopas.co.id/custom-php/api/geohr/"; const config = { @@ -60,6 +60,7 @@ class index extends Component { tooltipTambah: false, totalPage: 0, typeDialog: 'Save', + company_id } this.columns = [ { @@ -108,7 +109,8 @@ class index extends Component { const formData = { "paging": { "start": start, "length": this.state.rowsPerPage }, "columns": [ - { "name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND" } + { "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 } @@ -178,7 +180,8 @@ class index extends Component { const formData = { name: data.name, - description: data.description + description: data.description, + company_id } const result = await axios.post(PROJECT_ROLE_ADD, formData, config) @@ -198,7 +201,8 @@ class index extends Component { const formData = { name: data.name, - description: data.description + description: data.description, + company_id } const url = PROJECT_ROLE_EDIT(data.id) const result = await axios.put(url, formData, config) diff --git a/src/views/Pages/Login/Login.js b/src/views/Pages/Login/Login.js index 7bda490..fd210fc 100644 --- a/src/views/Pages/Login/Login.js +++ b/src/views/Pages/Login/Login.js @@ -66,7 +66,7 @@ class Login extends Component { }, loader: false, type: 'password', - defaultPage: '' + defaultPage: '' } this.handleChange = this.handleChange.bind(this); this.showHide = this.showHide.bind(this); @@ -98,8 +98,8 @@ class Login extends Component { }); } - getDataRole = async (token, role_id) => { - const config = { + getDataRole = async (token, role_id) => { + const config = { headers: { Authorization: `Bearer ${token}`, @@ -113,12 +113,12 @@ class Login extends Component { { "name": "id", "logic_operator": "=", "value": `${role_id}`, "operator": "AND" } ], "joins": [ - { - "name": "m_menu", - "column_join": "default_page", - "column_results": ["id", "name", "url"], - }, - ], + { + "name": "m_menu", + "column_join": "default_page", + "column_results": ["id", "name", "url"], + }, + ], "orders": { "columns": ["id"], "ascending": false } } @@ -129,9 +129,9 @@ class Login extends Component { if (result && result.data && result.data.code == 200) { let resData = result.data.data - this.setState({defaultPage: resData[0].join_first_url}) + this.setState({ defaultPage: resData[0].join_first_url }) } - } + } getDataMenu = async (token, role_id) => { const config = { @@ -159,9 +159,9 @@ class Login extends Component { else { this.props.history.push("/dashboard"); } - if (this.state.defaultPage) { + if (this.state.defaultPage) { this.props.history.push(this.state.defaultPage); - } else if (role_id == 28) { + } else if (role_id == 28) { this.props.history.push("/dashboard-customer/58/63"); } else { @@ -208,13 +208,14 @@ class Login extends Component { if (doLogin && doLogin.data && doLogin.data.code === 200) { const { access_token, data_user } = doLogin.data.data - this.getDataRole(access_token, data_user.role_id) + this.getDataRole(access_token, data_user.role_id) this.getDataMenu(access_token, data_user.role_id) window.localStorage.setItem('isLogin', true); window.localStorage.setItem('token', access_token); window.localStorage.setItem('user_id', data_user.id); 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); } else { console.log("kode : ", doLogin.data.code); // NotificationManager.error('Cek username atau password anda!', 'Gagal Login!'); diff --git a/src/views/SimproV2/Divisi/index.js b/src/views/SimproV2/Divisi/index.js index 17e576a..a24594f 100644 --- a/src/views/SimproV2/Divisi/index.js +++ b/src/views/SimproV2/Divisi/index.js @@ -12,6 +12,7 @@ import { useTranslation } from 'react-i18next'; const url = ""; const proyek_id = localStorage.getItem('proyek_id'); const role_id = localStorage.getItem('role_id'); +const company_id = localStorage.getItem("company_id") const format = "DD-MM-YYYY"; const token = window.localStorage.getItem('token'); const config = { @@ -55,7 +56,7 @@ const ProjectType = ({ params }) => { const { t } = useTranslation() useEffect(() => { - getDataProjectType(); + getDataProjectType(); }, [currentPage, rowsPerPage, search]) useEffect(() => { @@ -73,9 +74,9 @@ const ProjectType = ({ params }) => { if (listDivions && listDivions.data && listDivions.data.code == 200) { let arr = [] - let dataRes = listDivions.data.data; - const filteredData = dataRes.filter(item => item.parent === null); - for (const v in filteredData) { + let dataRes = listDivions.data.data; + const filteredData = dataRes.filter(item => item.parent === null); + for (const v in filteredData) { arr.push(filteredData[v]) } setDataDivisions(arr); @@ -86,8 +87,8 @@ const ProjectType = ({ params }) => { const getDataProjectType = async () => { let start = 0; if (currentPage !== 1 && currentPage > 1) { - start = currentPage * rowsPerPage - rowsPerPage; - } + start = currentPage * rowsPerPage - rowsPerPage; + } const payload = { columns: [ { @@ -95,6 +96,12 @@ const ProjectType = ({ params }) => { logic_operator: "ilike", value: search, operator: "AND" + }, + { + name: "company_id", + logic_operator: "=", + value: company_id, + operator: "AND" } ], "orders": { @@ -114,9 +121,9 @@ const ProjectType = ({ params }) => { .catch((error) => error.response); if (result && result.data && result.data.code == 200) { - let dataRes = result.data.data || []; - setDatatable(dataRes); - setTotalPage(result.data.totalRecord); + let dataRes = result.data.data || []; + setDatatable(dataRes); + setTotalPage(result.data.totalRecord); } else { NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); } @@ -186,8 +193,8 @@ const ProjectType = ({ params }) => { }; const handleOpenDialog = (type) => { - setOpenDialog(true) - getListDivision(); + setOpenDialog(true) + getListDivision(); setTypeDialog(type) } @@ -277,7 +284,7 @@ const ProjectType = ({ params }) => { if (dataTable.length === 0) { return ( - {t('noData')} + {t('noData')} ) } @@ -352,16 +359,16 @@ const ProjectType = ({ params }) => { {n.name} - {n.description ?? '-'} - {n.color != null ? ( - - - - - - ): ( - No color set - )} + {n.description ?? '-'} + {n.color != null ? ( + + + + + + ) : ( + No color set + )} ) })} diff --git a/src/views/SimproV2/ProjectType/DialogForm.js b/src/views/SimproV2/ProjectType/DialogForm.js index 24a7ca1..054e8fb 100644 --- a/src/views/SimproV2/ProjectType/DialogForm.js +++ b/src/views/SimproV2/ProjectType/DialogForm.js @@ -9,6 +9,7 @@ import moment from 'moment'; import 'antd/dist/antd.css'; import { useTranslation } from 'react-i18next'; const { Option } = Select +const company_id = window.localStorage.getItem('company_id'); const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const [id, setId] = useState(0) @@ -39,7 +40,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi if (typeDialog === "Save") { data = { name: projectType, - description + description, + company_id } closeDialog('save', data); @@ -47,7 +49,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi data = { id, name: projectType, - description + description, + company_id } closeDialog('edit', data); } diff --git a/src/views/SimproV2/ProjectType/index.js b/src/views/SimproV2/ProjectType/index.js index c770f8a..a352a11 100644 --- a/src/views/SimproV2/ProjectType/index.js +++ b/src/views/SimproV2/ProjectType/index.js @@ -16,6 +16,7 @@ const proyek_id = localStorage.getItem('proyek_id'); const role_id = localStorage.getItem('role_id'); const format = "DD-MM-YYYY"; const token = window.localStorage.getItem('token'); +const company_id = window.localStorage.getItem('company_id'); const config = { headers: { @@ -81,6 +82,12 @@ const ProjectType = ({ params }) => { "logic_operator": "like", "value": search, "operator": "AND" + }, + { + "name": "company_id", + "logic_operator": "like", + "value": company_id, + "operator": "AND" } ], "orders": { diff --git a/src/views/SimproV2/ResourceWorker/DialogForm.js b/src/views/SimproV2/ResourceWorker/DialogForm.js index 5c4bb67..16f108a 100644 --- a/src/views/SimproV2/ResourceWorker/DialogForm.js +++ b/src/views/SimproV2/ResourceWorker/DialogForm.js @@ -12,6 +12,7 @@ import { useTranslation } from 'react-i18next'; const { Option } = Select const token = window.localStorage.getItem('token'); +const company_id = localStorage.getItem("company_id") const config = { headers: { @@ -117,7 +118,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi divisi_id: divisionId, address, status_resource: statusResource, - status_boundary: statusRestriction + status_boundary: statusRestriction, + company_id: company_id } console.log(data) @@ -165,7 +167,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi divisi_id: divisionId, address, status_resource: statusResource, - status_boundary: statusRestriction + status_boundary: statusRestriction, + company_id: company_id } if (birthDate && birthDate != "") { @@ -254,11 +257,11 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi setEmail(e.target.value)} placeholder={t('inputEmail')} - onBlur={(e) => { - if (!isValidEmail(e.target.value)) { - alert("Masukkan email yang valid."); - } - }} + onBlur={(e) => { + if (!isValidEmail(e.target.value)) { + alert("Masukkan email yang valid."); + } + }} /> @@ -341,11 +344,11 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi setEmail(e.target.value)} placeholder={`Email...`} - onBlur={(e) => { - if (!isValidEmail(e.target.value)) { - alert("Masukkan email yang valid."); - } - }} + onBlur={(e) => { + if (!isValidEmail(e.target.value)) { + alert("Masukkan email yang valid."); + } + }} /> diff --git a/src/views/SimproV2/ResourceWorker/index.js b/src/views/SimproV2/ResourceWorker/index.js index f4f6af5..4451a32 100644 --- a/src/views/SimproV2/ResourceWorker/index.js +++ b/src/views/SimproV2/ResourceWorker/index.js @@ -28,6 +28,7 @@ const config = { const ResourceWorker = ({ params }) => { const token = localStorage.getItem("token") + const company_id = localStorage.getItem("company_id") const HEADER = { headers: { "Content-Type": "application/json", @@ -171,6 +172,11 @@ const ResourceWorker = ({ params }) => { "logic_operator": "~*", "value": search }, + { + "name": "company_id", + "logic_operator": "=", + "value": company_id + }, ] }, "joins": [ @@ -232,7 +238,7 @@ const ResourceWorker = ({ params }) => { const handleSync = async () => { await axios.get(USER_SYNC, HEADER) .then(res => res) - .catch((error)=>error.response) + .catch((error) => error.response) } const handleExportExcel = async () => { @@ -560,7 +566,7 @@ const ResourceWorker = ({ params }) => { - + diff --git a/src/views/SimproV2/Satuan/DialogForm.js b/src/views/SimproV2/Satuan/DialogForm.js index 4ab7a35..6636c55 100644 --- a/src/views/SimproV2/Satuan/DialogForm.js +++ b/src/views/SimproV2/Satuan/DialogForm.js @@ -6,6 +6,7 @@ import { import 'antd/dist/antd.css'; import { useTranslation } from 'react-i18next'; +const company_id = localStorage.getItem("company_id") const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const [id, setId] = useState(0) @@ -31,7 +32,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi if (typeDialog === "Save") { data = { name: name, - description + description, + company_id } closeDialog('save', data); @@ -39,7 +41,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi data = { id, name: name, - description + description, + company_id } closeDialog('edit', data); } diff --git a/src/views/SimproV2/Satuan/index.js b/src/views/SimproV2/Satuan/index.js index b864493..d28fea6 100644 --- a/src/views/SimproV2/Satuan/index.js +++ b/src/views/SimproV2/Satuan/index.js @@ -10,6 +10,7 @@ import { SATUAN_ADD, SATUAN_EDIT, SATUAN_DELETE, SATUAN_SEARCH } from '../../../ import { useTranslation } from 'react-i18next'; const token = window.localStorage.getItem('token'); +const company_id = window.localStorage.getItem('company_id'); const config = { headers: { @@ -20,6 +21,7 @@ const config = { const Satuan = ({ params }) => { const token = localStorage.getItem("token") + const company_id = localStorage.getItem("company_id") const HEADER = { headers: { "Content-Type": "application/json", @@ -72,6 +74,12 @@ const Satuan = ({ params }) => { "logic_operator": "ilike", "value": search, "operator": "AND" + }, + { + "name": "company_id", + "logic_operator": "=", + "value": company_id, + "operator": "AND" } ], "orders": {