tambah filter dan flag files
This commit is contained in:
@@ -70,6 +70,23 @@ class RequestLogController extends Controller
|
|||||||
$q->orderBy($orderBy, $request->order);
|
$q->orderBy($orderBy, $request->order);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
->when($request->file, function ($q, $search) {
|
||||||
|
if ($search == 'kondisi') {
|
||||||
|
$q->whereHas('files', function ($subQuery) {
|
||||||
|
$subQuery->where('type', 'final-log-kondisi');
|
||||||
|
});
|
||||||
|
} elseif ($search == 'diagnosa') {
|
||||||
|
$q->whereHas('files', function ($subQuery) {
|
||||||
|
$subQuery->where('type', 'final-log-diagnosis');
|
||||||
|
});
|
||||||
|
} elseif ($search == 'result') {
|
||||||
|
$q->whereHas('files', function ($subQuery) {
|
||||||
|
$subQuery->where('type', 'final-log-result');
|
||||||
|
});
|
||||||
|
} elseif ($search == 'none') {
|
||||||
|
$q->doesntHave('files');
|
||||||
|
}
|
||||||
|
})
|
||||||
->when(empty($request->orderBy), function ($q) {
|
->when(empty($request->orderBy), function ($q) {
|
||||||
$q->orderBy('submission_date', 'desc');
|
$q->orderBy('submission_date', 'desc');
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ export default function DialogUploadFileFinalLog({ id, openDialog, setOpenDialog
|
|||||||
{/* -------------------------------Upload Dokumen Kondisi------------------------------- */}
|
{/* -------------------------------Upload Dokumen Kondisi------------------------------- */}
|
||||||
<Stack sx={{ marginTop: 2 }}>
|
<Stack sx={{ marginTop: 2 }}>
|
||||||
<Typography variant="body1" sx={{fontWeight:'bold'}}>
|
<Typography variant="body1" sx={{fontWeight:'bold'}}>
|
||||||
File Kondisi
|
File Billing
|
||||||
</Typography>
|
</Typography>
|
||||||
{/* <Typography variant="body2">Hasil Lab, </Typography> */}
|
{/* <Typography variant="body2">Hasil Lab, </Typography> */}
|
||||||
<Stack
|
<Stack
|
||||||
@@ -240,7 +240,7 @@ export default function DialogUploadFileFinalLog({ id, openDialog, setOpenDialog
|
|||||||
{/* -------------------------------Upload Dokumen Hasil Penunjang------------------------------- */}
|
{/* -------------------------------Upload Dokumen Hasil Penunjang------------------------------- */}
|
||||||
<Stack sx={{ marginTop: 2 }}>
|
<Stack sx={{ marginTop: 2 }}>
|
||||||
<Typography variant="body1" sx={{fontWeight:'bold'}}>
|
<Typography variant="body1" sx={{fontWeight:'bold'}}>
|
||||||
File Hasil Penunjang
|
File Hasil Penunjang Medis
|
||||||
</Typography>
|
</Typography>
|
||||||
{/* <Typography variant="body2">Hasil Lab, </Typography> */}
|
{/* <Typography variant="body2">Hasil Lab, </Typography> */}
|
||||||
<Stack
|
<Stack
|
||||||
|
|||||||
@@ -16,9 +16,12 @@ import {
|
|||||||
Stack,
|
Stack,
|
||||||
Menu,
|
Menu,
|
||||||
ButtonGroup,
|
ButtonGroup,
|
||||||
|
FormControl,
|
||||||
|
Select,
|
||||||
Link,
|
Link,
|
||||||
Chip,
|
Chip,
|
||||||
TableHead,
|
TableHead,
|
||||||
|
InputLabel,
|
||||||
Grid,
|
Grid,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||||
@@ -64,6 +67,13 @@ export default function List() {
|
|||||||
|
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
|
const fileOptions = {
|
||||||
|
kondisi: 'Dokumen Billing',
|
||||||
|
diagnosa: 'Dokumen Diagnosa',
|
||||||
|
result: 'Dokumen Penduk Medis',
|
||||||
|
none: 'Belum ada Dokumen'
|
||||||
|
};
|
||||||
|
|
||||||
function SearchInput(props: any) {
|
function SearchInput(props: any) {
|
||||||
// SEARCH
|
// SEARCH
|
||||||
const searchInput = useRef<HTMLInputElement>(null);
|
const searchInput = useRef<HTMLInputElement>(null);
|
||||||
@@ -229,30 +239,64 @@ export default function List() {
|
|||||||
/>
|
/>
|
||||||
{!currentImportFileName && (
|
{!currentImportFileName && (
|
||||||
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||||
<SearchInput onSearch={applyFilter} />
|
<Grid item md={9}>
|
||||||
<Button
|
<SearchInput onSearch={applyFilter} />
|
||||||
variant="outlined"
|
|
||||||
startIcon={<UploadIcon />}
|
</Grid>
|
||||||
sx={{ p: 1.8 }}
|
<Grid item md={2}>
|
||||||
onClick={handleClick}
|
<FormControl fullWidth>
|
||||||
>
|
<InputLabel>File</InputLabel>
|
||||||
Import
|
<Select
|
||||||
</Button>
|
value={searchParams.get('file') ?? 'semua'} // Pastikan menggunakan kunci 'file'
|
||||||
<Menu
|
label="File"
|
||||||
id="import-button"
|
onChange={(el) => {
|
||||||
anchorEl={anchorEl}
|
const selectedValue = el.target.value;
|
||||||
open={createMenu}
|
const filter = Object.fromEntries(searchParams.entries());
|
||||||
onClose={handleClose}
|
|
||||||
MenuListProps={{
|
if (selectedValue === 'semua') {
|
||||||
'aria-labelledby': 'basic-button',
|
delete filter.file; // Menghapus filter 'file' jika memilih 'semua'
|
||||||
}}
|
} else {
|
||||||
|
filter.file = selectedValue; // Menambahkan atau memperbarui filter 'file'
|
||||||
|
}
|
||||||
|
|
||||||
|
setSearchParams(filter); // Update state searchParams
|
||||||
|
loadDataTableData(filter); // Memuat data sesuai filter
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MenuItem value={'semua'}>Semua</MenuItem>
|
||||||
|
{Object.entries(fileOptions).map((option, index) => (
|
||||||
|
<MenuItem value={option[0]} key={index}>
|
||||||
|
{option[1]}
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
</Grid>
|
||||||
|
<Grid item md={1}>
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
startIcon={<UploadIcon />}
|
||||||
|
sx={{ p: 1.8 }}
|
||||||
|
onClick={handleClick}
|
||||||
>
|
>
|
||||||
<MenuItem onClick={() => {handleImportButton('claim')}}>Import</MenuItem>
|
Import
|
||||||
<MenuItem onClick={() => {handleGetTemplate('claim-request')}}>Download Template</MenuItem>
|
</Button>
|
||||||
<MenuItem onClick={() => {handleGetData('data-plan-benefit')}}>Download Claim Request</MenuItem>
|
<Menu
|
||||||
<MenuItem onClick={() => {handleImportButton('invoice')}}>Import Invoice</MenuItem>
|
id="import-button"
|
||||||
<MenuItem onClick={() => {handleGetTemplate('final-log-invoice')}}>Download Template Invoice</MenuItem>
|
anchorEl={anchorEl}
|
||||||
</Menu>
|
open={createMenu}
|
||||||
|
onClose={handleClose}
|
||||||
|
MenuListProps={{
|
||||||
|
'aria-labelledby': 'basic-button',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MenuItem onClick={() => {handleImportButton('claim')}}>Import</MenuItem>
|
||||||
|
<MenuItem onClick={() => {handleGetTemplate('claim-request')}}>Download Template</MenuItem>
|
||||||
|
<MenuItem onClick={() => {handleGetData('data-plan-benefit')}}>Download Claim Request</MenuItem>
|
||||||
|
<MenuItem onClick={() => {handleImportButton('invoice')}}>Import Invoice</MenuItem>
|
||||||
|
<MenuItem onClick={() => {handleGetTemplate('final-log-invoice')}}>Download Template Invoice</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
</Grid>
|
||||||
{/* <Button
|
{/* <Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
startIcon={<AddIcon />}
|
startIcon={<AddIcon />}
|
||||||
@@ -413,7 +457,36 @@ export default function List() {
|
|||||||
) : '-'}
|
) : '-'}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="left">{row.service_name}</TableCell>
|
<TableCell align="left">{row.service_name}</TableCell>
|
||||||
<TableCell align="left">{row.payment_type_name}</TableCell>
|
<TableCell align="left">
|
||||||
|
{row.payment_type_name}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
{row.files_by_type?.final_log_diagnosis?.length > 0 && (
|
||||||
|
<>
|
||||||
|
<Label variant='ghost' color='primary'>
|
||||||
|
File Diagnosa {row.files_by_type.final_log_diagnosis.length}
|
||||||
|
</Label>
|
||||||
|
<br />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{row.files_by_type?.final_log_kondisi?.length > 0 && (
|
||||||
|
<>
|
||||||
|
<Label variant='ghost' color='success'>
|
||||||
|
File Billing {row.files_by_type.final_log_kondisi.length}
|
||||||
|
</Label>
|
||||||
|
<br />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{row.files_by_type?.final_log_result?.length > 0 && (
|
||||||
|
<Label variant='ghost' color='warning'>
|
||||||
|
File Pendukung Medis {row.files_by_type.final_log_result.length}
|
||||||
|
</Label>
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
|
|
||||||
|
|
||||||
<TableCell align="left">
|
<TableCell align="left">
|
||||||
{ row.status_final_log == "requested" ?
|
{ row.status_final_log == "requested" ?
|
||||||
(<Label variant='ghost' color='primary'>{capitalizeFirstLetter(row.status_final_log)}</Label>) :
|
(<Label variant='ghost' color='primary'>{capitalizeFirstLetter(row.status_final_log)}</Label>) :
|
||||||
@@ -572,6 +645,12 @@ export default function List() {
|
|||||||
label: 'Claim Method',
|
label: 'Claim Method',
|
||||||
isSort: false,
|
isSort: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'file',
|
||||||
|
align: 'left',
|
||||||
|
label: 'File Upload',
|
||||||
|
isSort: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'status',
|
id: 'status',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|||||||
@@ -108,9 +108,9 @@ export type Benefit = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type files_by_type = {
|
export type files_by_type = {
|
||||||
claim_diagnosis : file[],
|
final_log_diagnosis : file[],
|
||||||
claim_kondisi : file[],
|
final_log_kondisi : file[],
|
||||||
claim_result : file[],
|
final_log_result : file[],
|
||||||
}
|
}
|
||||||
|
|
||||||
export type file = {
|
export type file = {
|
||||||
|
|||||||
Reference in New Issue
Block a user