@@ -554,6 +574,7 @@ const MasterCompany = ({ params }) => {
imageFavIcon={imageFavIcon}
imageSlider={imageSlider}
imageLogin={imageLogin}
+ transaction={transaction}
lastIdCompany={lastIdCompany}
/>
diff --git a/src/views/Master/MasterRoles/DialogMenuRoles.js b/src/views/Master/MasterRoles/DialogMenuRoles.js
index 2ed266b..ab8c026 100644
--- a/src/views/Master/MasterRoles/DialogMenuRoles.js
+++ b/src/views/Master/MasterRoles/DialogMenuRoles.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react'
-import { Modal, ModalHeader, ModalBody, ModalFooter, Row, Col, Table } from 'reactstrap';
-import { Button, Form, FormGroup, Label, Input } from 'reactstrap';
+import { Modal, ModalHeader, ModalBody, ModalFooter, Table } from 'reactstrap';
+import { Button, Form } from 'reactstrap';
import 'antd/dist/antd.css';
import axios from 'axios';
import { MENU_COMPANY_SEARCH } from '../../../const/ApiConst.js';
@@ -34,13 +34,11 @@ export default class DialogMenuRoles extends Component {
stateUpdateAll: false,
stateDeleteAll: false,
allChecked: true,
- company_id: props.company_id || null,
}
}
async componentDidMount() {
this.props.showDialog(this.showDialog);
- this.getAllMenu();
}
async componentDidUpdate(prevProps, prevState) {
@@ -51,10 +49,8 @@ export default class DialogMenuRoles extends Component {
this.setStateUpdate(true);
this.setStateCreate(true);
this.setStateDelete(true);
+ this.getAllMenu();
this.setState({ isParentClick: false, id: idRoles });
- // if (prevState.menu == this.state.menu) {
- // await this.setStateReadAfterRender();
- // }
}
}
@@ -72,11 +68,9 @@ export default class DialogMenuRoles extends Component {
],
"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" }
- )
- }
+ payload.columns.push(
+ { "name": "company_id", "logic_operator": "=", "value": this.props.company_id, "operator": "AND" }
+ )
const result = await axios
.post(MENU_COMPANY_SEARCH, payload, config)
.then(res => res)
@@ -116,14 +110,6 @@ export default class DialogMenuRoles extends Component {
})
}
- // setStateReadAfterRender = async () => {
- // await new Promise((resolve) => {
- // this.setState({}, resolve);
- // });
- // // Now you have access to the rendered elements and can update state based on it
- // this.setStateRead(true);
- // }
-
setStateCreate = edit => {
const stateCreate = [];
this.state.menu.map((val) => {
@@ -484,7 +470,7 @@ export default class DialogMenuRoles extends Component {
};
const renderMenu = (parentId, depth = 0) => {
const children = getChildren(parentId);
- return children.map((menuItem, index) => {
+ return children.map((menuItem) => {
const currentIndex = menuIdx;
menuIdxList[currentIndex] = menuItem.menu_id;
menuIdx++
diff --git a/src/views/Master/MasterRoles/index.js b/src/views/Master/MasterRoles/index.js
index ff5045f..2578efe 100644
--- a/src/views/Master/MasterRoles/index.js
+++ b/src/views/Master/MasterRoles/index.js
@@ -43,7 +43,6 @@ class index extends Component {
tooltipTambah: false,
totalPage: 0,
typeDialog: 'Save',
- company_id: props.company_id || 0,
role_name: props.role_name || '',
role_id: props.role_id || 0,
user_id: props.user_id || 0,
@@ -68,29 +67,27 @@ class index extends Component {
render: (text, record) => <>
{
- checkActMenup('/roles', 'update') ?
- this.handleMenuRoles(text.id)}>
- :
- null
- }
+ checkActMenup('/roles', 'update') ?
+ this.handleMenuRoles(text)}>
+ :
+ null
+ }
-
{
- checkActMenup('/roles', 'delete') ?
- this.handleDelete(text.id)}>
- :
- null
- }
+ checkActMenup('/roles', 'delete') ?
+ this.handleDelete(text)}>
+ :
+ null
+ }
-
{
- checkActMenup('/roles', 'update') ?
- this.handleEdit(text)}>
- :
- null
- }
+ checkActMenup('/roles', 'update') ?
+ this.handleEdit(text)}>
+ :
+ null
+ }
>,
},
@@ -133,7 +130,6 @@ class index extends Component {
if (this.state.currentPage !== 1 && this.state.currentPage > 1) {
start = (this.state.currentPage * this.state.rowsPerPage) - this.state.rowsPerPage
}
-
const formData = {
"paging": { "start": start, "length": this.state.rowsPerPage },
"columns": [],
@@ -153,12 +149,9 @@ class index extends Component {
}
if (this.state.role_name !== "Super Admin") {
formData.columns.push(
- { "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" },
+ { "name": "company_id", "logic_operator": "=", "value": this.props.company_id, "operator": "AND" },
)
} else {
- // formData.columns.push(
- // { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
- // )
formData.joins.push(
{ "name": "m_company", "column_join": "company_id", "column_results": ["company_name"] }
)
@@ -228,7 +221,6 @@ class index extends Component {
}
saveRole = async (data) => {
-
const formData = {
name: data.name,
description: data.description,
@@ -247,7 +239,6 @@ class index extends Component {
} else {
NotificationManager.error(`Data role gagal ditambahkan`, 'Failed!!');
}
-
}
editRole = async (data) => {
@@ -272,13 +263,13 @@ class index extends Component {
}
handleEdit = (data) => {
- this.setState({ dataEdit: data });
+ this.setState({ dataEdit: data, company_id: data.company_id });
this.handleOpenDialog('Edit');
}
- handleDelete = (id) => {
- id == '1' ? this.setState({ alertNotDelete: true }) :
- this.setState({ alertDelete: true, idDelete: id });
+ handleDelete = (data) => {
+ data.id == '1' ? this.setState({ alertNotDelete: true }) :
+ this.setState({ alertDelete: true, idDelete: data.id });
}
onShowSizeChange = (current, pageSize) => {
@@ -317,29 +308,24 @@ class index extends Component {
}
}
- handleMenuRoles = async (id) => {
+ handleMenuRoles = async (data) => {
const formData = {
"paging": { "start": 0, "length": -1 },
"columns": [],
"joins": [{ "name": "m_menu", "column_join": "menu_id", "column_results": ["parent_id", "name"] }],
"orders": { "columns": ["id"], "ascending": false }
}
-
- if (this.state.role_name !== "Super Admin") {
- formData.columns.push(
- { "name": "role_id", "logic_operator": "=", "value": `${id}`, "operator": "AND" }
- )
- }
-
+ formData.columns.push(
+ { "name": "role_id", "logic_operator": "=", "value": parseInt(data.id), "operator": "AND" }
+ )
const result = await axios
.post(ROLEMENU_SEARCH, formData, this.state.config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
- this.setState({ menuRoles: result.data.data, idRoles: id }, () => {
+ this.setState({ menuRoles: result.data.data, idRoles: data.id, company_id: data.company_id }, () => {
this.handleOpenDialogMr();
});
- } else {
}
}
@@ -348,8 +334,7 @@ class index extends Component {
if (payloadArray.length > 0) {
await this.deleteCurrentRoleMenu(payloadArray[0].roles_id)
}
- let promises = []
- let result = []
+ let dataArr = []
dataArray.map((val, index) => {
if (val.read === true) {
const formData = {
@@ -359,24 +344,22 @@ class index extends Component {
read: val.read,
update: val.update,
delete: val.delete
-
}
- promises.push(axios.post(ROLEMENU_ADD, formData, this.state.config)
- .then(res => result.push(res)))
+ dataArr.push(formData);
}
- })
-
- await Promise.all(promises);
- if (result) {
- if (result.length > 0) {
- if (result[0].data.code === 200) {
- this.getDataRoles();
- NotificationManager.success('Data roles berhasil ditambahkan!!', 'Success!!');
- } else {
- NotificationManager.error(`${result[0].data.message}`, 'Failed!!');
- }
- }
- }
+ });
+
+ const result = await axios
+ .post(ROLEMENU_ADD, dataArr, this.state.config)
+ .then((res) => res)
+ .catch((err) => err.response);
+
+ if (result && result.data && result.data.code == 200) {
+ this.getDataRoles();
+ NotificationManager.success('Data roles berhasil ditambahkan!!', 'Success!!');
+ } else {
+ NotificationManager.error(`${result.data.message}`, 'Failed!!');
+ }
}
deleteCurrentRoleMenu = async (id) => {
@@ -413,12 +396,9 @@ class index extends Component {
if (this.state.role_name !== "Super Admin") {
formData.columns.push(
- { "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" },
+ { "name": "company_id", "logic_operator": "=", "value": this.props.company_id, "operator": "AND" },
)
} else {
- // formData.columns.push(
- // { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
- // )
formData.joins.push(
{ "name": "m_company", "column_join": "company_id", "column_results": ["company_name"] }
)
@@ -462,9 +442,7 @@ class index extends Component {
}
render() {
- const { t } = this.props;
- const { tooltipTambah, tooltipExport, dialogMenuForm, dataTable, openDialog, currentPage, rowsPerPage, totalPage, search, tooltipEdit, tooltipDelete, tooltipMenu } = this.state
- let noSeq = 0;
+ const { dialogMenuForm, dataTable, openDialog, currentPage, rowsPerPage, totalPage, search } = this.state
return (
@@ -524,16 +502,15 @@ class index extends Component {
{
- checkActMenup('/roles', 'create') ?
-
-
- :
- null
- }
+ checkActMenup('/roles', 'create') ?
+
+ :
+ null
+ }
-
+
diff --git a/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js b/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js
index b39f2cc..55cb384 100644
--- a/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js
+++ b/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js
@@ -15,9 +15,9 @@ const DialogFormAnalysis = ({
closeDialog,
toggleDialog,
dataDetail,
- typeDialogName
+ typeDialogName,
+ token
}) => {
- const token = localStorage.getItem("token");
const [dataTable, setDatatable] = useState([]);
const HEADER = {
headers: {
diff --git a/src/views/SimproV2/CreatedProyek/DialogFormHierarchy.js b/src/views/SimproV2/CreatedProyek/DialogFormHierarchy.js
index 11296b5..98c1c8f 100644
--- a/src/views/SimproV2/CreatedProyek/DialogFormHierarchy.js
+++ b/src/views/SimproV2/CreatedProyek/DialogFormHierarchy.js
@@ -3,9 +3,6 @@ import {
Modal, ModalHeader, ModalBody, ModalFooter,
Button, Form, FormGroup, Label, Input, Col, Row
} from 'reactstrap';
-import { DatePicker, Tooltip, Select } from 'antd';
-import { formatRupiah, formatNumber } from '../../../const/CustomFunc'
-import moment from 'moment';
import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next';
@@ -114,4 +111,4 @@ const DialogFormHierarchy = ({ openDialog, closeDialog, toggleDialog, typeDialog
>
)
}
-export default DialogFormHierarchy;
\ No newline at end of file
+export default DialogFormHierarchy;
diff --git a/src/views/SimproV2/CreatedProyek/DialogGantt.js b/src/views/SimproV2/CreatedProyek/DialogGantt.js
index 2ca7988..813641b 100644
--- a/src/views/SimproV2/CreatedProyek/DialogGantt.js
+++ b/src/views/SimproV2/CreatedProyek/DialogGantt.js
@@ -13,7 +13,7 @@ import DialogUserGantt from './DialogUserGantt';
import { Link } from 'react-router-dom';
const { Option } = Select
-const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, companyId, configApp, hierarchyId, hierarchyName, openDialogHierarchy, isLogin, token, role_id, user_id, dataViewStartDate }) => {
+const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, companyId, companyName, hierarchyId, hierarchyName, openDialogHierarchy, isLogin, token, role_id, user_id, dataViewStartDate }) => {
const HEADER = {
headers: {
"Content-Type": "application/json",
@@ -134,7 +134,7 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
user_id,
company_id: companyId,
dataViewStartDate,
- configApp: configApp
+ companyName
}
}}>
diff --git a/src/views/SimproV2/CreatedProyek/DialogHierarchy.js b/src/views/SimproV2/CreatedProyek/DialogHierarchy.js
index 563d14d..0671dbd 100644
--- a/src/views/SimproV2/CreatedProyek/DialogHierarchy.js
+++ b/src/views/SimproV2/CreatedProyek/DialogHierarchy.js
@@ -1,7 +1,7 @@
import React, { useEffect, useState, useMemo } from 'react'
import { Modal, ModalHeader, ModalBody, } from 'reactstrap';
import { Button } from 'reactstrap';
-import { Space, Table, Tooltip, Spin } from 'antd';
+import { Table, Tooltip, Spin } from 'antd';
import 'antd/dist/antd.css';
import moment from 'moment';
import SweetAlert from 'react-bootstrap-sweetalert';
@@ -14,8 +14,7 @@ import DialogFormGantt from './DialogFormGantt';
import DialogGantt from './DialogGantt';
import { useTranslation } from 'react-i18next';
import _ from 'lodash';
-const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, dataViewStartDate }) => {
- const token = localStorage.getItem("token")
+const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, dataViewStartDate, token, role_id, user_id, companyName, companyId, isLogin }) => {
const HEADER = {
headers: {
"Content-Type": "application/json",
@@ -26,7 +25,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
const [id, setId] = useState(0)
const [parentId, setParentId] = useState(0)
const [parentName, setParentName] = useState(null)
- const [dataGantt, setDataGantt] = useState([])
const [typeDialog, setTypeDialog] = useState("add")
const [openDialogForm, setOpenDialogForm] = useState(false)
const [openDialogGantt, setOpenDialogGantt] = useState(false)
@@ -36,7 +34,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
const [alertDelete, setAlertDelete] = useState(false)
const [idDelete, setIdDelete] = useState(0)
const [idGantt, setIdGantt] = useState(0)
- const [humanResource, setHumanResource] = useState([])
const { t } = useTranslation();
const [loading, setLoading] = useState(true);
useEffect(() => {
@@ -44,40 +41,11 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
setLoading(true);
getdataHierarchy();
}
- }, [idTask, openDialog, closeDialog, openDialogFormGantt])
+ }, [idTask, openDialog, openDialogFormGantt])
useEffect(() => {
- if (!openDialog) {
setDataHierarchy([]);
- } else {
-
- }
- }, [openDialog, closeDialog])
-
- const getDataHumanResource = async () => {
- const result = await axios
- .get(USER_LIST, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.status == 200) {
- setTransferUser(result.data.data);
- } else {
-
- }
- }
-
- const setTransferUser = (data) => {
- const finalData = []
- data.map((val, index) => {
- let data = {
- key: val.id,
- title: val.name
- }
- finalData.push(data)
- });
- setHumanResource(finalData)
- }
+ }, [openDialog])
const handleAdd = async () => {
await setTypeDialog("Save")
@@ -137,8 +105,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
const closeDialogFromHierarchy = (type, data) => {
if (type == 'save') {
saveHierarchy(data)
- } else {
- updateHierarchy(data)
}
setId(0);
setOpenDialogForm(false);
@@ -157,11 +123,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
}
}
- const updateHierarchy = async (data) => {
-
- }
-
-
const getdataHierarchy = async () => {
const url = HIERARCHY_FTTH_TREE(idTask)
const result = await axios
@@ -311,9 +272,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
- {/*
-
- */}
diff --git a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js
index a141b67..9c9a4e3 100644
--- a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js
+++ b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js
@@ -28,8 +28,8 @@ import DialogFormAnalysis from './DialogFormAnalysis';
import moment from "moment";
const { Option } = Select
-const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId, proyekName }) => {
- const token = localStorage.getItem("token");
+const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId, proyekName, token }) => {
+
const [activeTab, setActiveTab] = useState('1');
const [search, setSearch] = useState('');
const [openDialogFormAnalysis, setOpenDialogFormAnalysis] = useState(false);
@@ -668,6 +668,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId, proy
toggleDialog={toggleDialogForm}
closeDialog={closeDialogForm}
dataDetail={dataDetail}
+ token={token}
typeDialogName={typeDialogName}
/>
>
diff --git a/src/views/SimproV2/CreatedProyek/index.js b/src/views/SimproV2/CreatedProyek/index.js
index b3a4d2c..4896c72 100644
--- a/src/views/SimproV2/CreatedProyek/index.js
+++ b/src/views/SimproV2/CreatedProyek/index.js
@@ -428,7 +428,7 @@ const CreatedProyek = ({ params, ...props }) => {
{
name: "m_type_proyek",
column_join: "type_proyek_id",
- column_results: ["name", "description"],
+ column_results: ["name", "description", "is_multiLocation"],
}
],
orders: { columns: ["nama"], ascending: true },
@@ -583,6 +583,7 @@ const CreatedProyek = ({ params, ...props }) => {
setDataViewStartDate(data.mulai_proyek)
setidTask(data.id);
setProyekName(data.nama);
+ setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(configApp).company_name);
setCompanyId(data.company_id);
setOpenDialogGantt(true);
};
@@ -1686,13 +1687,13 @@ const CreatedProyek = ({ params, ...props }) => {
const popupMenuGantt = (text, record) => {
return (
- {text.type_proyek_id !== 9 && loadVersionGantt && (
+ {text.join_second_is_multiLocation !== true && loadVersionGantt && (
)}
- {!loadVersionGantt && text.type_proyek_id !== 9 && (
+ {!loadVersionGantt && text.join_second_is_multiLocation !== true && (
<>
{dataVersionGantt.slice(0, 8).map((res) => (
{
user_id,
company_id: text.company_id,
dataViewStartDate,
- configApp
+ companyName: (role_name === 'Super Admin' ? text.join_third_company_name : JSON.parse(configApp).company_name)
}
}}>
@@ -1729,7 +1730,7 @@ const CreatedProyek = ({ params, ...props }) => {
)}
>
)}
- {text.type_proyek_id == 9 ? (
+ {text.join_second_is_multiLocation == true ? (
handleOpenDialogHierarchy(text)}
@@ -1799,7 +1800,7 @@ const CreatedProyek = ({ params, ...props }) => {
content={popupMenuGantt(text, record)}
trigger="click"
>
- {text.type_proyek_id == 9 ? (
+ {text.join_second_is_multiLocation == true ? (
@@ -2103,6 +2104,7 @@ const CreatedProyek = ({ params, ...props }) => {
closeDialog={handleCloseReport}
toggleDialog={toggleAddDialogRA}
projectId={projectId}
+ token={token}
proyekName={proyekName}
/>
),
@@ -2119,7 +2121,7 @@ const CreatedProyek = ({ params, ...props }) => {
user_id={user_id}
token={token}
isLogin={isLogin}
- configApp={configApp}
+ companyName={companyName}
proyekName={proyekName}
companyId={companyId}
dataViewStartDate={dataViewStartDate}
@@ -2135,7 +2137,13 @@ const CreatedProyek = ({ params, ...props }) => {
closeDialog={closeDialogHierarchy}
toggleDialog={toggleDialogHierarchy}
idTask={idTask}
+ role_id={role_id}
+ user_id={user_id}
+ token={token}
+ isLogin={isLogin}
+ companyName={companyName}
proyekName={proyekName}
+ companyId={companyId}
dataViewStartDate={dataViewStartDate}
/>
),
diff --git a/src/views/SimproV2/Divisi/index.js b/src/views/SimproV2/Divisi/index.js
index 627df0d..c1667c0 100644
--- a/src/views/SimproV2/Divisi/index.js
+++ b/src/views/SimproV2/Divisi/index.js
@@ -439,7 +439,6 @@ const ProjectType = ({ params, ...props }) => {
)
}] : []),
{ title: 'Nama', dataIndex: 'name', key: 'name' },
- { title: 'Nama', dataIndex: 'name', key: 'name' },
{ title: 'Deskripsi', dataIndex: 'description', key: 'description' },
{
title: 'Color',
diff --git a/src/views/SimproV2/Gantt/index.js b/src/views/SimproV2/Gantt/index.js
index 60c7ac2..4c672e3 100644
--- a/src/views/SimproV2/Gantt/index.js
+++ b/src/views/SimproV2/Gantt/index.js
@@ -9,7 +9,7 @@ import GanttFrame from "./GanttFrame";
let roCount = 0;
const Gantt = (props) => {
- let role_id = 0, user_id = 0, isLogin = false, token = '', companyId = 0, all_project = null, role_name='', hierarchy=[], user_name='', configApp='';
+ let role_id = 0, user_id = 0, isLogin = false, token = '', companyId = 0, all_project = null, role_name='', hierarchy=[], user_name='', companyName='';
if (props && props.role_id && props.user_id) {
role_id = props.role_id;
user_id = props.user_id;
@@ -21,7 +21,7 @@ const Gantt = (props) => {
isLogin = props.isLogin;
hierarchy = props.hierarchy;
user_name = props.user_name;
- configApp = props.configApp;
+ companyName = props.companyName;
}
const HEADER = {
headers: {
@@ -112,7 +112,7 @@ const Gantt = (props) => {
role_name={role_name}
companyId={companyId}
timestamp={timestamp}
- company_name={JSON.parse(configApp).company_name}
+ company_name={companyName}
/>
)}