Fix Breadcrumbs Links

This commit is contained in:
R
2023-01-12 15:00:35 +07:00
parent 7d1872ef1e
commit 3a2dd84500
21 changed files with 73 additions and 66 deletions

View File

@@ -62,12 +62,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
const onSubmit = async (data: any) => { const onSubmit = async (data: any) => {
if (!isEdit) { if (!isEdit) {
await axios await axios
.post('/corporates/' + corporate_id + '/divisions', data) .post('/corporate/' + corporate_id + '/divisions', data)
.then((res) => { .then((res) => {
enqueueSnackbar('Division created successfully', { variant: 'success' }); enqueueSnackbar('Division created successfully', { variant: 'success' });
}) })
.then((res) => { .then((res) => {
navigate('/corporates/' + corporate_id + '/divisions', { replace: true }); navigate('/corporate/' + corporate_id + '/divisions', { replace: true });
}) })
.catch(({ response }) => { .catch(({ response }) => {
if (response.status === 422) { if (response.status === 422) {
@@ -81,12 +81,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
}); });
} else { } else {
await axios await axios
.put('/corporates/' + corporate_id + '/divisions/' + currentCorporatePlan?.id, data) .put('/corporate/' + corporate_id + '/divisions/' + currentCorporatePlan?.id, data)
.then((res) => { .then((res) => {
enqueueSnackbar('Division updated successfully', { variant: 'success' }); enqueueSnackbar('Division updated successfully', { variant: 'success' });
}) })
.then((res) => { .then((res) => {
navigate('/corporates/' + corporate_id + '/divisions/', { replace: true }); navigate('/corporate/' + corporate_id + '/divisions/', { replace: true });
}) })
.catch(({ response }) => { .catch(({ response }) => {
enqueueSnackbar('Update Failed : ' + response.data.message, { variant: 'error' }); enqueueSnackbar('Update Failed : ' + response.data.message, { variant: 'error' });

View File

@@ -35,11 +35,11 @@ export default function Divisions() {
}, },
{ {
name: corporate?.name ?? '-', name: corporate?.name ?? '-',
href: '/corporates/' + corporate_id, href: '/corporate/' + corporate_id,
}, },
{ {
name: 'Benefit', name: 'Benefit',
href: '/corporates/' + corporate_id + '/benefits', href: '/corporate/' + corporate_id + '/benefits',
}, },
]} ]}
/> />

View File

@@ -326,7 +326,7 @@ export default function PlanList() {
</Button> </Button>
)} )}
</TableCell> </TableCell>
<TableCell align="center"> {/* <TableCell align="center">
<Button <Button
variant="outlined" variant="outlined"
color="success" color="success"
@@ -340,7 +340,7 @@ export default function PlanList() {
> >
{openEdit ? 'Save' : 'Edit'} {openEdit ? 'Save' : 'Edit'}
</Button> </Button>
</TableCell> </TableCell> */}
</TableRow> </TableRow>
{/* COLLAPSIBLE ROW */} {/* COLLAPSIBLE ROW */}
<TableRow> <TableRow>
@@ -767,9 +767,9 @@ export default function PlanList() {
<TableCell style={headStyle} align="center"> <TableCell style={headStyle} align="center">
Status Status
</TableCell> </TableCell>
<TableCell style={headStyle} align="center"> {/* <TableCell style={headStyle} align="center">
Action Action
</TableCell> </TableCell> */}
</TableRow> </TableRow>
</TableBody> </TableBody>
{dataTableIsLoading ? ( {dataTableIsLoading ? (

View File

@@ -64,12 +64,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
const onSubmit = async (data: any) => { const onSubmit = async (data: any) => {
if (!isEdit) { if (!isEdit) {
await axios await axios
.post('/corporates/' + corporate_id + '/divisions', data) .post('/corporate/' + corporate_id + '/divisions', data)
.then((res) => { .then((res) => {
enqueueSnackbar('Division created successfully', { variant: 'success' }); enqueueSnackbar('Division created successfully', { variant: 'success' });
}) })
.then((res) => { .then((res) => {
navigate('/corporates/' + corporate_id + '/divisions', { replace: true }); navigate('/corporate/' + corporate_id + '/divisions', { replace: true });
}) })
.catch(({ response }) => { .catch(({ response }) => {
if (response.status === 422) { if (response.status === 422) {
@@ -84,12 +84,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
}); });
} else { } else {
await axios await axios
.put('/corporates/' + corporate_id + '/divisions/' + currentCorporatePlan?.id , data) .put('/corporate/' + corporate_id + '/divisions/' + currentCorporatePlan?.id , data)
.then((res) => { .then((res) => {
enqueueSnackbar('Division updated successfully', { variant: 'success' }); enqueueSnackbar('Division updated successfully', { variant: 'success' });
}) })
.then((res) => { .then((res) => {
navigate('/corporates/' + corporate_id + '/divisions/' , { replace: true }); navigate('/corporate/' + corporate_id + '/divisions/' , { replace: true });
}) })
.catch(({ response }) => { .catch(({ response }) => {
enqueueSnackbar('Update Failed : '+ response.data.message, { variant: 'error' }); enqueueSnackbar('Update Failed : '+ response.data.message, { variant: 'error' });

View File

@@ -33,11 +33,11 @@ export default function Divisions() {
}, },
{ {
name: corporate?.name ?? '-', name: corporate?.name ?? '-',
href: '/corporates/' + corporate_id, href: '/corporate/' + corporate_id,
}, },
{ {
name: 'Claim History', name: 'Claim History',
href: '/corporates/' + corporate_id + '/claim-histories', href: '/corporate/' + corporate_id + '/claim-histories',
}, },
]} ]}
/> />

View File

@@ -64,12 +64,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporateBenefit }: P
const onSubmit = async (data: any) => { const onSubmit = async (data: any) => {
if (!isEdit) { if (!isEdit) {
await axios await axios
.post('/corporates/' + corporate_id + '/corporate-benefits', data) .post('/corporate/' + corporate_id + '/corporate-benefits', data)
.then((res) => { .then((res) => {
enqueueSnackbar('Corporate Plan created successfully', { variant: 'success' }); enqueueSnackbar('Corporate Plan created successfully', { variant: 'success' });
}) })
.then((res) => { .then((res) => {
navigate('/corporates/' + corporate_id + '/corporate-benefits', { replace: true }); navigate('/corporate/' + corporate_id + '/corporate-benefits', { replace: true });
}) })
.catch(({ response }) => { .catch(({ response }) => {
if (response.status === 422) { if (response.status === 422) {
@@ -84,12 +84,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporateBenefit }: P
}); });
} else { } else {
await axios await axios
.put('/corporates/' + corporate_id + '/corporate-benefits/' + currentCorporateBenefit?.id , data) .put('/corporate/' + corporate_id + '/corporate-benefits/' + currentCorporateBenefit?.id , data)
.then((res) => { .then((res) => {
enqueueSnackbar('Corporate Benefit updated successfully', { variant: 'success' }); enqueueSnackbar('Corporate Benefit updated successfully', { variant: 'success' });
}) })
.then((res) => { .then((res) => {
navigate('/corporates/' + corporate_id + '/corporate-benefits/' , { replace: true }); navigate('/corporate/' + corporate_id + '/corporate-benefits/' , { replace: true });
}) })
.catch(({ response }) => { .catch(({ response }) => {
enqueueSnackbar('Update Failed : '+ response.data.message, { variant: 'error' }); enqueueSnackbar('Update Failed : '+ response.data.message, { variant: 'error' });

View File

@@ -64,12 +64,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
const onSubmit = async (data: any) => { const onSubmit = async (data: any) => {
if (!isEdit) { if (!isEdit) {
await axios await axios
.post('/corporates/' + corporate_id + '/corporate-plans', data) .post('/corporate/' + corporate_id + '/corporate-plans', data)
.then((res) => { .then((res) => {
enqueueSnackbar('Corporate Plan created successfully', { variant: 'success' }); enqueueSnackbar('Corporate Plan created successfully', { variant: 'success' });
}) })
.then((res) => { .then((res) => {
navigate('/corporates/' + corporate_id + '/corporate-plans', { replace: true }); navigate('/corporate/' + corporate_id + '/corporate-plans', { replace: true });
}) })
.catch(({ response }) => { .catch(({ response }) => {
if (response.status === 422) { if (response.status === 422) {
@@ -83,12 +83,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
}); });
} else { } else {
await axios await axios
.put('/corporates/' + corporate_id + '/corporate-plans/' + currentCorporatePlan?.id, data) .put('/corporate/' + corporate_id + '/corporate-plans/' + currentCorporatePlan?.id, data)
.then((res) => { .then((res) => {
enqueueSnackbar('Corporate Plan updated successfully', { variant: 'success' }); enqueueSnackbar('Corporate Plan updated successfully', { variant: 'success' });
}) })
.then((res) => { .then((res) => {
navigate('/corporates/' + corporate_id + '/corporate-plans/', { replace: true }); navigate('/corporate/' + corporate_id + '/corporate-plans/', { replace: true });
}) })
.catch(({ response }) => { .catch(({ response }) => {
enqueueSnackbar('Update Failed : ' + response.data.message, { variant: 'error' }); enqueueSnackbar('Update Failed : ' + response.data.message, { variant: 'error' });

View File

@@ -32,11 +32,11 @@ export default function Divisions() {
}, },
{ {
name: corporate?.name ?? '-', name: corporate?.name ?? '-',
href: '/corporates/' + corporate_id, href: '/corporate/' + corporate_id,
}, },
{ {
name: 'Corporate Plan', name: 'Corporate Plan',
href: '/corporates/' + corporate_id + '/corporate-plans', href: '/corporate/' + corporate_id + '/corporate-plans',
}, },
]} ]}
/> />

View File

@@ -36,11 +36,11 @@ export default function Divisions() {
}, },
{ {
name: corporate?.name ?? '-', name: corporate?.name ?? '-',
href: '/corporates/' + corporate_id, href: '/corporate/' + corporate_id,
}, },
{ {
name: 'Diagnosis Exclusion', name: 'Diagnosis Exclusion',
href: '/corporates/' + corporate_id + '/diagnosis-exclusions', href: '/corporate/' + corporate_id + '/diagnosis-exclusions',
}, },
]} ]}
/> />

View File

@@ -64,12 +64,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
const onSubmit = async (data: any) => { const onSubmit = async (data: any) => {
if (!isEdit) { if (!isEdit) {
await axios await axios
.post('/corporates/' + corporate_id + '/divisions', data) .post('/corporate/' + corporate_id + '/divisions', data)
.then((res) => { .then((res) => {
enqueueSnackbar('Division created successfully', { variant: 'success' }); enqueueSnackbar('Division created successfully', { variant: 'success' });
}) })
.then((res) => { .then((res) => {
navigate('/corporates/' + corporate_id + '/divisions', { replace: true }); navigate('/corporate/' + corporate_id + '/divisions', { replace: true });
}) })
.catch(({ response }) => { .catch(({ response }) => {
if (response.status === 422) { if (response.status === 422) {
@@ -84,12 +84,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
}); });
} else { } else {
await axios await axios
.put('/corporates/' + corporate_id + '/divisions/' + currentCorporatePlan?.id , data) .put('/corporate/' + corporate_id + '/divisions/' + currentCorporatePlan?.id , data)
.then((res) => { .then((res) => {
enqueueSnackbar('Division updated successfully', { variant: 'success' }); enqueueSnackbar('Division updated successfully', { variant: 'success' });
}) })
.then((res) => { .then((res) => {
navigate('/corporates/' + corporate_id + '/divisions/' , { replace: true }); navigate('/corporate/' + corporate_id + '/divisions/' , { replace: true });
}) })
.catch(({ response }) => { .catch(({ response }) => {
enqueueSnackbar('Update Failed : '+ response.data.message, { variant: 'error' }); enqueueSnackbar('Update Failed : '+ response.data.message, { variant: 'error' });

View File

@@ -36,11 +36,11 @@ export default function Divisions() {
}, },
{ {
name: corporate?.name ?? '-', name: corporate?.name ?? '-',
href: '/corporates/'+corporate_id, href: '/corporate/' + corporate_id,
}, },
{ {
name: 'Division', name: 'Division',
href: '/corporates/'+corporate_id+'/divisions', href: '/corporate/' + corporate_id + '/divisions',
}, },
]} ]}
/> />

View File

@@ -191,7 +191,7 @@ export default function PlanList() {
const loadDataTableData = async (appliedFilter: any | null = null) => { const loadDataTableData = async (appliedFilter: any | null = null) => {
setDataTableLoading(true); setDataTableLoading(true);
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]); const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
const response = await axios.get('/corporates/' + corporate_id + '/divisions', { const response = await axios.get('/corporate/' + corporate_id + '/divisions', {
params: filter, params: filter,
}); });
// console.log(response.data); // console.log(response.data);

View File

@@ -34,11 +34,11 @@ export default function CorporateFormularium() {
}, },
{ {
name: corporate?.name ?? '-', name: corporate?.name ?? '-',
href: '/corporates/' + corporate_id, href: '/corporate/' + corporate_id,
}, },
{ {
name: 'Formularium', name: 'Formularium',
href: '/corporates/' + corporate_id + '/formularium', href: '/corporate/' + corporate_id + '/formularium',
}, },
]} ]}
/> />

View File

@@ -64,12 +64,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
const onSubmit = async (data: any) => { const onSubmit = async (data: any) => {
if (!isEdit) { if (!isEdit) {
await axios await axios
.post('/corporates/' + corporate_id + '/divisions', data) .post('/corporate/' + corporate_id + '/divisions', data)
.then((res) => { .then((res) => {
enqueueSnackbar('Division created successfully', { variant: 'success' }); enqueueSnackbar('Division created successfully', { variant: 'success' });
}) })
.then((res) => { .then((res) => {
navigate('/corporates/' + corporate_id + '/divisions', { replace: true }); navigate('/corporate/' + corporate_id + '/divisions', { replace: true });
}) })
.catch(({ response }) => { .catch(({ response }) => {
if (response.status === 422) { if (response.status === 422) {
@@ -84,12 +84,12 @@ export default function CorporatePlanForm({ isEdit, currentCorporatePlan }: Prop
}); });
} else { } else {
await axios await axios
.put('/corporates/' + corporate_id + '/divisions/' + currentCorporatePlan?.id , data) .put('/corporate/' + corporate_id + '/divisions/' + currentCorporatePlan?.id , data)
.then((res) => { .then((res) => {
enqueueSnackbar('Division updated successfully', { variant: 'success' }); enqueueSnackbar('Division updated successfully', { variant: 'success' });
}) })
.then((res) => { .then((res) => {
navigate('/corporates/' + corporate_id + '/divisions/' , { replace: true }); navigate('/corporate/' + corporate_id + '/divisions/' , { replace: true });
}) })
.catch(({ response }) => { .catch(({ response }) => {
enqueueSnackbar('Update Failed : '+ response.data.message, { variant: 'error' }); enqueueSnackbar('Update Failed : '+ response.data.message, { variant: 'error' });

View File

@@ -34,11 +34,11 @@ export default function Divisions() {
}, },
{ {
name: corporate?.name ?? '-', name: corporate?.name ?? '-',
href: '/corporates/' + corporate_id, href: '/corporate/' + corporate_id,
}, },
{ {
name: 'Hospitals', name: 'Hospitals',
href: '/corporates/' + corporate_id + '/hospitals', href: '/corporate/' + corporate_id + '/hospitals',
}, },
]} ]}
/> />

View File

@@ -4,7 +4,7 @@ import HeaderBreadcrumbs from '../../../components/HeaderBreadcrumbs';
import Page from '../../../components/Page'; import Page from '../../../components/Page';
import useSettings from '../../../hooks/useSettings'; import useSettings from '../../../hooks/useSettings';
import CorporateTabNavigations from '../CorporateTabNavigations'; import CorporateTabNavigations from '../CorporateTabNavigations';
import DivisionsList from './List'; import MemberList from './List';
import { useContext, useEffect, useState } from 'react'; import { useContext, useEffect, useState } from 'react';
import { ConfiguredCorporateContext } from '@/contexts/ConfiguredCorporateContext'; import { ConfiguredCorporateContext } from '@/contexts/ConfiguredCorporateContext';
@@ -33,18 +33,18 @@ export default function Divisions() {
}, },
{ {
name: corporate?.name ?? '-', name: corporate?.name ?? '-',
href: '/corporates/' + corporate_id, href: '/corporate/' + corporate_id,
}, },
{ {
name: 'Member', name: 'Member',
href: '/corporates/' + corporate_id + '/members', href: '/corporate/' + corporate_id + '/members',
}, },
]} ]}
/> />
<Card> <Card>
<CorporateTabNavigations position={'members'} /> <CorporateTabNavigations position={'members'} />
<DivisionsList /> <MemberList />
</Card> </Card>
</Page> </Page>
); );

View File

@@ -540,9 +540,9 @@ export default function CorporatePlanList() {
<TableCell style={headStyle} align="center"> <TableCell style={headStyle} align="center">
Status Status
</TableCell> </TableCell>
<TableCell style={headStyle} align="center"> {/* <TableCell style={headStyle} align="center">
Action Action
</TableCell> </TableCell> */}
</TableRow> </TableRow>
</TableBody> </TableBody>
{dataTableIsLoading ? ( {dataTableIsLoading ? (

View File

@@ -32,11 +32,11 @@ export default function Divisions() {
}, },
{ {
name: corporate?.name ?? '-', name: corporate?.name ?? '-',
href: '/corporates/' + corporate_id, href: '/corporate/' + corporate_id,
}, },
{ {
name: 'Plan', name: 'Plan',
href: '/corporates/' + corporate_id + '/plans', href: '/corporate/' + corporate_id + '/plans',
}, },
]} ]}
/> />

View File

@@ -309,11 +309,11 @@ export default function CorporatePlanList() {
</Button> </Button>
)} )}
</TableCell> </TableCell>
<TableCell align="center"> {/* <TableCell align="center">
<Button variant="outlined" color="success" size="small"> <Button variant="outlined" color="success" size="small">
Edit Edit
</Button> </Button>
</TableCell> </TableCell> */}
</TableRow> </TableRow>
{/* COLLAPSIBLE ROW */} {/* COLLAPSIBLE ROW */}
<TableRow> <TableRow>
@@ -677,9 +677,9 @@ export default function CorporatePlanList() {
<TableCell style={headStyle} align="center"> <TableCell style={headStyle} align="center">
Status Status
</TableCell> </TableCell>
<TableCell style={headStyle} align="center"> {/* <TableCell style={headStyle} align="center">
Action Action
</TableCell> </TableCell> */}
</TableRow> </TableRow>
</TableBody> </TableBody>
{dataTableIsLoading ? ( {dataTableIsLoading ? (

View File

@@ -50,19 +50,27 @@ import Page from '../../../components/Page';
import useSettings from '../../../hooks/useSettings'; import useSettings from '../../../hooks/useSettings';
import CorporateTabNavigations from '../CorporateTabNavigations'; import CorporateTabNavigations from '../CorporateTabNavigations';
import DivisionsList from './List'; import DivisionsList from './List';
import { ChangeEvent, useEffect, useMemo, useState } from 'react'; import { ChangeEvent, useContext, useEffect, useMemo, useState } from 'react';
import axios from '../../../utils/axios'; import axios from '../../../utils/axios';
import { CorporateService } from '../../../@types/corporates'; import { Corporate, CorporateService } from '../../../@types/corporates';
import { InfoIcon } from '../../../theme/overrides/CustomIcons'; import { InfoIcon } from '../../../theme/overrides/CustomIcons';
import { includes, min, set } from 'lodash'; import { includes, min, set } from 'lodash';
import { array } from 'yup/lib/locale'; import { array } from 'yup/lib/locale';
import CancelIcon from '@mui/icons-material/Cancel'; import CancelIcon from '@mui/icons-material/Cancel';
import { enqueueSnackbar, useSnackbar } from 'notistack'; import { enqueueSnackbar, useSnackbar } from 'notistack';
import { ConfiguredCorporateContext } from '@/contexts/ConfiguredCorporateContext';
export default function Divisions() { export default function Divisions() {
const { themeStretch } = useSettings(); const { themeStretch } = useSettings();
const { corporate_id, service_code } = useParams(); const { corporate_id, service_code } = useParams();
const [corporate, setCorporate] = useState<Corporate | null>();
const configuredCorporateContext = useContext(ConfiguredCorporateContext);
useEffect(() => {
setCorporate(configuredCorporateContext.currentCorporate);
}, [configuredCorporateContext]);
const [service, setService] = useState<CorporateService>({ const [service, setService] = useState<CorporateService>({
configurations: {}, configurations: {},
@@ -80,7 +88,7 @@ export default function Divisions() {
// console.log('specialities', specialities); // console.log('specialities', specialities);
useEffect(() => { useEffect(() => {
axios.get('/corporates/' + corporate_id + '/services/' + service_code).then((res) => { axios.get('/corporate/' + corporate_id + '/services/' + service_code).then((res) => {
setService(res.data.service); setService(res.data.service);
setPlans( setPlans(
res.data.corporate.plans.map((item: any) => ({ res.data.corporate.plans.map((item: any) => ({
@@ -364,22 +372,21 @@ export default function Divisions() {
<HeaderBreadcrumbs <HeaderBreadcrumbs
heading={'Create Benefit'} heading={'Create Benefit'}
links={[ links={[
{ name: 'Dashboard', href: '/dashboard' },
{ {
name: 'Corporates', name: 'Corporates',
href: '/corporates', href: '/corporates',
}, },
{ {
name: 'Corporate Name', name: corporate?.name ?? '-',
href: '/corporates/' + corporate_id, href: '/corporate/' + corporate_id,
}, },
{ {
name: 'Services', name: 'Services',
href: '/corporates/' + corporate_id + '/services', href: '/corporate/' + corporate_id + '/services',
}, },
{ {
name: service.name ?? '-', name: service_code ?? '-',
href: '/corporates/' + corporate_id + '/services/' + service_code, href: '/corporate/' + corporate_id + '/services/' + service_code,
}, },
]} ]}
/> />

View File

@@ -34,11 +34,11 @@ export default function Divisions() {
}, },
{ {
name: corporate?.name ?? '-', name: corporate?.name ?? '-',
href: '/corporates/' + corporate_id, href: '/corporate/' + corporate_id,
}, },
{ {
name: 'Services', name: 'Services',
href: '/corporates/' + corporate_id + '/services', href: '/corporate/' + corporate_id + '/services',
}, },
]} ]}
/> />