tambah filter dan flag files
This commit is contained in:
@@ -70,6 +70,23 @@ class RequestLogController extends Controller
|
||||
$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) {
|
||||
$q->orderBy('submission_date', 'desc');
|
||||
})
|
||||
|
||||
@@ -123,7 +123,7 @@ export default function DialogUploadFileFinalLog({ id, openDialog, setOpenDialog
|
||||
{/* -------------------------------Upload Dokumen Kondisi------------------------------- */}
|
||||
<Stack sx={{ marginTop: 2 }}>
|
||||
<Typography variant="body1" sx={{fontWeight:'bold'}}>
|
||||
File Kondisi
|
||||
File Billing
|
||||
</Typography>
|
||||
{/* <Typography variant="body2">Hasil Lab, </Typography> */}
|
||||
<Stack
|
||||
@@ -240,7 +240,7 @@ export default function DialogUploadFileFinalLog({ id, openDialog, setOpenDialog
|
||||
{/* -------------------------------Upload Dokumen Hasil Penunjang------------------------------- */}
|
||||
<Stack sx={{ marginTop: 2 }}>
|
||||
<Typography variant="body1" sx={{fontWeight:'bold'}}>
|
||||
File Hasil Penunjang
|
||||
File Hasil Penunjang Medis
|
||||
</Typography>
|
||||
{/* <Typography variant="body2">Hasil Lab, </Typography> */}
|
||||
<Stack
|
||||
|
||||
@@ -16,9 +16,12 @@ import {
|
||||
Stack,
|
||||
Menu,
|
||||
ButtonGroup,
|
||||
FormControl,
|
||||
Select,
|
||||
Link,
|
||||
Chip,
|
||||
TableHead,
|
||||
InputLabel,
|
||||
Grid,
|
||||
} from '@mui/material';
|
||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||
@@ -64,6 +67,13 @@ export default function List() {
|
||||
|
||||
const navigate = useNavigate()
|
||||
|
||||
const fileOptions = {
|
||||
kondisi: 'Dokumen Billing',
|
||||
diagnosa: 'Dokumen Diagnosa',
|
||||
result: 'Dokumen Penduk Medis',
|
||||
none: 'Belum ada Dokumen'
|
||||
};
|
||||
|
||||
function SearchInput(props: any) {
|
||||
// SEARCH
|
||||
const searchInput = useRef<HTMLInputElement>(null);
|
||||
@@ -229,30 +239,64 @@ export default function List() {
|
||||
/>
|
||||
{!currentImportFileName && (
|
||||
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||
<SearchInput onSearch={applyFilter} />
|
||||
<Button
|
||||
variant="outlined"
|
||||
startIcon={<UploadIcon />}
|
||||
sx={{ p: 1.8 }}
|
||||
onClick={handleClick}
|
||||
>
|
||||
Import
|
||||
</Button>
|
||||
<Menu
|
||||
id="import-button"
|
||||
anchorEl={anchorEl}
|
||||
open={createMenu}
|
||||
onClose={handleClose}
|
||||
MenuListProps={{
|
||||
'aria-labelledby': 'basic-button',
|
||||
}}
|
||||
<Grid item md={9}>
|
||||
<SearchInput onSearch={applyFilter} />
|
||||
|
||||
</Grid>
|
||||
<Grid item md={2}>
|
||||
<FormControl fullWidth>
|
||||
<InputLabel>File</InputLabel>
|
||||
<Select
|
||||
value={searchParams.get('file') ?? 'semua'} // Pastikan menggunakan kunci 'file'
|
||||
label="File"
|
||||
onChange={(el) => {
|
||||
const selectedValue = el.target.value;
|
||||
const filter = Object.fromEntries(searchParams.entries());
|
||||
|
||||
if (selectedValue === 'semua') {
|
||||
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>
|
||||
<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>
|
||||
Import
|
||||
</Button>
|
||||
<Menu
|
||||
id="import-button"
|
||||
anchorEl={anchorEl}
|
||||
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
|
||||
variant="contained"
|
||||
startIcon={<AddIcon />}
|
||||
@@ -413,7 +457,36 @@ export default function List() {
|
||||
) : '-'}
|
||||
</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">
|
||||
{ row.status_final_log == "requested" ?
|
||||
(<Label variant='ghost' color='primary'>{capitalizeFirstLetter(row.status_final_log)}</Label>) :
|
||||
@@ -572,6 +645,12 @@ export default function List() {
|
||||
label: 'Claim Method',
|
||||
isSort: false,
|
||||
},
|
||||
{
|
||||
id: 'file',
|
||||
align: 'left',
|
||||
label: 'File Upload',
|
||||
isSort: true,
|
||||
},
|
||||
{
|
||||
id: 'status',
|
||||
align: 'left',
|
||||
|
||||
@@ -108,9 +108,9 @@ export type Benefit = {
|
||||
}
|
||||
|
||||
export type files_by_type = {
|
||||
claim_diagnosis : file[],
|
||||
claim_kondisi : file[],
|
||||
claim_result : file[],
|
||||
final_log_diagnosis : file[],
|
||||
final_log_kondisi : file[],
|
||||
final_log_result : file[],
|
||||
}
|
||||
|
||||
export type file = {
|
||||
|
||||
Reference in New Issue
Block a user