add list master formularium
This commit is contained in:
@@ -53,7 +53,7 @@ const navConfig = [
|
|||||||
children: [
|
children: [
|
||||||
{ title: 'Corporate', path: '/corporates' },
|
{ title: 'Corporate', path: '/corporates' },
|
||||||
// { title: 'Corporate Create', path: '/corporates/create' },
|
// { title: 'Corporate Create', path: '/corporates/create' },
|
||||||
{ title: 'Formularium', path: '/master/formularium-template' },
|
{ title: 'Formularium', path: '/master/formularium-template-v2' },
|
||||||
{ title: 'Master ICD-10 Diagnosis', path: '/master/diagnosis-template' },
|
{ title: 'Master ICD-10 Diagnosis', path: '/master/diagnosis-template' },
|
||||||
{ title: 'Hospitals', path: '/hospitals' },
|
{ title: 'Hospitals', path: '/hospitals' },
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ import {
|
|||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<TableRow key={key} sx={{ '&:last-child td, &:last-child th': { border: 0 } }}>
|
<TableRow key={key} sx={{ '&:last-child td, &:last-child th': { border: 0 } }}>
|
||||||
<TableCell>{`${field}`}</TableCell>
|
<TableCell align="center">{`${field}`}</TableCell>
|
||||||
<TableCell align="center">{`${value}`}</TableCell>
|
<TableCell align="center">{`${value}`}</TableCell>
|
||||||
<TableCell align="center">{renderedValue}</TableCell>
|
<TableCell align="center">{renderedValue}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export default function PlanCreate() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCorporate(configuredCorporateContext.currentCorporate);
|
setCorporate(configuredCorporateContext.currentCorporate);
|
||||||
|
console.log(configuredCorporateContext.currentCorporate);
|
||||||
}, [configuredCorporateContext])
|
}, [configuredCorporateContext])
|
||||||
|
|
||||||
const [ currentCorporatePlan, setCurrentCorporatePlan ] = useState<CorporatePlan>();
|
const [ currentCorporatePlan, setCurrentCorporatePlan ] = useState<CorporatePlan>();
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
import HeaderBreadcrumbs from "../../../components/HeaderBreadcrumbs";
|
||||||
|
import Page from "../../../components/Page";
|
||||||
|
import useSettings from "../../../hooks/useSettings";
|
||||||
|
import {useContext, useEffect, useMemo, useState } from 'react';
|
||||||
|
import axios from '../../../utils/axios';
|
||||||
|
import { useSnackbar } from 'notistack';
|
||||||
|
import { ConfiguredCorporateContext } from "@/contexts/ConfiguredCorporateContext";
|
||||||
|
import { Corporate, CorporatePlan } from "@/@types/corporates";
|
||||||
|
import { MasterFormularium } from "./Type";
|
||||||
|
import CreateUpdateForm from "./CreateUpdateForm";
|
||||||
|
import Typography from "@/theme/overrides/Typography";
|
||||||
|
|
||||||
|
export default function CreateUpdate() {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const { corporate_id, id } = useParams();
|
||||||
|
const [corporate, setCorporate] = useState<Corporate|null>();
|
||||||
|
const configuredCorporateContext = useContext(ConfiguredCorporateContext)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setCorporate(configuredCorporateContext.currentCorporate);
|
||||||
|
}, [ConfiguredCorporateContext])
|
||||||
|
|
||||||
|
const [ currentCorporatePlan, setCurrentCorporatePlan ] = useState<CorporatePlan>();
|
||||||
|
const [ currentMasterForm, setCurrentMasterForm ] = useState<MasterFormularium>();
|
||||||
|
const isEdit = !!id;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isEdit) {
|
||||||
|
axios.get(`/master/formularium-template/${id}/edit`)
|
||||||
|
.then((res) => {
|
||||||
|
// setCurrentCorporatePlan(res.data);
|
||||||
|
setCurrentMasterForm(res.data);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
if (err.response.status === 404) {
|
||||||
|
navigate('/404');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, [corporate_id, id])
|
||||||
|
|
||||||
|
const pageType = !isEdit ? "Create" : "Edit"
|
||||||
|
const pageTitle = `Master Formularium ${pageType}`
|
||||||
|
return (
|
||||||
|
<Page title={pageTitle}>
|
||||||
|
<HeaderBreadcrumbs
|
||||||
|
heading={pageTitle}
|
||||||
|
links={[
|
||||||
|
{
|
||||||
|
name: 'Master',
|
||||||
|
href: '/master/formularium-template-v2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Formularium',
|
||||||
|
href: '/master/formularium-template-v2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: !isEdit ? 'Create' : 'Edit',
|
||||||
|
href: !isEdit ? `/master/formularium-template-v2/create` : `/master/formularium-template-v2/${id}/edit`
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<CreateUpdateForm isEdit={isEdit} currentMasterForm={currentMasterForm} />
|
||||||
|
|
||||||
|
</Page>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
import * as Yup from 'yup';
|
||||||
|
import { LoadingButton } from "@mui/lab";
|
||||||
|
import { Button, Card, Grid, Stack, Typography } from "@mui/material";
|
||||||
|
import { CorporatePlan } from "../../../@types/corporates";
|
||||||
|
import { FormProvider, RHFSwitch, RHFTextField } from "../../../components/hook-form";
|
||||||
|
import { useEffect, useMemo } from 'react';
|
||||||
|
import { useForm } from 'react-hook-form';
|
||||||
|
import { yupResolver } from '@hookform/resolvers/yup';
|
||||||
|
import { useSnackbar } from 'notistack';
|
||||||
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
|
import axios from '../../../utils/axios';
|
||||||
|
import { MasterFormularium } from "./Type";
|
||||||
|
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
isEdit: boolean;
|
||||||
|
currentMasterForm?: MasterFormularium;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function CreateUpdateForm({ isEdit, currentMasterForm }: Props) {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
|
||||||
|
const NewCorporatePlanSchema = Yup.object().shape({
|
||||||
|
name: Yup.string().required('Name is required'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultValues = useMemo(
|
||||||
|
() => ({
|
||||||
|
name: currentMasterForm?.name || '',
|
||||||
|
description: currentMasterForm?.description || '',
|
||||||
|
}),
|
||||||
|
[currentMasterForm]
|
||||||
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isEdit && currentMasterForm) {
|
||||||
|
reset(defaultValues);
|
||||||
|
}
|
||||||
|
if (!isEdit) {
|
||||||
|
reset(defaultValues);
|
||||||
|
}
|
||||||
|
}, [isEdit, currentMasterForm])
|
||||||
|
|
||||||
|
const methods = useForm({
|
||||||
|
resolver: yupResolver(NewCorporatePlanSchema),
|
||||||
|
defaultValues,
|
||||||
|
})
|
||||||
|
|
||||||
|
const {
|
||||||
|
reset,
|
||||||
|
setError,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { isSubmitting }
|
||||||
|
} = methods;
|
||||||
|
|
||||||
|
const onSubmit = async (data: any) => {
|
||||||
|
if (!isEdit) {
|
||||||
|
await axios
|
||||||
|
.post('/master/formularium-template/store', data)
|
||||||
|
.then((res) => {
|
||||||
|
enqueueSnackbar('Formularium created succesfully', {variant: 'success'});
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
navigate('/master/formularium-template-v2', { replace: true });
|
||||||
|
})
|
||||||
|
.catch(({ response }) => {
|
||||||
|
if (response.status === 422) {
|
||||||
|
for (const [key, value] of Object.entries(response.data.errors)) {
|
||||||
|
setError(key, { message: value[0] });
|
||||||
|
enqueueSnackbar(value[0] ?? 'Failed Processing Reques', { variant: 'error' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
enqueueSnackbar('Create Failed : ' + response.data.message, {variant: 'error'});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await axios
|
||||||
|
.put(`/master/formularium-template/${currentMasterForm?.id}/update`, data)
|
||||||
|
.then((res) => {
|
||||||
|
enqueueSnackbar('Formularium updated successfully', { variant: 'success' });
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
navigate('/master/formularium-template-v2', { replace: true });
|
||||||
|
})
|
||||||
|
.catch(({ response }) => {
|
||||||
|
enqueueSnackbar(`Update Failed : ${response.data.message}`, { variant: 'error' })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
<Grid container spacing={2}>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Card sx={{ p:2 }}>
|
||||||
|
<Stack spacing={3}>
|
||||||
|
<Typography variant='h6' sx={{color: '#19BBBB'}}>Detail</Typography>
|
||||||
|
<Typography variant='h6'>Name*</Typography>
|
||||||
|
<RHFTextField name='name' label='Name' />
|
||||||
|
<Typography variant='h6'>Description*</Typography>
|
||||||
|
<RHFTextField name='description' label='Description' />
|
||||||
|
</Stack>
|
||||||
|
</Card>
|
||||||
|
<Stack direction='row' spacing={4} sx={{marginTop: '40px'}}>
|
||||||
|
<Grid container item xs={12} justifyContent='flex-end' sx={{p:2}}>
|
||||||
|
<Button
|
||||||
|
variant='outlined'
|
||||||
|
onClick={() => navigate('/master/formularium-template-v2')}
|
||||||
|
sx={{
|
||||||
|
p:1,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
outlineColor: 'black',
|
||||||
|
marginRight: '20px',
|
||||||
|
width: 100
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<LoadingButton
|
||||||
|
loading={isSubmitting}
|
||||||
|
type='submit'
|
||||||
|
variant='contained'
|
||||||
|
sx={{
|
||||||
|
p:1,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
backgroundColor: '#19BBBB',
|
||||||
|
"&:hover":{
|
||||||
|
backgroundColor: '#19BBBB', color: '#FFF'
|
||||||
|
},
|
||||||
|
width: 100
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{ isEdit? 'Update' : 'Create' }
|
||||||
|
</LoadingButton>
|
||||||
|
</Grid>
|
||||||
|
</Stack>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</FormProvider>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,289 @@
|
|||||||
|
// @mui
|
||||||
|
import { Box, Button, Card, Collapse, IconButton, InputLabel, MenuItem, OutlinedInput, Paper, Grid, Select, SelectChangeEvent, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, Typography, Badge, Tab, Tabs, CardHeader, Stack, Menu, ButtonGroup, Pagination } from '@mui/material';
|
||||||
|
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||||
|
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
|
||||||
|
import AddIcon from '@mui/icons-material/Add';
|
||||||
|
import UploadIcon from '@mui/icons-material/Upload';
|
||||||
|
import CancelIcon from '@mui/icons-material/Cancel';
|
||||||
|
// hooks
|
||||||
|
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
|
||||||
|
import useSettings from '../../../../hooks/useSettings';
|
||||||
|
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||||
|
// components
|
||||||
|
import axios from '../../../../utils/axios';
|
||||||
|
import { LaravelPaginatedData } from '../../../../@types/paginated-data';
|
||||||
|
import { Icd } from '../../../../@types/diagnosis';
|
||||||
|
import BasePagination from '../../../../components/BasePagination';
|
||||||
|
import { enqueueSnackbar } from 'notistack';
|
||||||
|
|
||||||
|
|
||||||
|
export default function List() {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const { master_formularium_id } = useParams();
|
||||||
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
const [importResult, setImportResult] = useState(null);
|
||||||
|
|
||||||
|
function SearchInput(props: any) {
|
||||||
|
const searchInput = useRef<HTMLInputElement>(null);
|
||||||
|
const [searchText, setSearchText] = useState("");
|
||||||
|
|
||||||
|
const handleSearchChange = (event: any) => {
|
||||||
|
const newSearchText = event.target.value ?? ''
|
||||||
|
setSearchText(newSearchText);
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSearchSubmit = (event: any) => {
|
||||||
|
event.preventDefault();
|
||||||
|
props.onSearch(searchText);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchText(searchParams.get('search') ?? '');
|
||||||
|
}, [searchParams])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<form onSubmit={handleSearchSubmit} style={{width: '100%'}}>
|
||||||
|
<TextField
|
||||||
|
id='search-input'
|
||||||
|
ref={searchInput}
|
||||||
|
label='search'
|
||||||
|
variant='outlined'
|
||||||
|
fullWidth
|
||||||
|
onChange={handleSearchChange}
|
||||||
|
value={searchText}
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ImportForm( props: any ) {
|
||||||
|
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
||||||
|
const createMenu = Boolean(anchorEl);
|
||||||
|
const importForm = useRef<HTMLInputElement>(null)
|
||||||
|
const [currentImportFileName, setCurrentImportFileName] = useState(null)
|
||||||
|
|
||||||
|
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
|
setAnchorEl(event.currentTarget);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
setAnchorEl(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleImportButton = () => {
|
||||||
|
if (importForm?.current) {
|
||||||
|
handleClose();
|
||||||
|
importForm.current ? importForm.current.click() : console.log('No File selected');
|
||||||
|
} else {
|
||||||
|
alert('No file selected')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCancelImportButton = () => {
|
||||||
|
importForm.current.value = '';
|
||||||
|
importForm.current?.dispatchEvent(new Event('change', { bubbles: true }))
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleGetTemplate = (type: string) => {
|
||||||
|
axios.get('corporate/import-document-example/' + type)
|
||||||
|
.then((response) => {
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = response.data.data.file_url;
|
||||||
|
link.setAttribute('download', response.data.data.file_name);
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
handleClose();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleImportChange = (event: any) => {
|
||||||
|
if (event.target.files[0]) {
|
||||||
|
setCurrentImportFileName(event.target.files[0].name)
|
||||||
|
} else {
|
||||||
|
setCurrentImportFileName(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleFormulariumList = async (appliedFilter = null) => {
|
||||||
|
axios.get(`master/formulariums/${master_formularium_id}/list`)
|
||||||
|
.then((response) => {
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = response.data.data.file_url;
|
||||||
|
link.setAttribute('download', response.data.data.file_name);
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
handleClose();
|
||||||
|
enqueueSnackbar('Download Success', { variant: 'success' })
|
||||||
|
})
|
||||||
|
.catch(response => {
|
||||||
|
enqueueSnackbar('Looks like something went wrong. Please check your data and try again. ' + response.message, { variant: 'error' })
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleUpload = () => {
|
||||||
|
if (importForm.current?.files?.length) {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('file', importForm.current?.files[0])
|
||||||
|
axios.post(`master/formularium/${master_formularium_id}/import`, formData )
|
||||||
|
.then(response => {
|
||||||
|
handleCancelImportButton();
|
||||||
|
loadDataTableData();
|
||||||
|
setImportResult(response.data);
|
||||||
|
})
|
||||||
|
.catch(response => {
|
||||||
|
enqueueSnackbar('Looks like something went wrong. Please check your data and try again. ' + response.message, { variant: 'error' })
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
enqueueSnackbar(`No File Selected`, { variant: 'warning' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<input
|
||||||
|
type='file'
|
||||||
|
id='file'
|
||||||
|
ref={importForm}
|
||||||
|
style={{display: 'none'}}
|
||||||
|
onChange={handleImportChange}
|
||||||
|
accept='.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain'
|
||||||
|
/>
|
||||||
|
{(!currentImportFileName && <Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||||
|
<SearchInput onSearch={applyFilter}/>
|
||||||
|
<Button
|
||||||
|
id='import-button'
|
||||||
|
variant='outlined'
|
||||||
|
startIcon={<AddIcon />}
|
||||||
|
sx={{
|
||||||
|
p: 1.8,
|
||||||
|
width: '200px',
|
||||||
|
backgroundColor: '#19BBBB', color: '#FFF',
|
||||||
|
"&:hover":{
|
||||||
|
backgroundColor: "#19BBBB", color: '#FFF'
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
aria-controls={createMenu ? 'basic-menu' : undefined}
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-expanded={createMenu ? 'true' : undefined}
|
||||||
|
onClick={handleClick}
|
||||||
|
>
|
||||||
|
Create
|
||||||
|
</Button>
|
||||||
|
<Menu
|
||||||
|
id='import-button'
|
||||||
|
anchorEl={anchorEl}
|
||||||
|
open={createMenu}
|
||||||
|
onClose={handleClose}
|
||||||
|
MenuListProps={{
|
||||||
|
'aria-labelledby': 'basic-button',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MenuItem onClick={() => handleImportButton}>Import</MenuItem>
|
||||||
|
<MenuItem onClick={() => handleGetTemplate('master-formularium')}>Download Template</MenuItem>
|
||||||
|
<MenuItem onClick={() => handleFormulariumList()}>Download Formularium</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
{( currentImportFileName && <Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||||
|
<ButtonGroup
|
||||||
|
variant='outlined'
|
||||||
|
aria-label='outlined button group'
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
<Button onClick={handleImportButton} fullWidth>{currentImportFileName ?? "No File Selected"}</Button>
|
||||||
|
<Button onClick={handleCancelImportButton} size='small' fullWidth={false} sx={{ p:1.8 }}>
|
||||||
|
<CancelIcon color='error'/>
|
||||||
|
</Button>
|
||||||
|
</ButtonGroup>
|
||||||
|
<Button
|
||||||
|
id='upload-button'
|
||||||
|
variant='outlined'
|
||||||
|
startIcon={<UploadIcon />}
|
||||||
|
sx={{ p: 1.8 }}
|
||||||
|
onClick={handleUpload}
|
||||||
|
>
|
||||||
|
Upload
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
{( importResult &&
|
||||||
|
<Stack direction={'row'} sx={{ px: 2, pb: 2 }}>
|
||||||
|
<Box sx={{ color: 'text.secondary'}}>Last Import Result Report : <a href={importResult.result_file?.url ?? "#"}>{importResult.result_file?.name ?? "-"}</a></Box>
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default data
|
||||||
|
const [dataTableRow, setDataTableRow] = useState<[] | null>(null)
|
||||||
|
const [dataTableIsLoading, setDataTableLoading] = useState(true);
|
||||||
|
const [dataTableData, setDataTableData] = useState<LaravelPaginatedData>({
|
||||||
|
current_page: 1,
|
||||||
|
data: [],
|
||||||
|
path: "",
|
||||||
|
first_page_url: "",
|
||||||
|
last_page: 1,
|
||||||
|
last_page_url: "",
|
||||||
|
next_page_url: "",
|
||||||
|
prev_page_url: "",
|
||||||
|
per_page: 10,
|
||||||
|
from: 0,
|
||||||
|
to: 0,
|
||||||
|
total: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
const loadDataTableData = async (appliedFilter : any | null = null) => {
|
||||||
|
setDataTableLoading(true);
|
||||||
|
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
|
||||||
|
const response = await axios.get(`/master/formulariums/${master_formularium_id}`, { params: filter });
|
||||||
|
setDataTableLoading(false);
|
||||||
|
|
||||||
|
setDataTableData(response.data)
|
||||||
|
setDataTableRow(response.data.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
const applyFilter = async (searchFilter: string) => {
|
||||||
|
await loadDataTableData({ 'search': searchFilter });
|
||||||
|
setSearchParams({ 'search' : searchFilter });
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePageChange = (event : ChangeEvent, value: number) => {
|
||||||
|
const filter = Object.fromEntries([...searchParams.entries(), ['page', value]]);
|
||||||
|
loadDataTableData(filter);
|
||||||
|
setSearchParams(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
loadDataTableData();
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const headStyle = {
|
||||||
|
fontWeight: 'bold',
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
<ImportForm />
|
||||||
|
<Card>
|
||||||
|
<TableContainer component={Paper}>
|
||||||
|
<Table aria-label='collapsible table'>
|
||||||
|
<TableHead>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell style={headStyle} align='left' width={50}/>
|
||||||
|
<TableCell style={headStyle} align='left'>Code</TableCell>
|
||||||
|
<TableCell style={headStyle} align='left'>ATC Code</TableCell>
|
||||||
|
<TableCell style={headStyle} align='left'>Name</TableCell>
|
||||||
|
<TableCell style={headStyle} align='left'>Category Name</TableCell>
|
||||||
|
<TableCell style={headStyle} align='left'>UOM</TableCell>
|
||||||
|
<TableCell style={headStyle} align='center' width={100}></TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
|
||||||
|
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import { Card, Grid } from "@mui/material";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import HeaderBreadcrumbs from "../../../../components/HeaderBreadcrumbs";
|
||||||
|
import Page from "../../../../components/Page";
|
||||||
|
import useSettings from "../../../../hooks/useSettings";
|
||||||
|
import List from "./Formularium";
|
||||||
|
|
||||||
|
|
||||||
|
export default function Formularium() {
|
||||||
|
const pageTitle = "Formularium"
|
||||||
|
const { id } = useParams();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Page title={ pageTitle }>
|
||||||
|
<HeaderBreadcrumbs
|
||||||
|
heading={ pageTitle }
|
||||||
|
links={[
|
||||||
|
{
|
||||||
|
name: 'Master',
|
||||||
|
href: '/master/formularium-template-v2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Formularium',
|
||||||
|
href: '/master/formularium-template-v2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Detail',
|
||||||
|
href: `/master/formularium-template-v2/${id}/detail`
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<Card>
|
||||||
|
<List />
|
||||||
|
</Card>
|
||||||
|
</Page>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import TableMoreMenu from "@/components/table/TableMoreMenu"
|
||||||
|
import EditOutlinedIcon from '@mui/icons-material/EditOutlined';
|
||||||
|
import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined';
|
||||||
|
import HistoryIcon from '@mui/icons-material/History';
|
||||||
|
import FindInPageOutlinedIcon from '@mui/icons-material/FindInPageOutlined';
|
||||||
|
import { Collapse, Grid, MenuItem, Paper, Table, TableCell, TableContainer, TableHead, TableRow } from "@mui/material"
|
||||||
|
import React, { useEffect } from "react";
|
||||||
|
import axios from "@/utils/axios";
|
||||||
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
import { MasterFormularium } from "./Type";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
props: MasterFormularium
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function FormulariumRow({props} : Props) {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRow>
|
||||||
|
<TableCell align="left" width={50}></TableCell>
|
||||||
|
<TableCell align="left">{props.name}</TableCell>
|
||||||
|
<TableCell align="left">{props.description}</TableCell>
|
||||||
|
<TableCell align="center" width={100}>
|
||||||
|
<TableMoreMenu actions = {
|
||||||
|
<>
|
||||||
|
<MenuItem onClick={() => navigate(`/master/formularium-template-v2/${props.id}/detail`)}>
|
||||||
|
<FindInPageOutlinedIcon />
|
||||||
|
Detail
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => navigate(`/master/formularium-template-v2/${props.id}/edit`)}>
|
||||||
|
<EditOutlinedIcon />
|
||||||
|
Edit
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem>
|
||||||
|
<CachedOutlinedIcon />
|
||||||
|
Update Status
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => navigate(`/master/formularium-template-v2/${props.id}/history`)}>
|
||||||
|
<HistoryIcon />
|
||||||
|
History
|
||||||
|
</MenuItem>
|
||||||
|
</>
|
||||||
|
} />
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
)
|
||||||
|
}
|
||||||
211
frontend/dashboard/src/pages/Master/FormulariumV2/History.tsx
Normal file
211
frontend/dashboard/src/pages/Master/FormulariumV2/History.tsx
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
// @mui
|
||||||
|
import {
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Card,
|
||||||
|
Collapse,
|
||||||
|
Container,
|
||||||
|
FormControl,
|
||||||
|
Grid,
|
||||||
|
IconButton,
|
||||||
|
InputLabel,
|
||||||
|
MenuItem,
|
||||||
|
OutlinedInput,
|
||||||
|
Paper,
|
||||||
|
Select,
|
||||||
|
SelectChangeEvent,
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
TableContainer,
|
||||||
|
TableHead,
|
||||||
|
TableRow,
|
||||||
|
TextField,
|
||||||
|
Typography,
|
||||||
|
Badge,
|
||||||
|
Stack,
|
||||||
|
} from '@mui/material';
|
||||||
|
import * as React from 'react';
|
||||||
|
import { useParams } from 'react-router-dom';
|
||||||
|
import { styled } from '@mui/material/styles';
|
||||||
|
import ArrowForwardIosSharpIcon from '@mui/icons-material/ArrowForwardIosSharp';
|
||||||
|
import MuiAccordion, { AccordionProps } from '@mui/material/Accordion';
|
||||||
|
import { useContext, useEffect, useState } from 'react';
|
||||||
|
import MuiAccordionSummary, {
|
||||||
|
AccordionSummaryProps,
|
||||||
|
} from '@mui/material/AccordionSummary';
|
||||||
|
import useSettings from '../../../hooks/useSettings';
|
||||||
|
import axios from '../../../utils/axios';
|
||||||
|
import { ConfiguredCorporateContext } from '@/contexts/ConfiguredCorporateContext';
|
||||||
|
import MuiAccordionDetails from '@mui/material/AccordionDetails';
|
||||||
|
import HeaderBreadcrumbs from '../../../components/HeaderBreadcrumbs';
|
||||||
|
import { Corporate } from '@/@types/corporates';
|
||||||
|
import { fDate, fDateTime } from '@/utils/formatTime';
|
||||||
|
|
||||||
|
|
||||||
|
const Accordion = styled((props: AccordionProps) => (
|
||||||
|
<MuiAccordion disableGutters elevation={0} square {...props} />
|
||||||
|
))(({ theme }) => ({
|
||||||
|
border: `1px solid ${theme.palette.divider}`,
|
||||||
|
"&:not(:last-child)": {
|
||||||
|
borderBottom: 0,
|
||||||
|
},
|
||||||
|
"&:before": {
|
||||||
|
display: 'none'
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
const AccordionSummary = styled((props: AccordionSummaryProps) => (
|
||||||
|
<MuiAccordionSummary
|
||||||
|
expandIcon={<ArrowForwardIosSharpIcon sx={{ fontSize: '0.9rem'}} />}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))(({ theme }) => ({
|
||||||
|
backgroundColor: theme.palette.mode === 'dark'
|
||||||
|
? 'rgba(255,255,255,0.5)'
|
||||||
|
: 'rgba(0,0,0,.03)',
|
||||||
|
flexDirection: 'row-reverse',
|
||||||
|
"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded": {
|
||||||
|
transform: 'rotate(90dg)',
|
||||||
|
},
|
||||||
|
"& .MuiAccordionSummary=content": {
|
||||||
|
marginLeft: theme.spacing(1),
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
const AccordionDetails = styled(MuiAccordionDetails)(({ theme }) => ({
|
||||||
|
padding: theme.spacing(2),
|
||||||
|
borderTop: '1px solid rgba(0,0,0,.125)',
|
||||||
|
}));
|
||||||
|
|
||||||
|
export default function MasterFormulariumHistory() {
|
||||||
|
const [expanded, setExpanded] = React.useState<string | false>('panel1');
|
||||||
|
|
||||||
|
const handleChange = (panel: string) => (event: React.SyntheticEvent, newExpanded: boolean) => {
|
||||||
|
setExpanded(newExpanded ? panel : false);
|
||||||
|
};
|
||||||
|
const pageTitle = 'Master Formularium History'
|
||||||
|
const { id } = useParams();
|
||||||
|
const { corporate_id } = useParams();
|
||||||
|
const [corporate, setCorporate] = useState<Corporate | null>();
|
||||||
|
const [currentCorporate, setCurrentCorporate] = useState<Corporate>();
|
||||||
|
const configuredCorporateContext = useContext(ConfiguredCorporateContext);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setCorporate(configuredCorporateContext.currentCorporate);
|
||||||
|
const model = 'App\\Models\\FormulariumTemplate';
|
||||||
|
const url = `/audittrail/${id}?model=${model}`;
|
||||||
|
axios.get(url)
|
||||||
|
.then((res) => {
|
||||||
|
setCurrentCorporate(res.data);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Terjadi kesalahan: ', error);
|
||||||
|
});
|
||||||
|
}, [configuredCorporateContext])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<HeaderBreadcrumbs
|
||||||
|
heading={pageTitle}
|
||||||
|
links={[
|
||||||
|
{
|
||||||
|
name: 'Master',
|
||||||
|
href: '/master/formularium-template-v2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Formularium',
|
||||||
|
href: '/master/formularium-template-v2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'History',
|
||||||
|
href: `/master/formularium-template-v2/${id}`
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
{currentCorporate?.data.map((item, index) => (
|
||||||
|
<Accordion
|
||||||
|
key={index}
|
||||||
|
expanded={expanded === `panel${index}`}
|
||||||
|
onChange={handleChange(`panel${index}`)}
|
||||||
|
>
|
||||||
|
<AccordionSummary
|
||||||
|
aria-controls={`panel${index}d-content`}
|
||||||
|
id={`panel${index}d-header`}
|
||||||
|
>
|
||||||
|
<Typography>{`Data has ${item.action} by ${item.user_id} on ${fDateTime(item.updated_at)}`}</Typography>
|
||||||
|
</AccordionSummary>
|
||||||
|
<AccordionDetails>
|
||||||
|
<TableContainer component={Paper}>
|
||||||
|
<Table aria-label='collapsible table'>
|
||||||
|
<TableHead>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell align='center'>Field</TableCell>
|
||||||
|
<TableCell align="center">Old Value</TableCell>
|
||||||
|
<TableCell align="center">New Values</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
<TableBody>
|
||||||
|
{Object.entries(item.old_values).map(([key, value]) => {
|
||||||
|
let renderedValue;
|
||||||
|
if (key === 'deleted_by' ||
|
||||||
|
key === 'deleted_at' ||
|
||||||
|
key === 'created_by' ||
|
||||||
|
key === 'created_at' ||
|
||||||
|
key === 'updated_by' ||
|
||||||
|
key === 'description'
|
||||||
|
) {
|
||||||
|
return null; // Melewati iterasi saat key adalah 'deleted_by'
|
||||||
|
}
|
||||||
|
switch (key) {
|
||||||
|
case 'welcome_message':
|
||||||
|
renderedValue = item.new_values[key].replace(/<[^>]*>/g, '');
|
||||||
|
value = value.replace(/<[^>]*>/g, '');
|
||||||
|
break;
|
||||||
|
case 'help_text':
|
||||||
|
renderedValue = item.new_values[key].replace(/<[^>]*>/g, '');
|
||||||
|
value = value.replace(/<[^>]*>/g, '');
|
||||||
|
break;
|
||||||
|
case 'active':
|
||||||
|
renderedValue = item.new_values[key] == 1 ? 'Active' : 'Inactive';
|
||||||
|
value = value == 1 ? 'Active' : 'Inactive';
|
||||||
|
break;
|
||||||
|
case 'created_at':
|
||||||
|
renderedValue = fDateTime(item.new_values[key]);
|
||||||
|
value = fDateTime(value);
|
||||||
|
break;
|
||||||
|
case 'updated_at':
|
||||||
|
renderedValue = fDateTime(item.new_values[key]);
|
||||||
|
value = fDateTime(value);
|
||||||
|
break;
|
||||||
|
case 'delete_at':
|
||||||
|
renderedValue = fDateTime(item.new_values[key]);
|
||||||
|
value = fDateTime(value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
renderedValue = item.new_values[key];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const field = key.charAt(0).toUpperCase() + key.slice(1);
|
||||||
|
if (value == renderedValue) {
|
||||||
|
return null
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<TableRow key={key} sx={{ '&:last-child td, &:last-child th': { border: 0 } }}>
|
||||||
|
<TableCell align="center">{`${field}`}</TableCell>
|
||||||
|
<TableCell align="center">{`${value}`}</TableCell>
|
||||||
|
<TableCell align="center">{renderedValue}</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
</AccordionDetails>
|
||||||
|
</Accordion>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
33
frontend/dashboard/src/pages/Master/FormulariumV2/Index.tsx
Normal file
33
frontend/dashboard/src/pages/Master/FormulariumV2/Index.tsx
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import { Card, Grid } from "@mui/material";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import HeaderBreadcrumbs from "../../../components/HeaderBreadcrumbs";
|
||||||
|
import Page from "../../../components/Page";
|
||||||
|
import useSettings from "../../../hooks/useSettings";
|
||||||
|
import List from "./List";
|
||||||
|
|
||||||
|
export default function MasterFormularium() {
|
||||||
|
const pageTitle = "Master Formularium"
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Page title={ pageTitle }>
|
||||||
|
<HeaderBreadcrumbs
|
||||||
|
heading={pageTitle}
|
||||||
|
links={[
|
||||||
|
{
|
||||||
|
name: "Master",
|
||||||
|
href: "/master/formularium-template-v2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Formularium",
|
||||||
|
href: "/master/formularium-template-v2"
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Card>
|
||||||
|
<List />
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
</Page>
|
||||||
|
)
|
||||||
|
}
|
||||||
172
frontend/dashboard/src/pages/Master/FormulariumV2/List.tsx
Normal file
172
frontend/dashboard/src/pages/Master/FormulariumV2/List.tsx
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
// @mui
|
||||||
|
import { Box, Button, Card, Collapse, IconButton, InputLabel, MenuItem, OutlinedInput, Paper, Grid, Select, SelectChangeEvent, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, Typography, Badge, Tab, Tabs, CardHeader, Stack, Menu, ButtonGroup, Pagination } from '@mui/material';
|
||||||
|
import AddIcon from '@mui/icons-material/Add';
|
||||||
|
// hooks
|
||||||
|
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
|
||||||
|
import useSettings from '../../../hooks/useSettings';
|
||||||
|
import { Link, useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||||
|
// components
|
||||||
|
import axios from '../../../utils/axios';
|
||||||
|
import { LaravelPaginatedData } from '../../../@types/paginated-data';
|
||||||
|
import BasePagination from '../../../components/BasePagination';
|
||||||
|
import FormulariumRow from "./FormulariumRow";
|
||||||
|
import { MasterFormularium } from "./Type";
|
||||||
|
|
||||||
|
export default function List() {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
|
// Default data
|
||||||
|
const [dataTableRow, setDataTableRow] = useState<MasterFormularium[] | null>(null)
|
||||||
|
const [dataTableIsLoading, setDataTableLoading] = useState(true);
|
||||||
|
const [dataTableData, setDataTableData] = useState<LaravelPaginatedData>({
|
||||||
|
current_page: 1,
|
||||||
|
data: [],
|
||||||
|
path: "",
|
||||||
|
first_page_url: "",
|
||||||
|
last_page: 1,
|
||||||
|
last_page_url: "",
|
||||||
|
next_page_url: "",
|
||||||
|
prev_page_url: "",
|
||||||
|
per_page: 10,
|
||||||
|
from: 0,
|
||||||
|
to: 0,
|
||||||
|
total: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
const loadDataTableData =async (appliedFilter: any | null = null) => {
|
||||||
|
setDataTableLoading(true);
|
||||||
|
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
|
||||||
|
const response = await axios.get('/master/formularium-template', { params: filter });
|
||||||
|
console.log(response.data);
|
||||||
|
console.log(response.data.data)
|
||||||
|
setDataTableLoading(false);
|
||||||
|
|
||||||
|
setDataTableData(response.data);
|
||||||
|
setDataTableRow(response.data.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
const applyFilter = async (searchFilter: string) => {
|
||||||
|
await loadDataTableData({'search' : searchFilter });
|
||||||
|
setSearchParams({ 'search' : searchFilter })
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePageChange = (event : ChangeEvent, value: number) => {
|
||||||
|
const filter = Object.fromEntries([...searchParams.entries(), ['page', value]]);
|
||||||
|
loadDataTableData(filter);
|
||||||
|
setSearchParams(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
loadDataTableData();
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
function SearchInput(props: any) {
|
||||||
|
const searchInput = useRef<HTMLInputElement>(null);
|
||||||
|
const [searchText, setSearchText] = useState("");
|
||||||
|
|
||||||
|
const handleSearchChange = (event: any) => {
|
||||||
|
const newSearchText = event.target.value ?? ""
|
||||||
|
setSearchText(newSearchText)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSearchSubmit = (event: any) => {
|
||||||
|
event.preventDefault();
|
||||||
|
props.onSearch(searchText);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchText(searchParams.get('search') ?? '');
|
||||||
|
}, [searchParams])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<form onSubmit={handleSearchSubmit} style={{width: '100%'}}>
|
||||||
|
<TextField
|
||||||
|
id='search-input'
|
||||||
|
ref={searchInput}
|
||||||
|
label='Search'
|
||||||
|
variant='outlined'
|
||||||
|
fullWidth
|
||||||
|
onChange={handleSearchChange}
|
||||||
|
value={searchText}
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function SearchCreate(props: any) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Stack direction={'row'} spacing={2} sx={{p:2}}>
|
||||||
|
<SearchInput onSearch={applyFilter}/>
|
||||||
|
<Button
|
||||||
|
id='create-button'
|
||||||
|
variant='contained'
|
||||||
|
startIcon={<AddIcon />}
|
||||||
|
onClick={() => navigate('/master/formularium-template-v2/create')}
|
||||||
|
sx={{
|
||||||
|
p: 1.8,
|
||||||
|
width: '200px',
|
||||||
|
backgroundColor: '#19BBBB', color: '#FFF',
|
||||||
|
"&:hover":{
|
||||||
|
backgroundColor: "#19BBBB", color: '#FFF'
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Create
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const headStyle = {
|
||||||
|
fontWeight: 'bold'
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<React.Fragment>
|
||||||
|
<Stack>
|
||||||
|
<SearchCreate />
|
||||||
|
<Card>
|
||||||
|
<TableContainer component={Paper}>
|
||||||
|
<Table aria-label='collapsible table'>
|
||||||
|
<TableHead>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell align='left' width={50}></TableCell>
|
||||||
|
<TableCell align='left' style={headStyle}>Name</TableCell>
|
||||||
|
<TableCell align='left' style={headStyle}>Description</TableCell>
|
||||||
|
<TableCell align='center' style={headStyle} width={100}></TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
{dataTableIsLoading ? (
|
||||||
|
<TableBody>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell colSpan={4} align='center'>
|
||||||
|
Loading
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableBody>
|
||||||
|
) : dataTableData.data.length == 0 ? (
|
||||||
|
<TableBody>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell colSpan={4} align='center'>
|
||||||
|
No Data
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableBody>
|
||||||
|
) : (
|
||||||
|
<TableBody>
|
||||||
|
{dataTableRow?.map(item => (
|
||||||
|
<FormulariumRow props={item}/>
|
||||||
|
))}
|
||||||
|
</TableBody>
|
||||||
|
)}
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
<BasePagination paginationData={dataTableData} onPageChange={handlePageChange} />
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
</React.Fragment>
|
||||||
|
)
|
||||||
|
}
|
||||||
31
frontend/dashboard/src/pages/Master/FormulariumV2/Type.ts
Normal file
31
frontend/dashboard/src/pages/Master/FormulariumV2/Type.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
export type MasterFormularium = {
|
||||||
|
id: number
|
||||||
|
name: string
|
||||||
|
description: string
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export type FormulariumData = {
|
||||||
|
id: number
|
||||||
|
code: string
|
||||||
|
name: string
|
||||||
|
description: string
|
||||||
|
manufacturer: string
|
||||||
|
category_name: string
|
||||||
|
kategori_obat: string
|
||||||
|
uom: string
|
||||||
|
general_indication: string
|
||||||
|
composition: string
|
||||||
|
atc_code: string
|
||||||
|
class: string
|
||||||
|
bpom_registration: string
|
||||||
|
classifications: string
|
||||||
|
cat_for: string
|
||||||
|
created_at: string
|
||||||
|
updated_at: string
|
||||||
|
deleted_at: any
|
||||||
|
created_by: number
|
||||||
|
updated_by: number
|
||||||
|
deleted_by: any
|
||||||
|
formularium_template_id: number
|
||||||
|
}
|
||||||
@@ -323,6 +323,26 @@ export default function Router() {
|
|||||||
path: 'master/formularium-template/:id/edit',
|
path: 'master/formularium-template/:id/edit',
|
||||||
element: <MasterFormulariumTemplateCreate />,
|
element: <MasterFormulariumTemplateCreate />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'master/formularium-template-v2',
|
||||||
|
element: <MasterFormulariumTemplateV2 />
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'master/formularium-template-v2/create',
|
||||||
|
element: <MasterFormulariumTemplateCreateV2 />
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'master/formularium-template-v2/:id/edit',
|
||||||
|
element: <MasterFormulariumTemplateCreateV2 />
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'master/formularium-template-v2/:id/history',
|
||||||
|
element: <MasterFormulariumTemplateHistoriesV2 />
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'master/formularium-template-v2/:id/detail',
|
||||||
|
element: <MasterFormulariumTemplateDetailV2 />
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: 'report/appointments',
|
path: 'report/appointments',
|
||||||
@@ -536,6 +556,11 @@ const MasterFormulariumTemplate = Loadable(lazy(() => import('../pages/Master/Fo
|
|||||||
const MasterFormulariumTemplateCreate = Loadable(lazy(() => import('../pages/Master/Formularium/Master/CreateUpdate')));
|
const MasterFormulariumTemplateCreate = Loadable(lazy(() => import('../pages/Master/Formularium/Master/CreateUpdate')));
|
||||||
const MasterFormulariumTemplateHistories = Loadable(lazy(() => import('../pages/Master/Formularium/Master/History')));
|
const MasterFormulariumTemplateHistories = Loadable(lazy(() => import('../pages/Master/Formularium/Master/History')));
|
||||||
|
|
||||||
|
const MasterFormulariumTemplateV2 = Loadable(lazy(() => import('../pages/Master/FormulariumV2/Index')));
|
||||||
|
const MasterFormulariumTemplateCreateV2 = Loadable(lazy(() => import('../pages/Master/FormulariumV2/CreateUpdate')));
|
||||||
|
const MasterFormulariumTemplateHistoriesV2 = Loadable(lazy(() => import('../pages/Master/FormulariumV2/History')));
|
||||||
|
const MasterFormulariumTemplateDetailV2 = Loadable(lazy(() => import('../pages/Master/FormulariumV2/Detail/Index')))
|
||||||
|
|
||||||
const CorporateServices = Loadable(lazy(() => import('../pages/Corporates/Services/Index')));
|
const CorporateServices = Loadable(lazy(() => import('../pages/Corporates/Services/Index')));
|
||||||
const CorporateServicesCreate = Loadable(lazy(() => import('../pages/Corporates/Services/Create')));
|
const CorporateServicesCreate = Loadable(lazy(() => import('../pages/Corporates/Services/Create')));
|
||||||
const CorporateServicesHistory = Loadable(lazy(() => import('../pages/Corporates/Services/sections/History')));
|
const CorporateServicesHistory = Loadable(lazy(() => import('../pages/Corporates/Services/sections/History')));
|
||||||
|
|||||||
Reference in New Issue
Block a user