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. 28
      src/views/Master/MasterRoles/DialogMenuRoles.js
  5. 121
      src/views/Master/MasterRoles/index.js
  6. 4
      src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js
  7. 5
      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 DashboardProject = React.lazy(() => import('./views/DashboardProject'));
const DashboardBOD = React.lazy(() => import('./views/Dashboard/DashboardBOD')); const DashboardBOD = React.lazy(() => import('./views/Dashboard/DashboardBOD'));
const DashboardDyna = React.lazy(() => import('./views/Dashboard/DashboardDyna')); 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 DashboardCustomer = React.lazy(() => import('./views/Dashboard/DashboardCustomer'));
const DashboardProject = React.lazy(() => import('./views/Dashboard/DashboardProject')); const DashboardProject = React.lazy(() => import('./views/Dashboard/DashboardProject'));
const DashboardProjectCarousell = React.lazy(() => import('./views/Dashboard/DashboardProjectCarousell')); const DashboardProjectCarousell = React.lazy(() => import('./views/Dashboard/DashboardProjectCarousell'));
@ -68,7 +67,6 @@ const routes = [
{ path: '/', exact: true, name: 'Home' }, { path: '/', exact: true, name: 'Home' },
{ path: '/dashboard', name: 'DashboardBOD', component: DashboardBOD }, { path: '/dashboard', name: 'DashboardBOD', component: DashboardBOD },
{ path: '/dashboard-dyna', name: 'DashboardBOD', component: DashboardDyna }, { 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-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-project/:PROJECT_ID/:GANTT_ID/:Header', exact: true, name: 'Dashboard Project', component: DashboardProject },
{ path: '/dashboard-perproject', exact: true, name: 'Dashboard Project Carousell', component: DashboardProjectCarousell }, { 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` "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 { Option } = Select
const { t } = useTranslation() const { t } = useTranslation()
const [registrationnumber, setRegistrationNumber] = useState('') const [registrationnumber, setRegistrationNumber] = useState('')
@ -44,6 +44,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
const [baseUrl, setBaseUrl] = useState([]) const [baseUrl, setBaseUrl] = useState([])
const [statusCompany, setStatusCompany] = useState(true) const [statusCompany, setStatusCompany] = useState(true)
const [template, setTemplate] = useState('') const [template, setTemplate] = useState('')
const [typePaket, setTypePaket] = useState('')
const [lastIdxURL, setLastIdxURL] = useState(0); const [lastIdxURL, setLastIdxURL] = useState(0);
const [availableUrl, setAvailableBaseUrl] = useState(false); const [availableUrl, setAvailableBaseUrl] = useState(false);
const [id, setId] = useState(0) const [id, setId] = useState(0)
@ -96,6 +97,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
setHtmlTitle(dataEditCompany.html_title) setHtmlTitle(dataEditCompany.html_title)
setStatusCompany(dataEditCompany.is_active) setStatusCompany(dataEditCompany.is_active)
setTemplate(dataEditCompany.template_id) setTemplate(dataEditCompany.template_id)
setTypePaket(transaction ? transaction?.type_paket : '')
setBaseUrl(dataEditCompany.base_url ? dataEditCompany.base_url : []) setBaseUrl(dataEditCompany.base_url ? dataEditCompany.base_url : [])
if (dataEditCompany.base_url) { if (dataEditCompany.base_url) {
setAvailableBaseUrl(true) setAvailableBaseUrl(true)
@ -114,6 +116,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
setHtmlTitle('') setHtmlTitle('')
setStatusCompany('') setStatusCompany('')
setTemplate('') setTemplate('')
setTypePaket('')
setLogoLogin(null) setLogoLogin(null)
setLogoHeader(null) setLogoHeader(null)
setSliderLogin(null) setSliderLogin(null)
@ -377,6 +380,26 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
alert("Please input the name"); alert("Please input the name");
return; 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") { if (typeDialog === "Save") {
data = { data = {
@ -394,6 +417,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
is_active: statusCompany, is_active: statusCompany,
template_id: parseInt(template), template_id: parseInt(template),
type_account: typeAccount, type_account: typeAccount,
type_paket: typePaket,
date_register: moment() date_register: moment()
} }
data.imageLogin = logoLogin ? logoLogin : null; data.imageLogin = logoLogin ? logoLogin : null;
@ -419,6 +443,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
is_active: statusCompany, is_active: statusCompany,
template_id: parseInt(template), template_id: parseInt(template),
type_account: typeAccount, type_account: typeAccount,
type_paket: typePaket
} }
data.imageLogin = logoLogin ? logoLogin : null; data.imageLogin = logoLogin ? logoLogin : null;
data.imageHeader = logoHeader ? logoHeader : null; data.imageHeader = logoHeader ? logoHeader : null;
@ -723,6 +748,15 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, company
</Select> </Select>
</FormGroup> </FormGroup>
</Col> </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>
<Row> <Row>
<Col md={6}> <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 { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Table, Button, Tooltip, Spin } from 'antd'; import { Pagination, Table, Button, Tooltip, Spin } from 'antd';
import { 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'; } from '../../../const/ApiConst';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
@ -19,12 +20,8 @@ const config = {
}; };
const MasterCompany = ({ params }) => { const MasterCompany = ({ params }) => {
const token = localStorage.getItem("token") 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 HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -54,13 +51,11 @@ const MasterCompany = ({ params }) => {
const [imageSlider, setProjectImageSlider] = useState([]); const [imageSlider, setProjectImageSlider] = useState([]);
const [imageFavIcon, setProjectImageFavicon] = useState(null); const [imageFavIcon, setProjectImageFavicon] = useState(null);
const [lastIdCompany,setLastCompanyId] = useState(''); const [lastIdCompany,setLastCompanyId] = useState('');
const [transaction, setTransaction] = useState([]);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const pageName = params.name; const pageName = params.name;
const { t } = useTranslation(); const { t } = useTranslation();
let configApp = '';
if (role !== 'Super Admin') {
configApp = JSON.parse(window.localStorage.getItem('configApp'));
}
useEffect(() => { useEffect(() => {
setLoading(true) setLoading(true)
getDataCompany() 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 handleSearch = e => {
const value = e.target.value const value = e.target.value
setSearch(value); setSearch(value);
@ -201,11 +223,13 @@ const MasterCompany = ({ params }) => {
const handleOpenDialog = async (type) => { const handleOpenDialog = async (type) => {
await setTypeDialog(type) await setTypeDialog(type)
setOpenDialog(true) setOpenDialog(true)
} }
const handleEdit = async (data) => { const handleEdit = async (data) => {
setDataEdit(data); setDataEdit(data);
setCompanyID(data.id);
getDataTransaction(data.id);
setCompanyName(data.company_name);
await getProjectImageHeader(data.id); await getProjectImageHeader(data.id);
await getProjectImageSlider(data.id); await getProjectImageSlider(data.id);
await getProjectImageLogin(data.id); await getProjectImageLogin(data.id);
@ -228,9 +252,11 @@ const MasterCompany = ({ params }) => {
} }
const handleDelete = async (id) => { const handleDelete = async (data) => {
await setAlertDelete(true) setCompanyID(data.id);
await setIdDelete(id) setCompanyName(data.company_name);
await setAlertDelete(true);
await setIdDelete(data.id);
} }
const handleCloseDialog = (type, data) => { const handleCloseDialog = (type, data) => {
@ -247,7 +273,7 @@ const MasterCompany = ({ params }) => {
setOpenDialog(false) setOpenDialog(false)
} }
const packFiles = (id, files) => { const packFiles = (id, files, company_name) => {
const data = new FormData(); const data = new FormData();
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
@ -256,11 +282,10 @@ const MasterCompany = ({ params }) => {
data.append('ref_id', id); data.append('ref_id', id);
data.append('category', 'company_slider_login'); data.append('category', 'company_slider_login');
data.append('company_name', company_name)
return data; return data;
}; };
const saveCompany = async (data) => { const saveCompany = async (data) => {
const formData = data const formData = data
const result = await axios.post(COMPANY_MANAGEMENT_ADD, formData, HEADER) const result = await axios.post(COMPANY_MANAGEMENT_ADD, formData, HEADER)
@ -272,26 +297,31 @@ const MasterCompany = ({ params }) => {
const logoLogin = data.imageLogin; const logoLogin = data.imageLogin;
const favIcon = data.imageFavicon; const favIcon = data.imageFavicon;
const slider = data.imageSlider; const slider = data.imageSlider;
const resultData = result.data.data;
setCompanyName(resultData.company_name);
if (logoHeader) { if (logoHeader) {
await saveImageHeader( await saveImageHeader(
result.data.data.id, resultData.id,
logoHeader logoHeader,
resultData.company_name
); );
} }
if (logoLogin) { if (logoLogin) {
await saveImageLogin( await saveImageLogin(
result.data.data.id, resultData.id,
logoLogin logoLogin,
resultData.company_name
); );
} }
if (favIcon) { if (favIcon) {
await saveFavIcon( await saveFavIcon(
result.data.data.id, resultData.id,
favIcon favIcon,
resultData.company_name
); );
} }
if(slider) { if(slider) {
const dataPack = packFiles(result.data.data.id,slider) const dataPack = packFiles(resultData.id, slider, resultData.company_name)
await saveSliderLogin(dataPack) await saveSliderLogin(dataPack)
} }
getDataCompany(); getDataCompany();
@ -304,7 +334,6 @@ const MasterCompany = ({ params }) => {
} }
const editCompany = async (data) => { const editCompany = async (data) => {
let urlEdit = COMPANY_MANAGEMENT_EDIT(data.id) let urlEdit = COMPANY_MANAGEMENT_EDIT(data.id)
const logoHeader = data.imageHeader; const logoHeader = data.imageHeader;
const logoLogin = data.imageLogin; const logoLogin = data.imageLogin;
@ -321,7 +350,8 @@ const MasterCompany = ({ params }) => {
); );
await saveImageHeader( await saveImageHeader(
data.id, data.id,
logoHeader logoHeader,
companyName
); );
} }
if (logoLogin) { if (logoLogin) {
@ -330,7 +360,8 @@ const MasterCompany = ({ params }) => {
); );
await saveImageLogin( await saveImageLogin(
data.id, data.id,
logoLogin logoLogin,
companyName
); );
} }
if (favIcon) { if (favIcon) {
@ -339,14 +370,15 @@ const MasterCompany = ({ params }) => {
); );
await saveFavIcon( await saveFavIcon(
data.id, data.id,
favIcon favIcon,
companyName
); );
} }
if(slider) { if(slider) {
await deleteImageSlider( await deleteImageSlider(
data.id data.id
); );
const dataPack = packFiles(data.id,slider) const dataPack = packFiles(data.id, slider, companyName)
await saveSliderLogin(dataPack) await saveSliderLogin(dataPack)
} }
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
@ -359,14 +391,12 @@ const MasterCompany = ({ params }) => {
} }
} }
// Save Image Function // Save Image Function
const saveImageHeader = async (id, data) => { const saveImageHeader = async (id, data, company_name) => {
const formData = new FormData; const formData = new FormData;
formData.append('ref_id', id); formData.append('ref_id', id);
formData.append('category', 'company_logo_header'); formData.append('category', 'company_logo_header');
formData.append('files', data); formData.append('files', data);
if(role != 'Super Admin') { formData.append('company_name', company_name);
formData.append('company_name',configApp.company_name);
}
await axios await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) .post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@ -375,14 +405,12 @@ const MasterCompany = ({ params }) => {
return "berhasil"; return "berhasil";
}; };
const saveImageLogin = async (id, data) => { const saveImageLogin = async (id, data, company_name) => {
const formData = new FormData; const formData = new FormData;
formData.append('ref_id', id); formData.append('ref_id', id);
formData.append('category', 'company_logo_login'); formData.append('category', 'company_logo_login');
formData.append('files', data); formData.append('files', data);
if(role != 'Super Admin') { formData.append('company_name', company_name);
formData.append('company_name',configApp.company_name);
}
await axios await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) .post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@ -391,14 +419,12 @@ const MasterCompany = ({ params }) => {
return "berhasil"; return "berhasil";
}; };
const saveFavIcon = async (id, data) => { const saveFavIcon = async (id, data, company_name) => {
const formData = new FormData; const formData = new FormData;
formData.append('ref_id', id); formData.append('ref_id', id);
formData.append('category', 'company_favicon'); formData.append('category', 'company_favicon');
formData.append('files', data); formData.append('files', data);
if(role != 'Super Admin') { formData.append('company_name', company_name);
formData.append('company_name',configApp.company_name);
}
await axios await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) .post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@ -408,7 +434,6 @@ const MasterCompany = ({ params }) => {
}; };
const saveSliderLogin = async (data) => { const saveSliderLogin = async (data) => {
data.company_name = configApp.company_name;
await axios await axios
.post(IMAGE_MULTIPLE_UPLOAD, data, HEADER_MULTIPART) .post(IMAGE_MULTIPLE_UPLOAD, data, HEADER_MULTIPART)
.then(res => res) .then(res => res)
@ -418,7 +443,7 @@ const MasterCompany = ({ params }) => {
// Delete Image Function // Delete Image Function
const deleteImageHeader = async (id) => { 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 await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -427,7 +452,7 @@ const MasterCompany = ({ params }) => {
}; };
const deleteImageLogin = async (id) => { 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 await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -436,7 +461,7 @@ const MasterCompany = ({ params }) => {
}; };
const deleteImageFavicon = async (id) => { 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 await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -445,7 +470,7 @@ const MasterCompany = ({ params }) => {
}; };
const deleteImageSlider = async (id) => { 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 await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -458,18 +483,13 @@ const MasterCompany = ({ params }) => {
} }
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let url = COMPANY_MANAGEMENT_DELETE(idDelete); const url = COMPANY_MANAGEMENT_DELETE(idDelete);
const result = await axios.delete(url, config) const result = await axios.delete(url, config)
.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) {
getDataCompany() getDataCompany()
deleteImageHeader(idDelete)
deleteImageLogin(idDelete)
deleteImageFavicon(idDelete)
deleteImageSlider(idDelete)
setIdDelete(0) setIdDelete(0)
setAlertDelete(false) setAlertDelete(false)
setLoading(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> <Button size="small" type="link" style={{ color: 'green' }} onClick={() => handleEdit(text)}><i className="fa fa-edit"></i></Button>
</Tooltip> </Tooltip>
<Tooltip title={t('delete')}> <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>
<Tooltip title="Set User"> <Tooltip title="Set User">
<Button size="small" type="link" style={{ color: 'primary' }} onClick={() => handleSetWorker(text)}><i className="fa fa-users"></i></Button> <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} imageFavIcon={imageFavIcon}
imageSlider={imageSlider} imageSlider={imageSlider}
imageLogin={imageLogin} imageLogin={imageLogin}
transaction={transaction}
lastIdCompany={lastIdCompany} lastIdCompany={lastIdCompany}
/> />

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

@ -1,6 +1,6 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter, Row, Col, Table } from 'reactstrap'; import { Modal, ModalHeader, ModalBody, ModalFooter, Table } from 'reactstrap';
import { Button, Form, FormGroup, Label, Input } from 'reactstrap'; import { Button, Form } from 'reactstrap';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import axios from 'axios'; import axios from 'axios';
import { MENU_COMPANY_SEARCH } from '../../../const/ApiConst.js'; import { MENU_COMPANY_SEARCH } from '../../../const/ApiConst.js';
@ -34,13 +34,11 @@ export default class DialogMenuRoles extends Component {
stateUpdateAll: false, stateUpdateAll: false,
stateDeleteAll: false, stateDeleteAll: false,
allChecked: true, allChecked: true,
company_id: props.company_id || null,
} }
} }
async componentDidMount() { async componentDidMount() {
this.props.showDialog(this.showDialog); this.props.showDialog(this.showDialog);
this.getAllMenu();
} }
async componentDidUpdate(prevProps, prevState) { async componentDidUpdate(prevProps, prevState) {
@ -51,10 +49,8 @@ export default class DialogMenuRoles extends Component {
this.setStateUpdate(true); this.setStateUpdate(true);
this.setStateCreate(true); this.setStateCreate(true);
this.setStateDelete(true); this.setStateDelete(true);
this.getAllMenu();
this.setState({ isParentClick: false, id: idRoles }); 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 } "orders": { "columns": ["id"], "ascending": false }
} }
if (this.state.role_name !== "Super Admin") { payload.columns.push(
payload.columns.push( { "name": "company_id", "logic_operator": "=", "value": this.props.company_id, "operator": "AND" }
{ "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)
@ -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 => { setStateCreate = edit => {
const stateCreate = []; const stateCreate = [];
this.state.menu.map((val) => { this.state.menu.map((val) => {
@ -484,7 +470,7 @@ export default class DialogMenuRoles extends Component {
}; };
const renderMenu = (parentId, depth = 0) => { const renderMenu = (parentId, depth = 0) => {
const children = getChildren(parentId); const children = getChildren(parentId);
return children.map((menuItem, index) => { return children.map((menuItem) => {
const currentIndex = menuIdx; const currentIndex = menuIdx;
menuIdxList[currentIndex] = menuItem.menu_id; menuIdxList[currentIndex] = menuItem.menu_id;
menuIdx++ menuIdx++

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

@ -43,7 +43,6 @@ class index extends Component {
tooltipTambah: false, tooltipTambah: false,
totalPage: 0, totalPage: 0,
typeDialog: 'Save', typeDialog: 'Save',
company_id: props.company_id || 0,
role_name: props.role_name || '', role_name: props.role_name || '',
role_id: props.role_id || 0, role_id: props.role_id || 0,
user_id: props.user_id || 0, user_id: props.user_id || 0,
@ -68,29 +67,27 @@ class index extends Component {
render: (text, record) => <> render: (text, record) => <>
<Tooltip title={this.props.t('menuRoles')}> <Tooltip title={this.props.t('menuRoles')}>
{ {
checkActMenup('/roles', 'update') ? 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 null
} }
</Tooltip> </Tooltip>
<Tooltip title={this.props.t('delete')}> <Tooltip title={this.props.t('delete')}>
{ {
checkActMenup('/roles', '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 null
} }
</Tooltip> </Tooltip>
<Tooltip title={this.props.t('edit')}> <Tooltip title={this.props.t('edit')}>
{ {
checkActMenup('/roles', 'update') ? checkActMenup('/roles', 'update') ?
<i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => this.handleEdit(text)}></i> <i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => this.handleEdit(text)}></i>
: :
null null
} }
</Tooltip> </Tooltip>
</>, </>,
}, },
@ -133,7 +130,6 @@ class index extends Component {
if (this.state.currentPage !== 1 && this.state.currentPage > 1) { if (this.state.currentPage !== 1 && this.state.currentPage > 1) {
start = (this.state.currentPage * this.state.rowsPerPage) - this.state.rowsPerPage start = (this.state.currentPage * this.state.rowsPerPage) - this.state.rowsPerPage
} }
const formData = { const formData = {
"paging": { "start": start, "length": this.state.rowsPerPage }, "paging": { "start": start, "length": this.state.rowsPerPage },
"columns": [], "columns": [],
@ -153,12 +149,9 @@ class index extends Component {
} }
if (this.state.role_name !== "Super Admin") { if (this.state.role_name !== "Super Admin") {
formData.columns.push( 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 { } else {
// formData.columns.push(
// { "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"] }
) )
@ -228,7 +221,6 @@ class index extends Component {
} }
saveRole = async (data) => { saveRole = async (data) => {
const formData = { const formData = {
name: data.name, name: data.name,
description: data.description, description: data.description,
@ -247,7 +239,6 @@ class index extends Component {
} else { } else {
NotificationManager.error(`Data role gagal ditambahkan`, 'Failed!!'); NotificationManager.error(`Data role gagal ditambahkan`, 'Failed!!');
} }
} }
editRole = async (data) => { editRole = async (data) => {
@ -272,13 +263,13 @@ class index extends Component {
} }
handleEdit = (data) => { handleEdit = (data) => {
this.setState({ dataEdit: data }); this.setState({ dataEdit: data, company_id: data.company_id });
this.handleOpenDialog('Edit'); this.handleOpenDialog('Edit');
} }
handleDelete = (id) => { handleDelete = (data) => {
id == '1' ? this.setState({ alertNotDelete: true }) : data.id == '1' ? this.setState({ alertNotDelete: true }) :
this.setState({ alertDelete: true, idDelete: id }); this.setState({ alertDelete: true, idDelete: data.id });
} }
onShowSizeChange = (current, pageSize) => { onShowSizeChange = (current, pageSize) => {
@ -317,29 +308,24 @@ class index extends Component {
} }
} }
handleMenuRoles = async (id) => { handleMenuRoles = async (data) => {
const formData = { const formData = {
"paging": { "start": 0, "length": -1 }, "paging": { "start": 0, "length": -1 },
"columns": [], "columns": [],
"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 }
} }
formData.columns.push(
if (this.state.role_name !== "Super Admin") { { "name": "role_id", "logic_operator": "=", "value": parseInt(data.id), "operator": "AND" }
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)
.catch((error) => error.response); .catch((error) => error.response);
if (result && result.data && result.data.code == 200) { 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(); this.handleOpenDialogMr();
}); });
} else {
} }
} }
@ -348,8 +334,7 @@ class index extends Component {
if (payloadArray.length > 0) { if (payloadArray.length > 0) {
await this.deleteCurrentRoleMenu(payloadArray[0].roles_id) await this.deleteCurrentRoleMenu(payloadArray[0].roles_id)
} }
let promises = [] let dataArr = []
let result = []
dataArray.map((val, index) => { dataArray.map((val, index) => {
if (val.read === true) { if (val.read === true) {
const formData = { const formData = {
@ -359,24 +344,22 @@ class index extends Component {
read: val.read, read: val.read,
update: val.update, update: val.update,
delete: val.delete delete: val.delete
} }
promises.push(axios.post(ROLEMENU_ADD, formData, this.state.config) dataArr.push(formData);
.then(res => result.push(res)))
} }
}) });
await Promise.all(promises); const result = await axios
if (result) { .post(ROLEMENU_ADD, dataArr, this.state.config)
if (result.length > 0) { .then((res) => res)
if (result[0].data.code === 200) { .catch((err) => err.response);
this.getDataRoles();
NotificationManager.success('Data roles berhasil ditambahkan!!', 'Success!!'); if (result && result.data && result.data.code == 200) {
} else { this.getDataRoles();
NotificationManager.error(`${result[0].data.message}`, 'Failed!!'); NotificationManager.success('Data roles berhasil ditambahkan!!', 'Success!!');
} } else {
} NotificationManager.error(`${result.data.message}`, 'Failed!!');
} }
} }
deleteCurrentRoleMenu = async (id) => { deleteCurrentRoleMenu = async (id) => {
@ -413,12 +396,9 @@ class index extends Component {
if (this.state.role_name !== "Super Admin") { if (this.state.role_name !== "Super Admin") {
formData.columns.push( 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 { } else {
// formData.columns.push(
// { "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"] }
) )
@ -462,9 +442,7 @@ class index extends Component {
} }
render() { render() {
const { t } = this.props; const { dialogMenuForm, dataTable, openDialog, currentPage, rowsPerPage, totalPage, search } = this.state
const { tooltipTambah, tooltipExport, dialogMenuForm, dataTable, openDialog, currentPage, rowsPerPage, totalPage, search, tooltipEdit, tooltipDelete, tooltipMenu } = this.state
let noSeq = 0;
return ( return (
<div> <div>
<NotificationContainer /> <NotificationContainer />
@ -524,16 +502,15 @@ class index extends Component {
<Col> <Col>
<Tooltip title={this.props.t('rolesAdd')}> <Tooltip title={this.props.t('rolesAdd')}>
{ {
checkActMenup('/roles', 'create') ? checkActMenup('/roles', 'create') ?
<Button Button id="TooltipTambah" color="success" onClick={() => this.handleOpenDialog('Save')}><i className="fa fa-plus"></i> <Button Button id="TooltipTambah" color="success" onClick={() => this.handleOpenDialog('Save')}><i className="fa fa-plus"></i>
</Button> </Button>
:
: null
null }
}
</Tooltip> </Tooltip>
<Tooltip title={this.props.t('exportExcel')}> <Tooltip title={this.props.t('exportExcel')}>
<Button style={{ marginLeft: "5px" }} id="TooltipExport" color="primary" onClick={() => this.handleExportExcel()}><i className="fa fa-print"></i></Button> <Button style={{ marginLeft: "5px" }} id="TooltipExport" color="primary" onClick={() => this.handleExportExcel()}><i className="fa fa-print"></i></Button>
</Tooltip> </Tooltip>
</Col> </Col>
</Row> </Row>

4
src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js

@ -15,9 +15,9 @@ const DialogFormAnalysis = ({
closeDialog, closeDialog,
toggleDialog, toggleDialog,
dataDetail, dataDetail,
typeDialogName typeDialogName,
token
}) => { }) => {
const token = localStorage.getItem("token");
const [dataTable, setDatatable] = useState([]); const [dataTable, setDatatable] = useState([]);
const HEADER = { const HEADER = {
headers: { headers: {

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

@ -3,9 +3,6 @@ import {
Modal, ModalHeader, ModalBody, ModalFooter, Modal, ModalHeader, ModalBody, ModalFooter,
Button, Form, FormGroup, Label, Input, Col, Row Button, Form, FormGroup, Label, Input, Col, Row
} from 'reactstrap'; } from 'reactstrap';
import { DatePicker, Tooltip, Select } from 'antd';
import { formatRupiah, formatNumber } from '../../../const/CustomFunc'
import moment from 'moment';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@ -114,4 +111,4 @@ const DialogFormHierarchy = ({ openDialog, closeDialog, toggleDialog, typeDialog
</> </>
) )
} }
export default DialogFormHierarchy; export default DialogFormHierarchy;

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

@ -13,7 +13,7 @@ import DialogUserGantt from './DialogUserGantt';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
const { Option } = Select 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 = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -134,7 +134,7 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
user_id, user_id,
company_id: companyId, company_id: companyId,
dataViewStartDate, dataViewStartDate,
configApp: configApp companyName
} }
}}> }}>
<Tooltip title="Gantt"> <Tooltip title="Gantt">

57
src/views/SimproV2/CreatedProyek/DialogHierarchy.js

@ -1,7 +1,7 @@
import React, { useEffect, useState, useMemo } from 'react' import React, { useEffect, useState, useMemo } from 'react'
import { Modal, ModalHeader, ModalBody, } from 'reactstrap'; import { Modal, ModalHeader, ModalBody, } from 'reactstrap';
import { Button } 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 'antd/dist/antd.css';
import moment from 'moment'; import moment from 'moment';
import SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
@ -14,8 +14,7 @@ import DialogFormGantt from './DialogFormGantt';
import DialogGantt from './DialogGantt'; import DialogGantt from './DialogGantt';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import _ from 'lodash'; import _ from 'lodash';
const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, dataViewStartDate }) => { const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, dataViewStartDate, token, role_id, user_id, companyName, companyId, isLogin }) => {
const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -26,7 +25,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [parentId, setParentId] = useState(0) const [parentId, setParentId] = useState(0)
const [parentName, setParentName] = useState(null) const [parentName, setParentName] = useState(null)
const [dataGantt, setDataGantt] = useState([])
const [typeDialog, setTypeDialog] = useState("add") const [typeDialog, setTypeDialog] = useState("add")
const [openDialogForm, setOpenDialogForm] = useState(false) const [openDialogForm, setOpenDialogForm] = useState(false)
const [openDialogGantt, setOpenDialogGantt] = useState(false) const [openDialogGantt, setOpenDialogGantt] = useState(false)
@ -36,7 +34,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
const [alertDelete, setAlertDelete] = useState(false) const [alertDelete, setAlertDelete] = useState(false)
const [idDelete, setIdDelete] = useState(0) const [idDelete, setIdDelete] = useState(0)
const [idGantt, setIdGantt] = useState(0) const [idGantt, setIdGantt] = useState(0)
const [humanResource, setHumanResource] = useState([])
const { t } = useTranslation(); const { t } = useTranslation();
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
useEffect(() => { useEffect(() => {
@ -44,40 +41,11 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
setLoading(true); setLoading(true);
getdataHierarchy(); getdataHierarchy();
} }
}, [idTask, openDialog, closeDialog, openDialogFormGantt]) }, [idTask, openDialog, openDialogFormGantt])
useEffect(() => { useEffect(() => {
if (!openDialog) {
setDataHierarchy([]); setDataHierarchy([]);
} else { }, [openDialog])
}
}, [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)
}
const handleAdd = async () => { const handleAdd = async () => {
await setTypeDialog("Save") await setTypeDialog("Save")
@ -137,8 +105,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
const closeDialogFromHierarchy = (type, data) => { const closeDialogFromHierarchy = (type, data) => {
if (type == 'save') { if (type == 'save') {
saveHierarchy(data) saveHierarchy(data)
} else {
updateHierarchy(data)
} }
setId(0); setId(0);
setOpenDialogForm(false); setOpenDialogForm(false);
@ -157,11 +123,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
} }
} }
const updateHierarchy = async (data) => {
}
const getdataHierarchy = async () => { const getdataHierarchy = async () => {
const url = HIERARCHY_FTTH_TREE(idTask) const url = HIERARCHY_FTTH_TREE(idTask)
const result = await axios const result = await axios
@ -311,9 +272,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
</div> </div>
</Spin> </Spin>
</ModalBody> </ModalBody>
{/* <ModalFooter>
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Batal</Button>
</ModalFooter> */}
</Modal> </Modal>
<NotificationContainer /> <NotificationContainer />
<SweetAlert <SweetAlert
@ -335,6 +293,13 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
hierarchyId={parentId} hierarchyId={parentId}
hierarchyName={parentName} hierarchyName={parentName}
idTask={idTask} idTask={idTask}
role_id={role_id}
user_id={user_id}
token={token}
isLogin={isLogin}
companyName={companyName}
proyekName={proyekName}
companyId={companyId}
openDialogHierarchy={openDialog} openDialogHierarchy={openDialog}
dataViewStartDate={dataViewStartDate} dataViewStartDate={dataViewStartDate}
/> />

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

@ -28,8 +28,8 @@ import DialogFormAnalysis from './DialogFormAnalysis';
import moment from "moment"; import moment from "moment";
const { Option } = Select const { Option } = Select
const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId, proyekName }) => { const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId, proyekName, token }) => {
const token = localStorage.getItem("token");
const [activeTab, setActiveTab] = useState('1'); const [activeTab, setActiveTab] = useState('1');
const [search, setSearch] = useState(''); const [search, setSearch] = useState('');
const [openDialogFormAnalysis, setOpenDialogFormAnalysis] = useState(false); const [openDialogFormAnalysis, setOpenDialogFormAnalysis] = useState(false);
@ -668,6 +668,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId, proy
toggleDialog={toggleDialogForm} toggleDialog={toggleDialogForm}
closeDialog={closeDialogForm} closeDialog={closeDialogForm}
dataDetail={dataDetail} dataDetail={dataDetail}
token={token}
typeDialogName={typeDialogName} typeDialogName={typeDialogName}
/> />
</> </>

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

@ -428,7 +428,7 @@ const CreatedProyek = ({ params, ...props }) => {
{ {
name: "m_type_proyek", name: "m_type_proyek",
column_join: "type_proyek_id", column_join: "type_proyek_id",
column_results: ["name", "description"], column_results: ["name", "description", "is_multiLocation"],
} }
], ],
orders: { columns: ["nama"], ascending: true }, orders: { columns: ["nama"], ascending: true },
@ -583,6 +583,7 @@ const CreatedProyek = ({ params, ...props }) => {
setDataViewStartDate(data.mulai_proyek) setDataViewStartDate(data.mulai_proyek)
setidTask(data.id); setidTask(data.id);
setProyekName(data.nama); setProyekName(data.nama);
setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(configApp).company_name);
setCompanyId(data.company_id); setCompanyId(data.company_id);
setOpenDialogGantt(true); setOpenDialogGantt(true);
}; };
@ -1686,13 +1687,13 @@ const CreatedProyek = ({ params, ...props }) => {
const popupMenuGantt = (text, record) => { const popupMenuGantt = (text, record) => {
return ( return (
<div> <div>
{text.type_proyek_id !== 9 && loadVersionGantt && ( {text.join_second_is_multiLocation !== true && loadVersionGantt && (
<div className="menu-list"> <div className="menu-list">
<Skeleton active /> <Skeleton active />
</div> </div>
)} )}
{!loadVersionGantt && text.type_proyek_id !== 9 && ( {!loadVersionGantt && text.join_second_is_multiLocation !== true && (
<> <>
{dataVersionGantt.slice(0, 8).map((res) => ( {dataVersionGantt.slice(0, 8).map((res) => (
<Link to={{ <Link to={{
@ -1704,7 +1705,7 @@ const CreatedProyek = ({ params, ...props }) => {
user_id, user_id,
company_id: text.company_id, company_id: text.company_id,
dataViewStartDate, dataViewStartDate,
configApp companyName: (role_name === 'Super Admin' ? text.join_third_company_name : JSON.parse(configApp).company_name)
} }
}}> }}>
<div className="menu-list"> <div className="menu-list">
@ -1729,7 +1730,7 @@ const CreatedProyek = ({ params, ...props }) => {
)} )}
</> </>
)} )}
{text.type_proyek_id == 9 ? ( {text.join_second_is_multiLocation == true ? (
<div <div
className="menu-list" className="menu-list"
onClick={() => handleOpenDialogHierarchy(text)} onClick={() => handleOpenDialogHierarchy(text)}
@ -1799,7 +1800,7 @@ const CreatedProyek = ({ params, ...props }) => {
content={popupMenuGantt(text, record)} content={popupMenuGantt(text, record)}
trigger="click" trigger="click"
> >
{text.type_proyek_id == 9 ? ( {text.join_second_is_multiLocation == true ? (
<Button size="small" type="link" style={{ color: "green" }}> <Button size="small" type="link" style={{ color: "green" }}>
<i className="fa fa-bars"></i> <i className="fa fa-bars"></i>
</Button> </Button>
@ -2103,6 +2104,7 @@ const CreatedProyek = ({ params, ...props }) => {
closeDialog={handleCloseReport} closeDialog={handleCloseReport}
toggleDialog={toggleAddDialogRA} toggleDialog={toggleAddDialogRA}
projectId={projectId} projectId={projectId}
token={token}
proyekName={proyekName} proyekName={proyekName}
/> />
), ),
@ -2119,7 +2121,7 @@ const CreatedProyek = ({ params, ...props }) => {
user_id={user_id} user_id={user_id}
token={token} token={token}
isLogin={isLogin} isLogin={isLogin}
configApp={configApp} companyName={companyName}
proyekName={proyekName} proyekName={proyekName}
companyId={companyId} companyId={companyId}
dataViewStartDate={dataViewStartDate} dataViewStartDate={dataViewStartDate}
@ -2135,7 +2137,13 @@ const CreatedProyek = ({ params, ...props }) => {
closeDialog={closeDialogHierarchy} closeDialog={closeDialogHierarchy}
toggleDialog={toggleDialogHierarchy} toggleDialog={toggleDialogHierarchy}
idTask={idTask} idTask={idTask}
role_id={role_id}
user_id={user_id}
token={token}
isLogin={isLogin}
companyName={companyName}
proyekName={proyekName} proyekName={proyekName}
companyId={companyId}
dataViewStartDate={dataViewStartDate} 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: 'Nama', dataIndex: 'name', key: 'name' },
{ title: 'Deskripsi', dataIndex: 'description', key: 'description' }, { title: 'Deskripsi', dataIndex: 'description', key: 'description' },
{ {
title: 'Color', title: 'Color',

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

@ -9,7 +9,7 @@ import GanttFrame from "./GanttFrame";
let roCount = 0; let roCount = 0;
const Gantt = (props) => { 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) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
@ -21,7 +21,7 @@ const Gantt = (props) => {
isLogin = props.isLogin; isLogin = props.isLogin;
hierarchy = props.hierarchy; hierarchy = props.hierarchy;
user_name = props.user_name; user_name = props.user_name;
configApp = props.configApp; companyName = props.companyName;
} }
const HEADER = { const HEADER = {
headers: { headers: {
@ -112,7 +112,7 @@ const Gantt = (props) => {
role_name={role_name} role_name={role_name}
companyId={companyId} companyId={companyId}
timestamp={timestamp} timestamp={timestamp}
company_name={JSON.parse(configApp).company_name} company_name={companyName}
/> />
)} )}
</div> </div>

Loading…
Cancel
Save