(null);
+
+ return (
+
+
+
+ {/* }
+ sx={{ p: 1.8 }}
+ onClick={() => {
+ navigate('/claims/create');
+ }}
+ >
+ Create
+ */}
+
+
+ );
+ }
+
+ const searchInput = useRef(null);
+
+
+ //handle search
+ const handleSearchChange = (event: any) => {
+ const newSearchText = event.target.value ?? '';
+ setSearchText(newSearchText);
+ };
+
+ const handleSearchSubmit = (event: any) => {
+ event.preventDefault();
+ loadDataTableData();
+ };
+
+
+
+ useEffect(() => {
+ // Trigger First Search
+ //setSearchText(searchText);
+ }, []);
+
+ const item = [
+ {
+ id: '',
+ value: '',
+ name: 'Semua',
+ },
+ ];
+
+ // const handleClick = () => {
+
+ // }
+
+
+
+ // Dummy Default Data
+ const [dataTableIsLoading, setDataTableLoading] = useState(true);
+ const [dataTableData, setDataTableData] = useState(
+ LaravelPaginatedDataDefault
+ );
+
+
+
+ const loadDataTableData = async (appliedFilter: any | null = null) => {
+ setDataTableLoading(true);
+ const year = startDate?.getFullYear();
+ const month = (startDate?.getMonth() + 1).toString().padStart(2, '0'); // Tambahkan 1 karena bulan dimulai dari 0, dan padStart untuk memastikan 2 digit
+ const day = startDate?.getDate().toString().padStart(2, '0'); // padStart untuk memastikan 2 digit
+
+ const formattedDate = year && month && day ? `${year}-${month}-${day}` : '';
+
+ const year1 = endDate?.getFullYear();
+ const month1 = (endDate?.getMonth() + 1).toString().padStart(2, '0'); // Tambahkan 1 karena bulan dimulai dari 0, dan padStart untuk memastikan 2 digit
+ const day1 = endDate?.getDate().toString().padStart(2, '0'); // padStart untuk memastikan 2 digit
+
+ const formattedDate1 = year1 && month1 && day1 ? `${year1}-${month1}-${day1}` : '';
+
+ const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
+ const response = await axios.get('/get-doctorrating', {
+ params: {
+ search: searchText,
+ start_date: formattedDate ? formattedDate : null,
+ end_date:formattedDate1,
+ provider: dataProvider,
+ order: order,
+ orderBy: orderBy,
+ page: perPage,
+ }
+ });
+
+ setDataTableLoading(false);
+
+ setDataTableData(response.data);
+ };
+
+ const getProvider = async () => {
+ const response = await axios.get('/claims/get-provider');
+ setProviders(response.data)
+ }
+
+ const applyFilter = async (searchFilter: { search: string }) => {
+ await loadDataTableData(searchFilter);
+ setSearchParams(searchFilter);
+ };
+
+ const handlePageChange = (event: ChangeEvent, value: number): void => {
+ setPerPage(value);
+ };
+
+ const [openDialogSubmit, setOpenDialogSubmit] = useState(false);
+ const handleCloseDialogSubmit = () => {
+ setOpenDialogSubmit(false);
+ }
+
+ function toTitleCase(str: string | null) {
+ return str.replace(/\w\S*/g, function(txt) {
+ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
+ });
+ }
+
+ const [approve, setApprove] = useState('');
+
+ const [reasonDecline, setReasonDecline] = useState('');
+
+ const handleReasonDeclineChange = (event) => {
+ setReasonDecline(event.target.value);
+ // Tambahkan logika yang diperlukan di sini
+ };
+
+ const handleSubmitData = async () => {
+ try {
+ const response = await axios.post('download-zip', { selectedRows: selectedRows });
+ const fileUrl = response.data.file_url; // Perbaikan disini
+ enqueueSnackbar('Data berhasil di download', { variant: 'success' });
+ window.open(fileUrl, '_blank');
+ setOpenDialogSubmit(false);
+ setTimeout(() => {
+ window.location.reload();
+ }, 5000); // Reload the page after 5 seconds
+ } catch (error) {
+ enqueueSnackbar('Data Gagal di download', { variant: 'error' });
+ }
+ };
+
+ const handleSubmitData1 = () => {
+ //approve or decline
+ if (!reasonDecline && approve == 'decline') {
+ enqueueSnackbar('Mohon isi alasan', { variant: 'warning' });
+ return false;
+ }
+ Promise.all(selectedRows.map(send_bulk))
+ .then(() => {
+ enqueueSnackbar('All requests processed successfully', { variant: 'success' });
+ setOpenDialogSubmit(false);
+ setTimeout(() => {
+ window.location.reload();
+ }, 5000); // Reload the page after 5 seconds
+ })
+ .catch((error) => {
+ enqueueSnackbar(error.response?.data?.message ?? 'Something went wrong!', { variant: 'error' });
+ });
+ };
+
+ function send_bulk(id) {
+ return axios.post(`claims/${id}/${approve}`, { reasonDecline: reasonDecline });
+ }
+
+
+ const [anchorEl, setAnchorEl] = React.useState(null);
+ const createMenu = Boolean(anchorEl);
+ const importClaimManagement = useRef(null);
+ const [currentImportFileName, setCurrentImportFileName] = useState(null);
+ const [importLoading, setImportLoading] = useState(false);
+ const [importResult, setImportResult] = useState(null);
+ const handleClick = (event: React.MouseEvent) => {
+ setAnchorEl(event.currentTarget);
+ };
+ const handleClose = () => {
+ setAnchorEl(null);
+ };
+ const handleImportButton = () => {
+ if (importClaimManagement?.current) {
+ handleClose();
+ importClaimManagement.current ? importClaimManagement.current.click() : console.log('No File selected');
+ } else {
+ alert('No file selected');
+ }
+ };
+ const handleCancelImportButton = () => {
+ if(importClaimManagement.current)
+ {
+ importClaimManagement.current.value = '';
+ importClaimManagement.current.dispatchEvent(new Event('change', { bubbles: true }));
+ }
+ };
+ const handleImportChange = (event: any) => {
+ if (event.target.files[0]) {
+ setCurrentImportFileName(event.target.files[0].name);
+ } else {
+ setCurrentImportFileName(null);
+ }
+ };
+ const handleUpload = () => {
+ if(importClaimManagement.current && importClaimManagement.current.files)
+ {
+ if (importClaimManagement.current?.files.length) {
+ const formData = new FormData();
+ formData.append('file', importClaimManagement.current?.files[0]);
+ setImportLoading(true);
+ axios
+ .post('claims/import', formData)
+ .then((response) => {
+ handleCancelImportButton();
+ loadDataTableData();
+ setImportResult(response.data);
+ setImportLoading(false);
+ enqueueSnackbar('Success Import Claim Managemenet', { variant: 'success' });
+ })
+ .catch((response) => {
+ enqueueSnackbar(
+ 'Looks like something went wrong. Please check your data and try again. ' +
+ response.message,
+ { variant: 'error' }
+ );
+ setImportLoading(false);
+ });
+ } else {
+ enqueueSnackbar('No File Selected', { variant: 'warning' });
+ }
+ }
+ };
+ const handleGetTemplate = () => {
+ axios.get('claims/download-template').then((response) => {
+ const link = document.createElement('a');
+ link.href = response.data.data.file_url;
+ link.setAttribute('download', response.data.data.file_name);
+ document.body.appendChild(link);
+ link.click();
+ handleClose();
+ });
+
+
+ };
+
+ const handleExportReportFiled = async () => {
+
+ await axios
+ .post('claims/exportFiled', { params: importResult?.data.result_rows })
+ .then((res) => {
+ enqueueSnackbar('Data berhasil di Export', {
+ variant: 'success',
+ anchorOrigin: { horizontal: 'right', vertical: 'top' },
+ });
+ setIsLoading(false)
+
+ document.location.href = res.data.data.file_url;
+ })
+ .catch((err) =>
+ enqueueSnackbar('Data Gagal di Export', {
+ variant: 'error',
+ anchorOrigin: { horizontal: 'right', vertical: 'top' },
+ })
+
+ );
+ };
+
+
+ // useEffect(() => {
+ // loadDataTableData();
+ // getProvider();
+ // }, []);
+
+ const headStyle = {
+ fontWeight: 'bold',
+ };
+ // const headCells = [
+ // {
+ // id: 'dCreateOn',
+ // align: 'left',
+ // label: 'Date Submission',
+ // isSort: true,
+ // },
+ // {
+ // id: 'code',
+ // align: 'left',
+ // label: 'Code',
+ // isSort: true,
+ // },
+ // {
+ // id: 'name',
+ // align: 'left',
+ // label: 'Name',
+ // isSort: false,
+ // },
+ // {
+ // id: 'provider',
+ // align: 'left',
+ // label: 'Provider',
+ // isSort: false,
+ // },
+ // {
+ // id: 'files',
+ // align: 'left',
+ // label: 'Nama File',
+ // isSort: false,
+ // },
+ // ];
+ const headCells = [
+ {
+ id: 'nama_peserta',
+ align: 'left',
+ label: 'Nama Peserta',
+ isSort: true,
+ },
+ {
+ id: 'nama_dokter',
+ align: 'left',
+ label: 'Nama Dokter',
+ isSort: true,
+ },
+ {
+ id: 'rating',
+ align: 'left',
+ label: 'Rating',
+ isSort: true,
+ },
+ {
+ id: 'review',
+ align: 'left',
+ label: 'Review',
+ isSort: false,
+ },
+ {
+ id: 'tanggal_konsultasi',
+ align: 'left',
+ label: 'Tanggal Konsultasi',
+ isSort: true,
+ },
+ ];
+
+ const orders = {
+ order: order,
+ setOrder: setOrder,
+ orderBy: orderBy,
+ setOrderBy: setOrderBy,
+ };
+ const createSortHandler = (property: string) => (event: React.MouseEvent) => {
+ handleRequestSort(event, property);
+ };
+ const handleRequestSort = async (event: React.MouseEvent, property: string) => {
+ const isAsc = orders?.orderBy === property && orders?.order === 'asc';
+
+ orders?.setOrder(isAsc ? 'desc' : 'asc');
+ orders?.setOrderBy(property);
+ };
+ // Called on every row to map the data to the columns
+ function createData(data: Claims): Claims {
+ return {
+ ...data,
+ };
+ }
+
+ {
+ /* ------------------ TABLE ROW ------------------ */
+ }
+ function Row(props: { row: ReturnType, isSelected: boolean, onSelect: (id: string) => void }) {
+ const { row, isSelected, onSelect } = props;
+ // Memperbaiki destrukturisasi props
+
+ const handleRowCheckboxChange = () => {
+ onSelect(row.id); // Panggil fungsi onSelect dari komponen induk dengan id baris saat checkbox di baris diklik
+ };
+
+ const [open, setOpen] = React.useState(false);
+
+ const test = 1000;
+
+ return (
+
+ *': { borderBottom: 'unset' } }}>
+ {/*
+ setOpen(!open)}>
+ {open ? : }
+
+ */}
+ {/*
+
+ */}
+ {row?.nama_peserta}
+ {row?.nama_dokter}
+ {row?.nRating}
+ {row?.sNotes}
+ {row?.dCreateOn ? fDateTime(row?.dCreateOn) : ''}
+ {/* {row?.dCreateOn ? fDateTime(row?.dCreateOn) : ''} */}
+ {/* {row?.code} */}
+ {/* {row.code} */}
+ {/* {row?.provider} */}
+
+ {/* COLLAPSIBLE ROW */}
+
+
+
+ {/*
+
+ Description : {row.description}
+
+ */}
+
+
+
+
+ );
+ }
+ {
+ /* ------------------ END TABLE ROW ------------------ */
+ }
+
+
+
+ function TableContent() {
+ return (
+
+ {/* ------------------ TABLE HEADER ------------------ */}
+
+
+ {selectedRows.length > 0 ? (
+ <>
+
+
+
+ {selectedRows.length > 0 ? selectedRows.length : '0'} Selected
+
+
+
+
+
+ {/*
+ } onClick={() => {setOpenDialogSubmit(true);
+ setApprove('decline');}}>
+ Decline
+
+ */}
+
+ } onClick={() => {setOpenDialogSubmit(true);
+ setApprove('approve');}}>
+ Download
+
+
+
+ >
+ ) : (
+ <>
+ {/*
+
+ */}
+ {headCells &&
+ headCells.map((headCell, index) => (
+
+ {headCell.isSort ? (
+
+ {headCell.label}
+ {orders?.orderBy === headCell.id ? (
+
+ {orders.order === 'desc' ? 'sorted descending' : 'sorted ascending'}
+
+ ) : null}
+
+ ) : (
+ headCell.label
+ )}
+
+ ))}
+ >
+
+ )}
+
+
+
+
+ {/* ------------------ END TABLE HEADER ------------------ */}
+
+ {/* ------------------ TABLE ROW ------------------ */}
+ {dataTableIsLoading ? (
+
+
+
+ Loading
+
+
+
+ ) : dataTableData.data.length === 0 ? (
+
+
+
+ No Data
+
+
+
+ ) : (
+
+ {dataTableData.data.map((row) => (
+
+ ))}
+
+ )}
+ {/* ------------------ END TABLE ROW ------------------ */}
+
+ );
+ }
+
+ return (
+
+
+
+
+
+
+
+ }
+ />
+
+
+ );
+ }
diff --git a/frontend/dashboard/src/routes/index.tsx b/frontend/dashboard/src/routes/index.tsx
index 61acc03b..529d30cc 100644
--- a/frontend/dashboard/src/routes/index.tsx
+++ b/frontend/dashboard/src/routes/index.tsx
@@ -13,7 +13,7 @@ import { AuthProvider } from '../contexts/LaravelAuthContext';
import AuthGuard from '../guards/AuthGuard';
import { Link, useParams, useSearchParams } from 'react-router-dom';
import Prescription from '@/pages/Report/Prescription/Index';
-import DoctorRating from '@/pages/Report/DoctorRating/Index';
+import DoctorRating from '@/pages/Report/DoctorRating_v2/Index';
// ----------------------------------------------------------------------
@@ -443,7 +443,7 @@ export default function Router() {
element: ,
},
{
- path: 'report/doctorrating',
+ path: 'report/doctor-rating',
element: ,
},
{