[WIP] Update Claim
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
import Iconify from '@/components/Iconify';
|
||||
import { Divider, InputAdornment, Paper, Stack, TextField, Typography } from '@mui/material';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export default function ClaimItems({ items, setItems }) {
|
||||
|
||||
const handleChangeBiayaDiajukan = (event, itemIndex: Number) => {
|
||||
setItems(items.map((item, index) => {
|
||||
if (index == itemIndex) {
|
||||
return {...item, biaya_diajukan : event.target.value}
|
||||
} else {
|
||||
return item;
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
const handleChangeBiayaDisetujui = (event, itemIndex: Number) => {
|
||||
setItems(items.map((item, index) => {
|
||||
if (index == itemIndex) {
|
||||
return {...item, biaya_disetujui : event.target.value}
|
||||
} else {
|
||||
return item;
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
const calculateBiayaDitolak = (biayaDiajukan: Number | null, biayaDisetujui: Number | null) => {
|
||||
return (biayaDiajukan ? biayaDiajukan : 0) - (biayaDisetujui ? biayaDisetujui : 0)
|
||||
}
|
||||
|
||||
const handleDeleteItem = (itemIndex: Number) => {
|
||||
setItems(items.filter((item, index) => index != itemIndex))
|
||||
}
|
||||
|
||||
return (
|
||||
<Stack spacing={2}>
|
||||
{items.length > 0 ? (
|
||||
items.map((item, index) => (
|
||||
<Paper variant="outlined" sx={{ background: 'white', p: 2 }} key={index}>
|
||||
<Stack direction="row" justifyContent="space-between">
|
||||
<Typography>#{index+1} ({item.code}) {item.description}</Typography>
|
||||
<Iconify icon="eva:trash-fill" color="red" onClick={() => {handleDeleteItem(index)}}></Iconify>
|
||||
</Stack>
|
||||
<Stack
|
||||
direction="row"
|
||||
justifyContent="space-evenly"
|
||||
divider={<Divider orientation="vertical" flexItem />}
|
||||
>
|
||||
<TextField label="Biaya Diajukan" variant="standard" fullWidth type="number" value={item.biaya_diajukan ?? 0} onChange={(event) => {handleChangeBiayaDiajukan(event, index)}}>
|
||||
<InputAdornment position="start">IDR</InputAdornment>
|
||||
{/* <InputMask mask="(0)999 999 99 99" maskChar=" " /> */}
|
||||
</TextField>
|
||||
<TextField label="Biaya Disetujui" variant="standard" fullWidth type="number" value={item.biaya_disetujui ?? 0} onChange={(event) => {handleChangeBiayaDisetujui(event, index)}}>
|
||||
<InputAdornment position="start">IDR</InputAdornment>
|
||||
{/* <InputMask mask="(0)999 999 99 99" maskChar=" " /> */}
|
||||
</TextField>
|
||||
<TextField label="Biaya Ditolak" variant="standard" fullWidth type="number" value={calculateBiayaDitolak(item.biaya_diajukan, item.biaya_disetujui)}>
|
||||
<InputAdornment position="start">IDR</InputAdornment>
|
||||
{/* <InputMask mask="(0)999 999 99 99" maskChar=" " /> */}
|
||||
</TextField>
|
||||
</Stack>
|
||||
</Paper>
|
||||
))
|
||||
) : (
|
||||
<Typography>No Benefit Item</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import Iconify from '@/components/Iconify';
|
||||
import { Paper, Stack, Typography } from '@mui/material';
|
||||
import { useState } from 'react';
|
||||
|
||||
export default function DiagnosisHistory({ diagnosis }) {
|
||||
function DiagnosaItem({ item }) {
|
||||
return (
|
||||
<Stack direction="row" justifyContent="space-between" alignItems="center" sx={{ p: 1 }}>
|
||||
<Stack>
|
||||
<Typography variant="body2" fontWeight="600">
|
||||
Nama Penyakit
|
||||
</Typography>
|
||||
<Typography variant="body2">Claim Terakhir : 23 Januari 2023 08:00</Typography>
|
||||
</Stack>
|
||||
<Iconify icon="eva:arrow-ios-forward-fill"></Iconify>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Paper variant="outlined" sx={{ background: '#f4f6f8', p: 2, marginTop: 2 }}>
|
||||
<Stack direction="row" justifyContent="space-between" alignItems="center">
|
||||
<Stack direction="row" alignItems="center" spacing={1}>
|
||||
<Iconify icon="eva:bell-fill" />
|
||||
<Typography variant="body2" fontWeight={600}>
|
||||
Riwayat Diagnosa
|
||||
</Typography>
|
||||
</Stack>
|
||||
<Typography
|
||||
variant="body2"
|
||||
onClick={() => {
|
||||
setOpenDialogRequestDocument(true);
|
||||
}}
|
||||
>
|
||||
View All
|
||||
</Typography>
|
||||
</Stack>
|
||||
|
||||
<Paper sx={{ background: 'white', marginTop: 2 }}>
|
||||
{ diagnosis.length > 0 ? (
|
||||
<Stack sx={{ maxHeight: '250px', overflowY: 'scroll' }}>
|
||||
{ diagnosis.map((diagnosa, index) => (
|
||||
<DiagnosaItem item={diagnosa} key={index}></DiagnosaItem>
|
||||
)) }
|
||||
</Stack>
|
||||
) : (
|
||||
<Stack sx={{ p: 1 }}>
|
||||
<Typography>Belum ada History Perawatan</Typography>
|
||||
</Stack>
|
||||
) }
|
||||
</Paper>
|
||||
</Paper>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import MuiDialog from "@/components/MuiDialog";
|
||||
import { Button, Checkbox, Typography } from "@mui/material";
|
||||
import { Paper } from "@mui/material";
|
||||
import { Stack } from '@mui/material';
|
||||
import { useState } from "react";
|
||||
|
||||
|
||||
export default function DialogMemberBenefit({member, setOpenDialog, openDialog, onSubmit}) {
|
||||
|
||||
const benefits = member?.current_plan?.benefits ?? [];
|
||||
const [selectedBenefits, setSelectedBenefits] = useState([]);
|
||||
|
||||
const toggleBenefit = (benefit) => {
|
||||
if (selectedBenefits.includes(benefit)) {
|
||||
console.log('removing', benefit)
|
||||
setSelectedBenefits(selectedBenefits.filter((throughBenefit) => benefit.id != throughBenefit.id))
|
||||
} else {
|
||||
console.log('adding', benefit)
|
||||
setSelectedBenefits([...selectedBenefits, benefit])
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
onSubmit(selectedBenefits);
|
||||
console.log ('submitting')
|
||||
setOpenDialog(false);
|
||||
setSelectedBenefits([]);
|
||||
}
|
||||
|
||||
const getContent = () => (
|
||||
<Stack spacing={1} marginTop={2}>
|
||||
{ benefits.map((benefit, index) => (
|
||||
|
||||
<Paper sx={{ background: 'white', marginTop: 2, p: 2 }} key={index}>
|
||||
<Stack direction="row" justifyContent="space-between" alignItems='center'>
|
||||
<Stack>
|
||||
<Typography variant="body1" fontWeight={600}>{benefit.description}</Typography>
|
||||
<Typography variant="body2">{benefit.code}</Typography>
|
||||
</Stack>
|
||||
<Checkbox checked={selectedBenefits.includes(benefit)} onClick={() => { toggleBenefit(benefit) }}></Checkbox>
|
||||
</Stack>
|
||||
</Paper>
|
||||
))}
|
||||
|
||||
<Button variant="contained" onClick={() => {handleSubmit()}}>Tambah</Button>
|
||||
</Stack>
|
||||
);
|
||||
|
||||
|
||||
return (
|
||||
<MuiDialog
|
||||
title={{name: "Add Member Benefit"}}
|
||||
openDialog={openDialog}
|
||||
setOpenDialog={setOpenDialog}
|
||||
content={getContent()}
|
||||
maxWidth="xl"
|
||||
/>
|
||||
);
|
||||
}
|
||||
68
frontend/dashboard/src/pages/Claims/components/Documents.tsx
Normal file
68
frontend/dashboard/src/pages/Claims/components/Documents.tsx
Normal file
@@ -0,0 +1,68 @@
|
||||
import Iconify from '@/components/Iconify';
|
||||
import { Paper, Stack, Typography } from '@mui/material';
|
||||
import { useState } from 'react';
|
||||
|
||||
export default function Documents({ files }) {
|
||||
// --------------------------------------------------------------
|
||||
// Dialog Request Document
|
||||
const [openDialogRequestDocument, setOpenDialogRequestDocument] = useState(false);
|
||||
|
||||
function FileItem({item}) {
|
||||
function fileCategory(type: string) {
|
||||
switch(type) {
|
||||
case 'claim-result':
|
||||
return 'Claim Result';
|
||||
case 'claim-diagnosis':
|
||||
return 'Claim Diagnosis';
|
||||
case 'claim-condition':
|
||||
return 'Claim Condition';
|
||||
default:
|
||||
return 'Other File';
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Stack direction="row" justifyContent="space-between" alignItems="center" sx={{ p: 1 }}>
|
||||
<Stack>
|
||||
<Typography variant="body2" fontWeight="600">
|
||||
{ fileCategory(item.type) }
|
||||
</Typography>
|
||||
<Typography variant="body2"><a href={item.url} target="_blank">{ item.name }</a></Typography>
|
||||
</Stack>
|
||||
<Iconify icon="eva:arrow-ios-forward-fill"></Iconify>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Paper variant="outlined" sx={{ background: '#f4f6f8', p: 2 }}>
|
||||
<Stack direction="row" justifyContent="space-between">
|
||||
<Typography variant="body2" fontWeight={600}>
|
||||
Dokumen Tambahan
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="body2"
|
||||
onClick={() => {
|
||||
setOpenDialogRequestDocument(true);
|
||||
}}
|
||||
>
|
||||
+ Request Document
|
||||
</Typography>
|
||||
</Stack>
|
||||
|
||||
<Paper sx={{ background: 'white', marginTop: 2 }}>
|
||||
{ files.length > 0 ? (
|
||||
<Stack sx={{ maxHeight: '250px', overflowY: 'scroll' }}>
|
||||
{ files.map((file, index) => (
|
||||
<FileItem item={file} key={index}></FileItem>
|
||||
)) }
|
||||
</Stack>
|
||||
) : (
|
||||
<Stack sx={{ p: 1 }}>
|
||||
<Typography>Belum ada History Perawatan</Typography>
|
||||
</Stack>
|
||||
)}
|
||||
</Paper>
|
||||
</Paper>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user