Browse Source

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

Reviewed-on: ibnu/generic-ospro-frontend#90
pull/1/head
farhantock 6 months ago
parent
commit
442c87a063
  1. 2
      src/routes.js
  2. 36
      src/views/Master/MasterCompany/DialogForm.js
  3. 129
      src/views/Master/MasterCompany/index.js
  4. 24
      src/views/Master/MasterRoles/DialogMenuRoles.js
  5. 67
      src/views/Master/MasterRoles/index.js
  6. 4
      src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js
  7. 3
      src/views/SimproV2/CreatedProyek/DialogFormHierarchy.js
  8. 4
      src/views/SimproV2/CreatedProyek/DialogGantt.js
  9. 57
      src/views/SimproV2/CreatedProyek/DialogHierarchy.js
  10. 5
      src/views/SimproV2/CreatedProyek/ReportAnalysis.js
  11. 22
      src/views/SimproV2/CreatedProyek/index.js
  12. 1
      src/views/SimproV2/Divisi/index.js
  13. 6
      src/views/SimproV2/Gantt/index.js

2
src/routes.js

@ -51,7 +51,6 @@ const Kanban = React.lazy(() => import('./views/SimproV2/Kanban'));
// const DashboardProject = React.lazy(() => import('./views/DashboardProject'));
const DashboardBOD = React.lazy(() => import('./views/Dashboard/DashboardBOD'));
const DashboardDyna = React.lazy(() => import('./views/Dashboard/DashboardDyna'));
// const DashboardDND = React.lazy(() => import('./components/wj/App'))
const DashboardCustomer = React.lazy(() => import('./views/Dashboard/DashboardCustomer'));
const DashboardProject = React.lazy(() => import('./views/Dashboard/DashboardProject'));
const DashboardProjectCarousell = React.lazy(() => import('./views/Dashboard/DashboardProjectCarousell'));
@ -68,7 +67,6 @@ const routes = [
{ path: '/', exact: true, name: 'Home' },
{ path: '/dashboard', name: 'DashboardBOD', component: DashboardBOD },
{ path: '/dashboard-dyna', name: 'DashboardBOD', component: DashboardDyna },
// { path: '/dashboard-dnd', name: 'DashboardBOD', component: DashboardDND },
{ path: '/dashboard-customer/:PROJECT_ID/:GANTT_ID/:SCURVE', name: 'DashboardCustomer', component: DashboardCustomer },
{ path: '/dashboard-project/:PROJECT_ID/:GANTT_ID/:Header', exact: true, name: 'Dashboard Project', component: DashboardProject },
{ path: '/dashboard-perproject', exact: true, name: 'Dashboard Project Carousell', component: DashboardProjectCarousell },

36
src/views/Master/MasterCompany/DialogForm.js

@ -23,7 +23,7 @@ const config = {
"Content-type": `application/json`
}
};
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, companyID, companyNameProp, dataEditCompany, imageHeader, imageFavIcon, imageLogin, imageSlider, lastIdCompany }) => {
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, companyID, companyNameProp, transaction, dataEditCompany, imageHeader, imageFavIcon, imageLogin, imageSlider, lastIdCompany }) => {
const { Option } = Select
const { t } = useTranslation()
const [registrationnumber, setRegistrationNumber] = useState('')
@ -44,6 +44,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
const [baseUrl, setBaseUrl] = useState([])
const [statusCompany, setStatusCompany] = useState(true)
const [template, setTemplate] = useState('')
const [typePaket, setTypePaket] = useState('')
const [lastIdxURL, setLastIdxURL] = useState(0);
const [availableUrl, setAvailableBaseUrl] = useState(false);
const [id, setId] = useState(0)
@ -96,6 +97,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
setHtmlTitle(dataEditCompany.html_title)
setStatusCompany(dataEditCompany.is_active)
setTemplate(dataEditCompany.template_id)
setTypePaket(transaction ? transaction?.type_paket : '')
setBaseUrl(dataEditCompany.base_url ? dataEditCompany.base_url : [])
if (dataEditCompany.base_url) {
setAvailableBaseUrl(true)
@ -114,6 +116,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
setHtmlTitle('')
setStatusCompany('')
setTemplate('')
setTypePaket('')
setLogoLogin(null)
setLogoHeader(null)
setSliderLogin(null)
@ -377,6 +380,26 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
alert("Please input the name");
return;
}
if (!statusCompany && statusCompany === "") {
alert("Please select the company status");
return;
}
if (!template && template === "") {
alert("Please select the template company");
return;
}
if (!template && template === "") {
alert("Please select the template company");
return;
}
if (!typeAccount && typeAccount === "") {
alert("Please select the type account");
return;
}
if (!typePaket && typePaket === "") {
alert("Please select the type paket");
return;
}
if (typeDialog === "Save") {
data = {
@ -394,6 +417,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
is_active: statusCompany,
template_id: parseInt(template),
type_account: typeAccount,
type_paket: typePaket,
date_register: moment()
}
data.imageLogin = logoLogin ? logoLogin : null;
@ -419,6 +443,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
is_active: statusCompany,
template_id: parseInt(template),
type_account: typeAccount,
type_paket: typePaket
}
data.imageLogin = logoLogin ? logoLogin : null;
data.imageHeader = logoHeader ? logoHeader : null;
@ -723,6 +748,15 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
</Select>
</FormGroup>
</Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize">Type Paket<span style={{ color: "red" }}>*</span></Label>
<Select style={{ width: "100%" }} defaultValue={typePaket} value={typePaket} onChange={(e) => setTypePaket(e)} placeholder="Select a type paket">
<Option value="Free">Free</Option>
<Option value="Basic">Basic</Option>
</Select>
</FormGroup>
</Col>
</Row>
<Row>
<Col md={6}>

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

@ -6,7 +6,8 @@ import DialogForm from './DialogForm'
import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Table, Button, Tooltip, Spin } from 'antd';
import {
COMPANY_MANAGEMENT_SEARCH, COMPANY_MANAGEMENT_ADD, COMPANY_MANAGEMENT_EDIT, COMPANY_MANAGEMENT_DELETE, IMAGE_UPLOAD, IMAGE_MULTIPLE_UPLOAD, IMAGE_MULTIPLE_DELETE, IMAGE_GET_BY_ID, IMAGE_DELETE, IMAGE_SEARCH
COMPANY_MANAGEMENT_SEARCH, COMPANY_MANAGEMENT_ADD, COMPANY_MANAGEMENT_EDIT, COMPANY_MANAGEMENT_DELETE, IMAGE_UPLOAD, IMAGE_MULTIPLE_UPLOAD, IMAGE_MULTIPLE_DELETE, IMAGE_GET_BY_ID, IMAGE_DELETE, IMAGE_SEARCH,
TRANSACTION_SEARCH
} from '../../../const/ApiConst';
import { useTranslation } from 'react-i18next';
const token = window.localStorage.getItem('token');
@ -19,12 +20,8 @@ const config = {
};
const MasterCompany = ({ params }) => {
const token = localStorage.getItem("token")
let company_id = '';
const role = window.localStorage.getItem('role_name');
if(role != 'Super Admin') {
company_id = localStorage.getItem("company_id");
}
const token = localStorage.getItem("token");
const HEADER = {
headers: {
"Content-Type": "application/json",
@ -54,13 +51,11 @@ const MasterCompany = ({ params }) => {
const [imageSlider, setProjectImageSlider] = useState([]);
const [imageFavIcon, setProjectImageFavicon] = useState(null);
const [lastIdCompany,setLastCompanyId] = useState('');
const [transaction, setTransaction] = useState([]);
const [loading, setLoading] = useState(true);
const pageName = params.name;
const { t } = useTranslation();
let configApp = '';
if (role !== 'Super Admin') {
configApp = JSON.parse(window.localStorage.getItem('configApp'));
}
useEffect(() => {
setLoading(true)
getDataCompany()
@ -192,6 +187,33 @@ const MasterCompany = ({ params }) => {
}
}
const getDataTransaction = async (company_id) => {
const formData = {
"paging": {"start": 0, "length": 1},
"columns": [
{"name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND"}
],
"select": [
"company_id",
"type_paket",
"amount",
"exp_ospro",
"pay_date",
"created_at"
]
}
const result = await axios
.post(TRANSACTION_SEARCH, formData, config)
.then(res => res)
.catch((error) => error.response );
if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data[0];
setTransaction(dataRes);
} else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed");
}
}
const handleSearch = e => {
const value = e.target.value
setSearch(value);
@ -201,11 +223,13 @@ const MasterCompany = ({ params }) => {
const handleOpenDialog = async (type) => {
await setTypeDialog(type)
setOpenDialog(true)
}
const handleEdit = async (data) => {
setDataEdit(data);
setCompanyID(data.id);
getDataTransaction(data.id);
setCompanyName(data.company_name);
await getProjectImageHeader(data.id);
await getProjectImageSlider(data.id);
await getProjectImageLogin(data.id);
@ -228,9 +252,11 @@ const MasterCompany = ({ params }) => {
}
const handleDelete = async (id) => {
await setAlertDelete(true)
await setIdDelete(id)
const handleDelete = async (data) => {
setCompanyID(data.id);
setCompanyName(data.company_name);
await setAlertDelete(true);
await setIdDelete(data.id);
}
const handleCloseDialog = (type, data) => {
@ -247,7 +273,7 @@ const MasterCompany = ({ params }) => {
setOpenDialog(false)
}
const packFiles = (id, files) => {
const packFiles = (id, files, company_name) => {
const data = new FormData();
for (let i = 0; i < files.length; i++) {
@ -256,11 +282,10 @@ const MasterCompany = ({ params }) => {
data.append('ref_id', id);
data.append('category', 'company_slider_login');
data.append('company_name', company_name)
return data;
};
const saveCompany = async (data) => {
const formData = data
const result = await axios.post(COMPANY_MANAGEMENT_ADD, formData, HEADER)
@ -272,26 +297,31 @@ const MasterCompany = ({ params }) => {
const logoLogin = data.imageLogin;
const favIcon = data.imageFavicon;
const slider = data.imageSlider;
const resultData = result.data.data;
setCompanyName(resultData.company_name);
if (logoHeader) {
await saveImageHeader(
result.data.data.id,
logoHeader
resultData.id,
logoHeader,
resultData.company_name
);
}
if (logoLogin) {
await saveImageLogin(
result.data.data.id,
logoLogin
resultData.id,
logoLogin,
resultData.company_name
);
}
if (favIcon) {
await saveFavIcon(
result.data.data.id,
favIcon
resultData.id,
favIcon,
resultData.company_name
);
}
if(slider) {
const dataPack = packFiles(result.data.data.id,slider)
const dataPack = packFiles(resultData.id, slider, resultData.company_name)
await saveSliderLogin(dataPack)
}
getDataCompany();
@ -304,7 +334,6 @@ const MasterCompany = ({ params }) => {
}
const editCompany = async (data) => {
let urlEdit = COMPANY_MANAGEMENT_EDIT(data.id)
const logoHeader = data.imageHeader;
const logoLogin = data.imageLogin;
@ -321,7 +350,8 @@ const MasterCompany = ({ params }) => {
);
await saveImageHeader(
data.id,
logoHeader
logoHeader,
companyName
);
}
if (logoLogin) {
@ -330,7 +360,8 @@ const MasterCompany = ({ params }) => {
);
await saveImageLogin(
data.id,
logoLogin
logoLogin,
companyName
);
}
if (favIcon) {
@ -339,14 +370,15 @@ const MasterCompany = ({ params }) => {
);
await saveFavIcon(
data.id,
favIcon
favIcon,
companyName
);
}
if(slider) {
await deleteImageSlider(
data.id
);
const dataPack = packFiles(data.id,slider)
const dataPack = packFiles(data.id, slider, companyName)
await saveSliderLogin(dataPack)
}
if (result && result.data && result.data.code === 200) {
@ -359,14 +391,12 @@ const MasterCompany = ({ params }) => {
}
}
// Save Image Function
const saveImageHeader = async (id, data) => {
const saveImageHeader = async (id, data, company_name) => {
const formData = new FormData;
formData.append('ref_id', id);
formData.append('category', 'company_logo_header');
formData.append('files', data);
if(role != 'Super Admin') {
formData.append('company_name',configApp.company_name);
}
formData.append('company_name', company_name);
await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@ -375,14 +405,12 @@ const MasterCompany = ({ params }) => {
return "berhasil";
};
const saveImageLogin = async (id, data) => {
const saveImageLogin = async (id, data, company_name) => {
const formData = new FormData;
formData.append('ref_id', id);
formData.append('category', 'company_logo_login');
formData.append('files', data);
if(role != 'Super Admin') {
formData.append('company_name',configApp.company_name);
}
formData.append('company_name', company_name);
await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@ -391,14 +419,12 @@ const MasterCompany = ({ params }) => {
return "berhasil";
};
const saveFavIcon = async (id, data) => {
const saveFavIcon = async (id, data, company_name) => {
const formData = new FormData;
formData.append('ref_id', id);
formData.append('category', 'company_favicon');
formData.append('files', data);
if(role != 'Super Admin') {
formData.append('company_name',configApp.company_name);
}
formData.append('company_name', company_name);
await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@ -408,7 +434,6 @@ const MasterCompany = ({ params }) => {
};
const saveSliderLogin = async (data) => {
data.company_name = configApp.company_name;
await axios
.post(IMAGE_MULTIPLE_UPLOAD, data, HEADER_MULTIPART)
.then(res => res)
@ -418,7 +443,7 @@ const MasterCompany = ({ params }) => {
// Delete Image Function
const deleteImageHeader = async (id) => {
const URL = IMAGE_DELETE(id, 'company_logo_header', company_id != '' ? company_id : 'undifined');
const URL = IMAGE_DELETE(id, 'company_logo_header', companyID != '' ? companyID : 'undifined');
await axios
.delete(URL, HEADER)
.then(res => res)
@ -427,7 +452,7 @@ const MasterCompany = ({ params }) => {
};
const deleteImageLogin = async (id) => {
const URL = IMAGE_DELETE(id, 'company_logo_login', company_id != '' ? company_id : 'undifined');
const URL = IMAGE_DELETE(id, 'company_logo_login', companyID != '' ? companyID : 'undifined');
await axios
.delete(URL, HEADER)
.then(res => res)
@ -436,7 +461,7 @@ const MasterCompany = ({ params }) => {
};
const deleteImageFavicon = async (id) => {
const URL = IMAGE_DELETE(id, 'company_favicon', company_id != '' ? company_id : 'undifined');
const URL = IMAGE_DELETE(id, 'company_favicon', companyID != '' ? companyID : 'undifined');
await axios
.delete(URL, HEADER)
.then(res => res)
@ -445,7 +470,7 @@ const MasterCompany = ({ params }) => {
};
const deleteImageSlider = async (id) => {
const URL = IMAGE_MULTIPLE_DELETE(id, 'company_slider_login', company_id != '' ? company_id : 'undifined');
const URL = IMAGE_MULTIPLE_DELETE(id, 'company_slider_login', companyID != '' ? companyID : 'undifined');
await axios
.delete(URL, HEADER)
.then(res => res)
@ -458,18 +483,13 @@ const MasterCompany = ({ params }) => {
}
const onConfirmDelete = async () => {
let url = COMPANY_MANAGEMENT_DELETE(idDelete);
const url = COMPANY_MANAGEMENT_DELETE(idDelete);
const result = await axios.delete(url, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code === 200) {
getDataCompany()
deleteImageHeader(idDelete)
deleteImageLogin(idDelete)
deleteImageFavicon(idDelete)
deleteImageSlider(idDelete)
setIdDelete(0)
setAlertDelete(false)
setLoading(false)
@ -498,7 +518,7 @@ const MasterCompany = ({ params }) => {
<Button size="small" type="link" style={{ color: 'green' }} onClick={() => handleEdit(text)}><i className="fa fa-edit"></i></Button>
</Tooltip>
<Tooltip title={t('delete')}>
<Button size="small" type="link" style={{ color: 'red' }} onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button>
<Button size="small" type="link" style={{ color: 'red' }} onClick={() => handleDelete(text)}><i className="fa fa-trash"></i></Button>
</Tooltip>
<Tooltip title="Set User">
<Button size="small" type="link" style={{ color: 'primary' }} onClick={() => handleSetWorker(text)}><i className="fa fa-users"></i></Button>
@ -554,6 +574,7 @@ const MasterCompany = ({ params }) => {
imageFavIcon={imageFavIcon}
imageSlider={imageSlider}
imageLogin={imageLogin}
transaction={transaction}
lastIdCompany={lastIdCompany}
/>

24
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" }
{ "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++

67
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,
@ -69,21 +68,19 @@ class index extends Component {
<Tooltip title={this.props.t('menuRoles')}>
{
checkActMenup('/roles', 'update') ?
<i className="cil-menu fa-lg" style={{ color: 'green', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleMenuRoles(text.id)}></i>
<i className="cil-menu fa-lg" style={{ color: 'green', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleMenuRoles(text)}></i>
:
null
}
</Tooltip>
<Tooltip title={this.props.t('delete')}>
{
checkActMenup('/roles', 'delete') ?
<i className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleDelete(text.id)}></i>
<i className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleDelete(text)}></i>
:
null
}
</Tooltip>
<Tooltip title={this.props.t('edit')}>
{
checkActMenup('/roles', 'update') ?
@ -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" }
{ "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,23 +344,21 @@ 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);
}
})
});
const result = await axios
.post(ROLEMENU_ADD, dataArr, this.state.config)
.then((res) => res)
.catch((err) => err.response);
await Promise.all(promises);
if (result) {
if (result.length > 0) {
if (result[0].data.code === 200) {
if (result && result.data && result.data.code == 200) {
this.getDataRoles();
NotificationManager.success('Data roles berhasil ditambahkan!!', 'Success!!');
} else {
NotificationManager.error(`${result[0].data.message}`, 'Failed!!');
}
}
NotificationManager.error(`${result.data.message}`, 'Failed!!');
}
}
@ -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 (
<div>
<NotificationContainer />
@ -527,7 +505,6 @@ class index extends Component {
checkActMenup('/roles', 'create') ?
<Button Button id="TooltipTambah" color="success" onClick={() => this.handleOpenDialog('Save')}><i className="fa fa-plus"></i>
</Button>
:
null
}

4
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: {

3
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';

4
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
}
}}>
<Tooltip title="Gantt">

57
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
</div>
</Spin>
</ModalBody>
{/* <ModalFooter>
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Batal</Button>
</ModalFooter> */}
</Modal>
<NotificationContainer />
<SweetAlert
@ -335,6 +293,13 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
hierarchyId={parentId}
hierarchyName={parentName}
idTask={idTask}
role_id={role_id}
user_id={user_id}
token={token}
isLogin={isLogin}
companyName={companyName}
proyekName={proyekName}
companyId={companyId}
openDialogHierarchy={openDialog}
dataViewStartDate={dataViewStartDate}
/>

5
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}
/>
</>

22
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 (
<div>
{text.type_proyek_id !== 9 && loadVersionGantt && (
{text.join_second_is_multiLocation !== true && loadVersionGantt && (
<div className="menu-list">
<Skeleton active />
</div>
)}
{!loadVersionGantt && text.type_proyek_id !== 9 && (
{!loadVersionGantt && text.join_second_is_multiLocation !== true && (
<>
{dataVersionGantt.slice(0, 8).map((res) => (
<Link to={{
@ -1704,7 +1705,7 @@ const CreatedProyek = ({ params, ...props }) => {
user_id,
company_id: text.company_id,
dataViewStartDate,
configApp
companyName: (role_name === 'Super Admin' ? text.join_third_company_name : JSON.parse(configApp).company_name)
}
}}>
<div className="menu-list">
@ -1729,7 +1730,7 @@ const CreatedProyek = ({ params, ...props }) => {
)}
</>
)}
{text.type_proyek_id == 9 ? (
{text.join_second_is_multiLocation == true ? (
<div
className="menu-list"
onClick={() => 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 ? (
<Button size="small" type="link" style={{ color: "green" }}>
<i className="fa fa-bars"></i>
</Button>
@ -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}
/>
),

1
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',

6
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}
/>
)}
</div>

Loading…
Cancel
Save