|
|
|
@ -1,14 +1,22 @@
|
|
|
|
|
import React, { useEffect, useState } from "react"; |
|
|
|
|
import { Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap"; |
|
|
|
|
import { Modal, ModalHeader, ModalBody, ModalFooter, Card, CardBody } from "reactstrap"; |
|
|
|
|
import { Button } from "reactstrap"; |
|
|
|
|
import axios from "../../../const/interceptorApi"; |
|
|
|
|
import { |
|
|
|
|
NotificationManager, |
|
|
|
|
} from "react-notifications"; |
|
|
|
|
import { BASE_SIMPRO_LUMEN } from "../../../const/ApiConst"; |
|
|
|
|
import { Table } from 'antd'; |
|
|
|
|
import "antd/dist/antd.css"; |
|
|
|
|
|
|
|
|
|
const DialogFormAnalysis = ({ |
|
|
|
|
openDialog, |
|
|
|
|
closeDialog, |
|
|
|
|
toggleDialog, |
|
|
|
|
dataDetail |
|
|
|
|
}) => { |
|
|
|
|
const token = localStorage.getItem("token"); |
|
|
|
|
const [dataTable, setDatatable] = useState([]); |
|
|
|
|
const HEADER = { |
|
|
|
|
headers: { |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
@ -16,12 +24,66 @@ const DialogFormAnalysis = ({
|
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (dataDetail) { |
|
|
|
|
getReportActivityMaterial(); |
|
|
|
|
} |
|
|
|
|
}, [openDialog]); |
|
|
|
|
|
|
|
|
|
const columns = [ |
|
|
|
|
{title: "Human Resource", dataIndex: "join_first_name", key: "join_first_name"}, |
|
|
|
|
{title: "Report Date", dataIndex: "report_date", key: "report_date"}, |
|
|
|
|
{title: "Volume Plan", dataIndex: "join_second_qty_planning", key: "join_second_qty_planning"}, |
|
|
|
|
{title: "Volume Actual", dataIndex: "qty", key: "qty"}, |
|
|
|
|
{title: "Keterangan", dataIndex: "description", key: "description"}, |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
const getReportActivityMaterial = async () => { |
|
|
|
|
const payload = { |
|
|
|
|
columns: [ |
|
|
|
|
{ |
|
|
|
|
name: "assign_material_id", |
|
|
|
|
logic_operator: "=", |
|
|
|
|
value: dataDetail.join_third_id, |
|
|
|
|
operator: "AND", |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
joins: [ |
|
|
|
|
{ |
|
|
|
|
name: "m_users", |
|
|
|
|
column_join: "user_id", |
|
|
|
|
column_results: ["name"] |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: "assign_material_to_activity", |
|
|
|
|
column_join: "assign_material_id", |
|
|
|
|
column_results: ["qty_planning"] |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
orders: { columns: ["id"], ascending: false }, |
|
|
|
|
paging: { start: 0, length: -1 }, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
|
.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 || []; |
|
|
|
|
setDatatable(dataRes); |
|
|
|
|
} else { |
|
|
|
|
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const handleCLearData = () => { |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const handleCancel = () => { |
|
|
|
|
closeDialog("cancel", "none"); |
|
|
|
|
console.log(dataDetail) |
|
|
|
|
handleCLearData(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -32,11 +94,17 @@ const DialogFormAnalysis = ({
|
|
|
|
|
Detail Report Analysis |
|
|
|
|
</ModalHeader> |
|
|
|
|
<ModalBody> |
|
|
|
|
<div> |
|
|
|
|
<h1> |
|
|
|
|
Test |
|
|
|
|
</h1> |
|
|
|
|
</div> |
|
|
|
|
<Card> |
|
|
|
|
<CardBody> |
|
|
|
|
<Table |
|
|
|
|
size="small" |
|
|
|
|
columns={columns} |
|
|
|
|
dataSource={dataTable} |
|
|
|
|
pagination={false} |
|
|
|
|
rowKey={"id"} |
|
|
|
|
/> |
|
|
|
|
</CardBody> |
|
|
|
|
</Card> |
|
|
|
|
</ModalBody> |
|
|
|
|
<ModalFooter> |
|
|
|
|
<Button |
|
|
|
|