tambah field objective
This commit is contained in:
@@ -28,21 +28,31 @@ import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';
|
||||
* Utils, Types, Functions
|
||||
* ============================================
|
||||
*/
|
||||
import { AddMonitoringDetail } from '../Model/Functions';
|
||||
import { AddMonitoringDetail, getOrganizationId } from '../Model/Functions';
|
||||
import { DetailMonitoringListType} from '../Model/Types';
|
||||
import FormCreateFilesUpload from '@/pages/CustomerService/FinalLog/Components/FormCreateFilesUpload';
|
||||
import MultiFilePreview from '@/components/upload/MultiFilePreview';
|
||||
import Iconify from '@/components/Iconify';
|
||||
import { useRef } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
|
||||
export default function DetailMonitoringList() {
|
||||
const { member_id, claim_code } = useParams();
|
||||
const [organizationId, setOrganizationId] = useState<number|undefined>();
|
||||
|
||||
const navigate = useNavigate()
|
||||
const pageTitle = claim_code??'_ _ _ _';
|
||||
const fileInput1 = useRef<HTMLInputElement>(null);
|
||||
const fileInput2 = useRef<HTMLInputElement>(null);
|
||||
const fileInput3 = useRef<HTMLInputElement>(null);
|
||||
|
||||
|
||||
const loadOrganizationID = async () => {
|
||||
const organization_id = await getOrganizationId(claim_code??'');
|
||||
setOrganizationId(organization_id);
|
||||
}
|
||||
useEffect(() => {
|
||||
loadOrganizationID();
|
||||
}, [])
|
||||
|
||||
// setup form
|
||||
// ====================================
|
||||
const defaultValues: DetailMonitoringListType = {
|
||||
@@ -50,6 +60,7 @@ export default function DetailMonitoringList() {
|
||||
claim_code : '',
|
||||
claim_id : '',
|
||||
subject : '',
|
||||
objective : '',
|
||||
submission_date : '',
|
||||
body_temperature: '',
|
||||
sistole : '',
|
||||
@@ -157,13 +168,11 @@ export default function DetailMonitoringList() {
|
||||
// Submit Form
|
||||
// =====================================
|
||||
const submitHandler = async (data: DetailMonitoringListType) => {
|
||||
console.log(claim_code);
|
||||
|
||||
const response = await AddMonitoringDetail(claim_code??'', data);
|
||||
|
||||
if (response == true) {
|
||||
reset();
|
||||
navigate('/case_management/daily_monitoring/'+member_id+'/claims', { replace: true });
|
||||
navigate('/case_management/daily_monitoring/'+member_id+'/'+organizationId+'/claims', { replace: true });
|
||||
// window.location.reload()
|
||||
}
|
||||
}
|
||||
@@ -171,7 +180,7 @@ export default function DetailMonitoringList() {
|
||||
return (
|
||||
<Page title={pageTitle}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', pl: '22px', mb: '40px' }}>
|
||||
<IconButton size='large' color='inherit' onClick={() => navigate(`/case_management/daily_monitoring/${member_id}/claims`)} >
|
||||
<IconButton size='large' color='inherit' onClick={() => navigate(`/case_management/daily_monitoring/${member_id}/${organizationId}/claims`)} >
|
||||
<ArrowBackIosNew/>
|
||||
</IconButton>
|
||||
|
||||
@@ -215,6 +224,8 @@ export default function DetailMonitoringList() {
|
||||
id="subject"
|
||||
name='subject'
|
||||
placeholder='Subjective'
|
||||
multiline
|
||||
rows={4}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
@@ -225,9 +236,18 @@ export default function DetailMonitoringList() {
|
||||
<Grid container spacing={3}>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="body1" component="div">
|
||||
Objectif
|
||||
Objective
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12} sx={{display: 'flex', gap: 1}}>
|
||||
<RHFTextField
|
||||
id="objective"
|
||||
name='objective'
|
||||
placeholder='Objective'
|
||||
multiline
|
||||
rows={4}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={3}>
|
||||
<Grid item xs={3}>
|
||||
|
||||
@@ -29,6 +29,7 @@ import FiberManualRecord from '@mui/icons-material/FiberManualRecord';
|
||||
*/
|
||||
import { fDate, fDateOnly } from '@/utils/formatTime';
|
||||
import { getMonitoringDetailList } from '../Model/Functions';
|
||||
import { getOrganizationId } from '../Model/Functions';
|
||||
import { DetailMonitoringListType } from '../Model/Types';
|
||||
|
||||
|
||||
@@ -40,7 +41,7 @@ export default function DetailMonitoringList() {
|
||||
// State
|
||||
// --------------------
|
||||
const [detailMonitoringList, setDetailMonitoringList] = useState<DetailMonitoringListType[]>();
|
||||
|
||||
const [organizationId, setOrganizationId] = useState<number|undefined>();
|
||||
// Use Effect
|
||||
// --------------------
|
||||
useEffect(() => {
|
||||
@@ -51,8 +52,10 @@ export default function DetailMonitoringList() {
|
||||
// -------------------
|
||||
const loadDataTableData = async () => {
|
||||
const response = await getMonitoringDetailList(claim_code??'');
|
||||
const organization_id = await getOrganizationId(claim_code??'');
|
||||
|
||||
setDetailMonitoringList(response);
|
||||
setOrganizationId(organization_id);
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -61,7 +64,7 @@ export default function DetailMonitoringList() {
|
||||
{/* back button */}
|
||||
<Grid item xs={12}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center' }}>
|
||||
<IconButton size='large' color='inherit' onClick={() => navigate(`/case_management/daily_monitoring/${member_id}/claims`)} >
|
||||
<IconButton size='large' color='inherit' onClick={() => navigate(`/case_management/daily_monitoring/${member_id}/${organizationId}/claims`)} >
|
||||
<ArrowBackIosNew/>
|
||||
</IconButton>
|
||||
|
||||
@@ -129,6 +132,11 @@ export default function DetailMonitoringList() {
|
||||
Object :
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12} paddingY={2}>
|
||||
<Typography variant="body2" color={"GrayText"}>
|
||||
{row.object}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={6}>
|
||||
|
||||
@@ -99,3 +99,21 @@ export const getMonitoringDetailList = async ( claim_code: string ): Promise<Det
|
||||
|
||||
return response;
|
||||
};
|
||||
/**
|
||||
* Get Monitoring Detail List
|
||||
*/
|
||||
export const getOrganizationId = async ( claim_code: string ): Promise<number> => {
|
||||
const response = await axios.get(`/case_management/daily_monitoring/detail/${claim_code}/list`)
|
||||
.then((res) =>{
|
||||
return res.data.data.organization_id;
|
||||
})
|
||||
.catch((res) => {
|
||||
enqueueSnackbar("server error !", {
|
||||
variant: 'error',
|
||||
});
|
||||
|
||||
return [];
|
||||
});
|
||||
|
||||
return response;
|
||||
};
|
||||
|
||||
@@ -52,6 +52,8 @@ export type DetailMonitoringListType = {
|
||||
claim_id : string|null,
|
||||
claim_code : string,
|
||||
subject : string,
|
||||
object : string,
|
||||
objective : string,
|
||||
body_temperature: string,
|
||||
respiration_rate: string,
|
||||
sistole : string,
|
||||
@@ -69,6 +71,9 @@ export type DetailMonitoringListType = {
|
||||
result : files[],
|
||||
document : document[],
|
||||
created_at : string|null
|
||||
data : {
|
||||
organization_id : number
|
||||
}
|
||||
}
|
||||
|
||||
export type MedicalPlanStrType = {
|
||||
|
||||
Reference in New Issue
Block a user