diff --git a/frontend/dashboard/src/pages/Corporates/Benefit/List.tsx b/frontend/dashboard/src/pages/Corporates/Benefit/List.tsx index 024313ed..d39b2f1a 100644 --- a/frontend/dashboard/src/pages/Corporates/Benefit/List.tsx +++ b/frontend/dashboard/src/pages/Corporates/Benefit/List.tsx @@ -17,6 +17,7 @@ export default function PlanList() { const { themeStretch } = useSettings(); const { corporate_id } = useParams(); const [searchParams, setSearchParams] = useSearchParams(); + const [importResult, setImportResult] = useState(null); function SearchInput(props: any) { // SEARCH @@ -87,11 +88,12 @@ export default function PlanList() { if (importPlan.current?.files.length) { const formData = new FormData(); formData.append("file", importPlan.current?.files[0]) - axios.post(`corporates/${corporate_id}/benefits/import`, formData ) + axios.post(`corporates/${corporate_id}/import-plan-benefit`, formData ) .then(response => { handleCancelImportButton(); loadDataTableData(); - alert('Succesfully read '+ response.data.total_successed_row + ' with ' + response.data.total_failed_row + ' failed rows'); + setImportResult(response.data) + // alert('Succesfully read '+ response.data.total_successed_row + ' with ' + response.data.total_failed_row + ' failed rows'); }) .catch(response => { alert('Looks like something went wrong. Please check your data and try again. ' + response.message) @@ -149,6 +151,11 @@ export default function PlanList() { )} + {( importResult && + + Last Import Result Report : {importResult.result_file?.name ?? "-"} + + )} ); } diff --git a/frontend/dashboard/src/pages/Corporates/Plan/List.tsx b/frontend/dashboard/src/pages/Corporates/Plan/List.tsx index 1428332a..b5b85660 100644 --- a/frontend/dashboard/src/pages/Corporates/Plan/List.tsx +++ b/frontend/dashboard/src/pages/Corporates/Plan/List.tsx @@ -18,6 +18,7 @@ export default function CorporatePlanList() { const { themeStretch } = useSettings(); const { corporate_id } = useParams(); const [searchParams, setSearchParams] = useSearchParams(); + const [importResult, setImportResult] = useState(null); function SearchInput(props: any) { // SEARCH @@ -88,11 +89,12 @@ export default function CorporatePlanList() { if (importPlan.current?.files.length) { const formData = new FormData(); formData.append("file", importPlan.current?.files[0]) - axios.post(`corporates/${corporate_id}/plans/import`, formData ) + axios.post(`corporates/${corporate_id}/import-plan-benefit`, formData ) .then(response => { handleCancelImportButton(); loadDataTableData(); - alert('Succesfully read '+ response.data.total_successed_row + ' with ' + response.data.total_failed_row + ' failed rows'); + setImportResult(response.data) + // alert('Succesfully read '+ response.data.total_successed_row + ' with ' + response.data.total_failed_row + ' failed rows'); }) .catch(response => { alert('Looks like something went wrong. Please check your data and try again. ' + response.message) @@ -150,6 +152,11 @@ export default function CorporatePlanList() { )} + {( importResult && + + Last Import Result Report : {importResult.result_file?.name ?? "-"} + + )} ); } @@ -179,7 +186,7 @@ export default function CorporatePlanList() { {row.service_code} - {row.corporate_plan?.code} + {row.corporate_plan_id} {row.code} {row.type} {row.start}