From d7fe5cd02b29863d9698b3de820e2d1eb6afc1c7 Mon Sep 17 00:00:00 2001 From: wahyu Date: Wed, 18 Oct 2023 09:16:45 +0700 Subject: [PATCH 1/6] report analysis init --- .../SimproV2/CreatedProyek/ReportAnalysis.js | 26 ++++++++++++++++++ src/views/SimproV2/CreatedProyek/index.js | 27 ++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/views/SimproV2/CreatedProyek/ReportAnalysis.js diff --git a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js new file mode 100644 index 0000000..44b6406 --- /dev/null +++ b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js @@ -0,0 +1,26 @@ +import React from 'react' +import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; +import { Button } from 'reactstrap'; +import 'antd/dist/antd.css'; +import './style.css' + + + const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { + + return ( + <> + + Project + +
Report Analysis
+
+ + + +
+ + ) + +} + +export default ReportAnalysis; diff --git a/src/views/SimproV2/CreatedProyek/index.js b/src/views/SimproV2/CreatedProyek/index.js index 6c2f44b..9e59876 100644 --- a/src/views/SimproV2/CreatedProyek/index.js +++ b/src/views/SimproV2/CreatedProyek/index.js @@ -87,6 +87,7 @@ import AssignHrProject from "./AsignHrProject"; import AssignCustProject from "./AsignCustProject"; import AssignK3Project from "./AssignK3Project"; import ViewProject from "./ViewProject"; +import ReportAnalysis from "./ReportAnalysis"; import { Icon } from "@iconify/react"; // import { Link } from 'react-router-dom'; // import SubProyekComp from './SubProyekComp'; @@ -122,6 +123,7 @@ const CreatedProyek = ({ params, ...props }) => { const [totalPage, setTotalPage] = useState(0); const [openDialog, setOpenDialog] = useState(false); const [openDialogViewDetail, setOpenDialogViewDetail] = useState(false); + const [openDialogRA, setOpenDialogRA] = useState(false); const [openDialogMaterial, setOpenDialogMaterial] = useState(false); const [openDialogTools, setOpenDialogTools] = useState(false); const [openDialogGantt, setOpenDialogGantt] = useState(false); @@ -591,6 +593,12 @@ const CreatedProyek = ({ params, ...props }) => { getProjectDetail(data.id); }; + const handleOpenReport = async (data) => { + setOpenDialogRA(true); + } + const handleCloseReport = async (data) => { + setOpenDialogRA(false); + } const getDataProject = async (proyek_id) => { const url = PROYEK_GET_ID(proyek_id); const result = await axios @@ -849,6 +857,7 @@ const CreatedProyek = ({ params, ...props }) => { const toggleAddDialog = () => setOpenDialog(!openDialog); const toggleAddDialogProyek = () => setOpenDialogProyek(!openDialogProyek); + const toggleAddDialogRA = () => setOpenDialogRA(!openDialogRA); const toggleAddDialogView = () => { if (openDialogViewDetail) { setProjectApproval(null); @@ -1504,6 +1513,12 @@ const CreatedProyek = ({ params, ...props }) => { S Curve +
handleOpenReport(text)}> + + + + Report Analysis +
{/* */}
{ ), [openDialogViewDetail] ); - + const renderReportAnalysis = useMemo( + () => ( + + ), + [openDialogRA] + ); const renderDialogGantt = useMemo( () => ( { Delete this data {ViewProyek} + {renderReportAnalysis} {RenderDialogForm} {RenderDialogFormProyek} {RenderDialogFormMaterial} From fc4b41b6730ec447ba79d9bfecbb1383e9e45a68 Mon Sep 17 00:00:00 2001 From: wahyu Date: Wed, 18 Oct 2023 11:10:45 +0700 Subject: [PATCH 2/6] Report analysis mockup --- .../SimproV2/CreatedProyek/ReportAnalysis.js | 152 +++++++++++++++++- 1 file changed, 149 insertions(+), 3 deletions(-) diff --git a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js index 44b6406..d797a83 100644 --- a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js @@ -1,18 +1,164 @@ -import React from 'react' -import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; +import React, {useState} from 'react' +import { Modal, ModalHeader, ModalBody, ModalFooter, Card, CardHeader, CardBody, Table } from 'reactstrap'; +import { TabContent, TabPane, Nav, NavItem, NavLink, Row, Col, Input } from 'reactstrap'; import { Button } from 'reactstrap'; import 'antd/dist/antd.css'; import './style.css' const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { + const [activeTab, setActiveTab] = useState('1'); + const [search, setSearch] = useState(''); + const toggle = (tab) => { + if (activeTab !== tab) { + setActiveTab(tab); + } + }; + + const handleSearch = (e) => { + const value = e.target.value; + setSearch(value); + }; return ( <> Project -
Report Analysis
+
+ + + + + + + + + + + + +
+

+ Hello World +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+
+
+
+ + + + + + + + + + + + + + + + +
+

+ Hello World +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+
+
+
+
+
From cd698c92f8807c906ee160c31c663fe4773becbe Mon Sep 17 00:00:00 2001 From: wahyu Date: Wed, 18 Oct 2023 11:50:08 +0700 Subject: [PATCH 3/6] fix endline --- .../SimproV2/CreatedProyek/FormAsignHr.js | 492 +++++++++--------- 1 file changed, 246 insertions(+), 246 deletions(-) diff --git a/src/views/SimproV2/CreatedProyek/FormAsignHr.js b/src/views/SimproV2/CreatedProyek/FormAsignHr.js index b02909d..a080fa0 100644 --- a/src/views/SimproV2/CreatedProyek/FormAsignHr.js +++ b/src/views/SimproV2/CreatedProyek/FormAsignHr.js @@ -1,246 +1,246 @@ -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, Select } from 'antd'; -import 'antd/dist/antd.css'; -import { formatNumber } from '../../../const/CustomFunc'; -const { Option } = Select - -const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit, dataHr, dataCurrentHr, dataRole }) => { - const [id, setId] = useState(null) - const [typeForm, setTypeForm] = useState('add') - const [user, setUser] = useState(null) - const [rbs, setRbs] = useState("") - const [projectRole, setProjectRole] = useState(null) - const [groupR, setGroupR] = useState("") - const [maxUsed, setMaxUsed] = useState("") - const [standartRate, setStandartRate] = useState("") - const [uomStandartRate, setUomStandartRate] = useState(null) - const [overTimeRate, setOverTimeRate] = useState("") - const [overTimeRateUom, setOverTimeRateUom] = useState(null) - const [costPerUsed, setCostPerUsed] = useState("") - const [accrue, setAccrue] = useState("") - const [baseCalender, setBaseCalender] = useState("") - const [listHr, setListHr] = useState([]) - const [isCustomer, setIsCustomer] = useState(false) - - const handleClearData = () => { - setUser(null) - setRbs("") - setProjectRole(null) - setGroupR("") - setMaxUsed("") - setIsCustomer(false) - setStandartRate("") - setUomStandartRate(null) - setOverTimeRate("") - setOverTimeRateUom(null) - setCostPerUsed("") - setAccrue("") - setBaseCalender("") - } - - useEffect(() => { - let data = dataHr || [] - let availableHr = [] - data.map((val, index) => { - if(dataEdit && dataEdit.user_id){ - 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) - }); - if(!check){ - availableHr.push(val); - } - }); - setListHr(availableHr) - }, [dataHr, dataCurrentHr, dataEdit]) - - useEffect(() => { - if (idTask && idTask > 0) { - if(dataEdit && dataEdit!=""){ - setTypeForm('edit') - setId(dataEdit.id) - setUser(dataEdit.user_id) - setRbs(dataEdit.rbs) - setProjectRole(dataEdit.project_role) - setGroupR(dataEdit.group_r) - setMaxUsed(dataEdit.max_used ? formatNumber(dataEdit.max_used.toString()) : '') - setIsCustomer(dataEdit.is_customer) - setStandartRate(dataEdit.standart_rate ? formatNumber(dataEdit.standart_rate.toString()) : '') - setUomStandartRate(dataEdit.uom_standart_rate) - setOverTimeRate(dataEdit.overtime_rate ? formatNumber(dataEdit.overtime_rate.toString()) : '') - setOverTimeRateUom(dataEdit.uom_overtime_rate) - setCostPerUsed(dataEdit.cost_per_used) - setAccrue(dataEdit.accrue_at) - setBaseCalender(dataEdit.base_calender) - }else{ - handleClearData() - setTypeForm('add') - } - } else { - handleClearData() - } - }, [openDialog]) - - const handleSave = () => { - let data = ''; - if (typeForm=="edit") { - data = { - id, - proyek_id: idTask, - user_id:user, - project_role:projectRole, - is_customer: isCustomer, - max_used:maxUsed.replaceAll(".", ""), - standart_rate:standartRate.replaceAll(".", ""), - uom_standart_rate:uomStandartRate, - overtime_rate:overTimeRate.replaceAll(".", ""), - uom_overtime_rate:overTimeRateUom, - } - - closeDialog('edit', data); - } else { - data = { - proyek_id: idTask, - user_id:user, - project_role:projectRole, - is_customer: isCustomer, - max_used:maxUsed.replaceAll(".", ""), - standart_rate:standartRate.replaceAll(".", ""), - uom_standart_rate:uomStandartRate, - overtime_rate:overTimeRate.replaceAll(".", ""), - uom_overtime_rate:overTimeRateUom, - } - closeDialog('add', data); - } - handleClearData() - } - - const handleCancel = () => { - closeDialog('cancel', 'none') - handleClearData() - } - - - const renderForm = () => { - return ( -
- - - - - - - - - - - - - - - - - setMaxUsed(formatNumber(e.target.value))} value={maxUsed} placeholder='' required/> - - - - - - - -
- setStandartRate(formatNumber(e.target.value))} value={standartRate} placeholder='1.000...' /> - -
- / -
- - - - -
- -
- - - setOverTimeRate(formatNumber(e.target.value))} value={overTimeRate} placeholder='1.000...' /> - -
- / -
- - - - -
- - ) - } - - return ( - <> - - {typeForm=="add" ? "Add" : "Edit" } Assign Human Resource - - {renderForm()} - - - {' '} - - - - - ) - -} - -export default FormAsignHr; +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, Select } from 'antd'; +import 'antd/dist/antd.css'; +import { formatNumber } from '../../../const/CustomFunc'; +const { Option } = Select + +const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit, dataHr, dataCurrentHr, dataRole }) => { + const [id, setId] = useState(null) + const [typeForm, setTypeForm] = useState('add') + const [user, setUser] = useState(null) + const [rbs, setRbs] = useState("") + const [projectRole, setProjectRole] = useState(null) + const [groupR, setGroupR] = useState("") + const [maxUsed, setMaxUsed] = useState("") + const [standartRate, setStandartRate] = useState("") + const [uomStandartRate, setUomStandartRate] = useState(null) + const [overTimeRate, setOverTimeRate] = useState("") + const [overTimeRateUom, setOverTimeRateUom] = useState(null) + const [costPerUsed, setCostPerUsed] = useState("") + const [accrue, setAccrue] = useState("") + const [baseCalender, setBaseCalender] = useState("") + const [listHr, setListHr] = useState([]) + const [isCustomer, setIsCustomer] = useState(false) + + const handleClearData = () => { + setUser(null) + setRbs("") + setProjectRole(null) + setGroupR("") + setMaxUsed("") + setIsCustomer(false) + setStandartRate("") + setUomStandartRate(null) + setOverTimeRate("") + setOverTimeRateUom(null) + setCostPerUsed("") + setAccrue("") + setBaseCalender("") + } + + useEffect(() => { + let data = dataHr || [] + let availableHr = [] + data.map((val, index) => { + if(dataEdit && dataEdit.user_id){ + 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) + }); + if(!check){ + availableHr.push(val); + } + }); + setListHr(availableHr) + }, [dataHr, dataCurrentHr, dataEdit]) + + useEffect(() => { + if (idTask && idTask > 0) { + if(dataEdit && dataEdit!=""){ + setTypeForm('edit') + setId(dataEdit.id) + setUser(dataEdit.user_id) + setRbs(dataEdit.rbs) + setProjectRole(dataEdit.project_role) + setGroupR(dataEdit.group_r) + setMaxUsed(dataEdit.max_used ? formatNumber(dataEdit.max_used.toString()) : '') + setIsCustomer(dataEdit.is_customer) + setStandartRate(dataEdit.standart_rate ? formatNumber(dataEdit.standart_rate.toString()) : '') + setUomStandartRate(dataEdit.uom_standart_rate) + setOverTimeRate(dataEdit.overtime_rate ? formatNumber(dataEdit.overtime_rate.toString()) : '') + setOverTimeRateUom(dataEdit.uom_overtime_rate) + setCostPerUsed(dataEdit.cost_per_used) + setAccrue(dataEdit.accrue_at) + setBaseCalender(dataEdit.base_calender) + }else{ + handleClearData() + setTypeForm('add') + } + } else { + handleClearData() + } + }, [openDialog]) + + const handleSave = () => { + let data = ''; + if (typeForm=="edit") { + data = { + id, + proyek_id: idTask, + user_id:user, + project_role:projectRole, + is_customer: isCustomer, + max_used:maxUsed.replaceAll(".", ""), + standart_rate:standartRate.replaceAll(".", ""), + uom_standart_rate:uomStandartRate, + overtime_rate:overTimeRate.replaceAll(".", ""), + uom_overtime_rate:overTimeRateUom, + } + + closeDialog('edit', data); + } else { + data = { + proyek_id: idTask, + user_id:user, + project_role:projectRole, + is_customer: isCustomer, + max_used:maxUsed.replaceAll(".", ""), + standart_rate:standartRate.replaceAll(".", ""), + uom_standart_rate:uomStandartRate, + overtime_rate:overTimeRate.replaceAll(".", ""), + uom_overtime_rate:overTimeRateUom, + } + closeDialog('add', data); + } + handleClearData() + } + + const handleCancel = () => { + closeDialog('cancel', 'none') + handleClearData() + } + + + const renderForm = () => { + return ( +
+ + + + + + + + + + + + + + + + + setMaxUsed(formatNumber(e.target.value))} value={maxUsed} placeholder='' required/> + + + + + + + +
+ setStandartRate(formatNumber(e.target.value))} value={standartRate} placeholder='1.000...' /> + +
+ / +
+ + + + +
+ +
+ + + setOverTimeRate(formatNumber(e.target.value))} value={overTimeRate} placeholder='1.000...' /> + +
+ / +
+ + + + +
+ + ) + } + + return ( + <> + + {typeForm=="add" ? "Add" : "Edit" } Assign Human Resource + + {renderForm()} + + + {' '} + + + + + ) + +} + +export default FormAsignHr; From 28a6615a1445e337ff34b73c845d83e4aa6dc7e0 Mon Sep 17 00:00:00 2001 From: wahyu Date: Wed, 18 Oct 2023 13:25:27 +0700 Subject: [PATCH 4/6] report analysis no sum --- .../SimproV2/CreatedProyek/ReportAnalysis.js | 215 ++++++++++++------ 1 file changed, 144 insertions(+), 71 deletions(-) diff --git a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js index d797a83..581cb0c 100644 --- a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js @@ -1,25 +1,142 @@ -import React, {useState} from 'react' -import { Modal, ModalHeader, ModalBody, ModalFooter, Card, CardHeader, CardBody, Table } from 'reactstrap'; +import React, {useState, useEffect} from 'react' +import { Modal, ModalHeader, ModalBody, ModalFooter, Card, CardHeader, CardBody } from 'reactstrap'; import { TabContent, TabPane, Nav, NavItem, NavLink, Row, Col, Input } from 'reactstrap'; import { Button } from 'reactstrap'; +import axios from "../../../const/interceptorApi"; +import { + NotificationManager, +} from "react-notifications"; +import { BASE_SIMPRO_LUMEN } from "../../../const/ApiConst"; import 'antd/dist/antd.css'; import './style.css' +import { Select, Table } from 'antd'; +const { Option } = Select - - const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { +const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { + const token = localStorage.getItem("token"); const [activeTab, setActiveTab] = useState('1'); const [search, setSearch] = useState(''); + const [dataTable, setDatatable] = useState([]); + const [dataTableActivityToHr, setDataTableActivityToHr] = useState([]); + const [hrList, setHrList] = useState([]); + const [selectedHr, setSelectedHr] = useState(null); + const toggle = (tab) => { if (activeTab !== tab) { setActiveTab(tab); } }; + const HEADER = { + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + }, + }; + + const columns = [ + {title: "Activity Name", dataIndex: "name", key: "name"} + ] + + const columnActivityToHr = [ + {title: "Activity Name", dataIndex: "join_first_name", key: "join_first_name"} + ] + + useEffect(() => { + if (search) { + getDataActivity() + } + }, [search]); + + useEffect(() => { + if (selectedHr) { + getDataActivityToHr() + } + }, [selectedHr]); + + useEffect(() => { + getDataHr() + }, []); + const handleSearch = (e) => { const value = e.target.value; setSearch(value); }; + const getDataHr = async () => { + const result = await axios + .get(`${BASE_SIMPRO_LUMEN}/human-resource/list`, HEADER) + .then((res) => res) + .catch((error) => error.response); + + if (result && result.data && result.data.code == 200) { + let dataRes = result.data.data || []; + setHrList(dataRes); + } else { + NotificationManager.error("Gagal Mengambil Data!!", "Failed"); + } + } + const getDataActivityToHr = async () => { + const payload = { + columns: [ + { + name: "user_id", + logic_operator: "=", + value: selectedHr, + operator: "AND", + }, + ], + joins: [ + { + name: "m_activity", + column_join: "activity_id", + column_results: ["name"] + } + ], + orders: { columns: ["id"], ascending: false }, + paging: { start: 0, length: -1 }, + }; + + const result = await axios + .post(`${BASE_SIMPRO_LUMEN}/user-to-activity/search-analysis`, payload, HEADER) + .then((res) => res) + .catch((error) => error.response); + + if (result && result.data && result.data.code == 200) { + let dataRes = result.data.data || []; + setDataTableActivityToHr(dataRes); + } else { + NotificationManager.error("Gagal Mengambil Data!!", "Failed"); + } + }; + + const getDataActivity = async () => { + const payload = { + columns: [ + { + name: "name", + logic_operator: "ilike", + value: search, + operator: "AND", + }, + ], + orders: { columns: ["id"], ascending: false }, + paging: { start: 0, length: -1 }, + }; + + const result = await axios + .post(`${BASE_SIMPRO_LUMEN}/activity/search`, payload, HEADER) + .then((res) => res) + .catch((error) => error.response); + + if (result && result.data && result.data.code == 200) { + let dataRes = result.data.data || []; + + setDatatable(dataRes); + } else { + NotificationManager.error("Gagal Mengambil Data!!", "Failed"); + } + }; return ( <> @@ -55,6 +172,8 @@ import './style.css'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+ @@ -108,13 +204,13 @@ import './style.css' - - - - - - - + @@ -124,36 +220,13 @@ import './style.css' Hello World -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+ From 11fff21f3eb96c6c8750a9f054673bdd552c6476 Mon Sep 17 00:00:00 2001 From: wahyu Date: Wed, 18 Oct 2023 14:19:39 +0700 Subject: [PATCH 5/6] add sum --- .../SimproV2/CreatedProyek/ReportAnalysis.js | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js index 581cb0c..cb16993 100644 --- a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js @@ -16,6 +16,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { const token = localStorage.getItem("token"); const [activeTab, setActiveTab] = useState('1'); const [search, setSearch] = useState(''); + const [avgActivity, setAvgActivity] = useState(0); const [dataTable, setDatatable] = useState([]); const [dataTableActivityToHr, setDataTableActivityToHr] = useState([]); const [hrList, setHrList] = useState([]); @@ -77,6 +78,8 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { } } const getDataActivityToHr = async () => { + setAvgActivity(0); + let sum = 0; const payload = { columns: [ { @@ -104,6 +107,10 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { if (result && result.data && result.data.code == 200) { let dataRes = result.data.data || []; + dataRes.forEach(element => { + element.persentase_progress ? sum += parseInt(element.persentase_progress) : sum += 0; + }); + setAvgActivity(sum / dataRes.length); setDataTableActivityToHr(dataRes); } else { NotificationManager.error("Gagal Mengambil Data!!", "Failed"); @@ -111,6 +118,8 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { }; const getDataActivity = async () => { + setAvgActivity(0); + let sum = 0; const payload = { columns: [ { @@ -132,6 +141,10 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { if (result && result.data && result.data.code == 200) { let dataRes = result.data.data || []; + dataRes.forEach(element => { + element.persentase_progress ? sum += parseInt(element.persentase_progress) : sum += 0; + }); + setAvgActivity(sum / dataRes.length); setDatatable(dataRes); } else { NotificationManager.error("Gagal Mengambil Data!!", "Failed"); @@ -186,7 +199,9 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => {

- Hello World + { + search && avgActivity ? `Activity ${search} adalah ${avgActivity.toFixed(2)} %` : null + }

{

- Hello World + { + selectedHr && avgActivity ? `Activity user ini adalah ${avgActivity.toFixed(2)} %` : null + }

Date: Thu, 19 Oct 2023 09:09:49 +0700 Subject: [PATCH 6/6] report analysis hr data --- .../SimproV2/CreatedProyek/ReportAnalysis.js | 34 +++++++++++++++---- src/views/SimproV2/CreatedProyek/index.js | 3 ++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js index cb16993..02b4d33 100644 --- a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js @@ -12,7 +12,7 @@ import './style.css' import { Select, Table } from 'antd'; const { Option } = Select -const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { +const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => { const token = localStorage.getItem("token"); const [activeTab, setActiveTab] = useState('1'); const [search, setSearch] = useState(''); @@ -40,7 +40,12 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { ] const columnActivityToHr = [ - {title: "Activity Name", dataIndex: "join_first_name", key: "join_first_name"} + {title: "Activity", dataIndex: "join_third_name", key: "join_third_name"}, + {title: "Human Resource", dataIndex: "join_second_name", key: "join_second_name"}, + {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"} ] useEffect(() => { @@ -88,12 +93,29 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { value: selectedHr, operator: "AND", }, + { + name: "proyek_id", + logic_operator: "=", + value: projectId, + table_name: "m_activity", + operator: "AND", + } ], joins: [ + { + name: "assign_material_to_activity", + column_join: "assign_material_id", + column_results: ["qty_planning"] + }, + { + name: "m_users", + column_join: "user_id", + column_results: ["name"] + }, { name: "m_activity", column_join: "activity_id", - column_results: ["name"] + column_results: ["name", "persentase_progress"] } ], orders: { columns: ["id"], ascending: false }, @@ -101,14 +123,14 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { }; const result = await axios - .post(`${BASE_SIMPRO_LUMEN}/user-to-activity/search-analysis`, payload, HEADER) + .post(`${BASE_SIMPRO_LUMEN}/report-activity-material/search`, payload, HEADER) .then((res) => res) .catch((error) => error.response); if (result && result.data && result.data.code == 200) { let dataRes = result.data.data || []; dataRes.forEach(element => { - element.persentase_progress ? sum += parseInt(element.persentase_progress) : sum += 0; + element.join_third_persentase_progress ? sum += parseInt(element.join_third_persentase_progress) : sum += 0; }); setAvgActivity(sum / dataRes.length); setDataTableActivityToHr(dataRes); @@ -190,7 +212,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog }) => { type="text" name="search" id="search" - placeholder={`Search Project Name`} + placeholder={`Search Activity Name`} style={{ width: 200 }} /> diff --git a/src/views/SimproV2/CreatedProyek/index.js b/src/views/SimproV2/CreatedProyek/index.js index 9e59876..485b32c 100644 --- a/src/views/SimproV2/CreatedProyek/index.js +++ b/src/views/SimproV2/CreatedProyek/index.js @@ -117,6 +117,7 @@ const CreatedProyek = ({ params, ...props }) => { }; const [idTask, setidTask] = useState(0); + const [projectId, setProjectId] = useState(0); const [dataTable, setDatatable] = useState([]); const [search, setSearch] = useState(""); const [currentPage, setCurrentPage] = useState(1); @@ -595,6 +596,7 @@ const CreatedProyek = ({ params, ...props }) => { const handleOpenReport = async (data) => { setOpenDialogRA(true); + setProjectId(data.id); } const handleCloseReport = async (data) => { setOpenDialogRA(false); @@ -1907,6 +1909,7 @@ const CreatedProyek = ({ params, ...props }) => { openDialog={openDialogRA} closeDialog={handleCloseReport} toggleDialog={toggleAddDialogRA} + projectId={projectId} /> ), [openDialogRA]