Browse Source

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

Reviewed-on: ordo/adw-frontend#118
Reviewed-by: ibnu <ibnu@mail.com>
pull/2/head
ibnu 1 year ago
parent
commit
8dfbd3d631
  1. 2
      src/views/Master/MasterBroadcast/DialogDetail.js
  2. 2
      src/views/Master/MasterBroadcast/index.js
  3. 29
      src/views/Master/MasterMenu/index.js
  4. 12
      src/views/SimproV2/CreatedProyek/AsignCustProject.js
  5. 609
      src/views/SimproV2/CreatedProyek/AsignHrProject.js
  6. 31
      src/views/SimproV2/CreatedProyek/DialogAssignCust.js
  7. 70
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  8. 462
      src/views/SimproV2/CreatedProyek/FormAsignHr.js
  9. 165
      src/views/SimproV2/CreatedProyek/ViewProject.js
  10. 8
      src/views/SimproV2/CreatedProyek/index.js
  11. 4
      src/views/SimproV2/Divisi/DialogForm.js
  12. 9
      src/views/SimproV2/Divisi/index.js

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

@ -119,7 +119,7 @@ class DialogDetail extends Component {
return ( return (
<tr key={index}> <tr key={index}>
<td>{val.status_send === "" ? "-" : val.status_send}</td> <td>{val.status_send === "" ? "-" : val.status_send}</td>
<td>{val.created_at === "" ? "-" : moment(val.created_date).format("DD-MM-YYYY HH:mm:ss")}</td> <td>{val.created_at === "" ? "-" : moment(val.created_at).format("DD-MM-YYYY HH:mm:ss")}</td>
<td>{val.description === "" ? "-" : val.description}</td> <td>{val.description === "" ? "-" : val.description}</td>
<td>{ matchedUser ? matchedUser.name : "-" }</td> <td>{ matchedUser ? matchedUser.name : "-" }</td>
<td>{val.title_notif === "" ? "-" : val.title_notif}</td> <td>{val.title_notif === "" ? "-" : val.title_notif}</td>

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

@ -424,7 +424,7 @@ class index extends Component {
<td>{n.description !== "" ? n.description : "-"}</td> <td>{n.description !== "" ? n.description : "-"}</td>
<td>{ matchedUser ? matchedUser.name : "-" }</td> <td>{ matchedUser ? matchedUser.name : "-" }</td>
<td>{n.status_send !== "" ? n.status_send : "-"}</td> <td>{n.status_send !== "" ? n.status_send : "-"}</td>
<td>{n.created_at !== "" ? moment.utc(n.created_at).format("DD-MM-YYYY HH:mm:ss") : "-"}</td> <td>{n.created_at !== "" ? moment(n.created_at).format("DD-MM-YYYY HH:mm:ss") : "-"}</td>
</tr> </tr>
); );
}) : <tr> }) : <tr>

29
src/views/Master/MasterMenu/index.js

@ -5,7 +5,7 @@ import SweetAlert from 'react-bootstrap-sweetalert';
import axios from 'axios'; import axios from 'axios';
import { Button } from 'reactstrap'; import { Button } from 'reactstrap';
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap'; import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
import { MENU_ADD, MENU_SEARCH, MENU_EDIT, MENU_DELETE } from '../../../const/ApiConst.js'; import { MENU_ADD, MENU_SEARCH, MENU_EDIT, MENU_DELETE, MENU_LIST } from '../../../const/ApiConst.js';
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Tooltip, Table } from 'antd'; import { Pagination, Tooltip, Table } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@ -67,23 +67,21 @@ const Index = ({ params }) => {
}; };
const getDataAllMenu = async () => { const getDataAllMenu = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "name", "logic_operator": "ilike", "value": "", "operator": "AND" }
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios const result = await axios
.post(MENU_SEARCH, payload, config) .get(MENU_LIST, 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) {
setAllDataMenu(result.data.data); let arr = []
} else { let dataRes = result.data.data;
} for (const v in dataRes) {
arr.push(dataRes[v])
}
setAllDataMenu(arr);
}else {
NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
}
} }
const getDataMenu = async () => { const getDataMenu = async () => {
@ -123,6 +121,7 @@ const Index = ({ params }) => {
const handleOpenDialog = async (type) => { const handleOpenDialog = async (type) => {
await setTypeDialog(type) await setTypeDialog(type)
getDataAllMenu();
setOpenDialog(true) setOpenDialog(true)
} }

12
src/views/SimproV2/CreatedProyek/AsignCustProject.js

@ -32,11 +32,6 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
} }
}, [openDialog]); }, [openDialog]);
useEffect(() => {
if (openDialog) {
}
}, [dataUserToProject])
const getDataAssignHr = async () => { const getDataAssignHr = async () => {
const payload = { const payload = {
"paging": { "paging": {
@ -45,7 +40,8 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
}, },
"columns": [ "columns": [
{ "name": "name", "logic_operator": "ilike", "value": "", "table_name": "m_users" }, { "name": "name", "logic_operator": "ilike", "value": "", "table_name": "m_users" },
{ "name": "proyek_id", "logic_operator": "=", "value": idTask } { "name": "proyek_id", "logic_operator": "=", "value": idTask },
{ "name": "is_customer", "logic_operator": "=", "value": "true" }
], ],
"joins": [ "joins": [
{ "name": "m_users", "column_join": "user_id", "column_results": ["name"] }, { "name": "m_users", "column_join": "user_id", "column_results": ["name"] },
@ -144,7 +140,9 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
} }
const handleCloseDialogFormTools = (type, data) => { const handleCloseDialogFormTools = (type, data) => {
if (type === "add") getDataAssignHr(); if (type === "add") {
getDataAssignHr()
}
if (type === "success") { if (type === "success") {
NotificationManager.success( NotificationManager.success(
`Assign Customer Project berhasil disimpan!`, `Assign Customer Project berhasil disimpan!`,

609
src/views/SimproV2/CreatedProyek/AsignHrProject.js

@ -1,304 +1,305 @@
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, Form } from 'reactstrap'; import { Button, Form } 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 { API_ADW, TOKEN_ADW, ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_DELETE, USER_LIST, PROJECT_ROLE_SEARCH, ASSIGN_HR_PROJECT_ADD, ASSIGN_HR_PROJECT_EDIT } from '../../../const/ApiConst'; import { API_ADW, TOKEN_ADW, ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_DELETE, USER_LIST, PROJECT_ROLE_SEARCH, ASSIGN_HR_PROJECT_ADD, ASSIGN_HR_PROJECT_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 SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
import FormAsignHr from './FormAsignHr'; import FormAsignHr from './FormAsignHr';
import { formatThousand } from '../../../const/CustomFunc'; import { formatThousand } from '../../../const/CustomFunc';
const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsResource, proyekName }) => { const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsResource, 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 [dataUserToProject, setdataUserToProject] = useState([]) const [dataUserToProject, setdataUserToProject] = useState([])
const [alertDelete, setAlertDelete] = useState(false) const [alertDelete, setAlertDelete] = useState(false)
const [idDelete, setIdDelete] = useState(0) const [idDelete, setIdDelete] = useState(0)
const [openDialogFormTools, setOpenDialogFormTools] = useState(false) const [openDialogFormTools, setOpenDialogFormTools] = useState(false)
const [dataEdit, setDataEdit] = useState(null) const [dataEdit, setDataEdit] = useState(null)
const [listUser, setListUser] = useState([]) const [listUser, setListUser] = useState([])
const [listRole, setListRole] = useState([]) const [listRole, setListRole] = useState([])
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (idTask > 0) {
getDataAssignHr(); getDataAssignHr();
} }
}, [openDialog]); }, [openDialog]);
useEffect(() => { useEffect(() => {
if (openDialog) { if (openDialog) {
getDataProjectRole(); getDataProjectRole();
getDataUser(); getDataUser();
} }
}, [dataUserToProject]) }, [dataUserToProject])
const getDataAssignHr = async () => { const getDataAssignHr = async () => {
const payload = { const payload = {
"paging": { "paging": {
"start": 0, "start": 0,
"length": -1 "length": -1
}, },
"columns": [ "columns": [
{ "name": "name", "logic_operator": "ilike", "value": "", "table_name": "m_users" }, { "name": "name", "logic_operator": "ilike", "value": "", "table_name": "m_users" },
{ "name": "proyek_id", "logic_operator": "=", "value": idTask } { "name": "proyek_id", "logic_operator": "=", "value": idTask },
], { "name": "is_customer", "logic_operator": "=", "value": "false" }
"joins": [ ],
{ "name": "m_users", "column_join": "user_id", "column_results": ["name"] }, "joins": [
{ "name": "m_role_proyek", "column_join": "project_role", "column_results": ["name"] }, { "name": "m_users", "column_join": "user_id", "column_results": ["name"] },
], { "name": "m_role_proyek", "column_join": "project_role", "column_results": ["name"] },
"orders": { ],
"columns": [ "orders": {
"id" "columns": [
], "id"
"ascending": false ],
} "ascending": false
} }
const URL = ASSIGN_HR_PROJECT_SEARCH }
const result = await axios const URL = ASSIGN_HR_PROJECT_SEARCH
.post(URL, payload, HEADER) const result = await axios
.then(res => res) .post(URL, payload, HEADER)
.catch((error) => error.response); .then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [] if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || []
setdataUserToProject(dataRes);
} else { setdataUserToProject(dataRes);
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); } else {
} NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
} }
}
const getDataUser = async () => {
const HEADER_ADW = { const getDataUser = async () => {
headers: { const HEADER_ADW = {
"Authorization": `${TOKEN_ADW}` headers: {
} "Authorization": `${TOKEN_ADW}`
} }
const result = await axios }
// .get(`${API_ADW}employees`, HEADER_ADW) const result = await axios
.get(USER_LIST, HEADER) // .get(`${API_ADW}employees`, HEADER_ADW)
.then(res => res) .get(USER_LIST, HEADER)
.catch((error) => error.response); .then(res => res)
if (result && result.data && result.data.data.length != 0) { .catch((error) => error.response);
let dataRes = result.data.data if (result && result.data && result.data.data.length != 0) {
setListUser(dataRes) let dataRes = result.data.data
} setListUser(dataRes)
} }
}
const getDataProjectRole = async () => {
const payload = { const getDataProjectRole = async () => {
"paging": { const payload = {
"start": 0, "paging": {
"length": -1 "start": 0,
}, "length": -1
"columns": [ },
{ "name": "created_by", "logic_operator": "ilike", "value": "" }, "columns": [
], { "name": "created_by", "logic_operator": "ilike", "value": "" },
"joins": [], ],
"orders": { "joins": [],
"columns": [ "orders": {
"id" "columns": [
], "id"
"ascending": false ],
} "ascending": false
} }
}
const result = await axios
.post(PROJECT_ROLE_SEARCH, payload, HEADER) const result = await axios
.then(res => res) .post(PROJECT_ROLE_SEARCH, payload, HEADER)
.catch((error) => error.response); .then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [] if (result && result.data && result.data.code == 200) {
setListRole(dataRes); let dataRes = result.data.data || []
} else { setListRole(dataRes);
} } else {
} }
}
const handleDelete = (id) => {
setIdDelete(id) const handleDelete = (id) => {
setAlertDelete(true) setIdDelete(id)
} setAlertDelete(true)
}
const cancelDelete = () => {
setAlertDelete(false) const cancelDelete = () => {
setIdDelete(0) setAlertDelete(false)
} setIdDelete(0)
}
const onConfirmDelete = async () => {
let urlDel = ASSIGN_HR_PROJECT_DELETE(idDelete) const onConfirmDelete = async () => {
const result = await axios.delete(urlDel, HEADER) let urlDel = ASSIGN_HR_PROJECT_DELETE(idDelete)
.then(res => res) const result = await axios.delete(urlDel, HEADER)
.catch((error) => error.response); .then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code === 200) {
getDataAssignHr() if (result && result.data && result.data.code === 200) {
setIdDelete(0) getDataAssignHr()
setAlertDelete(false) setIdDelete(0)
NotificationManager.success(`Data assign human resource berhasil dihapus`, 'Success!!'); setAlertDelete(false)
} else { NotificationManager.success(`Data assign human resource berhasil dihapus`, 'Success!!');
setIdDelete(0) } else {
setAlertDelete(false) setIdDelete(0)
NotificationManager.error(`Data assign human resource gagal dihapus`, 'Failed!!'); setAlertDelete(false)
} NotificationManager.error(`Data assign human resource gagal dihapus`, 'Failed!!');
} }
}
const handleEdit = async (data) => {
await setDataEdit(data) const handleEdit = async (data) => {
setOpenDialogFormTools(true) await setDataEdit(data)
} setOpenDialogFormTools(true)
}
const handleOpenDialogFormTools = () => {
setOpenDialogFormTools(true) const handleOpenDialogFormTools = () => {
} setOpenDialogFormTools(true)
}
const handleCancel = () => {
closeDialog('cancel', 'none') const handleCancel = () => {
} closeDialog('cancel', 'none')
}
const RenderTable = useMemo(() => {
const columns = [ const RenderTable = useMemo(() => {
{ const columns = [
title: 'Action', {
dataIndex: '', title: 'Action',
key: 'x', dataIndex: '',
className: "nowrap", key: 'x',
render: (text, record) => <><Tooltip title="Delete Request Resource"> className: "nowrap",
<Button size={"sm"} color='danger' onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button> render: (text, record) => <><Tooltip title="Delete Request Resource">
</Tooltip>{" "}<Tooltip title="Edit Request Resource"> <Button size={"sm"} color='danger' onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button>
<Button size={"sm"} color='primary' onClick={() => handleEdit(text)}><i className="fa fa-edit"></i></Button> </Tooltip>{" "}<Tooltip title="Edit Request Resource">
</Tooltip></>, <Button size={"sm"} color='primary' onClick={() => handleEdit(text)}><i className="fa fa-edit"></i></Button>
}, </Tooltip></>,
{ title: 'Name Human Resource', dataIndex: 'join_first_name', key: 'join_first_name', className: "nowrap" }, },
{ title: 'Role Human Resource', dataIndex: 'join_second_name', key: 'join_second_name', className: "nowrap" }, { title: 'Name Human Resource', dataIndex: 'join_first_name', key: 'join_first_name', className: "nowrap" },
{ title: 'Percentage Available User', dataIndex: 'max_used', key: 'max_used', className: "nowrap", render: (text, record) => record.max_used ? formatThousand(record.max_used) : '-' }, { title: 'Role Human Resource', dataIndex: 'join_second_name', key: 'join_second_name', className: "nowrap" },
{ title: 'Standard Rate', dataIndex: 'standart_rate', key: 'standart_rate', className: "nowrap", render: (text, record) => record.standart_rate ? formatThousand(record.standart_rate) : '-' }, { title: 'Percentage Available User', dataIndex: 'max_used', key: 'max_used', className: "nowrap", render: (text, record) => record.max_used ? formatThousand(record.max_used) : '-' },
{ title: 'UOM Standard Rate', dataIndex: 'uom_standart_rate', key: 'uom_standart_rate', className: "nowrap" }, { title: 'Standard Rate', dataIndex: 'standart_rate', key: 'standart_rate', className: "nowrap", render: (text, record) => record.standart_rate ? formatThousand(record.standart_rate) : '-' },
{ title: 'Overtime Rate', dataIndex: 'overtime_rate', key: 'overtime_rate', className: "nowrap", render: (text, record) => record.overtime_rate ? formatThousand(record.overtime_rate) : '-' }, { title: 'UOM Standard Rate', dataIndex: 'uom_standart_rate', key: 'uom_standart_rate', className: "nowrap" },
{ title: 'UOM Overtime Rate', dataIndex: 'uom_overtime_rate', key: 'uom_overtime_rate', className: "nowrap" }, { title: 'Overtime Rate', dataIndex: 'overtime_rate', key: 'overtime_rate', className: "nowrap", render: (text, record) => record.overtime_rate ? formatThousand(record.overtime_rate) : '-' },
{ title: 'UOM Overtime Rate', dataIndex: 'uom_overtime_rate', key: 'uom_overtime_rate', className: "nowrap" },
];
];
return (
<Table return (
size="small" <Table
columns={columns} size="small"
dataSource={dataUserToProject} columns={columns}
pagination={{ position: ["bottomLeft"] }} dataSource={dataUserToProject}
/> pagination={{ position: ["bottomLeft"] }}
) />
}, [dataUserToProject]) )
}, [dataUserToProject])
const renderForm = () => {
return ( const renderForm = () => {
<div style={{"overflowX":"scroll"}}> return (
{RenderTable} <div style={{"overflowX":"scroll"}}>
</div> {RenderTable}
) </div>
} )
}
const handleCloseDialogFormTools = (type, data) => {
if(type=="add"){ const handleCloseDialogFormTools = (type, data) => {
addDataAssignHr(data); if(type=="add"){
}else if(type=="edit"){ addDataAssignHr(data);
editDataAssignHr(data); }else if(type=="edit"){
}else{ editDataAssignHr(data);
setDataEdit(null) }else{
setOpenDialogFormTools(false) setDataEdit(null)
} setOpenDialogFormTools(false)
} }
}
const addDataAssignHr = async (payload) => {
const result = await axios const addDataAssignHr = async (payload) => {
.post(ASSIGN_HR_PROJECT_ADD, payload, HEADER) const result = await axios
.then(res => res) .post(ASSIGN_HR_PROJECT_ADD, payload, HEADER)
.catch((error) => error.response); .then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
getDataAssignHr(); if (result && result.data && result.data.code == 200) {
NotificationManager.success('assign human resource berhasil!!', 'Success'); getDataAssignHr();
setDataEdit(null) NotificationManager.success('assign human resource berhasil!!', 'Success');
setOpenDialogFormTools(false) setDataEdit(null)
} else { setOpenDialogFormTools(false)
NotificationManager.error('assign human resource gagal!!', 'Failed'); } else {
} NotificationManager.error('assign human resource gagal!!', 'Failed');
} }
}
const editDataAssignHr = async (payload) => {
let url = ASSIGN_HR_PROJECT_EDIT(payload.id) const editDataAssignHr = async (payload) => {
const result = await axios let url = ASSIGN_HR_PROJECT_EDIT(payload.id)
.put(url, payload, HEADER) const result = await axios
.then(res => res) .put(url, payload, HEADER)
.catch((error) => error.response); .then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
getDataAssignHr(); if (result && result.data && result.data.code == 200) {
NotificationManager.success('assign human resource berhasil diedit!!', 'Success'); getDataAssignHr();
setDataEdit(null) NotificationManager.success('assign human resource berhasil diedit!!', 'Success');
setOpenDialogFormTools(false) setDataEdit(null)
} else { setOpenDialogFormTools(false)
NotificationManager.error('assign human resource gagal diedit!!', 'Failed'); } else {
} NotificationManager.error('assign human resource gagal diedit!!', 'Failed');
} }
}
const toogleDialogFormTools = () => {
if (openDialogFormTools) { const toogleDialogFormTools = () => {
setDataEdit(null) if (openDialogFormTools) {
} setDataEdit(null)
setOpenDialogFormTools(!openDialogFormTools) }
} setOpenDialogFormTools(!openDialogFormTools)
}
return (
<> return (
<NotificationContainer /> <>
<SweetAlert <NotificationContainer />
show={alertDelete} <SweetAlert
warning show={alertDelete}
showCancel warning
confirmBtnText="Delete" showCancel
confirmBtnBsStyle="danger" confirmBtnText="Delete"
title={`Are you sure?`} confirmBtnBsStyle="danger"
onConfirm={onConfirmDelete} title={`Are you sure?`}
onCancel={() => cancelDelete()} onConfirm={onConfirmDelete}
focusCancelBtn onCancel={() => cancelDelete()}
> focusCancelBtn
Delete this data >
</SweetAlert> Delete this data
<Modal size="xl" isOpen={openDialog} toggle={toggleDialog}> </SweetAlert>
<ModalHeader className="capitalize withBtn" toggle={closeDialog}> <Modal size="xl" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize withBtn" toggle={closeDialog}>
<div>Assign Human Resource - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button>
</ModalHeader> <div>Assign Human Resource - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button>
<ModalBody> </ModalHeader>
{renderForm()} <ModalBody>
</ModalBody> {renderForm()}
{/* <ModalFooter> </ModalBody>
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Close</Button> {/* <ModalFooter>
</ModalFooter> */} <Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Close</Button>
</Modal> </ModalFooter> */}
<FormAsignHr </Modal>
openDialog={openDialogFormTools} <FormAsignHr
closeDialog={handleCloseDialogFormTools} openDialog={openDialogFormTools}
toggleDialog={toogleDialogFormTools} closeDialog={handleCloseDialogFormTools}
idTask={idTask} toggleDialog={toogleDialogFormTools}
dataEdit={dataEdit} idTask={idTask}
dataHr={listUser} dataEdit={dataEdit}
dataRole={listRole} dataHr={listUser}
dataCurrentHr={dataUserToProject} dataRole={listRole}
/> dataCurrentHr={dataUserToProject}
</> />
) </>
)
}
}
export default AssignHrProject;
export default AssignHrProject;

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

@ -3,7 +3,7 @@ import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button, Form } from 'reactstrap'; import { Button, Form } from 'reactstrap';
import axios from "../../../const/interceptorApi"; import axios from "../../../const/interceptorApi";
import { import {
USER_LIST, USER_SEARCH,
ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_SEARCH,
ASSIGN_HR_PROJECT_ADD_MULTIPLE ASSIGN_HR_PROJECT_ADD_MULTIPLE
} from '../../../const/ApiConst'; } from '../../../const/ApiConst';
@ -40,8 +40,29 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
const getDataAssignCustomer = async () => { const getDataAssignCustomer = async () => {
const payload = {
"select": [
"id",
"name",
"role_id"
],
"paging": {
"start": 0,
"length": -1
},
"columns": [
{ "name": "role_id", "logic_operator": "=", "value": 44 }
],
"orders": {
"columns": [
"id"
],
"ascending": false
}
}
const URL = USER_SEARCH;
const result = await axios const result = await axios
.get(USER_LIST, HEADER) .post(URL, payload, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
@ -99,6 +120,12 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
const getCustProject = async () => { const getCustProject = async () => {
const payload = { const payload = {
"select": [
"id",
"user_id",
"proyek_id",
"is_customer"
],
"columns": [ "columns": [
{ "name": "proyek_id", "logic_operator": "=", "value": idTask }, { "name": "proyek_id", "logic_operator": "=", "value": idTask },
{"name": "is_customer", "logic_operator": "=", "value": "true"} {"name": "is_customer", "logic_operator": "=", "value": "true"}

70
src/views/SimproV2/CreatedProyek/DialogFormProyek.js

@ -332,18 +332,35 @@ const DialogFormProyek = ({
setHealthBudget(val); setHealthBudget(val);
}; };
const onChangePm = (val) => { const onChangePm = (val) => {
let data = [...dataPM]; const item = dataPM.find((item) => item.id === val);
var item = data.find((item) => item.id === val); const existingParticipant = participants.find((participant) => participant.tittle === "PM");
participants.push({ if (existingParticipant) {
id: lastIdxParticipants + 1, setParticipants((prevParticipants) => {
title: "PM", return prevParticipants.map((participant) => {
name: item.name, if (participant.tittle === "PM") {
}); return {
setParticipants(participants); ...participant,
setLastIdxParticipants(lastIdxParticipants + 1); name: item.name,
setPic(val); };
}; }
return participant;
});
});
} else {
setParticipants((prevParticipants) => [
...prevParticipants,
{
id: item.id,
tittle: "PM",
name: item.name,
},
]);
setLastIdxParticipants(lastIdxParticipants + 1);
}
setPic(val);
};
const onChangeCurrency = (val) => { const onChangeCurrency = (val) => {
let curr = val.split("|"); // code|symbol|name let curr = val.split("|"); // code|symbol|name
@ -399,7 +416,7 @@ const DialogFormProyek = ({
const addParticipant = () => { const addParticipant = () => {
participants.push({ participants.push({
id: lastIdxParticipants + 1, id: lastIdxParticipants + 1,
title: "", tittle: "",
name: "", name: "",
}); });
setParticipants(participants); setParticipants(participants);
@ -438,7 +455,24 @@ const DialogFormProyek = ({
}; };
const handleInputChangeParticipants = (e, index) => { const handleInputChangeParticipants = (e, index) => {
const { name, value } = e.target; const { name, value } = e.target;
const existingParticipant = participants.find((participant) => participant.tittle === "PM");
if(value.toLowerCase() === "pm" && name === "tittle" && existingParticipant)
{
alert('PM is already exist!');
setParticipants((prevParticipants) =>
prevParticipants.map((participant, i) => {
if (i === index) {
return {
...participant,
tittle: "",
};
}
return participant;
})
);
return false;
}
const newParticipants = [...participants]; const newParticipants = [...participants];
newParticipants[index][name] = value; newParticipants[index][name] = value;
setParticipants(newParticipants); setParticipants(newParticipants);
@ -566,7 +600,7 @@ const DialogFormProyek = ({
const addApproval = () => { const addApproval = () => {
approval.push({ approval.push({
id: lastIdxApproval + 1, id: lastIdxApproval + 1,
title: "", tittle: "",
name: "", name: "",
date: moment(), date: moment(),
}); });
@ -1321,8 +1355,8 @@ const DialogFormProyek = ({
<Col md={4}> <Col md={4}>
<Input <Input
type="text" type="text"
value={item.tittle ? item.tittle : "-"} value={item.tittle}
name="title" name="tittle"
onChange={(e) => handleInputChangeParticipants(e, index)} onChange={(e) => handleInputChangeParticipants(e, index)}
/> />
</Col> </Col>
@ -1421,7 +1455,7 @@ const DialogFormProyek = ({
<Col md={3}> <Col md={3}>
<Input <Input
type="text" type="text"
value={item.tittle ? item.tittle : item.title} value={item.tittle ? item.tittle : item.tittle}
name="title" name="title"
onChange={(e) => handleInputChangeApproval(e, index)} onChange={(e) => handleInputChangeApproval(e, index)}
/> />

462
src/views/SimproV2/CreatedProyek/FormAsignHr.js

@ -1,246 +1,216 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button, Form, FormGroup, Label, Input, Col, Row } from 'reactstrap'; import { Button, Form, FormGroup, Label, Input, Col, Row } from 'reactstrap';
import { DatePicker, Select } from 'antd'; import { DatePicker, Select } from 'antd';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { formatNumber } from '../../../const/CustomFunc'; import { formatNumber } from '../../../const/CustomFunc';
const { Option } = Select const { Option } = Select
const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit, dataHr, dataCurrentHr, dataRole }) => { const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit, dataHr, dataCurrentHr, dataRole }) => {
const [id, setId] = useState(null) const [id, setId] = useState(null)
const [typeForm, setTypeForm] = useState('add') const [typeForm, setTypeForm] = useState('add')
const [user, setUser] = useState(null) const [user, setUser] = useState(null)
const [rbs, setRbs] = useState("") const [rbs, setRbs] = useState("")
const [projectRole, setProjectRole] = useState(null) const [projectRole, setProjectRole] = useState(null)
const [groupR, setGroupR] = useState("") const [groupR, setGroupR] = useState("")
const [maxUsed, setMaxUsed] = useState("") const [maxUsed, setMaxUsed] = useState("")
const [standartRate, setStandartRate] = useState("") const [standartRate, setStandartRate] = useState("")
const [uomStandartRate, setUomStandartRate] = useState(null) const [uomStandartRate, setUomStandartRate] = useState(null)
const [overTimeRate, setOverTimeRate] = useState("") const [overTimeRate, setOverTimeRate] = useState("")
const [overTimeRateUom, setOverTimeRateUom] = useState(null) const [overTimeRateUom, setOverTimeRateUom] = useState(null)
const [costPerUsed, setCostPerUsed] = useState("") const [costPerUsed, setCostPerUsed] = useState("")
const [accrue, setAccrue] = useState("") const [accrue, setAccrue] = useState("")
const [baseCalender, setBaseCalender] = useState("") const [baseCalender, setBaseCalender] = useState("")
const [listHr, setListHr] = useState([]) const [listHr, setListHr] = useState([])
const [isCustomer, setIsCustomer] = useState(false)
const handleClearData = () => {
const handleClearData = () => { setUser(null)
setUser(null) setRbs("")
setRbs("") setProjectRole(null)
setProjectRole(null) setGroupR("")
setGroupR("") setMaxUsed("")
setMaxUsed("") setStandartRate("")
setIsCustomer(false) setUomStandartRate(null)
setStandartRate("") setOverTimeRate("")
setUomStandartRate(null) setOverTimeRateUom(null)
setOverTimeRate("") setCostPerUsed("")
setOverTimeRateUom(null) setAccrue("")
setCostPerUsed("") setBaseCalender("")
setAccrue("") }
setBaseCalender("")
} useEffect(() => {
let data = dataHr || []
useEffect(() => { let availableHr = []
let data = dataHr || [] data.map((val, index) => {
let availableHr = [] if(dataEdit && dataEdit.user_id){
data.map((val, index) => { if(parseInt(val.id)===parseInt(dataEdit.user_id)){
if(dataEdit && dataEdit.user_id){ availableHr.push(val);
if(parseInt(val.id)===parseInt(dataEdit.user_id)){ }
availableHr.push(val); }
} let check = dataCurrentHr.some(function (x) {
} return parseInt(val.id)==parseInt(x.user_id)
let check = dataCurrentHr.some(function (x) { });
return parseInt(val.id)==parseInt(x.user_id) if(!check){
}); availableHr.push(val);
if(!check){ }
availableHr.push(val); });
} setListHr(availableHr)
}); }, [dataHr, dataCurrentHr, dataEdit])
setListHr(availableHr)
}, [dataHr, dataCurrentHr, dataEdit]) useEffect(() => {
if (idTask && idTask > 0) {
useEffect(() => { if(dataEdit && dataEdit!=""){
if (idTask && idTask > 0) { setTypeForm('edit')
if(dataEdit && dataEdit!=""){ setId(dataEdit.id)
setTypeForm('edit') setUser(dataEdit.user_id)
setId(dataEdit.id) setRbs(dataEdit.rbs)
setUser(dataEdit.user_id) setProjectRole(dataEdit.project_role)
setRbs(dataEdit.rbs) setGroupR(dataEdit.group_r)
setProjectRole(dataEdit.project_role) setMaxUsed(dataEdit.max_used ? formatNumber(dataEdit.max_used.toString()) : '')
setGroupR(dataEdit.group_r) setStandartRate(dataEdit.standart_rate ? formatNumber(dataEdit.standart_rate.toString()) : '')
setMaxUsed(dataEdit.max_used ? formatNumber(dataEdit.max_used.toString()) : '') setUomStandartRate(dataEdit.uom_standart_rate)
setIsCustomer(dataEdit.is_customer) setOverTimeRate(dataEdit.overtime_rate ? formatNumber(dataEdit.overtime_rate.toString()) : '')
setStandartRate(dataEdit.standart_rate ? formatNumber(dataEdit.standart_rate.toString()) : '') setOverTimeRateUom(dataEdit.uom_overtime_rate)
setUomStandartRate(dataEdit.uom_standart_rate) setCostPerUsed(dataEdit.cost_per_used)
setOverTimeRate(dataEdit.overtime_rate ? formatNumber(dataEdit.overtime_rate.toString()) : '') setAccrue(dataEdit.accrue_at)
setOverTimeRateUom(dataEdit.uom_overtime_rate) setBaseCalender(dataEdit.base_calender)
setCostPerUsed(dataEdit.cost_per_used) }else{
setAccrue(dataEdit.accrue_at) handleClearData()
setBaseCalender(dataEdit.base_calender) setTypeForm('add')
}else{ }
handleClearData() } else {
setTypeForm('add') handleClearData()
} }
} else { }, [openDialog])
handleClearData()
} const handleSave = () => {
}, [openDialog]) let data = '';
if (typeForm=="edit") {
const handleSave = () => { data = {
let data = ''; id,
if (typeForm=="edit") { proyek_id: idTask,
data = { user_id:user,
id, project_role:projectRole,
proyek_id: idTask, is_customer: false,
user_id:user, max_used:maxUsed.replaceAll(".", ""),
project_role:projectRole, standart_rate:standartRate.replaceAll(".", ""),
is_customer: isCustomer, uom_standart_rate:uomStandartRate,
max_used:maxUsed.replaceAll(".", ""), overtime_rate:overTimeRate.replaceAll(".", ""),
standart_rate:standartRate.replaceAll(".", ""), uom_overtime_rate:overTimeRateUom,
uom_standart_rate:uomStandartRate, }
overtime_rate:overTimeRate.replaceAll(".", ""),
uom_overtime_rate:overTimeRateUom, closeDialog('edit', data);
} } else {
data = {
closeDialog('edit', data); proyek_id: idTask,
} else { user_id:user,
data = { project_role:projectRole,
proyek_id: idTask, is_customer: false,
user_id:user, max_used:maxUsed.replaceAll(".", ""),
project_role:projectRole, standart_rate:standartRate.replaceAll(".", ""),
is_customer: isCustomer, uom_standart_rate:uomStandartRate,
max_used:maxUsed.replaceAll(".", ""), overtime_rate:overTimeRate.replaceAll(".", ""),
standart_rate:standartRate.replaceAll(".", ""), uom_overtime_rate:overTimeRateUom,
uom_standart_rate:uomStandartRate, }
overtime_rate:overTimeRate.replaceAll(".", ""), closeDialog('add', data);
uom_overtime_rate:overTimeRateUom, }
} handleClearData()
closeDialog('add', data); }
}
handleClearData() const handleCancel = () => {
} closeDialog('cancel', 'none')
handleClearData()
const handleCancel = () => { }
closeDialog('cancel', 'none')
handleClearData()
} const renderForm = () => {
return (
<Form>
const renderForm = () => { <Row>
return ( <Col>
<Form> <FormGroup>
<Row> <Label>Human Resource</Label>
<Col> <Select showSearch value={user} onChange={(val) => setUser(val)} placeholder="Select Human Resource" filterOption={(input, option) =>
<FormGroup> option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
<Label>Human Resource</Label> } style={{ width: '100%' }}>
<Select showSearch value={user} onChange={(val) => setUser(val)} placeholder="Select Human Resource" filterOption={(input, option) => {listHr && listHr.map(res => (
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 <Option key={res.id} value={res.id}>{`${res.name}`}</Option>
} style={{ width: '100%' }}> ))}
{listHr && listHr.map(res => ( </Select>
<Option key={res.id} value={res.id}>{`${res.name}`}</Option> </FormGroup>
))} </Col>
</Select> <Col>
</FormGroup> <FormGroup>
</Col> <Label>Role Human Resource</Label>
<Col> <Select showSearch value={projectRole} onChange={(val) => setProjectRole(val)}
<FormGroup> placeholder="Select Role Human Resource"
<Label>Role Human Resource</Label> filterOption={(input, option) => option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
<Select showSearch value={projectRole} onChange={(val) => setProjectRole(val)} tyle={{ width: '100%' }}>
placeholder="Select Role Human Resource" {dataRole && dataRole.map(res => (
filterOption={(input, option) => option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} <Option key={res.id} value={res.id}>{`${res.name}`}</Option>
tyle={{ width: '100%' }}> ))}
{dataRole && dataRole.map(res => ( </Select>
<Option key={res.id} value={res.id}>{`${res.name}`}</Option> </FormGroup>
))} </Col>
</Select> <Col>
</FormGroup> <FormGroup>
</Col> <Label>Percentage Available User</Label>
<Col> <Input type="text" onChange={(e) => setMaxUsed(formatNumber(e.target.value))} value={maxUsed} placeholder='' required/>
<FormGroup> </FormGroup>
<Label>Percentage Available User</Label> </Col>
<Input type="text" onChange={(e) => setMaxUsed(formatNumber(e.target.value))} value={maxUsed} placeholder='' required/> </Row>
</FormGroup> <div style={{widht:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}}>
</Col> <FormGroup style={{flexBasis:"49%"}}>
</Row> <Label>Standart Rate</Label>
<Row> <Input type="text" onChange={(e) => setStandartRate(formatNumber(e.target.value))} value={standartRate} placeholder='1.000...' />
<Col> </FormGroup>
<FormGroup> <div style={{flexBasis:"2%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}}>
<Label>Customer</Label> /
<div> </div>
<Select <FormGroup style={{flexBasis:"49%"}}>
value={isCustomer} <Label>UOM Standart Rate</Label>
defaultValue={false} <Select value={uomStandartRate} onChange={(val) => setUomStandartRate(val)} style={{ width: '100%' }} placeholder="Select UOM">
style={{ <Option value={"Day"}>Day</Option>
width: 235, <Option value={"Hour"}>Hour</Option>
}} </Select>
onChange={(val) => setIsCustomer(val)} </FormGroup>
options={[ </div>
{
value: true, <div style={{widht:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}}>
label: 'Yes', <FormGroup style={{flexBasis:"49%"}}>
}, <Label>Overtime Rate</Label>
{ <Input type="text" onChange={(e) => setOverTimeRate(formatNumber(e.target.value))} value={overTimeRate} placeholder='1.000...' />
value: false, </FormGroup>
label: 'No', <div style={{flexBasis:"2%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}}>
} /
]} </div>
/> <FormGroup style={{flexBasis:"49%"}}>
</div> <Label>UOM Overtime Rate</Label>
</FormGroup> <Select value={overTimeRateUom} onChange={(val) => setOverTimeRateUom(val)} style={{ width: '100%' }} placeholder="Select UOM">
</Col> <Option value={"Day"}>Day</Option>
</Row> <Option value={"Hour"}>Hour</Option>
<div style={{widht:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}}> </Select>
<FormGroup style={{flexBasis:"49%"}}> </FormGroup>
<Label>Standart Rate</Label> </div>
<Input type="text" onChange={(e) => setStandartRate(formatNumber(e.target.value))} value={standartRate} placeholder='1.000...' /> </Form>
</FormGroup> )
<div style={{flexBasis:"2%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}}> }
/
</div> return (
<FormGroup style={{flexBasis:"49%"}}> <>
<Label>UOM Standart Rate</Label> <Modal size="lg" isOpen={openDialog} toggle={toggleDialog}>
<Select value={uomStandartRate} onChange={(val) => setUomStandartRate(val)} style={{ width: '100%' }} placeholder="Select UOM"> <ModalHeader className="capitalize" toggle={closeDialog}>{typeForm=="add" ? "Add" : "Edit" } Assign Human Resource</ModalHeader>
<Option value={"Day"}>Day</Option> <ModalBody>
<Option value={"Hour"}>Hour</Option> {renderForm()}
</Select> </ModalBody>
</FormGroup> <ModalFooter>
</div> <Button color="primary" onClick={() => handleSave()}>{typeForm=="add" ? "Add" : "Edit" }</Button>{' '}
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Cancel</Button>
<div style={{widht:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}}> </ModalFooter>
<FormGroup style={{flexBasis:"49%"}}> </Modal>
<Label>Overtime Rate</Label> </>
<Input type="text" onChange={(e) => setOverTimeRate(formatNumber(e.target.value))} value={overTimeRate} placeholder='1.000...' /> )
</FormGroup>
<div style={{flexBasis:"2%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}}> }
/
</div> export default FormAsignHr;
<FormGroup style={{flexBasis:"49%"}}>
<Label>UOM Overtime Rate</Label>
<Select value={overTimeRateUom} onChange={(val) => setOverTimeRateUom(val)} style={{ width: '100%' }} placeholder="Select UOM">
<Option value={"Day"}>Day</Option>
<Option value={"Hour"}>Hour</Option>
</Select>
</FormGroup>
</div>
</Form>
)
}
return (
<>
<Modal size="lg" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}>{typeForm=="add" ? "Add" : "Edit" } Assign Human Resource</ModalHeader>
<ModalBody>
{renderForm()}
</ModalBody>
<ModalFooter>
<Button color="primary" onClick={() => handleSave()}>{typeForm=="add" ? "Add" : "Edit" }</Button>{' '}
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Cancel</Button>
</ModalFooter>
</Modal>
</>
)
}
export default FormAsignHr;

165
src/views/SimproV2/CreatedProyek/ViewProject.js

@ -7,7 +7,7 @@ import _ from 'underscore'
import './style.css' import './style.css'
import { formatThousand, sortBy } from '../../../const/CustomFunc'; import { formatThousand, sortBy } from '../../../const/CustomFunc';
import { BASE_OSPRO, PROYEK_SEARCH} from "../../../const/ApiConst"; import { BASE_OSPRO, PROYEK_SEARCH} from "../../../const/ApiConst";
import { Tooltip } from 'antd'; import { Tooltip, Spin } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import axios from "../../../const/interceptorApi" import axios from "../../../const/interceptorApi"
import autoTable from "jspdf-autotable"; import autoTable from "jspdf-autotable";
@ -47,6 +47,7 @@ const createMarkup = (element) => {
const [HR, setAssignHR] = useState("") const [HR, setAssignHR] = useState("")
const formatDate = "DD-MM-YYYY"; const formatDate = "DD-MM-YYYY";
const reportTemplateRef = useRef(null); const reportTemplateRef = useRef(null);
const [loading, setLoading] = useState(true);
const { t } = useTranslation(); const { t } = useTranslation();
const token = localStorage.getItem("token"); const token = localStorage.getItem("token");
@ -85,6 +86,7 @@ const createMarkup = (element) => {
setMilestone([]) setMilestone([])
setPotentialRisks("") setPotentialRisks("")
setApproval([]) setApproval([])
setLoading(false)
} }
}, [openDialog]); }, [openDialog]);
@ -93,7 +95,7 @@ const createMarkup = (element) => {
setProyekName(projectCharter.nama); setProyekName(projectCharter.nama);
setDescription(projectCharter.keterangan); setDescription(projectCharter.keterangan);
setKodeShortname(projectCharter.kode_sortname); setKodeShortname(projectCharter.kode_sortname);
setLokasiKantor(projectCharter.lokasi_kantor); setLokasiKantor(projectCharter.area_kerja);
setDurasiProyek(projectCharter.durasi_proyek); setDurasiProyek(projectCharter.durasi_proyek);
setMulaiProyek(projectCharter.mulai_proyek); setMulaiProyek(projectCharter.mulai_proyek);
setValueProyek(projectCharter.value_proyek); setValueProyek(projectCharter.value_proyek);
@ -171,12 +173,11 @@ const createMarkup = (element) => {
setAssignHR(assignHR) setAssignHR(assignHR)
} }
}, [assignHR]); }, [assignHR]);
const handleExportPdf = async () => { const handleExportPdf = async () => {
const doc = new jsPDF({ const doc = new jsPDF({
orientation: 'landscape', orientation: 'landscape',
unit: 'px', unit: 'px',
format: [1130, 1000] format: [1106, 1000]
}); });
doc.html(reportTemplateRef.current, { doc.html(reportTemplateRef.current, {
@ -212,14 +213,18 @@ const createMarkup = (element) => {
const K3Number = number[index]; const K3Number = number[index];
return( return(
<tr key={index}> <tr key={index}>
<td style={{...tdStyle, width:50, textAlign:'center' }}><p style={pStyle}>{ K3Number }</p></td> <td style={{...tdStyle, width:50, textAlign:'center' }}><p style={{ ...pStyle, fontWeight:'normal' }}>{ K3Number }</p></td>
<td style={tdStyle} className='plr-10'><p style={pStyle}>{val.checklist_k3_name ? val.checklist_k3_name : "-"}</p></td> <td style={ tdStyle } className='plr-10'><p style={{ ...pStyle, fontWeight:'normal' }}>{val.checklist_k3_name ? val.checklist_k3_name : "-"}</p></td>
</tr> </tr>
) )
}) })
) )
}else{ }else{
return (<tr><td><br></br></td></tr>) return (
<tr>
<td style={{ ...tdStyle, textAlign: "center" }}>-</td>
<td style={{ ...tdStyle, textAlign: "center" }}>-</td>
</tr>);
} }
} }
@ -231,10 +236,10 @@ const createMarkup = (element) => {
const ChecklistNumber = number[index]; const ChecklistNumber = number[index];
return( return(
<tr key={index}> <tr key={index}>
<td style={{...tdStyle, width:50, textAlign:'center' }}><p style={pStyle}>{ ChecklistNumber }</p></td> <td style={{...tdStyle, width:50, textAlign:'center' }}><p style={{ ...pStyle, fontWeight:'normal' }}>{ ChecklistNumber }</p></td>
<td style={tdStyle} className='plr-10'><p style={pStyle}>{val.item ? val.item : "-"}</p></td> <td style={ tdStyle } className='plr-10'><p style={{ ...pStyle, fontWeight:'normal' }}>{val.item ?? "-"}</p></td>
<td style={tdStyle} className='plr-10'> <td style={ tdStyle } className='plr-10'>
<p style={pStyle}> <p style={{ ...pStyle, fontWeight:'normal' }}>
{val.status_exist === true ? "Tersedia" : "Tidak tersedia"} {val.status_exist === true ? "Tersedia" : "Tidak tersedia"}
</p> </p>
</td> </td>
@ -243,7 +248,12 @@ const createMarkup = (element) => {
}) })
) )
}else{ }else{
return (<tr><td><br></br></td></tr>) return (
<tr>
<td style={{ ...tdStyle, textAlign: "center" }}>-</td>
<td style={{ ...tdStyle, textAlign: "center" }}>-</td>
<td style={{ ...tdStyle, textAlign: "center" }}>-</td>
</tr>);
} }
} }
@ -254,17 +264,21 @@ const createMarkup = (element) => {
return( return(
<tr key={index}> <tr key={index}>
<td style={{ ...tdStyle, width:50, textAlign:'center' }} className='plr-10'> <td style={{ ...tdStyle, width:50, textAlign:'center' }} className='plr-10'>
<p style={pStyle}> <p style={{ ...pStyle, fontWeight:'normal' }}>
{val.level_issue ? val.level_issue : "-"} {val.level_issue ? val.level_issue : "-"}
</p> </p>
</td> </td>
<td style={tdStyle} className='plr-10'><p style={pStyle}>{val.description ? val.description : "-"}</p></td> <td style={ tdStyle } className='plr-10'><p style={{ ...pStyle, fontWeight:'normal' }}>{val.description ? val.description : "-"}</p></td>
</tr> </tr>
) )
}) })
) )
}else{ }else{
return (<tr><td><br></br></td></tr>) return (
<tr>
<td style={{ ...tdStyle, textAlign:"center" }}>-</td>
<td style={{ ...tdStyle, textAlign:"center" }}>-</td>
</tr>)
} }
} }
@ -275,18 +289,23 @@ const createMarkup = (element) => {
return( return(
<tr key={index}> <tr key={index}>
<td style={{ ...tdStyle, width:50, textAlign:'center' }} className='plr-10'> <td style={{ ...tdStyle, width:50, textAlign:'center' }} className='plr-10'>
<p style={pStyle}> <p style={{ ...pStyle, fontWeight:'normal' }}>
{val.level_risk ? val.level_risk : "-"} {val.level_risk ?? "-"}
</p> </p>
</td> </td>
<td style={tdStyle} className='plr-10'><p style={pStyle}>{val.description ? val.description : "-"}</p></td> <td style={ tdStyle } className='plr-10'><p style={{ ...pStyle, fontWeight:'normal' }}>{val.description ?? "-"}</p></td>
<td style={tdStyle} className='plr-10'><p style={pStyle}>{val.preventive_risk ? val.preventive_risk : "-"}</p></td> <td style={ tdStyle } className='plr-10'><p style={{ ...pStyle, fontWeight:'normal' }}>{val.preventive_risk ?? "-"}</p></td>
</tr> </tr>
) )
}) })
) )
}else{ }else{
return (<tr><td><br></br></td></tr>) return (
<tr>
<td style={{ ...tdStyle, textAlign:"center" }}>-</td>
<td style={{ ...tdStyle, textAlign:"center" }}>-</td>
<td style={{ ...tdStyle, textAlign:"center" }}>-</td>
</tr>)
} }
} }
@ -297,20 +316,25 @@ const createMarkup = (element) => {
return( return(
<tr key={index}> <tr key={index}>
<td style={tdStyle} className='plr-10'> <td style={tdStyle} className='plr-10'>
<p>{val.join_first_name ? val.join_first_name : val.join_first_name}</p> <p>{val.join_first_name ? val.join_first_name : "-"}</p>
</td> </td>
<td style={tdStyle} className='plr-10'> <td style={tdStyle} className='plr-10'>
<p>{val.join_second_name ? val.join_second_name : val.join_second_name}</p> <p>{val.join_second_name ? val.join_second_name : "-"}</p>
</td> </td>
<td style={tdStyle} className='plr-10'> <td style={tdStyle} className='plr-10'>
<p>{val.join_second_description ? val.join_second_description : val.join_second_description}</p> <p>{val.join_second_description ? val.join_second_description : "-"}</p>
</td> </td>
</tr> </tr>
) )
}) })
) )
}else{ }else{
return (<tr><td><br></br></td></tr>) return (
<tr>
<td style={{ ...tdStyle, textAlign:"center" }}>-</td>
<td style={{ ...tdStyle, textAlign:"center" }}>-</td>
<td style={{ ...tdStyle, textAlign:"center" }}>-</td>
</tr>)
} }
} }
@ -328,20 +352,28 @@ const createMarkup = (element) => {
return ( return (
<tr key={index}> <tr key={index}>
<td style={tdStyle}> <td style={tdStyle}>
<p style={{ ...pStyle, textAlign:'center' }}>{milestoneLetter}</p> <p style={{ ...pStyle, fontWeight:'normal', textAlign:'center' }}>{milestoneLetter}</p>
</td> </td>
<td className='plr-10' style={tdStyle}> <td className='plr-10' style={tdStyle}>
<p style={{ ...pStyle, color: '#000000' }}>{val.status}</p> <p style={{ ...pStyle, fontWeight:'normal', color: '#000000' }}>{val.status ?? "-"}</p>
</td> </td>
<td className='plr-10' style={{ ...tdStyle, textAlign:'center' }}> <td className='plr-10' style={{ ...tdStyle, textAlign:'center' }}>
<p>&nbsp;{moment(val.deadline).format(formatDate)}</p> <p style={{ ...pStyle, fontWeight: 'normal', color: '#000000' }}>
&nbsp;{moment(val.deadline).format(formatDate)}
</p>
</td> </td>
</tr> </tr>
); );
}) })
); );
} else { } else {
return (<tr><td><br></br></td></tr>); return (
<tr>
<td style={{ ...tdStyle, textAlign: "center" }}>-</td>
<td style={{ ...tdStyle, textAlign: "center" }}>-</td>
<td style={{ ...tdStyle, textAlign: "center" }}>-</td>
</tr>);
} }
} }
@ -359,7 +391,10 @@ const createMarkup = (element) => {
}) })
) )
}else{ }else{
return (<tr><td><br></br></td></tr>) return (
<tr>
<td style={{ textAlign:"center" }}>&nbsp;-</td>
</tr>)
} }
} }
@ -391,9 +426,16 @@ const createMarkup = (element) => {
padding: '0', padding: '0',
}; };
const paddingTable = {
paddingTop:"20px",
paddingLeft: "30px",
paddingRight: "30px"
}
const renderForm = () => { const renderForm = () => {
return ( return (
<div id="pdf-content"> <div id="pdf-content" style={ paddingTable }>
<h3>Project Charter</h3>
<table style={tableStyle} className="a"> <table style={tableStyle} className="a">
<tbody> <tbody>
<tr> <tr>
@ -406,7 +448,7 @@ const createMarkup = (element) => {
<p style={ pStyle }>Nama Proyek</p> <p style={ pStyle }>Nama Proyek</p>
</td> </td>
<td colSpan="2" style={tdStyle}> <td colSpan="2" style={tdStyle}>
<p style={{ ...pStyle, fontWeight: 'normal', fontStyle: 'italic' }}>{proyekName ?? '-'}</p> <p className="capitalize" style={{ ...pStyle, fontWeight: 'normal' }}>{proyekName ?? '-'}</p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -414,7 +456,7 @@ const createMarkup = (element) => {
<p style={ pStyle }>Project description</p> <p style={ pStyle }>Project description</p>
</td> </td>
<td colSpan="2" style={tdStyle}> <td colSpan="2" style={tdStyle}>
<p style={{ ...pStyle, fontWeight: 'normal', fontStyle: 'italic' }}>{description ?? '-'}</p> <p style={{ ...pStyle, fontWeight: 'normal' }}>{description != "" ? description : '-'}</p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -430,7 +472,7 @@ const createMarkup = (element) => {
<p style={ pStyle }>Lokasi Proyek</p> <p style={ pStyle }>Lokasi Proyek</p>
</td> </td>
<td colSpan="2" style={tdStyle}> <td colSpan="2" style={tdStyle}>
<p>&nbsp;{lokasi ?? '-' }</p> <p>&nbsp;{lokasi != "" ? lokasi :'-' }</p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -462,7 +504,7 @@ const createMarkup = (element) => {
<p style={ pStyle }>Anggaran Proyek</p> <p style={ pStyle }>Anggaran Proyek</p>
</td> </td>
<td colSpan="2" style={tdStyle}> <td colSpan="2" style={tdStyle}>
<p style={{ ...pStyle, fontWeight: 'normal', fontStyle: 'italic' }}>{currency}. {formatThousand(budget)}</p> <p style={{ ...pStyle, fontWeight: 'normal' }}>{currency}. {formatThousand(budget)}</p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -483,7 +525,7 @@ const createMarkup = (element) => {
<p style={ pStyle }>Project Manager</p> <p style={ pStyle }>Project Manager</p>
</td> </td>
<td colSpan="2" style={tdStyle}> <td colSpan="2" style={tdStyle}>
<p>&nbsp;{PM}</p> <p>&nbsp;{PM ?? "-"}</p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -506,7 +548,13 @@ const createMarkup = (element) => {
</tr> </tr>
<tr> <tr>
<td style={tdStyle}> <td style={tdStyle}>
<p style={{ fontStyle: 'italic' }}>{objectives ?? '-'}</p> <p style={{ ...pStyle, fontWeight: 'normal' }}>
{objectives ? (
<span dangerouslySetInnerHTML={createMarkup(objectives)} />
) : (
'-'
)}
</p>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -522,7 +570,11 @@ const createMarkup = (element) => {
<tr> <tr>
<td style={tdStyle}> <td style={tdStyle}>
<ul> <ul>
<li style={pStyle}>{ scoupeProyek ?? '-' }</li> {scoupeProyek ? (
<li style={pStyle}>{ scoupeProyek ?? '-' }</li>
) : (
"-"
)}
</ul> </ul>
</td> </td>
</tr> </tr>
@ -562,7 +614,7 @@ const createMarkup = (element) => {
<th style={emptyCellStyle}> <th style={emptyCellStyle}>
<p>&nbsp; <p>&nbsp;
{image ? ( {image ? (
<img src={`${BASE_OSPRO}/assets/image/` + image} style={{ width: "50px" }}></img> <img src={`${BASE_OSPRO}/assets/image/` + image} style={{ maxWidth: "100%" }}></img>
) : ( ) : (
'-' '-'
)} )}
@ -645,7 +697,13 @@ const createMarkup = (element) => {
</th> </th>
</tr> </tr>
<tr> <tr>
<p dangerouslySetInnerHTML={createMarkup(lateProyek ?? '-')}></p> <p style={{ ...pStyle, fontWeight: 'normal' }}>
{lateProyek ? (
<span dangerouslySetInnerHTML={createMarkup(lateProyek)} />
) : (
"-"
)}
</p>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -659,7 +717,13 @@ const createMarkup = (element) => {
</tr> </tr>
<tr> <tr>
<th> <th>
<p style={pStyle}>{projectSuccess ?? '-'}</p> <p style={{ ...pStyle, fontWeight: 'normal' }}>
{projectSuccess ? (
<span dangerouslySetInnerHTML={createMarkup(projectSuccess)} />
) : (
'-'
)}
</p>
</th> </th>
</tr> </tr>
</tbody> </tbody>
@ -674,7 +738,13 @@ const createMarkup = (element) => {
</tr> </tr>
<tr> <tr>
<td> <td>
<p dangerouslySetInnerHTML={createMarkup(assumtionProyek ?? '-')}></p> <p style={{ ...pStyle, fontWeight: 'normal' }}>
{assumtionProyek ? (
<span dangerouslySetInnerHTML={createMarkup(assumtionProyek)} />
) : (
'-'
)}
</p>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -741,15 +811,10 @@ const createMarkup = (element) => {
<> <>
<Modal size="xl" isOpen={openDialog} toggle={toggleDialog}> <Modal size="xl" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}> <ModalHeader className="capitalize" toggle={closeDialog}>
<div style={{ display: "flex", justifyContent: "space-between" }}> <div>
<div> <Tooltip title={t('Export PDF')}>
Project <Button style={{ marginLeft: "5px" }} onClick={(e) => handleExportPdf()}><i className="fa fa-print"></i> Export PDF</Button>
</div> </Tooltip>
<div>
<Tooltip title={t('Export PDF')}>
<Button style={{ marginLeft: "5px" }} onClick={(e) => handleExportPdf()}><i className="fa fa-print"></i></Button>
</Tooltip>
</div>
</div> </div>
</ModalHeader> </ModalHeader>
<ModalBody> <ModalBody>

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

@ -601,8 +601,8 @@ const CreatedProyek = ({ params, ...props }) => {
.catch((error) => error.response); .catch((error) => error.response);
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
const {kode_sortname,nama,mulai_proyek,rencana_biaya,keterangan,durasi_proyek,project_objectives,potential_risk,currency_symbol, nama_divisi, late_consequence, assumtion, considered_success_when} = result.data.data; const {value_proyek,area_kerja,scoupe_of_work, kode_sortname,nama,mulai_proyek,rencana_biaya,keterangan,durasi_proyek,project_objectives,potential_risk,currency_symbol, nama_divisi, late_consequence, assumtion, considered_success_when} = result.data.data;
const dataToSend = {kode_sortname, nama, mulai_proyek, rencana_biaya, keterangan, durasi_proyek, project_objectives, potential_risk, currency_symbol, nama_divisi, late_consequence, assumtion, considered_success_when}; const dataToSend = {value_proyek,area_kerja,scoupe_of_work, kode_sortname, nama, mulai_proyek, rencana_biaya, keterangan, durasi_proyek, project_objectives, potential_risk, currency_symbol, nama_divisi, late_consequence, assumtion, considered_success_when};
setProjectCharter(dataToSend); setProjectCharter(dataToSend);
} else { } else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); NotificationManager.error("Gagal Mengambil Data!!", "Failed");
@ -956,7 +956,7 @@ const CreatedProyek = ({ params, ...props }) => {
const request = data.map((res) => { const request = data.map((res) => {
const payload = { const payload = {
proyek_id: parseInt(id), proyek_id: parseInt(id),
tittle: res.title, tittle: res.tittle,
name: res.name, name: res.name,
}; };
return axios.post(PROJECT_PARTICIPANT_ADD, payload, HEADER); return axios.post(PROJECT_PARTICIPANT_ADD, payload, HEADER);
@ -1971,7 +1971,7 @@ const CreatedProyek = ({ params, ...props }) => {
</Button> </Button>
</Tooltip> </Tooltip>
)} )}
<Tooltip title="Export Excel"> <Tooltip title="Export">
<Popover <Popover
// content={<a onClick={hide}>Close</a>} // content={<a onClick={hide}>Close</a>}
title="Export" title="Export"

4
src/views/SimproV2/Divisi/DialogForm.js

@ -59,13 +59,15 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setId(0) setId(0)
setDescription('') setDescription('')
setName('') setName('')
setParent(null)
} }
} }
const handleCancel = () => { const handleCancel = () => {
closeDialog('cancel', 'none') closeDialog('cancel', 'none')
setId(0) setId(0)
setDescription('') setDescription('')
setName('') setName('')
setParent(null)
} }
const renderForm = () => { const renderForm = () => {

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

@ -72,8 +72,10 @@ const ProjectType = ({ params }) => {
if (listDivions && listDivions.data && listDivions.data.code == 200) { if (listDivions && listDivions.data && listDivions.data.code == 200) {
let arr = [] let arr = []
for (const v in listDivions.data.data) { let dataRes = listDivions.data.data;
arr.push(listDivions.data.data[v]) const filteredData = dataRes.filter(item => item.parent === null);
for (const v in filteredData) {
arr.push(filteredData[v])
} }
setDataDivisions(arr); setDataDivisions(arr);
} else { } else {
@ -183,7 +185,8 @@ const ProjectType = ({ params }) => {
}; };
const handleOpenDialog = (type) => { const handleOpenDialog = (type) => {
setOpenDialog(true) setOpenDialog(true)
getListDivision();
setTypeDialog(type) setTypeDialog(type)
} }

Loading…
Cancel
Save