// @mui import { Button, Box, Stepper, Step, StepLabel, Card, Typography, Divider, Stack, CircularProgress, } from '@mui/material'; import { Add } from '@mui/icons-material'; // components import MuiDialog from '@/components/MuiDialog'; // theme import palette from '@/theme/palette'; // React import { ReactElement, useEffect, useState } from 'react'; import { fDate } from '@/utils/formatTime'; import { addMinutes, format } from 'date-fns'; import { LoadingButton } from '@mui/lab'; import { enqueueSnackbar } from 'notistack'; import Iconify from '../Iconify'; type DataContent = { claim: object; isLoading: boolean; handleDownloadLog: void; }; type MuiDialogProps = { title?: { name?: string; icon?: string; }; openDialog: boolean; setOpenDialog: Function; content?: ReactElement; data?: DataContent[]; }; const steps = ['Review', 'Approval', 'Disbursement']; const DialogDetailClaim = ({ title, openDialog, setOpenDialog, data }: MuiDialogProps) => { const claim = data.claim ?? null; // --------------------------------------------- // Step const [currentStep, setCurrentStep] = useState(0); useEffect( function () { if (claim?.status == 'requested') { setCurrentStep(0); } if (claim?.status == 'approved') { setCurrentStep(1); } if (claim?.status == 'closed') { setCurrentStep(2); } }, [data] ); // ---------------------------------------------------- // Date Stamp let currentDate = null; // ---------------------------------------------------- // Download LOG const [loadingDownloadLog, setLoadingDownloadLog] = useState(false); const handleDownloadLog = async (claimRequest) => { setLoadingDownloadLog(true); await data.handleDownloadLog(claimRequest).then(() => { setLoadingDownloadLog(false); }); }; // ---------------------------------------------------- // Handle Upload Invoice const handleUploadInvoice = () => { enqueueSnackbar('Something went wrong, please contact Link Medis Sehat', { variant: 'error' }); }; const getContent = () => ( <> {data.isLoading && ( )} {!data.isLoading && ( <> Claim Request Submission date {/* {JSON.stringify(data)} */} {claim.created_at && fDate(claim.created_at)} {steps.map((label) => ( {label} ))} {/* { claim.status == 'approved' && ( } fullWidth // sx={{ typography: 'subtitle2', borderColor: '#F5F5F5' }} onClick={() => {handleUploadInvoice()}} > Upload Invoice )} */} {/* ---------------------------------TYPE INFO------------------------------------ */} Pengajuan Penjaminan } fullWidth // sx={{ typography: 'subtitle2', borderColor: '#F5F5F5' }} onClick={() => {}} > Upload Invoice {claim.histories_by_date && claim.histories_by_date.map((historiesByDate) => ( {fDate(historiesByDate.date)} {historiesByDate.histories && historiesByDate.histories.map((history) => ( {/* ---------------------------------TYPE INFO------------------------------------ */} {fDate(history.created_at, 'HH:mm')} WIB Request {history.title} {history.description} ))} ))} {/* ---------------------------------TYPE INFO------------------------------------ */} Dokumen Kelengkapan {/* Dokumen */} Kondisi } spacing={1} sx={{ marginY: 2 }} > {claim.files_by_type?.claim_kondisi && claim.files_by_type.claim_kondisi.map((file, index) => ( - {file.name} ))} Diagnosa } spacing={1} sx={{ marginY: 2 }} > {claim.files_by_type?.claim_diagnosis && claim.files_by_type.claim_diagnosis.map((file, index) => ( - {file.name} ))} Hasil } spacing={1} sx={{ marginY: 2 }} > {claim.files_by_type?.result && claim.files_by_type.result.map((file, index) => ( - {file.name} ))} )} ); return ( ); }; export default DialogDetailClaim;