Browse Source

conflict

pull/2/head
ibnu 1 year ago
parent
commit
3e9edf34a2
  1. 7
      .env
  2. 1150
      src/const/ApiConst.js
  3. 2491
      src/views/Dashboard/DashboardProject.js
  4. 34
      src/views/Master/MasterBroadcast/DialogDetail.js
  5. 20
      src/views/Master/MasterBroadcast/DialogForm.js
  6. 8
      src/views/Master/MasterBroadcast/index.js
  7. 478
      src/views/SimproV2/CreatedProyek/DataRequestMaterial.js
  8. 3139
      src/views/SimproV2/CreatedProyek/index.js
  9. 217
      src/views/SimproV2/Gantt/index.js

7
.env

@ -1,3 +1,4 @@
PORT=3000 PORT=3000
CHOKIDAR_USEPOLLING=true CHOKIDAR_USEPOLLING=true
GENERATE_SOURCEMAP=false GENERATE_SOURCEMAP=false
SKIP_PREFLIGHT_CHECK=true

1150
src/const/ApiConst.js

File diff suppressed because it is too large Load Diff

2491
src/views/Dashboard/DashboardProject.js

File diff suppressed because it is too large Load Diff

34
src/views/Master/MasterBroadcast/DialogDetail.js

@ -4,10 +4,17 @@ import moment from 'moment';
import { Button, Table, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; import { Button, Table, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
import Select from 'react-select'; import Select from 'react-select';
import axios from 'axios'; import axios from 'axios';
import { BASE_URL_GEOHR_API } from '../../../const/ApiConst'; import { BASE_SIMPRO_LUMEN, BASE_URL_GEOHR_API } from '../../../const/ApiConst';
import { Transfer } from 'antd'; import { Transfer } from 'antd';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
const token = window.localStorage.getItem('token');
const config = {
headers:
{
Authorization: `Bearer ${token}`,
"Content-type": `application/json`
}
};
const ERROR_TITLE = "judul is required!" const ERROR_TITLE = "judul is required!"
const ERROR_MESSAGE = "message is required!" const ERROR_MESSAGE = "message is required!"
const BASE_URL = "https://oslog.id/geohr-api/"; const BASE_URL = "https://oslog.id/geohr-api/";
@ -42,26 +49,23 @@ class DialogDetail extends Component {
getDataDetail = async () => { getDataDetail = async () => {
countError++; countError++;
let url = BASE_URL_GEOHR_API + `/broadcast-detail/search?broadcastId=${this.state.id}`; let url = BASE_SIMPRO_LUMEN + `/broadcast/search`;
const payload = { const payload = {
"paging": { "start": 0, "length": 25 }, "paging": { "start": 0, "length": 25 },
"orders": { "columns": ["id"], "ascending": true }, "orders": { "columns": ["id"], "ascending": true },
"columns": [ "columns": [
{ "name": "status_send", "logic_operator": "ilike", "value": "", "operator": "AND" } { "name": "id", "logic_operator": "=", "value": this.state.id, "operator": "AND" }
],
"joins": [
{ "name": "m_broadcast", "column_results": ["title_notif", "message_notif", "description", "status_send"], "column_join": "broadcast_id" }
] ]
} }
const result = await axios const result = await axios
.post(url, payload) .post(url, payload, config)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
console.log('cek data detail', result.data) console.log('cek data detail', result.data)
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
if (result.data.data && result.data.data.broadcast_details) { if (result.data.data && result.data.data) {
this.setState({ dataListDetail: result.data.data.broadcast_details }) this.setState({ dataListDetail: result.data.data })
} }
} else { } else {
if (countError < 6) { if (countError < 6) {
@ -97,11 +101,11 @@ class DialogDetail extends Component {
{this.state.dataListDetail.map((val, index) => { {this.state.dataListDetail.map((val, index) => {
return ( return (
<tr key={index}> <tr key={index}>
<td>{val.join.status_send === "" ? "-" : val.status_send}</td> <td>{val.status_send === "" ? "-" : val.status_send}</td>
<td>{val.join.created_date === "" ? "-" : moment(val.created_date).format("YYYY-MM-DD HH:mm:ss")}</td> <td>{val.created_at === "" ? "-" : moment(val.created_date).format("DD-MM-YYYY HH:mm:ss")}</td>
<td>{val.join.broadcast_description === "" ? "-" : val.join.broadcast_description}</td> <td>{val.description === "" ? "-" : val.description}</td>
<td>{val.join.broadcast_title_notif === "" ? "-" : val.join.broadcast_title_notif}</td> <td>{val.title_notif === "" ? "-" : val.title_notif}</td>
<td>{val.join.broadcast_message_notif === "" ? "-" : val.join.broadcast_message_notif}</td> <td>{val.message_notif === "" ? "-" : val.message_notif}</td>
</tr> </tr>
) )
})} })}

20
src/views/Master/MasterBroadcast/DialogForm.js

@ -3,7 +3,7 @@ import React, { Component } from 'react';
import { Button, Form, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; import { Button, Form, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
import Select from 'react-select'; import Select from 'react-select';
import axios from 'axios'; import axios from 'axios';
import { BASE_URL_GEOHR_API2, ROLE_SEARCH, USER_WASPANG } from '../../../const/ApiConst'; import { BASE_URL_GEOHR_API2, ROLE_SEARCH, USER_WASPANG, USER_LIST } from '../../../const/ApiConst';
import { Transfer } from 'antd'; import { Transfer } from 'antd';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
@ -137,7 +137,7 @@ class DialogForm extends Component {
if (penerima === "all") { if (penerima === "all") {
idSend = this.state.allEmployeeId; idSend = this.state.allEmployeeId;
send_to_type = "all"; send_to_type = "all";
} else if (penerima === "division") { } else if (penerima === "organization") {
idSend = this.state.idOrganization; idSend = this.state.idOrganization;
send_to_type = "roles"; send_to_type = "roles";
} else if (penerima === "karyawan") { } else if (penerima === "karyawan") {
@ -145,9 +145,13 @@ class DialogForm extends Component {
send_to_type = "users"; send_to_type = "users";
} }
if(Array.isArray(idSend)){
idSend = idSend.map(function (e) { idSend = idSend.map(function (e) {
return e.toString() return e.toString()
}); });
} else {
idSend = idSend;
}
const data = { const data = {
title, title,
@ -186,7 +190,7 @@ class DialogForm extends Component {
} }
setEmployeeOrganization = () => { setEmployeeOrganization = () => {
let arrEd = this.state.dataEmployee; let arrEd = this.state.dataEmployee.data;
let cek = arrEd.filter(this.filterId) let cek = arrEd.filter(this.filterId)
this.setState({ idEmployeeDivision: cek }) this.setState({ idEmployeeDivision: cek })
@ -289,14 +293,14 @@ class DialogForm extends Component {
"ascending": false "ascending": false
} }
} }
//TODO should use search instead
const result = await axios const result = await axios
.post(USER_WASPANG, payload, config) .get(USER_LIST, config)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
console.log('test role', result) console.log('test role', result)
if (result && result.data && result.code == "200") { if (result && result.data && result.status == 200) {
this.setState({ dataEmployee: result.data }, () => { this.setState({ dataEmployee: result.data }, () => {
this.setDataEmployee(); this.setDataEmployee();
}); });
@ -307,12 +311,12 @@ class DialogForm extends Component {
setDataEmployee = () => { setDataEmployee = () => {
const listEmployee = []; const listEmployee = [];
const allIdEmployee = []; const allIdEmployee = [];
this.state.dataEmployee.map((val, index) => { this.state.dataEmployee.data.map((val, index) => {
allIdEmployee.push(val.id); allIdEmployee.push(val.id);
listEmployee.push({ listEmployee.push({
key: val.id, key: val.id,
id: val.id, id: val.id,
title: val.join.m_users_name title: val.name
}); });
}) })

8
src/views/Master/MasterBroadcast/index.js

@ -5,7 +5,7 @@ import React, { Component } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
import axios from 'axios'; import axios from 'axios';
import moment from 'moment'; import moment from 'moment';
import { API_BROADCAST_SIMPRO, BASE_SIMPRO, BASE_URL_GEOHR_API2 } from '../../../const/ApiConst'; import { API_BROADCAST_SIMPRO, BASE_SIMPRO, BASE_SIMPRO_LUMEN, BASE_URL_GEOHR_API2 } from '../../../const/ApiConst';
import { Button, Card, CardBody, CardHeader, DropdownItem, DropdownMenu, DropdownToggle, Input, InputGroup, InputGroupButtonDropdown, Table, Row, Col } from 'reactstrap'; import { Button, Card, CardBody, CardHeader, DropdownItem, DropdownMenu, DropdownToggle, Input, InputGroup, InputGroupButtonDropdown, Table, Row, Col } from 'reactstrap';
import { DatePicker, Pagination } from 'antd'; import { DatePicker, Pagination } from 'antd';
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
@ -85,7 +85,7 @@ class index extends Component {
}; };
getDataBroadcast = async () => { getDataBroadcast = async () => {
let url = BASE_SIMPRO + `/broadcast/search`; let url = BASE_SIMPRO_LUMEN + `/broadcast/search`;
const { searchDetail } = this.state const { searchDetail } = this.state
let start = 0; let start = 0;
@ -180,7 +180,7 @@ class index extends Component {
} }
saveBroadcast = async (type, data) => { saveBroadcast = async (type, data) => {
let url = BASE_SIMPRO + `/broadcast/add`; let url = BASE_SIMPRO_LUMEN + `/broadcast/add`;
const param = { const param = {
"title_notif": data.title, "title_notif": data.title,
@ -205,7 +205,7 @@ class index extends Component {
"send_to_type": "users", "send_to_type": "users",
"message_notif": data.message, "message_notif": data.message,
"description": data.description, "description": data.description,
"send_to_id": data.id.map((id, index) => id) "send_to_id": data.send_to_type == "users" ? data.id.map((id, index) => id) : null
} }
if (data.send_to_type === "all") { if (data.send_to_type === "all") {

478
src/views/SimproV2/CreatedProyek/DataRequestMaterial.js

@ -1,239 +1,239 @@
import React, { useEffect, useState, useMemo } from 'react' import React, { useEffect, useState, useMemo } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button } from 'reactstrap'; import { Button } from 'reactstrap';
import { Table, Tooltip } from 'antd'; import { Table, Tooltip } 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';
import { REQUEST_MATERIAL_SEARCH, REQUEST_MATERIAL_ADD, REQUEST_MATERIAL_DELETE, REQUEST_MATERIAL_EDIT } from '../../../const/ApiConst'; import { REQUEST_MATERIAL_SEARCH, REQUEST_MATERIAL_ADD, REQUEST_MATERIAL_DELETE, REQUEST_MATERIAL_EDIT } from '../../../const/ApiConst';
import axios from "../../../const/interceptorApi" import axios from "../../../const/interceptorApi"
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import DialogRequest from './FormRequestMaterial'; import DialogRequest from './FormRequestMaterial';
import { renderLabelStatus } from '../../../const/CustomFunc'; import { renderLabelStatus } from '../../../const/CustomFunc';
const DialogFormMaterial = ({ openDialog, closeDialog, toggleDialog, idTask, materialResource, proyekName }) => { const DialogFormMaterial = ({ openDialog, closeDialog, toggleDialog, idTask, materialResource, proyekName }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
"Authorization": `Bearer ${token}` "Authorization": `Bearer ${token}`
} }
} }
const [dataResource, setDataResource] = useState([]) const [dataResource, setDataResource] = useState([])
const [openDialogReq, setOpenDialogReq] = useState(false) const [openDialogReq, setOpenDialogReq] = useState(false)
const [alertDelete, setAlertDelete] = useState(false) const [alertDelete, setAlertDelete] = useState(false)
const [idDelete, setIdDelete] = useState(0) const [idDelete, setIdDelete] = useState(0)
const [dataEdit, setDataEdit] = useState(null) const [dataEdit, setDataEdit] = useState(null)
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (idTask > 0) {
getDataRequestMaterial(); // getDataRequestMaterial();
} }
}, [idTask]) }, [idTask])
useEffect(() => { useEffect(() => {
if (!openDialog) { if (!openDialog) {
setDataResource([]); setDataResource([]);
} else { } else {
} }
}, [openDialog]) }, [openDialog])
const getDataRequestMaterial = async () => { const getDataRequestMaterial = async () => {
const payload = { const payload = {
"columns": [ "columns": [
{ "name": "description", "logic_operator": "ilike", "value": "", "operator": "AND" }, { "name": "description", "logic_operator": "ilike", "value": "", "operator": "AND" },
{ "name": "proyek_id", "logic_operator": "=", "value": idTask, "operator": "AND" } { "name": "proyek_id", "logic_operator": "=", "value": idTask, "operator": "AND" }
], ],
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": true }, "orders": { "columns": ["id"], "ascending": true },
"paging": { "start": 0, "length": 25 } "paging": { "start": 0, "length": 25 }
} }
const result = await axios const result = await axios
.post(REQUEST_MATERIAL_SEARCH, payload, HEADER) .post(REQUEST_MATERIAL_SEARCH, payload, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
console.log("result", result) console.log("result", result)
if (result && result.status == 200) { if (result && result.status == 200) {
setDataResource(result.data.data); setDataResource(result.data.data);
} else { } else {
} }
} }
const handleCancel = () => { const handleCancel = () => {
setDataResource([]); setDataResource([]);
setDataEdit(null) setDataEdit(null)
closeDialog('cancel', 'none') closeDialog('cancel', 'none')
} }
const handleDelete = (id) => { const handleDelete = (id) => {
setIdDelete(id) setIdDelete(id)
setAlertDelete(true) setAlertDelete(true)
} }
const handleEdit = async (data) => { const handleEdit = async (data) => {
await setDataEdit(data) await setDataEdit(data)
setOpenDialogReq(true) setOpenDialogReq(true)
} }
const RenderTable = useMemo(() => { const RenderTable = useMemo(() => {
const columns = [ const columns = [
{ {
title: 'Action', title: 'Action',
dataIndex: '', dataIndex: '',
key: 'id', key: 'id',
className: "nowrap", className: "nowrap",
render: (text, record) => <> render: (text, record) => <>
{text.status == "fom" ? <><Tooltip title="Delete Request Resource"> {text.status == "fom" ? <><Tooltip title="Delete Request Resource">
<Button size="small" size={"sm"} color='danger' onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button> <Button size="small" size={"sm"} color='danger' onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button>
</Tooltip>{" "}<Tooltip title="Edit Request Resource"> </Tooltip>{" "}<Tooltip title="Edit Request Resource">
<Button size="small" size={"sm"} color='primary' onClick={() => handleEdit(text)}><i className="fa fa-edit"></i></Button> <Button size="small" size={"sm"} color='primary' onClick={() => handleEdit(text)}><i className="fa fa-edit"></i></Button>
</Tooltip></> : "-"} </Tooltip></> : "-"}
</>, </>,
}, },
{ title: 'Status', dataIndex: 'status', key: 'status', render: (text, record) => renderLabelStatus(text) }, { title: 'Status', dataIndex: 'status', key: 'status', render: (text, record) => renderLabelStatus(text) },
{ title: 'Description', dataIndex: 'description', key: 'description' }, { title: 'Description', dataIndex: 'description', key: 'description' },
{ title: 'Required Date', dataIndex: 'required_date', key: 'required_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{moment(text).format("D-M-YYYY")}</div>) }, { title: 'Required Date', dataIndex: 'required_date', key: 'required_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{moment(text).format("D-M-YYYY")}</div>) },
{ title: 'QTY', dataIndex: 'qty', key: 'qty', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? text : "-"}</div>) }, { title: 'QTY', dataIndex: 'qty', key: 'qty', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? text : "-"}</div>) },
{ title: 'UOM', dataIndex: 'uom', key: 'uom', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? text : "-"}</div>) }, { title: 'UOM', dataIndex: 'uom', key: 'uom', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? text : "-"}</div>) },
{ title: 'QTY Received', dataIndex: 'qty_received', key: 'qty_received', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? text : "-"}</div>) }, { title: 'QTY Received', dataIndex: 'qty_received', key: 'qty_received', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? text : "-"}</div>) },
{ title: 'FOM Date', dataIndex: 'fom_date', key: 'fom_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{moment(text).format("D-M-YYYY")}</div>) }, { title: 'FOM Date', dataIndex: 'fom_date', key: 'fom_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{moment(text).format("D-M-YYYY")}</div>) },
{ title: 'PR Date', dataIndex: 'pr_date', key: 'pr_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY") : "-"}</div>) }, { title: 'PR Date', dataIndex: 'pr_date', key: 'pr_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY") : "-"}</div>) },
{ title: 'PO Date', dataIndex: 'po_date', key: 'po_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY") : "-"}</div>) }, { title: 'PO Date', dataIndex: 'po_date', key: 'po_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY") : "-"}</div>) },
{ title: 'Received Date', dataIndex: 'received_date', key: 'received_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY") : "-"}</div>) }, { title: 'Received Date', dataIndex: 'received_date', key: 'received_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY") : "-"}</div>) },
{ title: 'Delivery Date', dataIndex: 'delivery_date', key: 'delivery_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY") : "-"}</div>) }, { title: 'Delivery Date', dataIndex: 'delivery_date', key: 'delivery_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY") : "-"}</div>) },
]; ];
return ( return (
<Table <Table
size="small" size="small"
columns={columns} columns={columns}
rowKey={"id"} rowKey={"id"}
dataSource={dataResource} dataSource={dataResource}
pagination={{ position: ["bottomLeft"] }} pagination={{ position: ["bottomLeft"] }}
/> />
) )
}, [dataResource]) }, [dataResource])
const closeDialogReq = (type, data) => { const closeDialogReq = (type, data) => {
if (type == "add") { if (type == "add") {
saveRequestMaterial(data); saveRequestMaterial(data);
} else if (type == "edit") { } else if (type == "edit") {
updateRequestMaterial(data); updateRequestMaterial(data);
} else { } else {
setOpenDialogReq(false); setOpenDialogReq(false);
setDataEdit(null) setDataEdit(null)
} }
} }
const toggleDialogReq = () => { const toggleDialogReq = () => {
setOpenDialogReq(!openDialogReq) setOpenDialogReq(!openDialogReq)
} }
const openDialogRequest = () => { const openDialogRequest = () => {
setOpenDialogReq(true) setOpenDialogReq(true)
} }
const saveRequestMaterial = async (data) => { const saveRequestMaterial = async (data) => {
const result = await axios const result = await axios
.post(REQUEST_MATERIAL_ADD, data, HEADER) .post(REQUEST_MATERIAL_ADD, data, HEADER)
.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) {
getDataRequestMaterial(); getDataRequestMaterial();
NotificationManager.success('Data request material berhasill ditambahkan!!', 'Success'); NotificationManager.success('Data request material berhasill ditambahkan!!', 'Success');
setOpenDialogReq(false); setOpenDialogReq(false);
setDataEdit(null) setDataEdit(null)
} else { } else {
NotificationManager.error('Data request material gagal ditambahkan!!', 'Failed'); NotificationManager.error('Data request material gagal ditambahkan!!', 'Failed');
} }
} }
const updateRequestMaterial = async (data) => { const updateRequestMaterial = async (data) => {
let url = REQUEST_MATERIAL_EDIT(data.id) let url = REQUEST_MATERIAL_EDIT(data.id)
const result = await axios const result = await axios
.put(url, data, HEADER) .put(url, data, HEADER)
.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) {
getDataRequestMaterial(); getDataRequestMaterial();
NotificationManager.success('Data request material berhasill diedit!!', 'Success'); NotificationManager.success('Data request material berhasill diedit!!', 'Success');
setOpenDialogReq(false); setOpenDialogReq(false);
setDataEdit(null) setDataEdit(null)
} else { } else {
NotificationManager.error('Data request material gagal diedit!!', 'Failed'); NotificationManager.error('Data request material gagal diedit!!', 'Failed');
} }
} }
const cancelDelete = () => { const cancelDelete = () => {
setAlertDelete(false) setAlertDelete(false)
setIdDelete(0) setIdDelete(0)
} }
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = REQUEST_MATERIAL_DELETE(idDelete) let urlDel = REQUEST_MATERIAL_DELETE(idDelete)
const result = await axios.delete(urlDel, HEADER) const result = await axios.delete(urlDel, HEADER)
.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) {
getDataRequestMaterial() getDataRequestMaterial()
setIdDelete(0) setIdDelete(0)
setAlertDelete(false) setAlertDelete(false)
NotificationManager.success(`Data request material berhasil dihapus`, 'Success!!'); NotificationManager.success(`Data request material berhasil dihapus`, 'Success!!');
} else { } else {
setIdDelete(0) setIdDelete(0)
setAlertDelete(false) setAlertDelete(false)
NotificationManager.error(`Data request material gagal dihapus`, 'Failed!!'); NotificationManager.error(`Data request material gagal dihapus`, 'Failed!!');
} }
} }
return ( return (
<> <>
<Modal size="xl" isOpen={openDialog} toggle={toggleDialog}> <Modal size="xl" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize withBtn" toggle={closeDialog} style={{ width: "100%" }}> <ModalHeader className="capitalize withBtn" toggle={closeDialog} style={{ width: "100%" }}>
<div>Request Material Resource - {proyekName}</div> <Button onClick={openDialogRequest} size='sm' color="primary"><i className='fa fa-plus'></i></Button> <div>Request Material Resource - {proyekName}</div> <Button onClick={openDialogRequest} size='sm' color="primary"><i className='fa fa-plus'></i></Button>
</ModalHeader> </ModalHeader>
<ModalBody> <ModalBody>
<div style={{ width: '100%', overflow: "auto" }}> <div style={{ width: '100%', overflow: "auto" }}>
{RenderTable} {RenderTable}
</div> </div>
</ModalBody> </ModalBody>
{/* <ModalFooter> {/* <ModalFooter>
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Batal</Button> <Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Batal</Button>
</ModalFooter> */} </ModalFooter> */}
</Modal> </Modal>
<NotificationContainer /> <NotificationContainer />
<SweetAlert <SweetAlert
show={alertDelete} show={alertDelete}
warning warning
showCancel showCancel
confirmBtnText="Delete" confirmBtnText="Delete"
confirmBtnBsStyle="danger" confirmBtnBsStyle="danger"
title={`Are you sure?`} title={`Are you sure?`}
onConfirm={onConfirmDelete} onConfirm={onConfirmDelete}
onCancel={() => cancelDelete()} onCancel={() => cancelDelete()}
focusCancelBtn focusCancelBtn
> >
Delete this data Delete this data
</SweetAlert> </SweetAlert>
<DialogRequest <DialogRequest
openDialog={openDialogReq} openDialog={openDialogReq}
closeDialog={closeDialogReq} closeDialog={closeDialogReq}
toggleDialog={toggleDialogReq} toggleDialog={toggleDialogReq}
idTask={idTask} idTask={idTask}
dataEdit={dataEdit} dataEdit={dataEdit}
materialResource={materialResource} materialResource={materialResource}
/> />
</> </>
) )
} }
export default DialogFormMaterial; export default DialogFormMaterial;

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

File diff suppressed because it is too large Load Diff

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

@ -1,103 +1,114 @@
import React, { useEffect, useMemo, useState } from 'react'; import React, { useEffect, useMemo, useState } from "react";
import Timeline from 'react-calendar-timeline' import Timeline from "react-calendar-timeline";
import 'react-calendar-timeline/lib/Timeline.css' import "react-calendar-timeline/lib/Timeline.css";
import { USER_VERSION_GANTT_SEARCH, BASE_SIMPRO_LUMEN, BASE_URL_GANTT } from '../../../const/ApiConst'; import {
import axios from "../../../const/interceptorApi" USER_VERSION_GANTT_SEARCH,
import { Fab, Action } from 'react-tiny-fab'; BASE_SIMPRO_LUMEN,
import 'react-tiny-fab/dist/styles.css'; BASE_URL_GANTT,
import { useHistory } from "react-router-dom"; } from "../../../const/ApiConst";
import GanttFrame from './GanttFrame'; import axios from "../../../const/interceptorApi";
const token = localStorage.getItem("token") import { Fab, Action } from "react-tiny-fab";
const userId = parseInt(localStorage.getItem("user_id")); import "react-tiny-fab/dist/styles.css";
const HEADER = { import { useHistory } from "react-router-dom";
headers: { import GanttFrame from "./GanttFrame";
"Content-Type": "application/json", const token = localStorage.getItem("token");
"Authorization": `Bearer ${token}` const userId = parseInt(localStorage.getItem("user_id"));
} const HEADER = {
} headers: {
"Content-Type": "application/json",
let roCount = 0; Authorization: `Bearer ${token}`,
},
const Gantt = (props) => { };
const versionGanttId = props.match.params ? props.match.params.id : 0;
const idProject = props.match.params.project ? props.match.params.project : 0; let roCount = 0;
const timestamp = props.match.params.timestamp ? props.match.params.timestamp : 0;
const Gantt = (props) => {
const [ro, setRo] = useState(1) const versionGanttId = props.match.params ? props.match.params.id : 0;
const [listUserGant, setListUserGantt] = useState([]) const idProject = props.match.params.project ? props.match.params.project : 0;
const [ready, setReady] = useState(false) const timestamp = props.match.params.timestamp
let history = useHistory(); ? props.match.params.timestamp
: 0;
useEffect(() => {
document.getElementsByClassName("breadcrumb-item active").innerHTML = "Gantt Project"; const [ro, setRo] = useState(1);
getDataUserGantt(); const [listUserGant, setListUserGantt] = useState([]);
}, []); const [ready, setReady] = useState(false);
let history = useHistory();
useEffect(() => {
cekPermission(); useEffect(() => {
}, [listUserGant]) document.getElementsByClassName("breadcrumb-item active").innerHTML =
"Gantt Project";
useEffect(() => { getDataUserGantt();
}, [ro]) }, []);
const getDataUserGantt = async () => { useEffect(() => {
const payload = { cekPermission();
"columns": [ }, [listUserGant]);
{ "name": "version_gantt_id", "logic_operator": "=", "value": versionGanttId, "operator": "AND" }
] useEffect(() => {}, [ro]);
}
const result = await axios const getDataUserGantt = async () => {
.post(USER_VERSION_GANTT_SEARCH, payload, HEADER) const payload = {
.then(res => res) columns: [
.catch((error) => error.response); {
name: "version_gantt_id",
if (result && result.status == 200) { logic_operator: "=",
setUserGantt(result.data.data); value: versionGanttId,
} else { operator: "AND",
cekPermission() },
} ],
} };
const result = await axios
const setUserGantt = (data) => { .post(USER_VERSION_GANTT_SEARCH, payload, HEADER)
let newTargetKeys = [] .then((res) => res)
data.map((val, index) => { .catch((error) => error.response);
newTargetKeys.push(val.user_id)
}); if (result && result.status == 200) {
setListUserGantt(newTargetKeys) setUserGantt(result.data.data);
} } else {
cekPermission();
const handleRedirect = () => { }
history.push("/dashboard-project/"+idProject+"/"+versionGanttId); };
}
const setUserGantt = (data) => {
const cekPermission = () => { let newTargetKeys = [];
let check = listUserGant.includes(userId) data.map((val, index) => {
if (check) { newTargetKeys.push(val.user_id);
setRo(0) });
} else { setListUserGantt(newTargetKeys);
setRo(1) };
}
if (roCount >= 1) { const handleRedirect = () => {
setReady(true) history.push("/dashboard-project/" + idProject + "/" + versionGanttId);
} };
roCount = roCount + 1;
} const cekPermission = () => {
let check = listUserGant.includes(userId);
return ( if (check) {
<> setRo(0);
<div style={{ margin: "-15px", marginBottom: "-30px" }}> } else {
{ready && ( setRo(1);
<GanttFrame }
versionGanttId={versionGanttId} if (roCount >= 1) {
idProject={idProject} setReady(true);
token={token} }
ro={ro} roCount = roCount + 1;
timestamp={timestamp} };
/>
)} return (
</div> <>
</> <div style={{ margin: "-15px", marginBottom: "-30px" }}>
); {ready && (
} <GanttFrame
versionGanttId={versionGanttId}
export default Gantt; idProject={idProject}
token={token}
ro={ro}
timestamp={timestamp}
/>
)}
</div>
</>
);
};
export default Gantt;

Loading…
Cancel
Save