From 3f4b3da3ff9101956af3b59e232af82b0c8f9c88 Mon Sep 17 00:00:00 2001 From: wahyu Date: Fri, 20 Oct 2023 09:23:42 +0700 Subject: [PATCH 1/6] fix endline --- .../SimproV2/CreatedProyek/DialogForm.js | 650 +++++++++--------- 1 file changed, 325 insertions(+), 325 deletions(-) diff --git a/src/views/SimproV2/CreatedProyek/DialogForm.js b/src/views/SimproV2/CreatedProyek/DialogForm.js index bac0696..a8b51de 100644 --- a/src/views/SimproV2/CreatedProyek/DialogForm.js +++ b/src/views/SimproV2/CreatedProyek/DialogForm.js @@ -1,325 +1,325 @@ -import React, { useEffect, useState } from "react"; -import { Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap"; -import { Button, Form, FormGroup, Label, Input, Col, Row } from "reactstrap"; -import { DatePicker, Tooltip, Select } from "antd"; -import axios from "../../../const/interceptorApi"; -import moment from "moment"; -import { - NotificationContainer, - NotificationManager, -} from "react-notifications"; -import "antd/dist/antd.css"; -import { formatNumber } from "../../../const/CustomFunc"; -import { - TYPE_PROYEK, - USER_LIST, - BASE_SIMPRO_LUMEN, -} from "../../../const/ApiConst"; - -const { Option } = Select; - -const DialogForm = ({ - openDialog, - closeDialog, - toggleDialog, - idTask, - dataTypeProyek, - dataPM, -}) => { - const token = localStorage.getItem("token"); - const HEADER = { - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${token}`, - }, - }; - const [id, setId] = useState(0); - const [name, setName] = useState(""); - const [shortName, setShortName] = useState(""); - const [description, setDescription] = useState(""); - const [biaya, setBiaya] = useState(""); - const [typeProject, setTypeproject] = useState(null); - const [sdm, setSdm] = useState(0); - const [pic, setPic] = useState(null); - const [startDate, setStartDate] = useState(moment()); - const [endDate, setEndDate] = useState(moment()); - const [workArea, setWorkArea] = useState(""); - const [finance, setFinance] = useState(""); - const [investor, setInvestor] = useState(""); - const [company, setCompany] = useState(""); - - const handleGetdataIdproyek = async (id) => { - const URL = `${BASE_SIMPRO_LUMEN}/project/edit/${id}`; - const result = await axios - .get(URL, HEADER) - .then((res) => res) - .catch((err) => err.response); - if (result && result.data && result.data.code === 200) { - const val = result.data.data; - setName(val.nama); - setShortName(val.kode_sortname); - setDescription(val.keterangan); - setBiaya(val.rencana_biaya ? formatNumber(val.rencana_biaya) : ""); - setTypeproject(val.type_proyek_id); - setPic(val.pm_id); - setStartDate(moment(val.mulai_proyek)); - setEndDate(moment(val.akhir_proyek)); - setWorkArea(val.area_kerja); - setInvestor(val.investor); - setCompany(val.company); - setFinance(val.finance); - } else { - NotificationManager.error(`Data proyek gagal di edit`, `Failed!!`); - } - }; - - const handleCLearData = () => { - setName(""); - setShortName(""); - setBiaya(""); - setTypeproject(null); - setPic(null); - setStartDate(moment()); - setEndDate(moment()); - setDescription(""); - setInvestor(""); - setFinance(""); - setWorkArea(""); - setCompany(""); - }; - - useEffect(() => { - if (idTask && idTask > 0) { - handleGetdataIdproyek(idTask); - } else { - handleCLearData(); - } - }, [openDialog]); - - const handleSave = () => { - let data = ""; - if (idTask) { - data = { - id: idTask, - nama: name, - kode_sortname: shortName, - rencana_biaya: biaya.replace(".", ""), - mulai_proyek: startDate, - akhir_proyek: endDate, - type_proyek_id: parseInt(typeProject), - pm_id: pic, - investor, - finance, - company, - area_kerja: workArea, - keterangan: description, - }; - - closeDialog("edit", data); - } else { - data = { - nama: name, - kode_sortname: shortName, - rencana_biaya: biaya.replace(".", ""), - mulai_proyek: startDate, - akhir_proyek: endDate, - type_proyek_id: parseInt(typeProject), - pm_id: pic, - investor, - finance, - company, - area_kerja: workArea, - keterangan: description, - }; - closeDialog("add", data); - } - handleCLearData(); - }; - - const handleCancel = () => { - closeDialog("cancel", "none"); - handleCLearData(); - }; - - const onChangeTypeProject = (val) => { - setTypeproject(val); - }; - - const onChangePm = (val) => { - setPic(val); - }; - - const handleDatePickerStart = (date, dateString) => { - setStartDate(date); - }; - - const handleDatePickerEnd = (date, dateString) => { - setEndDate(date); - }; - - const renderForm = () => { - return ( -
- - - - - setName(e.target.value)} - placeholder={`Input project name...`} - /> - - - - - - setShortName(e.target.value)} - placeholder={`Input code / short name...`} - /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - setWorkArea(e.target.value)} - placeholder={`Input work area...`} - /> - - - - - - setCompany(e.target.value)} - placeholder={`Input company...`} - /> - - - - - - - - setBiaya(formatNumber(e.target.value))} - placeholder={`Input planning cost...`} - /> - - - - - - setDescription(e.target.value)} - placeholder={`Input description...`} - /> - - - -
- ); - }; - - return ( - <> - - - {idTask ? `Update` : "Add"} Project - - {renderForm()} - - {" "} - - - - - ); -}; - -export default DialogForm; +import React, { useEffect, useState } from "react"; +import { Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap"; +import { Button, Form, FormGroup, Label, Input, Col, Row } from "reactstrap"; +import { DatePicker, Tooltip, Select } from "antd"; +import axios from "../../../const/interceptorApi"; +import moment from "moment"; +import { + NotificationContainer, + NotificationManager, +} from "react-notifications"; +import "antd/dist/antd.css"; +import { formatNumber } from "../../../const/CustomFunc"; +import { + TYPE_PROYEK, + USER_LIST, + BASE_SIMPRO_LUMEN, +} from "../../../const/ApiConst"; + +const { Option } = Select; + +const DialogForm = ({ + openDialog, + closeDialog, + toggleDialog, + idTask, + dataTypeProyek, + dataPM, +}) => { + const token = localStorage.getItem("token"); + const HEADER = { + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + }, + }; + const [id, setId] = useState(0); + const [name, setName] = useState(""); + const [shortName, setShortName] = useState(""); + const [description, setDescription] = useState(""); + const [biaya, setBiaya] = useState(""); + const [typeProject, setTypeproject] = useState(null); + const [sdm, setSdm] = useState(0); + const [pic, setPic] = useState(null); + const [startDate, setStartDate] = useState(moment()); + const [endDate, setEndDate] = useState(moment()); + const [workArea, setWorkArea] = useState(""); + const [finance, setFinance] = useState(""); + const [investor, setInvestor] = useState(""); + const [company, setCompany] = useState(""); + + const handleGetdataIdproyek = async (id) => { + const URL = `${BASE_SIMPRO_LUMEN}/project/edit/${id}`; + const result = await axios + .get(URL, HEADER) + .then((res) => res) + .catch((err) => err.response); + if (result && result.data && result.data.code === 200) { + const val = result.data.data; + setName(val.nama); + setShortName(val.kode_sortname); + setDescription(val.keterangan); + setBiaya(val.rencana_biaya ? formatNumber(val.rencana_biaya) : ""); + setTypeproject(val.type_proyek_id); + setPic(val.pm_id); + setStartDate(moment(val.mulai_proyek)); + setEndDate(moment(val.akhir_proyek)); + setWorkArea(val.area_kerja); + setInvestor(val.investor); + setCompany(val.company); + setFinance(val.finance); + } else { + NotificationManager.error(`Data proyek gagal di edit`, `Failed!!`); + } + }; + + const handleCLearData = () => { + setName(""); + setShortName(""); + setBiaya(""); + setTypeproject(null); + setPic(null); + setStartDate(moment()); + setEndDate(moment()); + setDescription(""); + setInvestor(""); + setFinance(""); + setWorkArea(""); + setCompany(""); + }; + + useEffect(() => { + if (idTask && idTask > 0) { + handleGetdataIdproyek(idTask); + } else { + handleCLearData(); + } + }, [openDialog]); + + const handleSave = () => { + let data = ""; + if (idTask) { + data = { + id: idTask, + nama: name, + kode_sortname: shortName, + rencana_biaya: biaya.replace(".", ""), + mulai_proyek: startDate, + akhir_proyek: endDate, + type_proyek_id: parseInt(typeProject), + pm_id: pic, + investor, + finance, + company, + area_kerja: workArea, + keterangan: description, + }; + + closeDialog("edit", data); + } else { + data = { + nama: name, + kode_sortname: shortName, + rencana_biaya: biaya.replace(".", ""), + mulai_proyek: startDate, + akhir_proyek: endDate, + type_proyek_id: parseInt(typeProject), + pm_id: pic, + investor, + finance, + company, + area_kerja: workArea, + keterangan: description, + }; + closeDialog("add", data); + } + handleCLearData(); + }; + + const handleCancel = () => { + closeDialog("cancel", "none"); + handleCLearData(); + }; + + const onChangeTypeProject = (val) => { + setTypeproject(val); + }; + + const onChangePm = (val) => { + setPic(val); + }; + + const handleDatePickerStart = (date, dateString) => { + setStartDate(date); + }; + + const handleDatePickerEnd = (date, dateString) => { + setEndDate(date); + }; + + const renderForm = () => { + return ( +
+ + + + + setName(e.target.value)} + placeholder={`Input project name...`} + /> + + + + + + setShortName(e.target.value)} + placeholder={`Input code / short name...`} + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + setWorkArea(e.target.value)} + placeholder={`Input work area...`} + /> + + + + + + setCompany(e.target.value)} + placeholder={`Input company...`} + /> + + + + + + + + setBiaya(formatNumber(e.target.value))} + placeholder={`Input planning cost...`} + /> + + + + + + setDescription(e.target.value)} + placeholder={`Input description...`} + /> + + + +
+ ); + }; + + return ( + <> + + + {idTask ? `Update` : "Add"} Project + + {renderForm()} + + {" "} + + + + + ); +}; + +export default DialogForm; From 354aa3485d573c03967fcff7fd68e588e7e0a572 Mon Sep 17 00:00:00 2001 From: wahyu Date: Fri, 20 Oct 2023 09:39:25 +0700 Subject: [PATCH 2/6] report analysis hr detail --- .../CreatedProyek/DialogFormAnalysis.js | 55 +++++++++++++ .../SimproV2/CreatedProyek/ReportAnalysis.js | 79 ++++++++++++++++--- 2 files changed, 121 insertions(+), 13 deletions(-) create mode 100644 src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js diff --git a/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js b/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js new file mode 100644 index 0000000..8178175 --- /dev/null +++ b/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js @@ -0,0 +1,55 @@ +import React, { useEffect, useState } from "react"; +import { Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap"; +import { Button } from "reactstrap"; +import "antd/dist/antd.css"; + +const DialogFormAnalysis = ({ + openDialog, + closeDialog, + toggleDialog, +}) => { + const token = localStorage.getItem("token"); + const HEADER = { + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + }, + }; + + const handleCLearData = () => { + + }; + + const handleCancel = () => { + closeDialog("cancel", "none"); + handleCLearData(); + }; + + return ( + <> + + + Detail Report Analysis + + +
+

+ Test +

+
+
+ + + +
+ + ); +}; + +export default DialogFormAnalysis; diff --git a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js index a6aef4e..9d0b17d 100644 --- a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js @@ -9,13 +9,17 @@ import { import { BASE_SIMPRO_LUMEN } from "../../../const/ApiConst"; import 'antd/dist/antd.css'; import './style.css' -import { Select, Table } from 'antd'; +import { Select, Table, Tooltip } from 'antd'; +import DialogFormAnalysis from './DialogFormAnalysis'; const { Option } = Select const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => { const token = localStorage.getItem("token"); const [activeTab, setActiveTab] = useState('1'); const [search, setSearch] = useState(''); + const [openDialogFormAnalysis, setOpenDialogFormAnalysis] = useState(false); + const [dataDetail, setDataDetail] = useState(null); + const [avgActivityHr, setAvgActivityHr] = useState(0); const [avgActivity, setAvgActivity] = useState(0); const [dataTable, setDatatable] = useState([]); const [dataTableActivityToHr, setDataTableActivityToHr] = useState([]); @@ -26,6 +30,20 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => if (activeTab !== tab) { setActiveTab(tab); } + switch (tab) { + case '1': + setAvgActivityHr(0); + setSelectedHr(null); + setDataTableActivityToHr([]); + break; + case '2': + setAvgActivity(0); + setSearch(''); + setDatatable([]) + break; + default: + break; + } }; const HEADER = { @@ -48,7 +66,20 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => {title: "Report Date", dataIndex: "report_date", key: "report_date"}, {title: "Volume Actual", dataIndex: "qty", key: "qty"}, {title: "Volume Planned", dataIndex: "join_first_qty_planning", key: "join_first_qty_planning"}, - {title: "Description", dataIndex: "description", key: "description"} + {title: "Description", dataIndex: "description", key: "description"}, + { + title: 'Action', + dataIndex: '', + key: 'id', + className: "nowrap", + render: (text, record) => + <> + + + {" "} + + , + }, ] useEffect(() => { @@ -72,6 +103,29 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => setSearch(value); }; + const handleDetail = (data) => { + setOpenDialogFormAnalysis(true); + setDataDetail(data); + } + + const closeDialogForm = (status) => { + if (status == "Save") { + // getdataGantt() + NotificationManager.success(`Gantt berhasil dibuat!`, 'Success!!'); + }else if (status == "Edit") { + // getdataGantt() + NotificationManager.success(`Gantt berhasil dibubah!`, 'Failed!!'); + }else if (status == "failed") { + NotificationManager.error(`Gantt gagal dibuat!`, 'Failed!!'); + } + setDataDetail(null) + setOpenDialogFormAnalysis(false) + } + + const toggleDialogForm = () => { + setOpenDialogFormAnalysis(!openDialogFormAnalysis) + } + const getDataHr = async () => { const result = await axios .get(`${BASE_SIMPRO_LUMEN}/human-resource/list`, HEADER) @@ -86,7 +140,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => } } const getDataActivityToHr = async () => { - setAvgActivity(0); + setAvgActivityHr(0); let sum = 0; const payload = { columns: [ @@ -135,7 +189,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => dataRes.forEach(element => { element.join_third_persentase_progress ? sum += parseInt(element.join_third_persentase_progress) : sum += 0; }); - setAvgActivity(sum / dataRes.length); + setAvgActivityHr(sum / dataRes.length); setDataTableActivityToHr(dataRes); } else { NotificationManager.error("Gagal Mengambil Data!!", "Failed"); @@ -184,7 +238,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => return ( <> - Project + Report Analysis