finishing feature/dashboard-create-claim-request
This commit is contained in:
@@ -43,7 +43,7 @@ export default function Claim() {
|
||||
|
||||
useEffect(() => {
|
||||
loadDataTableData();
|
||||
}, [loadDataTableData])
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<Page title={ `claims | ${memberDetail?.name??'_ _ _'}` } sx={{ px: 2 }}>
|
||||
|
||||
@@ -37,7 +37,7 @@ export default function ClaimListRow ({ ...props }: Props) {
|
||||
<TableRow hover sx={{ '& > td': { borderBottom: '1' } }}>
|
||||
<TableCell align="left" />
|
||||
<TableCell align="left">
|
||||
{props.row.admission_dates == "0000-00-00 00:00:00" ?
|
||||
{props.row.admission_date == "0000-00-00 00:00:00" ?
|
||||
('-')
|
||||
:
|
||||
(
|
||||
@@ -45,12 +45,12 @@ export default function ClaimListRow ({ ...props }: Props) {
|
||||
variant="ghost"
|
||||
color="default"
|
||||
>
|
||||
{fDate(props.row.admission_dates)}
|
||||
{fDate(props.row.admission_date)}
|
||||
</Label>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
{props.row.discharge_dates == "0000-00-00 00:00:00" ?
|
||||
{props.row.discharge_date == "0000-00-00 00:00:00" ?
|
||||
('-')
|
||||
:
|
||||
(
|
||||
@@ -58,7 +58,7 @@ export default function ClaimListRow ({ ...props }: Props) {
|
||||
variant="ghost"
|
||||
color="default"
|
||||
>
|
||||
{fDate(props.row.discharge_dates)}
|
||||
{fDate(props.row.discharge_date)}
|
||||
</Label>
|
||||
)}
|
||||
</TableCell>
|
||||
|
||||
@@ -30,8 +30,8 @@ export type MemberDetailType = {
|
||||
*/
|
||||
export type ClaimListType = {
|
||||
claim_id : number,
|
||||
admission_dates : string,
|
||||
discharge_dates : string,
|
||||
admission_date : string,
|
||||
discharge_date : string,
|
||||
claim_code : string,
|
||||
claim_status : string,
|
||||
service_type : string,
|
||||
|
||||
@@ -37,7 +37,7 @@ export default function ClaimListRow ({ ...props }: Props) {
|
||||
<TableRow hover sx={{ '& > td': { borderBottom: '1' } }}>
|
||||
<TableCell align="left" />
|
||||
<TableCell align="left">
|
||||
{props.row.admission_dates == "0000-00-00 00:00:00" ?
|
||||
{props.row.admission_date == "0000-00-00 00:00:00" ?
|
||||
('-')
|
||||
:
|
||||
(
|
||||
@@ -45,12 +45,12 @@ export default function ClaimListRow ({ ...props }: Props) {
|
||||
variant="ghost"
|
||||
color="default"
|
||||
>
|
||||
{fDate(props.row.admission_dates)}
|
||||
{fDate(props.row.admission_date)}
|
||||
</Label>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
{props.row.discharge_dates == "0000-00-00 00:00:00" ?
|
||||
{props.row.discharge_date == "0000-00-00 00:00:00" ?
|
||||
('-')
|
||||
:
|
||||
(
|
||||
@@ -58,7 +58,7 @@ export default function ClaimListRow ({ ...props }: Props) {
|
||||
variant="ghost"
|
||||
color="default"
|
||||
>
|
||||
{fDate(props.row.discharge_dates)}
|
||||
{fDate(props.row.discharge_date)}
|
||||
</Label>
|
||||
)}
|
||||
</TableCell>
|
||||
|
||||
@@ -30,8 +30,8 @@ export type MemberDetailType = {
|
||||
*/
|
||||
export type ClaimListType = {
|
||||
claim_id : number,
|
||||
admission_dates : string,
|
||||
discharge_dates : string,
|
||||
admission_date : string,
|
||||
discharge_date : string,
|
||||
claim_code : string,
|
||||
claim_status : string,
|
||||
service_type : string,
|
||||
|
||||
@@ -81,33 +81,33 @@ export default function FormCreate() {
|
||||
|
||||
// Function - Handle Btn Upload
|
||||
// -----------------------------
|
||||
const handleChangeInput = (data: MemberListType, type_file: 'invoice'|'prescription'|'laboratorium', file: any) => {
|
||||
const handleChangeInput = (data: MemberListType, type_file: 'kondisi'|'diagnosa'|'penunjang', file: any) => {
|
||||
let newListChoosed = listChoosed.map((list) => {
|
||||
if (data.id == list.id) {
|
||||
if (type_file == 'invoice') {
|
||||
if (list.invoice_files == undefined) {
|
||||
list.invoice_files = [file];
|
||||
if (type_file == 'kondisi') {
|
||||
if (list.file_kondisi == undefined) {
|
||||
list.file_kondisi = [file];
|
||||
}
|
||||
else {
|
||||
list.invoice_files.push(file);
|
||||
list.file_kondisi.push(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (type_file == 'prescription') {
|
||||
if (list.prescription_files == undefined) {
|
||||
list.prescription_files = [file];
|
||||
if (type_file == 'diagnosa') {
|
||||
if (list.file_diagnosa == undefined) {
|
||||
list.file_diagnosa = [file];
|
||||
}
|
||||
else {
|
||||
list.prescription_files.push(file);
|
||||
list.file_diagnosa.push(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (type_file == 'laboratorium') {
|
||||
if (list.laboratorium_files == undefined) {
|
||||
list.laboratorium_files = [file];
|
||||
if (type_file == 'penunjang') {
|
||||
if (list.file_penunjang == undefined) {
|
||||
list.file_penunjang = [file];
|
||||
}
|
||||
else {
|
||||
list.laboratorium_files.push(file);
|
||||
list.file_penunjang.push(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,27 +120,27 @@ export default function FormCreate() {
|
||||
|
||||
// Function - Handle Remove Fle
|
||||
// -----------------------------
|
||||
const handleRemoveFile = (data: MemberListType, type_file: 'invoice'|'prescription'|'laboratorium', target_index: number) => {
|
||||
const handleRemoveFile = (data: MemberListType, type_file: 'kondisi'|'diagnosa'|'penunjang', target_index: number) => {
|
||||
let newListChoosed = listChoosed.map((list) => {
|
||||
if (data.id == list.id) {
|
||||
if (type_file == 'invoice') {
|
||||
list.invoice_files = list.invoice_files?.filter((file: any, index: number) =>{
|
||||
if (type_file == 'kondisi') {
|
||||
list.file_kondisi = list.file_kondisi?.filter((file: any, index: number) =>{
|
||||
if (target_index !== index) {
|
||||
return file;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (type_file == 'prescription') {
|
||||
list.prescription_files = list.prescription_files?.filter((file: any, index: number) =>{
|
||||
if (type_file == 'diagnosa') {
|
||||
list.file_diagnosa = list.file_diagnosa?.filter((file: any, index: number) =>{
|
||||
if (target_index !== index) {
|
||||
return file;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (type_file == 'laboratorium') {
|
||||
list.laboratorium_files = list.laboratorium_files?.filter((file: any, index: number) =>{
|
||||
if (type_file == 'penunjang') {
|
||||
list.file_penunjang = list.file_penunjang?.filter((file: any, index: number) =>{
|
||||
if (target_index !== index) {
|
||||
return file;
|
||||
}
|
||||
@@ -282,59 +282,59 @@ export default function FormCreate() {
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
{/* Invoice */}
|
||||
{/* File Kondisi */}
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="h6">Real Invoice</Typography>
|
||||
<Typography variant="h6">Condition Document</Typography>
|
||||
</Grid>
|
||||
|
||||
{row.invoice_files && row.invoice_files.map((file, index) => (
|
||||
{row.file_kondisi && row.file_kondisi.map((file, index) => (
|
||||
<Grid item xs={12} key={index}>
|
||||
<FormCreateFilesUpload file={file} handleRemoveFileProp={() => handleRemoveFile(row, 'invoice', index)} />
|
||||
<FormCreateFilesUpload file={file} handleRemoveFileProp={() => handleRemoveFile(row, 'kondisi', index)} />
|
||||
</Grid>
|
||||
))}
|
||||
|
||||
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
||||
<FormCreateBtnUpload handleChangeInputProp={(file) => handleChangeInput(row, 'invoice', file)} />
|
||||
<FormCreateBtnUpload handleChangeInputProp={(file) => handleChangeInput(row, 'kondisi', file)} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
{/* Prescription */}
|
||||
{/* File Diagnosa */}
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="h6">Doctor's Prescription and Another Documents</Typography>
|
||||
<Typography variant="h6">Diagnosis Document</Typography>
|
||||
</Grid>
|
||||
|
||||
{row.prescription_files && row.prescription_files.map((file, index) => (
|
||||
{row.file_diagnosa && row.file_diagnosa.map((file, index) => (
|
||||
<Grid item xs={12} key={index}>
|
||||
<FormCreateFilesUpload file={file} handleRemoveFileProp={() => handleRemoveFile(row, 'prescription', index)} />
|
||||
<FormCreateFilesUpload file={file} handleRemoveFileProp={() => handleRemoveFile(row, 'diagnosa', index)} />
|
||||
</Grid>
|
||||
))}
|
||||
|
||||
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
||||
<FormCreateBtnUpload handleChangeInputProp={(file) => handleChangeInput(row, 'prescription', file)} />
|
||||
<FormCreateBtnUpload handleChangeInputProp={(file) => handleChangeInput(row, 'diagnosa', file)} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
{/* Laboratorium */}
|
||||
{/* File Penunjang */}
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="h6">Laboratory Results</Typography>
|
||||
<Typography variant="h6">Supporting Result Document</Typography>
|
||||
</Grid>
|
||||
|
||||
{row.laboratorium_files && row.laboratorium_files.map((file, index) => (
|
||||
{row.file_penunjang && row.file_penunjang.map((file, index) => (
|
||||
<Grid item xs={12} key={index}>
|
||||
<FormCreateFilesUpload file={file} handleRemoveFileProp={() => handleRemoveFile(row, 'laboratorium', index)} />
|
||||
<FormCreateFilesUpload file={file} handleRemoveFileProp={() => handleRemoveFile(row, 'penunjang', index)} />
|
||||
</Grid>
|
||||
))}
|
||||
|
||||
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
||||
<FormCreateBtnUpload handleChangeInputProp={(file) => handleChangeInput(row, 'laboratorium', file)} />
|
||||
<FormCreateBtnUpload handleChangeInputProp={(file) => handleChangeInput(row, 'penunjang', file)} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -33,21 +33,27 @@ export const addClaimRequest = async ( data: MemberListType[] ): Promise<boolean
|
||||
formData.append(`member_id[${index}]`, row.id.toString());
|
||||
formData.append(`service_code[${index}]`, row.patien_type??'');
|
||||
|
||||
if (row.invoice_files != undefined) {
|
||||
row.invoice_files.forEach((file, file_index) => {
|
||||
formData.append(`invoice[${index}][${file_index}]`, file);
|
||||
if (row.file_kondisi != undefined) {
|
||||
row.file_kondisi.forEach((file, file_index) => {
|
||||
console.log(file);
|
||||
|
||||
formData.append(`file_kondisi[member_${row.id}][${file_index}]`, file);
|
||||
});
|
||||
}
|
||||
|
||||
if (row.prescription_files != undefined) {
|
||||
row.prescription_files.forEach((file, file_index) => {
|
||||
formData.append(`prescription[${index}][${file_index}]`, file);
|
||||
if (row.file_diagnosa != undefined) {
|
||||
row.file_diagnosa.forEach((file, file_index) => {
|
||||
console.log(file);
|
||||
|
||||
formData.append(`file_diagnosa[member_${row.id}][${file_index}]`, file);
|
||||
});
|
||||
}
|
||||
|
||||
if (row.laboratorium_files != undefined) {
|
||||
row.laboratorium_files.forEach((file, file_index) => {
|
||||
formData.append(`laboratorium[${index}][${file_index}]`, file);
|
||||
if (row.file_penunjang != undefined) {
|
||||
row.file_penunjang.forEach((file, file_index) => {
|
||||
console.log(file);
|
||||
|
||||
formData.append(`file_penunjang[member_${row.id}][${file_index}]`, file);
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
@@ -12,8 +12,8 @@ export type MemberListType = {
|
||||
id : string,
|
||||
member_id : string,
|
||||
name : string,
|
||||
patien_type? : string,
|
||||
invoice_files? : any[],
|
||||
laboratorium_files? : any[],
|
||||
prescription_files? : any[]
|
||||
patien_type? : string,
|
||||
file_kondisi? : any[],
|
||||
file_diagnosa? : any[],
|
||||
file_penunjang? : any[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user