Browse Source

Merge pull request 'dev-wahyun' (#72) from dev-wahyun into staging

Reviewed-on: ibnu/generic-ospro-frontend#72
pull/1/head
wahyu 8 months ago
parent
commit
419b7c0068
  1. 1
      src/const/ApiConst.js
  2. 12
      src/views/Master/MasterCompany/index.js
  3. 48
      src/views/Master/MasterRoles/DialogMenuRoles.js
  4. 22
      src/views/Master/MasterRoles/index.js
  5. 6
      src/views/SimproV2/CreatedProyek/DialogAssignCust.js
  6. 5
      src/views/SimproV2/CreatedProyek/DialogGantt.js
  7. 6
      src/views/SimproV2/CreatedProyek/index.js
  8. 8
      src/views/SimproV2/Divisi/index.js
  9. 10
      src/views/SimproV2/Kanban/index.js
  10. 73
      src/views/SimproV2/ResourceWorker/DialogForm.js
  11. 16
      src/views/SimproV2/ResourceWorker/index.js
  12. 3
      src/views/SimproV2/Satuan/index.js
  13. 19
      src/views/SimproV2/Settings/components/Plan/Container1.js

1
src/const/ApiConst.js

@ -283,6 +283,7 @@ export const TRANSACTION_EDIT = (id) => {
export const STORAGE_LIMIT_INFORMATION = (company_name) => { export const STORAGE_LIMIT_INFORMATION = (company_name) => {
return `${BASE_SIMPRO_LUMEN}/information-storage/${company_name}`; return `${BASE_SIMPRO_LUMEN}/information-storage/${company_name}`;
}; };
export const STORAGE_LIMIT_INFORMATION_ALL_COMPANY = `${BASE_SIMPRO_LUMEN}/information-storage-all-company`
export const ABSENSI_ADD = `${BASE_SIMPRO_LUMEN}/permit/add`; export const ABSENSI_ADD = `${BASE_SIMPRO_LUMEN}/permit/add`;
export const ABSENSI_SEARCH = `${BASE_SIMPRO_LUMEN}/permit/search`; export const ABSENSI_SEARCH = `${BASE_SIMPRO_LUMEN}/permit/search`;

12
src/views/Master/MasterCompany/index.js

@ -125,11 +125,13 @@ const MasterCompany = ({ params }) => {
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
const sourceData = result.data.data; const sourceData = result.data.data;
const countRecord = result.data.totalRecord;
setDatatable(sourceData); setDatatable(sourceData);
setTotalPage(result.data.totalRecord); setTotalPage(countRecord);
const lastCompanyId = sourceData[sourceData.length - 1].id; const lastCompanyId = countRecord > 0 ? sourceData[sourceData.length - 1].id : null;
setLastCompanyId(lastCompanyId); setLastCompanyId(lastCompanyId);
setLoading(false) setLoading(false)
} else { } else {
@ -187,7 +189,7 @@ const MasterCompany = ({ params }) => {
const sourceData = result.data.data; const sourceData = result.data.data;
setProjectImageSlider(sourceData); setProjectImageSlider(sourceData);
} }
} }
const handleSearch = e => { const handleSearch = e => {
const value = e.target.value const value = e.target.value

48
src/views/Master/MasterRoles/DialogMenuRoles.js

@ -27,6 +27,7 @@ export default class DialogMenuRoles extends Component {
stateCreate: [], stateCreate: [],
stateUpdate: [], stateUpdate: [],
stateDelete: [], stateDelete: [],
role_name: props.role_name || '',
stateReadAll: false, stateReadAll: false,
stateCreateAll: false, stateCreateAll: false,
stateUpdateAll: false, stateUpdateAll: false,
@ -35,10 +36,12 @@ export default class DialogMenuRoles extends Component {
company_id: props.company_id || null, company_id: props.company_id || null,
} }
} }
async componentDidMount() { async componentDidMount() {
this.props.showDialog(this.showDialog); this.props.showDialog(this.showDialog);
this.getAllMenu(); this.getAllMenu();
} }
async componentDidUpdate() { async componentDidUpdate() {
if (this.state.isParentClick === true) { if (this.state.isParentClick === true) {
const { idRoles } = this.props const { idRoles } = this.props
@ -50,21 +53,26 @@ export default class DialogMenuRoles extends Component {
this.setState({ isParentClick: false, id: idRoles }); this.setState({ isParentClick: false, id: idRoles });
} }
} }
showDialog = () => { showDialog = () => {
this.setState({ isParentClick: true }); this.setState({ isParentClick: true });
} }
getAllMenu = async () => { getAllMenu = async () => {
const payload = { const payload = {
"paging": { "start": 0, "length": -1 }, "paging": { "start": 0, "length": -1 },
"columns": [ "columns": [],
{ "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" }
],
"joins": [ "joins": [
{ "name": "t_roles_menu", "column_join": "menu_id", "column_results": ["create", "update", "delete", "read"] }, { "name": "t_roles_menu", "column_join": "menu_id", "column_results": ["create", "update", "delete", "read"] },
{ "name": "m_menu", "column_join": "menu_id", "column_results": ["name"] } { "name": "m_menu", "column_join": "menu_id", "column_results": ["name"] }
], ],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (this.state.role_name !== "Super Admin") {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" }
)
}
const result = await axios const result = await axios
.post(MENU_COMPANY_SEARCH, payload, config) .post(MENU_COMPANY_SEARCH, payload, config)
.then(res => res) .then(res => res)
@ -73,9 +81,9 @@ export default class DialogMenuRoles extends Component {
this.setState({ menu: result.data.data }, () => { this.setState({ menu: result.data.data }, () => {
this.setStateMenu(false); this.setStateMenu(false);
}); });
} else {
} }
} }
setStateMenu = edit => { setStateMenu = edit => {
const stateMenu = []; const stateMenu = [];
this.state.menu.map((val) => { this.state.menu.map((val) => {
@ -89,6 +97,7 @@ export default class DialogMenuRoles extends Component {
}) })
}) })
} }
setStateRead = edit => { setStateRead = edit => {
const stateRead = []; const stateRead = [];
this.state.menu.map((val) => { this.state.menu.map((val) => {
@ -102,6 +111,7 @@ export default class DialogMenuRoles extends Component {
}) })
}) })
} }
setStateCreate = edit => { setStateCreate = edit => {
const stateCreate = []; const stateCreate = [];
this.state.menu.map((val) => { this.state.menu.map((val) => {
@ -115,6 +125,7 @@ export default class DialogMenuRoles extends Component {
}) })
}) })
} }
setStateUpdate = edit => { setStateUpdate = edit => {
const stateUpdate = []; const stateUpdate = [];
this.state.menu.map((val) => { this.state.menu.map((val) => {
@ -128,6 +139,7 @@ export default class DialogMenuRoles extends Component {
}) })
}) })
} }
setStateDelete = edit => { setStateDelete = edit => {
const stateDelete = []; const stateDelete = [];
this.state.menu.map((val) => { this.state.menu.map((val) => {
@ -141,6 +153,7 @@ export default class DialogMenuRoles extends Component {
}) })
}) })
} }
checkMenuRoles = () => { checkMenuRoles = () => {
let copyStateMenu = [...this.state.stateMenu]; let copyStateMenu = [...this.state.stateMenu];
this.props.menuRoles.map((val, indexMenu) => { this.props.menuRoles.map((val, indexMenu) => {
@ -158,6 +171,7 @@ export default class DialogMenuRoles extends Component {
} }
}) })
} }
checkReadRoles = () => { checkReadRoles = () => {
let copyStateRead = [...this.state.stateRead]; let copyStateRead = [...this.state.stateRead];
this.props.menuRoles.map((val) => { this.props.menuRoles.map((val) => {
@ -177,6 +191,7 @@ export default class DialogMenuRoles extends Component {
} }
}) })
} }
checkCreateRoles = () => { checkCreateRoles = () => {
let copyStateCreate = [...this.state.stateCreate]; let copyStateCreate = [...this.state.stateCreate];
this.props.menuRoles.map((val) => { this.props.menuRoles.map((val) => {
@ -196,6 +211,7 @@ export default class DialogMenuRoles extends Component {
} }
}) })
} }
checkUpdateRoles = () => { checkUpdateRoles = () => {
let copyStateUpdate = [...this.state.stateUpdate]; let copyStateUpdate = [...this.state.stateUpdate];
this.props.menuRoles.map((val) => { this.props.menuRoles.map((val) => {
@ -215,6 +231,7 @@ export default class DialogMenuRoles extends Component {
} }
}) })
} }
checkDeleteRoles = () => { checkDeleteRoles = () => {
let copyStateDelete = [...this.state.stateDelete]; let copyStateDelete = [...this.state.stateDelete];
this.props.menuRoles.map((val) => { this.props.menuRoles.map((val) => {
@ -234,26 +251,32 @@ export default class DialogMenuRoles extends Component {
} }
}) })
} }
getIndexDataMenu = (id) => { getIndexDataMenu = (id) => {
let index = this.state.menu.findIndex(obj => obj.id === id); let index = this.state.menu.findIndex(obj => obj.id === id);
return index return index
} }
getIndexDataCreate = (id) => { getIndexDataCreate = (id) => {
let index = this.state.stateCreate.findIndex(obj => obj.id === id); let index = this.state.stateCreate.findIndex(obj => obj.id === id);
return index return index
} }
getIndexDataDelete = (id) => { getIndexDataDelete = (id) => {
let index = this.state.stateDelete.findIndex(obj => obj.id === id); let index = this.state.stateDelete.findIndex(obj => obj.id === id);
return index return index
} }
getIndexDataRead = (id) => { getIndexDataRead = (id) => {
let index = this.state.stateRead.findIndex(obj => obj.id === id); let index = this.state.stateRead.findIndex(obj => obj.id === id);
return index return index
} }
getIndexDataUpdate = (id) => { getIndexDataUpdate = (id) => {
let index = this.state.stateUpdate.findIndex(obj => obj.id === id); let index = this.state.stateUpdate.findIndex(obj => obj.id === id);
return index return index
} }
handleSave = () => { handleSave = () => {
const { const {
stateMenu, stateMenu,
@ -268,7 +291,7 @@ export default class DialogMenuRoles extends Component {
menu.map((val, index) => { menu.map((val, index) => {
let data = { let data = {
roles_id: id, roles_id: id,
menu_id: val.id, menu_id: val.menu_id,
read: stateRead[index], read: stateRead[index],
create: stateCreate[index], create: stateCreate[index],
update: stateUpdate[index], update: stateUpdate[index],
@ -280,14 +303,17 @@ export default class DialogMenuRoles extends Component {
this.props.closeDialog('save', arrayData); this.props.closeDialog('save', arrayData);
this.setState({ id: 0 }); this.setState({ id: 0 });
} }
handleCancel = () => { handleCancel = () => {
this.props.closeDialog('cancel', 'none') this.props.closeDialog('cancel', 'none')
} }
handleChangeCheckbox = (checked, index) => { handleChangeCheckbox = (checked, index) => {
let copyStateMenu = [...this.state.stateMenu]; let copyStateMenu = [...this.state.stateMenu];
copyStateMenu[index] = checked; copyStateMenu[index] = checked;
this.setState({ stateMenu: copyStateMenu }) this.setState({ stateMenu: copyStateMenu })
} }
handleChangeCheckboxRead = (checked, index, menuItem = null, menuIdxList = []) => { handleChangeCheckboxRead = (checked, index, menuItem = null, menuIdxList = []) => {
let copyStateRead = [...this.state.stateRead]; let copyStateRead = [...this.state.stateRead];
copyStateRead[index] = checked; copyStateRead[index] = checked;
@ -312,6 +338,7 @@ export default class DialogMenuRoles extends Component {
}) })
this.setState({ stateRead: copyStateRead }) this.setState({ stateRead: copyStateRead })
} }
handleChangeCheckboxCreate = (checked, index, menuItem = null, menuIdxList = []) => { handleChangeCheckboxCreate = (checked, index, menuItem = null, menuIdxList = []) => {
let copyStateCreate = [...this.state.stateCreate]; let copyStateCreate = [...this.state.stateCreate];
copyStateCreate[index] = checked; copyStateCreate[index] = checked;
@ -336,6 +363,7 @@ export default class DialogMenuRoles extends Component {
}) })
this.setState({ stateCreate: copyStateCreate }) this.setState({ stateCreate: copyStateCreate })
} }
handleChangeCheckboxEdit = (checked, index, menuItem = null, menuIdxList = []) => { handleChangeCheckboxEdit = (checked, index, menuItem = null, menuIdxList = []) => {
let copyStateEdit = [...this.state.stateUpdate]; let copyStateEdit = [...this.state.stateUpdate];
copyStateEdit[index] = checked; copyStateEdit[index] = checked;
@ -360,6 +388,7 @@ export default class DialogMenuRoles extends Component {
}) })
this.setState({ stateUpdate: copyStateEdit }) this.setState({ stateUpdate: copyStateEdit })
} }
handleChangeCheckboxDelete = (checked, index, menuItem = null, menuIdxList = []) => { handleChangeCheckboxDelete = (checked, index, menuItem = null, menuIdxList = []) => {
let copyStateDelete = [...this.state.stateDelete]; let copyStateDelete = [...this.state.stateDelete];
copyStateDelete[index] = checked; copyStateDelete[index] = checked;
@ -384,6 +413,7 @@ export default class DialogMenuRoles extends Component {
}) })
this.setState({ stateDelete: copyStateDelete }) this.setState({ stateDelete: copyStateDelete })
} }
handleChangeCheckboxReadAll = (checked) => { handleChangeCheckboxReadAll = (checked) => {
let copyStateRead = [...this.state.stateRead]; let copyStateRead = [...this.state.stateRead];
copyStateRead.map((val, index) => { copyStateRead.map((val, index) => {
@ -391,6 +421,7 @@ export default class DialogMenuRoles extends Component {
}) })
this.setState({ stateRead: copyStateRead }) this.setState({ stateRead: copyStateRead })
} }
handleChangeCheckboxCreateAll = (checked, index) => { handleChangeCheckboxCreateAll = (checked, index) => {
let copyStateCreate = [...this.state.stateCreate]; let copyStateCreate = [...this.state.stateCreate];
copyStateCreate.map((val, index) => { copyStateCreate.map((val, index) => {
@ -398,6 +429,7 @@ export default class DialogMenuRoles extends Component {
}) })
this.setState({ stateCreate: copyStateCreate }) this.setState({ stateCreate: copyStateCreate })
} }
handleChangeCheckboxEditAll = (checked, index) => { handleChangeCheckboxEditAll = (checked, index) => {
let copyStateEdit = [...this.state.stateUpdate]; let copyStateEdit = [...this.state.stateUpdate];
copyStateEdit.map((val, index) => { copyStateEdit.map((val, index) => {
@ -405,6 +437,7 @@ export default class DialogMenuRoles extends Component {
}) })
this.setState({ stateUpdate: copyStateEdit }) this.setState({ stateUpdate: copyStateEdit })
} }
handleChangeCheckboxDeleteAll = (checked, index) => { handleChangeCheckboxDeleteAll = (checked, index) => {
let copyStateDelete = [...this.state.stateDelete]; let copyStateDelete = [...this.state.stateDelete];
copyStateDelete.map((val, index) => { copyStateDelete.map((val, index) => {
@ -412,6 +445,7 @@ export default class DialogMenuRoles extends Component {
}) })
this.setState({ stateDelete: copyStateDelete }) this.setState({ stateDelete: copyStateDelete })
} }
renderForm = () => { renderForm = () => {
const { menu, stateRead, stateCreate, stateUpdate, stateDelete } = this.state; const { menu, stateRead, stateCreate, stateUpdate, stateDelete } = this.state;
let menuIdxList = [] let menuIdxList = []
@ -449,6 +483,7 @@ export default class DialogMenuRoles extends Component {
</React.Fragment> </React.Fragment>
); );
}; };
renderAll = () => { renderAll = () => {
return ( return (
<tr> <tr>
@ -460,9 +495,11 @@ export default class DialogMenuRoles extends Component {
</tr> </tr>
) )
} }
checkArray = (val) => { checkArray = (val) => {
return val === false; return val === false;
} }
handleAllChecked = (checked) => { handleAllChecked = (checked) => {
this.setState({ allChecked: !this.state.allChecked }); this.setState({ allChecked: !this.state.allChecked });
if (checked === true) { if (checked === true) {
@ -486,6 +523,7 @@ export default class DialogMenuRoles extends Component {
}) })
} }
} }
render() { render() {
return ( return (
<Modal size="xl" scrollable={true} isOpen={this.props.openDialog} toggle={this.props.toggleDialog}> <Modal size="xl" scrollable={true} isOpen={this.props.openDialog} toggle={this.props.toggleDialog}>

22
src/views/Master/MasterRoles/index.js

@ -156,9 +156,9 @@ class index extends Component {
{ "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" }, { "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" },
) )
} else { } else {
formData.columns.push( // formData.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, // { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
) // )
formData.joins.push( formData.joins.push(
{ "name": "m_company", "column_join": "company_id", "column_results": ["company_name"] } { "name": "m_company", "column_join": "company_id", "column_results": ["company_name"] }
) )
@ -320,13 +320,17 @@ class index extends Component {
handleMenuRoles = async (id) => { handleMenuRoles = async (id) => {
const formData = { const formData = {
"paging": { "start": 0, "length": -1 }, "paging": { "start": 0, "length": -1 },
"columns": [ "columns": [],
{ "name": "role_id", "logic_operator": "=", "value": `${id}`, "operator": "AND" }
],
"joins": [{ "name": "m_menu", "column_join": "menu_id", "column_results": ["parent_id", "name"] }], "joins": [{ "name": "m_menu", "column_join": "menu_id", "column_results": ["parent_id", "name"] }],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (this.state.role_name !== "Super Admin") {
formData.columns.push(
{ "name": "role_id", "logic_operator": "=", "value": `${id}`, "operator": "AND" }
)
}
const result = await axios const result = await axios
.post(ROLEMENU_SEARCH, formData, this.state.config) .post(ROLEMENU_SEARCH, formData, this.state.config)
.then(res => res) .then(res => res)
@ -412,9 +416,9 @@ class index extends Component {
{ "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" }, { "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" },
) )
} else { } else {
formData.columns.push( // formData.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, // { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
) // )
formData.joins.push( formData.joins.push(
{ "name": "m_company", "column_join": "company_id", "column_results": ["company_name"] } { "name": "m_company", "column_join": "company_id", "column_results": ["company_name"] }
) )

6
src/views/SimproV2/CreatedProyek/DialogAssignCust.js

@ -44,14 +44,14 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask, compa
"select": [ "select": [
"id", "id",
"name", "name",
"role_id" "is_customer"
], ],
"paging": { "paging": {
"start": 0, "start": 0,
"length": -1 "length": -1
}, },
"columns": [ "columns": [
{ "name": "role_id", "logic_operator": "=", "value": 44 }, { "name": "is_customer", "logic_operator": "=", "value": true },
{ "name": "company_id", "logic_operator": "=", "value": company_id }, { "name": "company_id", "logic_operator": "=", "value": company_id },
], ],
"orders": { "orders": {
@ -69,7 +69,7 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask, compa
if (result && result.status == 200) { if (result && result.status == 200) {
let dataRes = result.data.data; let dataRes = result.data.data;
const filteredData = dataRes.filter(item => item.role_id === 44); const filteredData = dataRes.filter(item => item.is_customer === true);
setTransferUser(filteredData); setTransferUser(filteredData);
} }
} }

5
src/views/SimproV2/CreatedProyek/DialogGantt.js

@ -150,6 +150,11 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
<Tooltip title="Gantt"> <Tooltip title="Gantt">
<Button size={"sm"} color='primary'><i className="fa fa-gears"></i></Button> <Button size={"sm"} color='primary'><i className="fa fa-gears"></i></Button>
</Tooltip></Link>{" "} </Tooltip></Link>{" "}
<Link to={`/kanban/${idTask}/${text.id}`}>
<Tooltip title="Kanban">
<Button id="kanban" className="kanban" name="kanban" size={"sm"} color='primary'><i className="fa fa-calendar"></i></Button>
</Tooltip>
</Link>{" "}
</> </>
, ,
}, },

6
src/views/SimproV2/CreatedProyek/index.js

@ -418,12 +418,12 @@ const CreatedProyek = ({ params, ...props }) => {
paging: { start: start, length: rowsPerPage }, paging: { start: start, length: rowsPerPage },
}; };
if (all_project !== null && all_project === true) { if (role_name !== 'Super Admin' && all_project === 'true') {
payload.columns.push( payload.columns.push(
{ name: "company_id", logic_operator: "like", value: company_id, operator: "AND" } { name: "company_id", logic_operator: "like", value: parseInt(company_id), operator: "AND" }
); );
} }
if (role_name !== 'Super Admin') { if (role_name !== 'Super Admin' && all_project === 'null') {
payload.columns.push( payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" } { name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
); );

8
src/views/SimproV2/Divisi/index.js

@ -4,7 +4,7 @@ import React, { useState, useEffect, useMemo } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
import axios from "../../../const/interceptorApi" import axios from "../../../const/interceptorApi"
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap'; import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
import { DIVISI_LIST, DIVISI_ADD, DIVISI_EDIT, DIVISI_DELETE, DIVISI_SEARCH, COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst'; import { DIVISI_ADD, DIVISI_EDIT, DIVISI_DELETE, DIVISI_SEARCH, COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst';
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Button, Tooltip, Table, Spin } from 'antd'; import { Pagination, Button, Tooltip, Table, Spin } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@ -120,9 +120,6 @@ const ProjectType = ({ params, ...props }) => {
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
) )
} else { } else {
payload.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
payload.joins.push( payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] } { name: "m_company", column_join: "company_id", column_results: ["company_name"] }
) )
@ -183,9 +180,6 @@ const ProjectType = ({ params, ...props }) => {
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
) )
} else { } else {
payload.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
payload.joins.push( payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] } { name: "m_company", column_join: "company_id", column_results: ["company_name"] }
) )

10
src/views/SimproV2/Kanban/index.js

@ -240,7 +240,7 @@ const Kanban = ({ params, ...props }) => {
const payload = { const payload = {
columns: [ columns: [
{ {
name: "created_by", name: "created_by_id",
logic_operator: "IN", logic_operator: "IN",
value: hierarchy, value: hierarchy,
operator: "AND" operator: "AND"
@ -261,11 +261,9 @@ const Kanban = ({ params, ...props }) => {
orders: { columns: ["id"], ascending: false }, orders: { columns: ["id"], ascending: false },
}; };
if (parseInt(role_id) !== 1) { // if (parseInt(role_id) !== 1) {
payload["columns"] = [ // payload.columns.push( { name: "id", logic_operator: "=", value: project, operator: "AND" });
{ name: "id", logic_operator: "=", value: project, operator: "AND" }, // }
];
}
const result = await axios const result = await axios
.post(PROYEK_SEARCH, payload, HEADER) .post(PROYEK_SEARCH, payload, HEADER)

73
src/views/SimproV2/ResourceWorker/DialogForm.js

@ -33,7 +33,9 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const [divisionId, setDivisionId] = useState('') const [divisionId, setDivisionId] = useState('')
const [statusResource, setStatusResource] = useState('active') const [statusResource, setStatusResource] = useState('active')
const [statusRestriction, setStatusRestriction] = useState(false) const [statusRestriction, setStatusRestriction] = useState(false)
const [statusCustomer, setStatusCustomer] = useState(false)
const { t } = useTranslation() const { t } = useTranslation()
useEffect(() => { useEffect(() => {
if (typeDialog === "Edit" || typeDialog === "Set") { if (typeDialog === "Edit" || typeDialog === "Set") {
setId(dataEdit.id) setId(dataEdit.id)
@ -55,6 +57,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setDivisionId(dataEdit.divisi_id) setDivisionId(dataEdit.divisi_id)
setAddress(dataEdit.address) setAddress(dataEdit.address)
setStatusRestriction(dataEdit.status_boundary) setStatusRestriction(dataEdit.status_boundary)
setStatusCustomer(dataEdit.is_customer)
} else { } else {
setId(0) setId(0)
setResourceName('') setResourceName('')
@ -76,6 +79,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setCompanyId(null) setCompanyId(null)
setStatusResource('active') setStatusResource('active')
setStatusRestriction(false) setStatusRestriction(false)
setStatusCustomer(false)
} }
}, [dataEdit, openDialog]) }, [dataEdit, openDialog])
@ -104,14 +108,17 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
gender, gender,
birth_place: birthPlace, birth_place: birthPlace,
ktp_number: ktpNumber, ktp_number: ktpNumber,
role_id: roleId,
divisi_id: divisionId,
address, address,
status_resource: statusResource, status_resource: statusResource,
status_boundary: statusRestriction, status_boundary: statusRestriction,
company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id) company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id)
} }
if(statusCustomer === false) {
data.role_id = roleId;
data.divisi_id = divisionId;
}
if (birthDate && birthDate != "") { if (birthDate && birthDate != "") {
data['birth_date'] = birthDate; data['birth_date'] = birthDate;
} }
@ -153,13 +160,16 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
blood_type: bloodType, blood_type: bloodType,
ktp_number: ktpNumber, ktp_number: ktpNumber,
biaya_per_jam: biayaPerJam.replace('.', ''), biaya_per_jam: biayaPerJam.replace('.', ''),
role_id: roleId,
divisi_id: divisionId,
address, address,
status_resource: statusResource, status_resource: statusResource,
status_boundary: statusRestriction, status_boundary: statusRestriction,
is_customer: statusCustomer,
company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id) company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id)
} }
if(statusCustomer === false) {
data.role_id = roleId;
data.divisi_id = divisionId;
}
if (birthDate && birthDate != "") { if (birthDate && birthDate != "") {
data['birth_date'] = birthDate; data['birth_date'] = birthDate;
@ -283,25 +293,28 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
<Row> {
<Col md={6}> statusCustomer === false && (
<FormGroup> <Row>
<Label className="capitalize">{t('roles')} <span style={{ color: "red" }}>*</span></Label> <Col md={6}>
<Select showSearch defaultValue={roleId} onChange={(val) => setRoleId(val)} placeholder={t('selectRole')} style={{ width: '100%' }}> <FormGroup>
{setupSelectRole()} <Label className="capitalize">{t('roles')} <span style={{ color: "red" }}>*</span></Label>
</Select> <Select showSearch defaultValue={roleId} onChange={(val) => setRoleId(val)} placeholder={t('selectRole')} style={{ width: '100%' }}>
</FormGroup> {setupSelectRole()}
</Col> </Select>
<Col md={6}> </FormGroup>
<FormGroup> </Col>
<Label className="capitalize">{t('division')} <span style={{ color: "red" }}>*</span></Label> <Col md={6}>
<Select showSearch defaultValue={divisionId} onChange={(val) => setDivisionId(val)} placeholder={t('selectDivision')} style={{ width: '100%' }}> <FormGroup>
{setupSelectDivisi()} <Label className="capitalize">{t('division')} <span style={{ color: "red" }}>*</span></Label>
</Select> <Select showSearch defaultValue={divisionId} onChange={(val) => setDivisionId(val)} placeholder={t('selectDivision')} style={{ width: '100%' }}>
</FormGroup> {setupSelectDivisi()}
</Col> </Select>
</Row> </FormGroup>
</Col>
</Row>
)
}
<Row> <Row>
{ {
role_name === 'Super Admin' && ( role_name === 'Super Admin' && (
@ -329,8 +342,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
) )
} }
<Col md={6}> <Col md={6}>
<Label className="capitalize">{t('restrictions')}</Label> <Label className="capitalize">{t('Customer')}</Label>
<Select style={{ width: "100%" }} defaultValue={statusRestriction} onChange={(e) => setStatusRestriction(e)}> <Select style={{ width: "100%" }} defaultValue={statusCustomer} onChange={(e) => setStatusCustomer(e)}>
<Option value={true}>Ya</Option> <Option value={true}>Ya</Option>
<Option value={false}>Tidak</Option> <Option value={false}>Tidak</Option>
</Select> </Select>
@ -342,13 +355,19 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
<Option value={'inactive'}>Inactive</Option> <Option value={'inactive'}>Inactive</Option>
</Select> </Select>
</Col> </Col>
<Col md={6}> <Col md={6} style={{ marginTop:'13px' }}>
<Label className="capitalize">{t('restrictions')}</Label>
<Select style={{ width: "100%" }} defaultValue={statusRestriction} onChange={(e) => setStatusRestriction(e)}>
<Option value={true}>Ya</Option>
<Option value={false}>Tidak</Option>
</Select>
</Col>
<Col md={6} style={{ marginTop:'13px' }}>
<FormGroup> <FormGroup>
<Label className="capitalize">{t('address')}</Label> <Label className="capitalize">{t('address')}</Label>
<Input type="textarea" value={address} onChange={(e) => setAddress(e.target.value)} placeholder={t('inputaddress')} /> <Input type="textarea" value={address} onChange={(e) => setAddress(e.target.value)} placeholder={t('inputaddress')} />
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
</Form> </Form>
) )

16
src/views/SimproV2/ResourceWorker/index.js

@ -6,7 +6,6 @@ import SweetAlert from 'react-bootstrap-sweetalert';
import axios from "../../../const/interceptorApi" import axios from "../../../const/interceptorApi"
import moment from 'moment' import moment from 'moment'
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap'; import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
import { DownloadOutlined } from '@ant-design/icons';
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";
import { Pagination, Table, Button, Tooltip, Spin } from 'antd'; import { Pagination, Table, Button, Tooltip, Spin } from 'antd';
@ -101,7 +100,7 @@ const ResourceWorker = ({ params, ...props }) => {
} }
if (role_name !== "Super Admin") { if (role_name !== "Super Admin") {
formData.columns.push( formData.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, { "name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND" },
) )
} else { } else {
formData.columns.push( formData.columns.push(
@ -120,18 +119,13 @@ const ResourceWorker = ({ params, ...props }) => {
const getDivisiList = async () => { const getDivisiList = async () => {
const formData = { const formData = {
"paging": { "start": 0, "length": -1 },
"orders": { "columns": ["id"], "ascending": false }, "orders": { "columns": ["id"], "ascending": false },
"columns": [], "columns": [],
} }
if (role_name !== "Super Admin") { if (role_name !== "Super Admin") {
formData.columns.push( formData.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, { "name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND" },
)
} else {
formData.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
) )
} }
@ -236,7 +230,7 @@ const ResourceWorker = ({ params, ...props }) => {
if (role_name !== "Super Admin") { if (role_name !== "Super Admin") {
payload.group_column.where.push( payload.group_column.where.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, { "name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND" },
) )
} else { } else {
payload.group_column.where.push( payload.group_column.where.push(
@ -385,7 +379,7 @@ const ResourceWorker = ({ params, ...props }) => {
if (role_name !== "Super Admin") { if (role_name !== "Super Admin") {
payload.group_column.where.push( payload.group_column.where.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, { "name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND" },
) )
} else { } else {
payload.group_column.where.push( payload.group_column.where.push(
@ -598,7 +592,7 @@ const ResourceWorker = ({ params, ...props }) => {
title: t('roles'), title: t('roles'),
dataIndex: 'join_first_name', dataIndex: 'join_first_name',
key: 'join_first_name', key: 'join_first_name',
render: (text, record) => <>{record.join_first_name}</> render: (text, record) => <>{ record.is_customer === true ? 'Customer' : record.join_first_name}</>
}, },
{ title: 'Phone No.', dataIndex: 'phone_number', key: 'phone_number' }, { title: 'Phone No.', dataIndex: 'phone_number', key: 'phone_number' },
{ title: 'Email', dataIndex: 'email', key: 'email' }, { title: 'Email', dataIndex: 'email', key: 'email' },

3
src/views/SimproV2/Satuan/index.js

@ -127,9 +127,6 @@ const Satuan = ({ params, ...props }) => {
{ "name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND" }, { "name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND" },
) )
} else { } else {
payload.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
payload.joins.push( payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] } { name: "m_company", column_join: "company_id", column_results: ["company_name"] }
) )

19
src/views/SimproV2/Settings/components/Plan/Container1.js

@ -8,7 +8,6 @@ import moment from "moment";
const Container1 = () => { const Container1 = () => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const user_id = localStorage.getItem("user_id") const user_id = localStorage.getItem("user_id")
let company_id = '', configApp = '';
const role = window.localStorage.getItem('role_name'); const role = window.localStorage.getItem('role_name');
const [totalPage, setTotalPage] = useState(0); const [totalPage, setTotalPage] = useState(0);
const [transaction, setTransaction] = useState([]); const [transaction, setTransaction] = useState([]);
@ -17,9 +16,9 @@ const Container1 = () => {
const givenDate = new Date(transaction.exp_ospro); const givenDate = new Date(transaction.exp_ospro);
const createdDate = new Date(transaction.created_at) const createdDate = new Date(transaction.created_at)
const differenceInMillis = givenDate.getTime() - currentDate.getTime(); const differenceInMillis = givenDate.getTime() - currentDate.getTime();
const differenceInDays = role !== 'Super Admin' ? Math.floor(differenceInMillis / (1000 * 60 * 60 * 24)) : 30;
const differenceInDays = Math.floor(differenceInMillis / (1000 * 60 * 60 * 24)); let company_id = '', configApp = '';
if(role !== 'Super Admin') { if(role !== 'Super Admin') {
company_id = localStorage.getItem("company_id"); company_id = localStorage.getItem("company_id");
configApp = JSON.parse(window.localStorage.getItem('configApp')); configApp = JSON.parse(window.localStorage.getItem('configApp'));
@ -33,8 +32,10 @@ const Container1 = () => {
useEffect(()=>{ useEffect(()=>{
getDataProyek(); getDataProyek();
getDataTransaction();
getLimitInformation(); getLimitInformation();
if(role !== 'Super Admin') {
getDataTransaction();
}
},[]) },[])
const getDataProyek = async () => { const getDataProyek = async () => {
@ -88,13 +89,13 @@ const Container1 = () => {
} }
const getLimitInformation = async () => { const getLimitInformation = async () => {
const url = STORAGE_LIMIT_INFORMATION(configApp.company_name); const url = STORAGE_LIMIT_INFORMATION(role !== 'Super Admin' ? configApp.company_name : 'Super Admin');
const result = await axios const result = await axios
.get(url, config) .get(url, config)
.then((res) => res) .then((res) => res)
.catch((error) => error.response); .catch((error) => error.response);
if (result.data) { if (result.data) {
setLimitInformation(result.data); setLimitInformation(role !== 'Super Admin' ? parseFloat(result.data) : 0);
} else { } else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); NotificationManager.error("Gagal Mengambil Data!!", "Failed");
} }
@ -169,13 +170,13 @@ const Container1 = () => {
</div> </div>
</div> </div>
<div className={styles.daysRemainingUntil}> <div className={styles.daysRemainingUntil}>
{Math.abs(differenceInDays)} days remaining until your plan requires update { role !== 'Super Admin' ? Math.abs(differenceInDays) : 0} days remaining until your plan requires update
</div> </div>
</div> </div>
<div className={styles.days2}> <div className={styles.days2}>
<div className={styles.storageParent}> <div className={styles.storageParent}>
<div className={styles.storage}>Storage</div> <div className={styles.storage}>Storage</div>
<div className={styles.of500mb}>{storage} of {transaction.type_paket === 'Basic' ? 500 : 50}MB</div> <div className={styles.of500mb}>{storage} of {transaction?.type_paket === 'Basic' ? 500 : 50}MB</div>
</div> </div>
<div className={styles.rectangleParent}> <div className={styles.rectangleParent}>
<div className={styles.frameChild} /> <div className={styles.frameChild} />
@ -192,7 +193,7 @@ const Container1 = () => {
</div> </div>
</div> </div>
<div className={styles.storageRemainingUntil}> <div className={styles.storageRemainingUntil}>
{((storage / (transaction.type_paket === 'Basic' ? 500 : 50)) * 100).toFixed(2)}% storage remaining until your plan requires update {(((storage / (transaction.type_paket === 'Basic' ? 500 : 50)) * 100).toFixed(2))}% has been filled until your plan requires an update
</div> </div>
</div> </div>
<div className={styles.days3}> <div className={styles.days3}>

Loading…
Cancel
Save