(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: 'dCreateOn',
+ 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?.rating}
+ {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/pages/Report/KatalogDokter/Index.tsx b/frontend/dashboard/src/pages/Report/KatalogDokter/Index.tsx
new file mode 100644
index 00000000..54f4553e
--- /dev/null
+++ b/frontend/dashboard/src/pages/Report/KatalogDokter/Index.tsx
@@ -0,0 +1,35 @@
+import { Card, Grid, Container } from '@mui/material';
+import { useParams } from 'react-router-dom';
+import HeaderBreadcrumbs from '../../../components/HeaderBreadcrumbs';
+import Page from '../../../components/Page';
+import useSettings from '../../../hooks/useSettings';
+import List from './List';
+
+export default function Index() {
+ const { themeStretch } = useSettings();
+
+ const { id } = useParams();
+
+ const pageTitle = 'Katalog Dokter & Profile';
+ return (
+
+
+
+
+
+
+
+ );
+}
diff --git a/frontend/dashboard/src/pages/Report/KatalogDokter/List.tsx b/frontend/dashboard/src/pages/Report/KatalogDokter/List.tsx
new file mode 100644
index 00000000..65e4f327
--- /dev/null
+++ b/frontend/dashboard/src/pages/Report/KatalogDokter/List.tsx
@@ -0,0 +1,1027 @@
+// @mui
+import {
+ Box,
+ Grid,
+ Button,
+ Card,
+ Collapse,
+ IconButton,
+ MenuItem,
+ Table,
+ TableBody,
+ TableCell,
+ TableRow,
+ TextField,
+ Typography,
+ Stack,
+ Menu,
+ ButtonGroup,
+ Tooltip,
+ TableHead,
+ Checkbox,
+ InputAdornment,
+ TableSortLabel,
+ FormControl
+ } from '@mui/material';
+ import { visuallyHidden } from '@mui/utils';
+
+ import { DesktopDatePicker, LocalizationProvider } from '@mui/x-date-pickers';
+ import { fDateOnly } from '@/utils/formatTime';
+
+ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
+ import FindInPageOutlinedIcon from '@mui/icons-material/FindInPageOutlined';
+ import AssessmentIcon from '@mui/icons-material/Assessment';
+ // hooks
+ import React, { ChangeEvent, useEffect, useRef, useState } from 'react';
+ import { Link, Navigate, useNavigate, useSearchParams } from 'react-router-dom';
+
+ import { LoadingButton } from '@mui/lab';
+ // components
+ import axios from '../../../utils/axios';
+ import { LaravelPaginatedData, LaravelPaginatedDataDefault } from '../../../@types/paginated-data';
+ import DataTable from '../../../components/LaravelTable';
+ import { fCurrency } from '../../utils/formatNumber';
+ import EditRoundedIcon from '@mui/icons-material/EditRounded';
+ import { Chip } from '@mui/material';
+ import Iconify from '@/components/Iconify';
+ import { enqueueSnackbar } from 'notistack';
+ import { fDate, fDateTime } from '../../../utils/formatTime';
+ import { Claims } from '@/@types/claims';
+ import Label from '@/components/Label';
+ import { capitalizeFirstLetter } from '@/utils/formatString';
+ import TableMoreMenu from '@/components/table/TableMoreMenu';
+ import Edit from '@mui/icons-material/Edit';
+ import { Download } from '@mui/icons-material';
+ import { Add, Search } from '@mui/icons-material';
+ import Autocomplete from '@mui/material/Autocomplete';
+
+ import DownloadIcon from '@mui/icons-material/Download';
+
+ import UploadIcon from '@mui/icons-material/Upload';
+ import CancelIcon from '@mui/icons-material/Cancel';
+ import CheckCircleIcon from '@mui/icons-material/CheckCircle';
+
+ import { Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material';
+ import CloseIcon from '@mui/icons-material/Close';
+
+
+ export default function List() {
+ const [selectAll, setSelectAll] = useState(false);
+ const [selectedRows, setSelectedRows] = useState([]);
+ const [providers, setProviders] = useState(null);
+ // const [searchText, setSearchText] = useState('');
+ const [order, setOrder] = useState('desc');
+ const [orderBy, setOrderBy] = useState('dSTRExpireDate');
+ const [perPage, setPerPage] = useState(0);
+
+ const handleChange = (event, newValue) => {
+ // Jika newValue tidak undefined, atur nilai dataProvider
+ if (newValue !== undefined) {
+ setDataProvider(newValue.service_code);
+ } else {
+ // Jika tidak ada yang dipilih, set dataProvider menjadi string kosong
+ setDataProvider(null);
+ }
+ };
+ // Dummy data
+ const dummyServices = [
+ { service_code: '1', name: 'Service 1' },
+ { service_code: '2', name: 'Service 2' },
+ { service_code: '3', name: 'Service 3' },
+ // tambahkan data lain sesuai kebutuhan
+ ];
+
+
+
+ const handleSelectAll = () => {
+ setSelectAll(!selectAll);
+ if (!selectAll) {
+ const requestedIds = dataTableData.data
+ .filter(row => row.status === 'approved') // Memfilter baris dengan status 'requested'
+ .map(row => row.id); // Mengambil hanya ID dari baris-baris yang memenuhi kondisi
+ setSelectedRows(requestedIds);
+ } else {
+ setSelectedRows([]);
+ }
+ };
+
+ const handleRowSelect = (id) => {
+ if (selectedRows.includes(id)) {
+ setSelectedRows(selectedRows.filter(rowId => rowId !== id));
+ } else {
+ setSelectedRows([...selectedRows, id]);
+ }
+ };
+
+ const [searchParams, setSearchParams] = useSearchParams();
+ const [startDate, setStartDate] = useState(null);
+ const [searchText, setSearchText] = useState('');
+ const [endDate, setEndDate] = useState(null);
+ const navigate = useNavigate();
+ const [dataProvider, setDataProvider] = useState(null);
+
+ useEffect(() => {
+ if (startDate !== null || endDate !== null || dataProvider !== null
+ || order !== null || orderBy !== null || perPage !== 0) {
+ loadDataTableData();
+ getProvider();
+ }
+ }, [startDate, endDate, dataProvider, order, orderBy, perPage]);
+
+ const [isLoading, setIsLoading] = useState(false);
+ const [isLoadingImport, setIsLoadingImport] = useState(false);
+ const handleExportReport = async () => {
+
+
+ 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}` : '';
+
+
+
+ var filter = Object.fromEntries([...searchParams.entries()]);
+ setIsLoading(true)
+ await axios
+ .get('/export-dokter-katalog',{
+ params: {
+ search: searchText,
+ start_date: formattedDate ? formattedDate : null,
+ end_date:formattedDate1,
+ provider: dataProvider,
+ order: order,
+ orderBy: orderBy,
+ page: perPage,
+ }
+ })
+ .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' },
+ })
+
+ );
+ };
+
+
+ function SearchInput(props: any) {
+ // SEARCH
+ const searchInput = useRef(null);
+
+
+
+ const handleSearchChange = (event: any) => {
+ const newSearchText = event.target.value ?? '';
+ setSearchText(newSearchText);
+ };
+
+ const handleSearchSubmit = (event: any) => {
+ event.preventDefault();
+ props.onSearch({ search: searchText }); // Trigger to Parent
+ };
+
+ const handleGetData = (type :string) => {
+ axios.get(`claims/1/data-claim`)
+ .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();
+ })
+ }
+
+ useEffect(() => {
+ // Trigger First Search
+ // setSearchText(searchParams.get('search') ?? '');
+ }, []);
+
+ return (
+
+ );
+ }
+
+ function ImportForm(props: any) {
+ // IMPORT
+ // Create Button Menu
+ const [anchorEl, setAnchorEl] = React.useState(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-dokter-katalog', {
+ 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_dokter',
+ align: 'left',
+ label: 'Nama Dokter',
+ isSort: true,
+ },
+ {
+ id: 'lulusan',
+ align: 'left',
+ label: 'Lulusan',
+ isSort: true,
+ },
+ {
+ id: 'str',
+ align: 'left',
+ label: 'STR',
+ isSort: false,
+ },
+ {
+ id: 'sip',
+ align: 'left',
+ label: 'SIP',
+ isSort: false,
+ },
+ {
+ id: 'tempat_praktek',
+ align: 'left',
+ label: 'Tempat Praktek',
+ isSort: false,
+ },
+ ];
+
+ 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_dokter}
+ {row?.lulusan}
+ {row?.str}
+ {row?.sip}
+ {row?.tempat_praktek}
+ {/* {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 5a68d9f6..2fa32d41 100644
--- a/frontend/dashboard/src/routes/index.tsx
+++ b/frontend/dashboard/src/routes/index.tsx
@@ -12,7 +12,8 @@ import VerifyCode from '../pages/auth/VerifyCode';
import { AuthProvider } from '../contexts/LaravelAuthContext';
import AuthGuard from '../guards/AuthGuard';
import { Link, useParams, useSearchParams } from 'react-router-dom';
-import DoctorRating from '@/pages/Report/DoctorRating/Index';
+import DoctorRating from '@/pages/Report/DoctorRating_v2/Index';
+import KatalogDokter from '@/pages/Report/KatalogDokter/Index';
// ----------------------------------------------------------------------
@@ -438,9 +439,17 @@ export default function Router() {
element: ,
},
{
- path: 'report/doctorrating',
+ path: 'report/prescription',
+ element: ,
+ },
+ {
+ path: 'report/doctor-rating',
element: ,
},
+ {
+ path: 'report/katalog-dokter',
+ element: ,
+ },
{
path: 'report/linksehat-payments',
element: ,