Browse Source

Merge pull request 'staging upload 23-05-12' (#35) from staging into master

Reviewed-on: ordo/adw-frontend#35
pull/2/head
ibnu 2 years ago
parent
commit
f42841652a
  1. 9
      src/views/SimproV2/CreatedProyek/DialogDocument.js
  2. 5
      src/views/SimproV2/CreatedProyek/DialogGantt.js
  3. 5
      src/views/SimproV2/CreatedProyek/DialogHierarchy.js
  4. 32
      src/views/SimproV2/CreatedProyek/DialogUserGantt.js
  5. 25
      src/views/SimproV2/CreatedProyek/ImportActivity/index.js
  6. 80
      src/views/SimproV2/CreatedProyek/index.js

9
src/views/SimproV2/CreatedProyek/DialogDocument.js

@ -81,7 +81,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
setAlertDeleteFolder(true)
}
const handleDownload = (id) => {
const handleDownload = (id, file) => {
fetch(DOCUMENT_DOWNLOAD(id), {
headers: new Headers({
'Content-Type': 'application/json',
@ -90,11 +90,12 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
})
.then(response => {
response.blob().then(blob => {
let url = window.URL.createObjectURL(blob);
const url = window.URL.createObjectURL(new Blob([blob]));
let a = document.createElement('a');
a.href = url;
a.download = 'Project Documents';
a.download = file;
a.click();
a.remove();
});
//window.location.href = response.url;
});
@ -156,7 +157,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
<Button size={"sm"} color='danger' onClick={() => handleDeleteFolder(text.id)}><i className="fa fa-trash"></i></Button>
</Tooltip>}{" "}
{!record.isDir && <Tooltip title="Download Document">
<Button size={"sm"} color='primary' onClick={() => handleDownload(text.id)}><i className="fa fa-download"></i></Button>
<Button size={"sm"} color='primary' onClick={() => handleDownload(text.id, text.file)}><i className="fa fa-download"></i></Button>
</Tooltip>}{" "}
{record.isDir && <Tooltip title="New Folder">
<Button size="sm" color="success" onClick={() => handleNewFolderParent(record.id)}><i className="fa fa-folder"></i></Button>

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

@ -39,10 +39,6 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
}
}, [hierarchyId, idTask, openDialog])
useEffect(() => {
getDataHumanResource();
}, [])
useEffect(() => {
if (!openDialog) {
setDataGantt([]);
@ -274,7 +270,6 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
<DialogUserGantt
idGantt={idGantt}
humanResource={humanResource}
openDialog={openDialogUserGantt}
toggleDialog={toggleDialogUser}
closeDialog={closeDialogUser}

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

@ -46,10 +46,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
}
}, [saveHierarchy, idTask, openDialog, closeDialog, openDialogFormGantt])
useEffect(() => {
getDataHumanResource();
}, [])
useEffect(() => {
if (!openDialog) {
setDataHierarchy([]);
@ -333,7 +329,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
<DialogUserGantt
idGantt={idGantt}
humanResource={humanResource}
openDialog={openDialogUserGantt}
toggleDialog={toggleDialogUser}
closeDialog={closeDialogUser}

32
src/views/SimproV2/CreatedProyek/DialogUserGantt.js

@ -2,11 +2,11 @@ import React, { useEffect, useState } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button, Form } from 'reactstrap';
import axios from "../../../const/interceptorApi";
import { USER_VERSION_GANTT_ADDS, USER_VERSION_GANTT_SEARCH } from '../../../const/ApiConst';
import { USER_VERSION_GANTT_ADDS, USER_VERSION_GANTT_SEARCH, USER_LIST} from '../../../const/ApiConst';
import { Transfer } from 'antd';
import 'antd/dist/antd.css';
const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt, humanResource }) => {
const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
const token = localStorage.getItem("token")
const HEADER = {
headers: {
@ -16,6 +16,7 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt, human
}
const [id, setId] = useState(0)
const [targetKeys, setTargetKeys] = useState([])
const [humanResource, setHumanResource] = useState([])
const handleCLearData = () => {
@ -26,6 +27,8 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt, human
useEffect(() => {
if(!openDialog){
handleCLearData()
} else {
getDataHumanResource();
}
}, [openDialog])
@ -35,6 +38,31 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt, human
}
}, [idGantt])
const getDataHumanResource = async () => {
const result = await axios
.get(USER_LIST, HEADER)
.then(res => res)
.catch((error) => error.response);
if (result && result.status == 200) {
setTransferUser(result.data.data);
} else {
}
}
const setTransferUser = (data) => {
const finalData = []
data.map((val, index) => {
let data = {
key: val.id,
title: val.name
}
finalData.push(data)
});
setHumanResource(finalData)
}
const getUserGantt = async () => {
const payload = {
"columns": [

25
src/views/SimproV2/CreatedProyek/ImportActivity/index.js

@ -57,9 +57,8 @@ const columnToIndexs = {
weight: 4,
start_date: 5,
end_date: 6,
picKit: 7,
picOwner: 8,
duration: 9
nik: 7,
duration: 8
}
const ExcelDateToJSDate = (date) => {
@ -133,7 +132,10 @@ const ImportActivity = ({ params }) => {
}
if(prop == 'weight'){
columnData = Math.round(columnData * 100)
if (columnData == null) {
columnData = 0;
}
columnData = columnData * 100
}
extractedRow[prop] = columnData
@ -238,18 +240,13 @@ const ImportActivity = ({ params }) => {
title: 'Duration',
dataIndex: 'duration',
key: 'duration',
align: 'right',
},
{
title: 'PIC KIT',
dataIndex: 'picKit',
key: 'picKit',
},
{
title: 'PIC Owner',
dataIndex: 'picOwner',
key: 'picOwner',
},
title: 'NIK',
dataIndex: 'nik',
key: 'nik',
align: 'right',
}
];
if (isMovePage) {

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

@ -135,15 +135,31 @@ const CreatedProyek = ({ params, ...props }) => {
const pageName = params.name;
useEffect(() => {
// getDataUserResource()
if (openDialogMaterial) {
getDataMaterialResource();
}
}, [openDialogMaterial]);
useEffect(() => {
if (openDialogTools) {
getDataToolsResource();
}
}, [openDialogTools]);
useEffect(() => {
if (openDialogAssignK3) {
getDataK3();
}
}, [openDialogAssignK3]);
useEffect(() => {
if (openDialogProyek) {
handleGetTipeProject();
handleGetPhaseProject();
handleGetDivisions();
handleGetDataPm();
getDataK3();
}, []);
}
}, [openDialogProyek])
useEffect(() => {
getDataProyek();
@ -307,32 +323,6 @@ const CreatedProyek = ({ params, ...props }) => {
}
};
const getdataHierarchy = async (idTask) => {
setLoadHierarchy(true);
const payload = {
columns: [
{
name: "project_id",
logic_operator: "=",
value: idTask,
operator: "AND",
},
],
};
const result = await axios
.post(HIERARCHY_FTTH_SEARCH, payload, HEADER)
.then((res) => res)
.catch((error) => error.response);
if (result && result.status == 200) {
setDataHierarchy(result.data.data);
setLoadHierarchy(false);
} else {
NotificationManager.error(
`Data gantt project gagal terload silahkan coba lagi!`,
"Failed!!"
);
}
};
const getDataToolsResource = async () => {
const result = await axios
.get(TOOLS_RESOURCE_LIST, HEADER)
@ -843,8 +833,27 @@ const CreatedProyek = ({ params, ...props }) => {
["Project Name", "Budget", "Project Type", "PM", "Time Project"],
];
const payload = {
paging: { start: 0, length: -1 },
joins: [],
columns: [
{
name: "nama",
logic_operator: "ilike",
value: search,
operator: "AND",
},
],
joins: [
{
name: "m_users",
column_join: "pm_id",
column_results: ["name", "username"],
},
{
name: "m_type_proyek",
column_join: "type_proyek_id",
column_results: ["name", "description"],
},
// { "name": "subproyeks.m_subproyek", "column_join": "parent_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual"] }
],
orders: { columns: ["id"], ascending: false },
};
@ -1084,7 +1093,6 @@ const CreatedProyek = ({ params, ...props }) => {
{
text.type_proyek_id == 9 ?
<Button
onClick={() => getdataHierarchy(text.id)}
size="small"
type="link"
style={{ color: "green" }}
@ -1210,7 +1218,7 @@ const CreatedProyek = ({ params, ...props }) => {
dataPM={dataPm}
/>
),
[openDialogProyek]
[openDialogProyek, dataPm, dataDivisions, dataPhaseProject, dataTypeProyek, idTask]
);
const RenderDialogFormMaterial = useMemo(
@ -1226,7 +1234,7 @@ const CreatedProyek = ({ params, ...props }) => {
proyekName={proyekName}
/>
),
[openDialogMaterial]
[openDialogMaterial, proyekName, materialResource, materialProyek, userProyek, idTask]
);
const RenderDialogTableTools = useMemo(
@ -1241,7 +1249,7 @@ const CreatedProyek = ({ params, ...props }) => {
proyekName={proyekName}
/>
),
[openDialogTools]
[openDialogTools, proyekName, userProyek, toolsResource, idTask]
);
// DialogAsignHr
@ -1276,7 +1284,7 @@ const CreatedProyek = ({ params, ...props }) => {
dataK3={dataK3}
/>
),
[openDialogAssignK3]
[openDialogAssignK3, dataK3]
);
const RenderDialogDoc = useMemo(

Loading…
Cancel
Save