Browse Source

report analysis hr data

pull/1/head
wahyu 1 year ago
parent
commit
dec7d245f3
  1. 34
      src/views/SimproV2/CreatedProyek/ReportAnalysis.js
  2. 3
      src/views/SimproV2/CreatedProyek/index.js

34
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 }}
/>
</Col>

3
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]

Loading…
Cancel
Save