diff --git a/Modules/Internal/Http/Controllers/Api/ClaimRequestController.php b/Modules/Internal/Http/Controllers/Api/ClaimRequestController.php index 656c12aa..4419dc9c 100644 --- a/Modules/Internal/Http/Controllers/Api/ClaimRequestController.php +++ b/Modules/Internal/Http/Controllers/Api/ClaimRequestController.php @@ -36,7 +36,7 @@ class ClaimRequestController extends Controller ->when($request->status, function($q, $status) { $q->where('status', $status); }) - ->with(['member', 'files', 'service']) + ->with(['member', 'files', 'service', 'member.currentPolicy']) ->paginate(); return Helper::paginateResources(ClaimRequestResource::collection($claimRequests)); diff --git a/frontend/dashboard/src/App.tsx b/frontend/dashboard/src/App.tsx index 33c51771..e3a87817 100644 --- a/frontend/dashboard/src/App.tsx +++ b/frontend/dashboard/src/App.tsx @@ -10,12 +10,15 @@ import { ProgressBarStyle } from './components/ProgressBar'; import ThemeColorPresets from './components/ThemeColorPresets'; import MotionLazyContainer from './components/animate/MotionLazyContainer'; import { SnackbarProvider } from 'notistack'; +import { Provider } from 'react-redux'; +import store from "./store" // ---------------------------------------------------------------------- export default function App() { return ( - + + @@ -29,5 +32,6 @@ export default function App() { + ); } diff --git a/frontend/dashboard/src/pages/ClaimRequests/List.tsx b/frontend/dashboard/src/pages/ClaimRequests/List.tsx index e8489b62..87aaa67a 100644 --- a/frontend/dashboard/src/pages/ClaimRequests/List.tsx +++ b/frontend/dashboard/src/pages/ClaimRequests/List.tsx @@ -192,7 +192,7 @@ export default function List() { {row.member?.full_name} - {row.member?.full_name} + {row.member?.current_policy?.code} {row.submission_date} {row.service_name} {row.payment_type_name} diff --git a/frontend/dashboard/src/pages/Claims/List.tsx b/frontend/dashboard/src/pages/Claims/List.tsx index cac972bd..9e32e720 100644 --- a/frontend/dashboard/src/pages/Claims/List.tsx +++ b/frontend/dashboard/src/pages/Claims/List.tsx @@ -174,6 +174,7 @@ export default function List() { {row.code} + {row.claim_request?.code} {row.member?.full_name} {row.plan?.code} {row.claim_request?.service?.name} @@ -231,7 +232,10 @@ export default function List() { - Code + Code Request + + + Code Claim Member Name diff --git a/frontend/dashboard/src/pages/Claims/Show.tsx b/frontend/dashboard/src/pages/Claims/Show.tsx index 5a7818d2..f8c60efc 100644 --- a/frontend/dashboard/src/pages/Claims/Show.tsx +++ b/frontend/dashboard/src/pages/Claims/Show.tsx @@ -38,6 +38,7 @@ import ClaimDetail from './components/ClaimDetail'; import DialogHistoryPerawatan from './components/DialogHistoryPerawatan'; import { IconButton } from '@mui/material'; import { Tooltip } from '@mui/material'; +import { useSelector } from 'react-redux'; export default function ClaimsCreateUpdate() { const { themeStretch } = useSettings(); @@ -48,6 +49,10 @@ export default function ClaimsCreateUpdate() { const [currentClaim, setCurrentClaim] = useState(); const [documents, setDocuments] = useState([]); + const claimsHistoryData = useSelector((state) => state.claimsHistory) + + console.log(claimsHistoryData) + const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, @@ -66,6 +71,12 @@ export default function ClaimsCreateUpdate() { setClaimItems([...claimItems, ...items]); }; + useEffect(() => { + if(claimsHistoryData) { + setClaimItems(claimsHistoryData) + } + },[claimsHistoryData]) + const handleSaveClaimItems = () => { console.log('Storing ', claimItems); setLoadingClaimItems(true); @@ -305,6 +316,9 @@ export default function ClaimsCreateUpdate() { )} + + Admission Date : {currentClaim?.claim_request?.submission_date} + @@ -347,7 +361,7 @@ export default function ClaimsCreateUpdate() { Nomor Polis - {currentClaim?.member?.full_name} + {currentClaim?.member?.current_policy?.code} diff --git a/frontend/dashboard/src/pages/Claims/components/DialogHistoryPerawatan.tsx b/frontend/dashboard/src/pages/Claims/components/DialogHistoryPerawatan.tsx index ed183def..7bd83e91 100644 --- a/frontend/dashboard/src/pages/Claims/components/DialogHistoryPerawatan.tsx +++ b/frontend/dashboard/src/pages/Claims/components/DialogHistoryPerawatan.tsx @@ -6,6 +6,8 @@ import { Stack } from '@mui/material'; import { enqueueSnackbar } from 'notistack'; import React, { useState } from 'react'; import FormHistoryPerawatan from './FormHistoryPerawatan'; +import { useDispatch } from 'react-redux'; +import { claimsHistoryAction } from '@/store/claimsHistorySlice'; type DialogHistoryPerawatanType = { openDialog: boolean; @@ -18,6 +20,7 @@ type DialogHistoryPerawatanType = { export default function DialogHistoryPerawatan({ openDialog, setOpenDialog, onSubmit, claim, encounter } : DialogHistoryPerawatanType) { const isEdit = encounter?.id != null + const dispatch = useDispatch() // const benefits = member?.current_plan?.benefits ?? []; // const [selectedBenefits, setSelectedBenefits] = useState([]); @@ -38,6 +41,10 @@ export default function DialogHistoryPerawatan({ openDialog, setOpenDialog, onSu .then((res) => { enqueueSnackbar(res.data.message, {variant: 'success'}) setOpenDialog(false); + window.location.reload(); // tolong benerin ya + // axios.get(`claims/${claim.id}`).then((res) => { + // dispatch(claimsHistoryAction.setClaims(res.data.data.encounter)) + // }) }) .catch((err) => { enqueueSnackbar(err.message, {variant: 'error'}) @@ -47,6 +54,10 @@ export default function DialogHistoryPerawatan({ openDialog, setOpenDialog, onSu .then((res) => { enqueueSnackbar(res.data.message, {variant: 'success'}) setOpenDialog(false); + window.location.reload(); // tolong benerin ya + // axios.get(`claims/${claim.id}`).then((res) => { + // dispatch(claimsHistoryAction.setClaims(res.data.data.encounter)) + // }) }) .catch((err) => { enqueueSnackbar(err.message, {variant: 'error'}) diff --git a/frontend/dashboard/src/store/claimsHistorySlice.ts b/frontend/dashboard/src/store/claimsHistorySlice.ts new file mode 100644 index 00000000..b5ac604d --- /dev/null +++ b/frontend/dashboard/src/store/claimsHistorySlice.ts @@ -0,0 +1,18 @@ +import { createSlice } from "@reduxjs/toolkit"; + +const claimsHistory = createSlice({ + name:'claims-history', + + initialState:{ + claimsHistory: [] + }, + reducers:{ + setClaims(states, actions){ + states.claimsHistory = actions.payload + } + } +}) + +export const claimsHistoryAction = claimsHistory.actions + +export default claimsHistory.reducer \ No newline at end of file diff --git a/frontend/dashboard/src/store/index.ts b/frontend/dashboard/src/store/index.ts new file mode 100644 index 00000000..c0469eb4 --- /dev/null +++ b/frontend/dashboard/src/store/index.ts @@ -0,0 +1,14 @@ +import { configureStore } from '@reduxjs/toolkit'; +import claims from "./claimsHistorySlice" + +const store = configureStore({ + reducer: { + claimsHistory: claims + // auth: authReducer, + // nav: navReducer + } +}) + +export default store + +