Browse Source

filter by company_id

pull/1/head
farhantock 1 year ago
parent
commit
49d46d394e
  1. 1
      src/views/SimproV2/ChecklistK3/index.js
  2. 65
      src/views/SimproV2/CreatedProyek/AsignCustProject.js
  3. 73
      src/views/SimproV2/CreatedProyek/AsignHrProject.js
  4. 87
      src/views/SimproV2/CreatedProyek/DialogAssignCust.js
  5. 1391
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  6. 86
      src/views/SimproV2/CreatedProyek/index.js

1
src/views/SimproV2/ChecklistK3/index.js

@ -285,6 +285,7 @@ const ChecklistK3 = ({ params }) => {
dataEdit={dataEdit} dataEdit={dataEdit}
clickOpenModal={clickOpenModal} clickOpenModal={clickOpenModal}
dataParent={allDataMenu} dataParent={allDataMenu}
company_id={company_id}
/> />
<Card> <Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}> <CardHeader style={{ display: "flex", justifyContent: "space-between" }}>

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

@ -5,15 +5,15 @@ 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 { import {
ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_SEARCH,
ASSIGN_HR_PROJECT_DELETE ASSIGN_HR_PROJECT_DELETE
} from '../../../const/ApiConst'; } 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 FormAsignCust from './DialogAssignCust'; import FormAsignCust from './DialogAssignCust';
const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName }) => { const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, company_id }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
@ -25,11 +25,11 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
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 [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (idTask > 0) {
setLoading(true); setLoading(true);
getDataAssignHr(); getDataAssignHr();
} }
}, [openDialog]); }, [openDialog]);
@ -64,11 +64,11 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [] let dataRes = result.data.data || []
const filteredData = dataRes.filter(item => item.is_customer === true); const filteredData = dataRes.filter(item => item.is_customer === true);
setdataUserToProject(filteredData); setdataUserToProject(filteredData);
setLoading(false); setLoading(false);
} else { } else {
setLoading(false); setLoading(false);
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
} }
} }
@ -119,7 +119,7 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
key: 'x', key: 'x',
className: "nowrap", className: "nowrap",
render: (text, record) => <><Tooltip title={`Delete Request Resource ${text.id}`}> render: (text, record) => <><Tooltip title={`Delete Request Resource ${text.id}`}>
<Button size={"sm"} color='danger' onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button> <Button size={"sm"} color='danger' onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button>
</Tooltip>{" "}</>, </Tooltip>{" "}</>,
}, },
{ title: 'Name Human Resource', dataIndex: 'join_first_name', key: 'join_first_name', className: "nowrap" } { title: 'Name Human Resource', dataIndex: 'join_first_name', key: 'join_first_name', className: "nowrap" }
@ -137,28 +137,28 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
const renderForm = () => { const renderForm = () => {
return ( return (
<div style={{"overflowX":"scroll"}}> <div style={{ "overflowX": "scroll" }}>
{RenderTable} {RenderTable}
</div> </div>
) )
} }
const handleCloseDialogFormTools = (type, data) => { const handleCloseDialogFormTools = (type, data) => {
if (type === "add") { if (type === "add") {
getDataAssignHr() getDataAssignHr()
} }
if (type === "success") { if (type === "success") {
NotificationManager.success( NotificationManager.success(
`Assign Customer Project berhasil disimpan!`, `Assign Customer Project berhasil disimpan!`,
"Success!!" "Success!!"
); );
} else if (type === "failed") { } else if (type === "failed") {
NotificationManager.error( NotificationManager.error(
`Assign Customer Project gagal disimpan!`, `Assign Customer Project gagal disimpan!`,
"Failed!!" "Failed!!"
); );
} }
setOpenDialogFormTools(false) setOpenDialogFormTools(false)
} }
const toogleDialogFormTools = () => { const toogleDialogFormTools = () => {
@ -189,10 +189,10 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
<div>Assign Customer - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button> <div>Assign Customer - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button>
</ModalHeader> </ModalHeader>
<ModalBody> <ModalBody>
<Spin tip="Loading..." spinning={loading}> <Spin tip="Loading..." spinning={loading}>
{renderForm()} {renderForm()}
</Spin> </Spin>
</ModalBody> </ModalBody>
</Modal> </Modal>
<FormAsignCust <FormAsignCust
@ -200,6 +200,7 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
closeDialog={handleCloseDialogFormTools} closeDialog={handleCloseDialogFormTools}
toggleDialog={toogleDialogFormTools} toggleDialog={toogleDialogFormTools}
idTask={idTask} idTask={idTask}
company_id={company_id}
/> />
</> </>
) )

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

@ -4,14 +4,14 @@ import { Button, Form } from 'reactstrap';
import { 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 { 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 { USER_SEARCH, ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_DELETE, 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, company_id, proyekName }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
@ -25,18 +25,18 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
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([])
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (idTask > 0) {
setLoading(true); setLoading(true);
getDataAssignHr(); getDataAssignHr();
} }
}, [openDialog]); }, [openDialog]);
useEffect(() => { useEffect(() => {
if (openDialog) { if (openDialog) {
getDataProjectRole(); getDataProjectRole();
getDataUser(); getDataUser();
} }
@ -50,8 +50,8 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
}, },
"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" } { "name": "is_customer", "logic_operator": "=", "value": "false" }
], ],
"joins": [ "joins": [
{ "name": "m_users", "column_join": "user_id", "column_results": ["name"] }, { "name": "m_users", "column_join": "user_id", "column_results": ["name"] },
@ -72,23 +72,38 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [] let dataRes = result.data.data || []
setdataUserToProject(dataRes); setdataUserToProject(dataRes);
setLoading(false); setLoading(false);
} else { } else {
setLoading(false); setLoading(false);
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
} }
} }
const getDataUser = async () => { const getDataUser = async () => {
const HEADER_ADW = {
headers: { const payload = {
"Authorization": `${TOKEN_ADW}` "select": [
"id",
"name",
"role_id"
],
"paging": {
"start": 0,
"length": -1
},
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id },
],
"orders": {
"columns": [
"id"
],
"ascending": false
} }
} }
const result = await axios const result = await axios
// .get(`${API_ADW}employees`, HEADER_ADW) .post(USER_SEARCH, payload, HEADER)
.get(USER_LIST, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if (result && result.data && result.data.data.length != 0) { if (result && result.data && result.data.data.length != 0) {
@ -161,7 +176,7 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
} }
const handleOpenDialogFormTools = () => { const handleOpenDialogFormTools = () => {
setOpenDialogFormTools(true) setOpenDialogFormTools(true)
} }
const handleCancel = () => { const handleCancel = () => {
@ -177,10 +192,10 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
key: 'x', key: 'x',
className: "nowrap", className: "nowrap",
render: (text, record) => <><Tooltip title="Delete Request Resource"> render: (text, record) => <><Tooltip title="Delete Request Resource">
<Button size={"sm"} color='danger' onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button> <Button 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={"sm"} color='primary' onClick={() => handleEdit(text)}><i className="fa fa-edit"></i></Button> <Button size={"sm"} color='primary' onClick={() => handleEdit(text)}><i className="fa fa-edit"></i></Button>
</Tooltip></>, </Tooltip></>,
}, },
{ title: 'Name Human Resource', dataIndex: 'join_first_name', key: 'join_first_name', className: "nowrap" }, { 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: 'Role Human Resource', dataIndex: 'join_second_name', key: 'join_second_name', className: "nowrap" },
@ -204,18 +219,18 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
const renderForm = () => { const renderForm = () => {
return ( return (
<div style={{"overflowX":"scroll"}}> <div style={{ "overflowX": "scroll" }}>
{RenderTable} {RenderTable}
</div> </div>
) )
} }
const handleCloseDialogFormTools = (type, data) => { const handleCloseDialogFormTools = (type, data) => {
if(type=="add"){ if (type == "add") {
addDataAssignHr(data); addDataAssignHr(data);
}else if(type=="edit"){ } else if (type == "edit") {
editDataAssignHr(data); editDataAssignHr(data);
}else{ } else {
setDataEdit(null) setDataEdit(null)
setOpenDialogFormTools(false) setOpenDialogFormTools(false)
} }
@ -237,7 +252,7 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
} }
} }
const editDataAssignHr = async (payload) => { const editDataAssignHr = async (payload) => {
let url = ASSIGN_HR_PROJECT_EDIT(payload.id) let url = ASSIGN_HR_PROJECT_EDIT(payload.id)
const result = await axios const result = await axios
.put(url, payload, HEADER) .put(url, payload, HEADER)
@ -283,10 +298,10 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
<div>Assign Human Resource - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button> <div>Assign Human Resource - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button>
</ModalHeader> </ModalHeader>
<ModalBody> <ModalBody>
<Spin tip="Loading..." spinning={loading}> <Spin tip="Loading..." spinning={loading}>
{renderForm()} {renderForm()}
</Spin> </Spin>
</ModalBody> </ModalBody>
{/* <ModalFooter> {/* <ModalFooter>
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Close</Button> <Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Close</Button>

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

@ -12,7 +12,7 @@ import 'antd/dist/antd.css';
import { NotificationManager } from 'react-notifications'; import { NotificationManager } from 'react-notifications';
const role_id = localStorage.getItem('role_id'); const role_id = localStorage.getItem('role_id');
const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) => { const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask, company_id }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
@ -46,19 +46,20 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
"name", "name",
"role_id" "role_id"
], ],
"paging": { "paging": {
"start": 0, "start": 0,
"length": -1 "length": -1
}, },
"columns": [ "columns": [
{ "name": "role_id", "logic_operator": "=", "value": 44 } { "name": "role_id", "logic_operator": "=", "value": 44 },
], { "name": "company_id", "logic_operator": "=", "value": company_id },
"orders": { ],
"columns": [ "orders": {
"id" "columns": [
], "id"
"ascending": false ],
} "ascending": false
}
} }
const URL = USER_SEARCH; const URL = USER_SEARCH;
const result = await axios const result = await axios
@ -90,7 +91,7 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
handleCLearData() handleCLearData()
} }
const saveCustProject= async () => { const saveCustProject = async () => {
const formData = { const formData = {
user_id: targetKeys, user_id: targetKeys,
@ -102,9 +103,9 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if(result && result.status==200){ if (result && result.status == 200) {
closeDialog('success') closeDialog('success')
}else{ } else {
closeDialog('failed') closeDialog('failed')
} }
} }
@ -120,32 +121,32 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
const getCustProject = async () => { const getCustProject = async () => {
const payload = { const payload = {
"select": [ "select": [
"id", "id",
"user_id", "user_id",
"proyek_id", "proyek_id",
"is_customer" "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" }
] ]
} }
const result = await axios const result = await axios
.post(ASSIGN_HR_PROJECT_SEARCH, payload, HEADER) .post(ASSIGN_HR_PROJECT_SEARCH, payload, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if(result && result.status==200){ if (result && result.status == 200) {
console.log("cek get assign HR is custumer",result.data.data) console.log("cek get assign HR is custumer", result.data.data)
let data = result.data.data || [] let data = result.data.data || []
let newTargetKeys = [] let newTargetKeys = []
if (data.length > 0) { if (data.length > 0) {
data.map((val,index)=> { data.map((val, index) => {
newTargetKeys.push(val.user_id) newTargetKeys.push(val.user_id)
}); });
} }
setTargetKeys(newTargetKeys) setTargetKeys(newTargetKeys)
} }
} }
const renderForm = () => { const renderForm = () => {
@ -158,16 +159,16 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
overflow: "auto" overflow: "auto"
}}> }}>
<Transfer <Transfer
showSearch showSearch
titles={['Available Customer', 'Granted to']} titles={['Available Customer', 'Granted to']}
dataSource={assignCustomer} dataSource={assignCustomer}
targetKeys={targetKeys} targetKeys={targetKeys}
onChange={handleChange} onChange={handleChange}
render={item => item.title} render={item => item.title}
listStyle={{ listStyle={{
width: 250, width: 250,
height: 300, height: 300,
}} }}
/> />
</div> </div>
) )
@ -176,7 +177,7 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
return ( return (
<> <>
<Modal size="lg" style={{maxWidth: '600px', width: '100%'}} isOpen={openDialog} toggle={toggleDialog}> <Modal size="lg" style={{ maxWidth: '600px', width: '100%' }} isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}>Add Customer</ModalHeader> <ModalHeader className="capitalize" toggle={closeDialog}>Add Customer</ModalHeader>
<ModalBody> <ModalBody>
{renderForm()} {renderForm()}

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

File diff suppressed because it is too large Load Diff

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

@ -23,31 +23,23 @@ import {
} from "antd"; } from "antd";
import { import {
PROJECT_APPROVAL_ADD, PROJECT_APPROVAL_ADD,
PROJECT_APPROVAL_EDIT,
PROJECT_PARTICIPANT_ADD, PROJECT_PARTICIPANT_ADD,
PROJECT_CHECKLIST_ADD, PROJECT_CHECKLIST_ADD,
PROJECT_ISSUE_ADD, PROJECT_ISSUE_ADD,
PROJECT_RISK_ADD, PROJECT_RISK_ADD,
PROJECT_PARTICIPANT_EDIT,
PROJECT_MILESTONE_ADD, PROJECT_MILESTONE_ADD,
PROJECT_MILESTONE_EDIT,
PROJECT_PARTICIPANT_DELETE_BY_PROYEK, PROJECT_PARTICIPANT_DELETE_BY_PROYEK,
PROJECT_MILESTONE_DELETE_BY_PROYEK, PROJECT_MILESTONE_DELETE_BY_PROYEK,
PROJECT_APPROVAL_DELETE_BY_PROYEK, PROJECT_APPROVAL_DELETE_BY_PROYEK,
USER_LIST, USER_SEARCH,
TYPE_PROYEK,
PROJECT_TYPE_SEARCH,
PROYEK_ADD, PROYEK_ADD,
PROYEK_SEARCH, PROYEK_SEARCH,
PROYEK_SEARCH_BY_USER,
PROYEK_EDIT, PROYEK_EDIT,
ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_SEARCH,
PROJECT_CHECKLIST_SEARCH, PROJECT_CHECKLIST_SEARCH,
PROYEK_DELETE, PROYEK_DELETE,
TOOLS_RESOURCE_SEARCH,
MATERIAL_RESOURCE_SEARCH,
USER_SEARCH,
PROJECT_CHARTER_SEARCH,
HIERARCHY_FTTH_SEARCH,
PROJECT_ISSUE_SEARCH, PROJECT_ISSUE_SEARCH,
PROJECT_RISK_SEARCH, PROJECT_RISK_SEARCH,
PROJECT_CHECKLIST_DELETE_BY_PROYEK, PROJECT_CHECKLIST_DELETE_BY_PROYEK,
@ -61,18 +53,15 @@ import {
PROJECT_APPROVAL_SEARCH, PROJECT_APPROVAL_SEARCH,
CHECKLIST_K3_LIST, CHECKLIST_K3_LIST,
VERSION_GANTT_SEARCH, VERSION_GANTT_SEARCH,
PHASE_PROYEK, PROJECT_PHASE_SEARCH,
DIVISI_LIST, DIVISI_SEARCH,
BASE_OSPRO, BASE_OSPRO,
IMAGE_UPLOAD, IMAGE_UPLOAD,
IMAGE_GET_BY_ID, IMAGE_GET_BY_ID,
IMAGE_DELETE, IMAGE_DELETE,
} from "../../../const/ApiConst"; } from "../../../const/ApiConst";
import { import {
formatNumber, formatThousand
formatRupiah,
formatThousand,
renderFormatRupiah,
} from "../../../const/CustomFunc"; } from "../../../const/CustomFunc";
import moment from "moment"; import moment from "moment";
// import DialogFormResource from './DialogFormResource'; // import DialogFormResource from './DialogFormResource';
@ -96,7 +85,7 @@ const url = "";
const format = "DD-MM-YYYY"; const format = "DD-MM-YYYY";
const CreatedProyek = ({ params, ...props }) => { const CreatedProyek = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = ''; let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0;
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id; role_id = props.location.state.role_id;
user_id = props.location.state.user_id; user_id = props.location.state.user_id;
@ -109,6 +98,7 @@ const CreatedProyek = ({ params, ...props }) => {
user_id = localStorage.getItem("user_id"); user_id = localStorage.getItem("user_id");
token = localStorage.getItem("token"); token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin"); isLogin = localStorage.getItem("isLogin");
company_id = localStorage.getItem('company_id');
} }
const history = useHistory(); const history = useHistory();
const HEADER = { const HEADER = {
@ -234,8 +224,17 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const handleGetTipeProject = async () => { const handleGetTipeProject = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios const result = await axios
.get(TYPE_PROYEK, HEADER) .post(PROJECT_TYPE_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
.catch((err) => err.response); .catch((err) => err.response);
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
@ -245,8 +244,17 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const handleGetPhaseProject = async () => { const handleGetPhaseProject = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios const result = await axios
.get(PHASE_PROYEK, HEADER) .post(PROJECT_PHASE_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
.catch((err) => err.response); .catch((err) => err.response);
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
@ -255,8 +263,17 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const handleGetDivisions = async () => { const handleGetDivisions = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios const result = await axios
.get(DIVISI_LIST, HEADER) .post(DIVISI_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
.catch((err) => err.response); .catch((err) => err.response);
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
@ -266,9 +283,18 @@ const CreatedProyek = ({ params, ...props }) => {
} }
}; };
const handleGetDataPm = async (text) => { const handleGetDataPm = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios const result = await axios
.get(USER_LIST, HEADER) .post(USER_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
.catch((err) => err.response); .catch((err) => err.response);
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
@ -304,6 +330,7 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const getDataProyek = async () => { const getDataProyek = async () => {
setLoading(true);
let start = 0; let start = 0;
let hierarchy = []; let hierarchy = [];
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy"))); hierarchy.push(JSON.parse(localStorage.getItem("hierarchy")));
@ -468,10 +495,6 @@ const CreatedProyek = ({ params, ...props }) => {
} }
}; };
const handleOpenDialog = (id) => {
setOpenDialog(true);
setidTask(id);
};
const handleOpenDialogProyek = async (id) => { const handleOpenDialogProyek = async (id) => {
setOpenDialogProyek(true); setOpenDialogProyek(true);
@ -531,12 +554,6 @@ const CreatedProyek = ({ params, ...props }) => {
setOpenDialogAssignK3(true); setOpenDialogAssignK3(true);
}; };
const handleOpenDialogTools = (data) => {
setOpenDialogTools(true);
setidTask(data.id);
setProyekName(data.nama);
setUserProyek(data.user_proyeks);
};
const handleOpenDialogViewDetail = async (data) => { const handleOpenDialogViewDetail = async (data) => {
setLoading(true); setLoading(true);
@ -1132,6 +1149,7 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const editProyek = async (data) => { const editProyek = async (data) => {
setLoading(true)
const { checklist, issue, potentialRisks, participants, milestones, approval } = data.projectCharter; const { checklist, issue, potentialRisks, participants, milestones, approval } = data.projectCharter;
const imageObject = data.imageStructureOrg; const imageObject = data.imageStructureOrg;
@ -1852,6 +1870,7 @@ const CreatedProyek = ({ params, ...props }) => {
handleClose={handleCloseDialogAsignHr} handleClose={handleCloseDialogAsignHr}
idTask={idTask} idTask={idTask}
proyekName={proyekName} proyekName={proyekName}
company_id={company_id}
/> />
), ),
[openDialogAsignHR] [openDialogAsignHR]
@ -1867,6 +1886,7 @@ const CreatedProyek = ({ params, ...props }) => {
handleClose={handleCloseDialogAsignCust} handleClose={handleCloseDialogAsignCust}
idTask={idTask} idTask={idTask}
proyekName={proyekName} proyekName={proyekName}
company_id={company_id}
/> />
), ),
[openDialogAsignCust] [openDialogAsignCust]

Loading…
Cancel
Save