diff --git a/src/views/SimproV2/ChecklistK3/index.js b/src/views/SimproV2/ChecklistK3/index.js
index 89051cf..4cd4cb5 100644
--- a/src/views/SimproV2/ChecklistK3/index.js
+++ b/src/views/SimproV2/ChecklistK3/index.js
@@ -7,7 +7,7 @@ import { Card, CardBody, CardHeader, Col, Row, Input, Table } from 'reactstrap';
import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Button, Tooltip } from 'antd';
import {
- CHECKLIST_K3_ADD, CHECKLIST_K3_EDIT, CHECKLIST_K3_DELETE,CHECKLIST_K3_SEARCH
+ CHECKLIST_K3_ADD, CHECKLIST_K3_EDIT, CHECKLIST_K3_DELETE, CHECKLIST_K3_SEARCH
} from '../../../const/ApiConst';
const token = window.localStorage.getItem('token');
@@ -283,7 +283,7 @@ const ChecklistK3 = ({ params }) => {
-
+
@@ -307,10 +307,10 @@ const ChecklistK3 = ({ params }) => {
- handleDelete(n.id)}>
+ handleDelete(n.id)}>
- handleEdit(n)}>
+ handleEdit(n)}>
|
{n.name} |
diff --git a/src/views/SimproV2/CreatedProyek/index.js b/src/views/SimproV2/CreatedProyek/index.js
index 2936b7f..8474055 100644
--- a/src/views/SimproV2/CreatedProyek/index.js
+++ b/src/views/SimproV2/CreatedProyek/index.js
@@ -763,25 +763,25 @@ const CreatedProyek = ({ params, ...props }) => {
Sortname: n.kode_sortname ? n.kode_sortname : "",
"Nama Project": n.nama ? n.nama : "",
"Tanggal Mulai": n.mulai_proyek
- ? moment(n.mulai_proyek).format(format)
- : "-",
+ ? moment(n.mulai_proyek).format(format)
+ : "-",
"Tanggal Selesai": n.akhir_proyek
- ? moment(n.akhir_proyek).format(format)
- : "-",
+ ? moment(n.akhir_proyek).format(format)
+ : "-",
"Area Kerja": n.area_kerja ? n.area_kerja : "",
Perusahaan: n.company ? n.company : "",
Keterangan: n.keterangan ? n.keterangan : "",
"Dianggap sukses ketika": n.considered_success_when
- ? n.considered_success_when
- : "",
+ ? n.considered_success_when
+ : "",
"Tujuan Proyek": n.project_objectives ? n.project_objectives : "",
"Resiko potensial": n.potential_risk ? n.potential_risk : "",
"Rencana Biaya": n.rencana_biaya
- ? formatThousand(n.rencana_biaya)
- : "-",
+ ? formatThousand(n.rencana_biaya)
+ : "-",
"Testing Environment": n.testing_environment
- ? n.testing_environment
- : "-",
+ ? n.testing_environment
+ : "-",
};
excelData.push(dataRow);
});
@@ -791,33 +791,45 @@ const CreatedProyek = ({ params, ...props }) => {
}
};
- const handleExportPdf = () => {
+ const handleExportPdf = async () => {
const doc = new jsPDF();
const headers = [
["Project Name", "Budget", "Project Type", "PM", "Time Project"],
];
- const data = dataTable.map((elt) => [
- elt.nama,
- `Rp. ${formatThousand(elt.rencana_biaya)}`,
- elt.join_second_name,
- elt.join_first_name,
- `${moment(elt.mulai_proyek).format(format)} - ${moment(
- elt.akhir_proyek
- ).format(format)}`,
- ]);
- // Or use javascript directly:
- doc.text(4, 15, "Project Charter");
- autoTable(doc, {
- startY: 20,
- margin: { horizontal: 4 },
- styles: { overflow: "linebreak", columnWidth: "auto", fontSize: 8 },
- columnStyles: { text: { columnWidth: "auto" } },
- head: headers,
- body: data,
- });
+ const payload = {
+ paging: { start: 0, length: -1 },
+ joins: [],
+ orders: { columns: ["id"], ascending: false },
+ };
- doc.save("table.pdf");
+ const result = await axios
+ .post(PROYEK_SEARCH, payload, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+ if (result && result.data && result.data.code == 200) {
+ let resData = result.data.data;
+ const data = resData.map((elt) => [
+ elt.nama,
+ `Rp. ${formatThousand(elt.rencana_biaya)}`,
+ elt.join_second_name,
+ elt.join_first_name,
+ `${moment(elt.mulai_proyek).format(format)} - ${moment(
+ elt.akhir_proyek
+ ).format(format)}`,
+ ]);
+ // Or use javascript directly:
+ doc.text(4, 15, "Project Charter");
+ autoTable(doc, {
+ startY: 20,
+ margin: { horizontal: 4 },
+ styles: { overflow: "linebreak", columnWidth: "auto", fontSize: 8 },
+ columnStyles: { text: { columnWidth: "auto" } },
+ head: headers,
+ body: data,
+ });
+ }
+ doc.save("Project.pdf");
// const unit = "pt";
// const size = "A4"; // Use A1, A2, A3 or A4
// const orientation = "portrait"; // portrait or landscape
@@ -1321,12 +1333,12 @@ const CreatedProyek = ({ params, ...props }) => {
>
}
- // visible={visible}
- // onVisibleChange={handleVisibleChange}
+ // visible={visible}
+ // onVisibleChange={handleVisibleChange}
>
diff --git a/src/views/SimproV2/Divisi/index.js b/src/views/SimproV2/Divisi/index.js
index acab2bd..269e8f2 100644
--- a/src/views/SimproV2/Divisi/index.js
+++ b/src/views/SimproV2/Divisi/index.js
@@ -54,14 +54,23 @@ const ProjectType = ({ params }) => {
const [typeDialog, setTypeDialog] = useState('Save')
const [dataDivisions, setDataDivisions] = useState([])
+
+ useEffect(() => {
+ getListDivision()
+ }, [])
+
useEffect(() => {
getDataProjectType()
}, [currentPage, rowsPerPage, search])
- const getDataProjectType = async () => {
-
- let start = 0;
+ useEffect(() => {
+ const cekData = dataExport || []
+ if (cekData.length > 0) {
+ exportExcel()
+ }
+ }, [dataExport])
+ const getListDivision = async () => {
const listDivions = await axios
.get(DIVISI_LIST, HEADER)
.then(res => res)
@@ -76,11 +85,12 @@ const ProjectType = ({ params }) => {
} else {
NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
}
-
+ }
+ const getDataProjectType = async () => {
+ let start = 0;
if (currentPage !== 1 && currentPage > 1) {
start = (currentPage * rowsPerPage) - rowsPerPage
}
-
const payload = {
"columns": [
{
@@ -101,19 +111,78 @@ const ProjectType = ({ params }) => {
"start": start
}
}
-
const result = await axios
- .post(DIVISI_SEARCH, payload, config)
+ .post(DIVISI_SEARCH, payload, HEADER)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
+ result.data.data.map((res) => {
+ res.key = res.id.toString()
+ });
setDatatable(result.data.data);
setTotalPage(result.data.totalRecord);
} else {
NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
}
}
+ const handleExportExcel = async () => {
+ let start = 0;
+
+ if (currentPage !== 1 && currentPage > 1) {
+ start = (currentPage * rowsPerPage) - rowsPerPage
+ }
+
+ const payload = {
+ "columns": [
+ {
+ "name": "name",
+ "logic_operator": "like",
+ "value": search,
+ "operator": "AND"
+ }
+ ],
+ "orders": {
+ "ascending": true,
+ "columns": [
+ 'id'
+ ]
+ },
+ "paging": {
+ "length": rowsPerPage,
+ "start": start
+ }
+ }
+
+ const result = await axios
+ .post(DIVISI_SEARCH, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+ if (result && result.data && result.data.code == 200) {
+ let resData = result.data.data;
+ const excelData = [];
+ resData.map((val, index) => {
+ let dataRow = {
+ "Nama Divisi": val.name,
+ "Deskripsi": val.description,
+ }
+ excelData.push(dataRow)
+ })
+ await setDataExport(excelData)
+ } else {
+ NotificationManager.error('Gagal Export Data!!', 'Failed');
+ }
+ }
+
+ const exportExcel = () => {
+ const dataExcel = dataExport || [];
+ const fileName = `Data ${pageName}.xlsx`;
+ const ws = XLSX.utils.json_to_sheet(dataExcel);
+ const wb = XLSX.utils.book_new();
+ XLSX.utils.book_append_sheet(wb, ws, `Data ${pageName}`);
+ XLSX.writeFile(wb, fileName);
+ setDataExport([])
+ }
const handleSearch = e => {
const value = e.target.value
@@ -248,10 +317,16 @@ const ProjectType = ({ params }) => {
{pageName}
+
+
+
+
+
+
@@ -280,7 +355,7 @@ const ProjectType = ({ params }) => {
handleEdit(n)}>
- {n.displayName} |
+ {n.name} |
{n.description} |
)
diff --git a/src/views/SimproV2/Presence/index.js b/src/views/SimproV2/Presence/index.js
index 5cefa3e..e368342 100644
--- a/src/views/SimproV2/Presence/index.js
+++ b/src/views/SimproV2/Presence/index.js
@@ -196,12 +196,13 @@ const Index = ({ params }) => {
let dataRow = {
"NIK/ID Card": val.join_first_ktp_number ? val.join_first_ktp_number : '-',
"Nama Human Resource": val.join_first_name ? val.join_first_name : '',
- "Tanggal Kehadiran": val.date_presence ? moment(val.date_presence).format("D-M-YYYY") : '-',
"Jam Masuk": val.clock_in ? moment(val.clock_in).format("D-M-YYYY HH:mm:ss") : '-',
"Jam Keluar": val.clock_out ? moment(val.clock_out).format("D-M-YYYY HH:mm:ss") : '-',
"Durasi Kerja": renderDurasiKerja(val.clock_in, val.clock_out),
- "Clock-in Location": val.clock_in_loc && val.clock_in_loc !== '' ? val.clock_in_loc : '-',
- "Clock-out Location": val.clock_out_loc && val.clock_out_loc !== '' ? val.clock_out_loc : '-'
+ "Lokasi Masuk": val.clock_in_loc && val.clock_in_loc !== '' ? val.clock_in_loc : '-',
+ "Lokasi Pulang": val.clock_out_loc && val.clock_out_loc !== '' ? val.clock_out_loc : '-',
+ "Area Kerja In": val.clock_in_boundary ? "Sesuai" : "Tidak Sesuai",
+ "Area Kerja Out": val.clock_out_boundary == null ? "-" : val.clock_out_boundary ? "Sesuai" : "Tidak Sesuai",
}
excelData.push(dataRow)
})