Merge branch 'feature/add-input-benefit-hsp' into staging
This commit is contained in:
@@ -86,6 +86,77 @@ import { format } from 'date-fns';
|
|||||||
|
|
||||||
export default function Detail() {
|
export default function Detail() {
|
||||||
|
|
||||||
|
//dari hospital portal
|
||||||
|
const [dischargeDate, setDischargeDate] = useState<string>(format(new Date(), "yyyy MMM d HH:mm:ss"));
|
||||||
|
const [serviceOptions, setServiceOptions] = useState([
|
||||||
|
{ value: '-', label: '-' }
|
||||||
|
]);
|
||||||
|
const [specialisOptions, setSpecialisOptions] = useState([
|
||||||
|
{ value: '-', label: '-' }
|
||||||
|
]);
|
||||||
|
useEffect(() => {
|
||||||
|
axios.get('service-member/'+1)
|
||||||
|
.then((response) => {
|
||||||
|
setServiceOptions(response.data);
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('Error fetching ICD options:', error);
|
||||||
|
});
|
||||||
|
|
||||||
|
axios.get('specialis')
|
||||||
|
.then((response) => {
|
||||||
|
setSpecialisOptions(response.data);
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('Error fetching ICD options:', error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}, []);
|
||||||
|
const [serviceCode, setServiceCode] = useState<string>("");
|
||||||
|
const [idSpecialities, setIdSpecialities] = useState("");
|
||||||
|
const [inputDppj, setInputDppj] = useState("");
|
||||||
|
function submitRequestFinalLog() {
|
||||||
|
if(dischargeDate == '')
|
||||||
|
{
|
||||||
|
enqueueSnackbar('Tanggal Keluar', { variant: 'warning' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//cek spesialis
|
||||||
|
if(!idSpecialities)
|
||||||
|
{
|
||||||
|
enqueueSnackbar('Spesialis', { variant: 'warning' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//cek dpjp
|
||||||
|
if(!inputDppj)
|
||||||
|
{
|
||||||
|
enqueueSnackbar('DPPJ', { variant: 'warning' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
setSubmitLoading(true);
|
||||||
|
const formData = makeFormData({
|
||||||
|
// request_logs_id: member.id,
|
||||||
|
// result_files: fileHasilPenunjangs,
|
||||||
|
// diagnosa_files: fileDiagnosas,
|
||||||
|
// kondisi_files: fileKondisis,
|
||||||
|
discharge_date: fPostFormat(dischargeDate, 'yyyy-MM-dd HH:mm:ss'),
|
||||||
|
service_code: serviceCode,
|
||||||
|
spescialis_id: idSpecialities,
|
||||||
|
dppj: inputDppj,
|
||||||
|
});
|
||||||
|
axios
|
||||||
|
.post('/request-final-log', formData)
|
||||||
|
.then((response) => {
|
||||||
|
enqueueSnackbar(response.data.meta.message ?? 'Berhasil membuat data', { variant: 'success' });
|
||||||
|
// handleSubmitSuccess();
|
||||||
|
// onClose({ someData: 'example data' }, getData);
|
||||||
|
})
|
||||||
|
.catch(({ response }) => {
|
||||||
|
enqueueSnackbar(response.data.meta.message ?? 'Something Went Wrong', { variant: 'error' });
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
setSubmitLoading(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//end dari hospital portal
|
||||||
|
|
||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
@@ -553,17 +624,17 @@ function submitRequestFinalLog() {
|
|||||||
<Stack spacing={2} sx={{ flex: 1 }}>
|
<Stack spacing={2} sx={{ flex: 1 }}>
|
||||||
<Typography variant="subtitle1">Tipe Service </Typography>
|
<Typography variant="subtitle1">Tipe Service </Typography>
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
|
id="service_type"
|
||||||
options={serviceOptions}
|
options={serviceOptions}
|
||||||
value={selectedService}
|
getOptionLabel={(option) => option.label || ""}
|
||||||
getOptionLabel={(o) => o.label}
|
value={serviceOptions.find((opt) => opt.value == serviceCode) || null}
|
||||||
isOptionEqualToValue={(o, v) => o.value === v.value}
|
onChange={(event, newValue) => {
|
||||||
onChange={(_, v) => setServiceCode(v?.value ?? '')}
|
setServiceCode(newValue?.value || "");
|
||||||
|
}}
|
||||||
renderInput={(params) => (
|
renderInput={(params) => (
|
||||||
<TextField {...params} label="Tipe Service" fullWidth />
|
<TextField {...params} label='Tipe Service' fullWidth />
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
<FormHelperText style={{ color: "red" }}></FormHelperText>
|
<FormHelperText style={{ color: "red" }}></FormHelperText>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -296,10 +296,10 @@ export default function DetailRequestFinalLog() {
|
|||||||
>([])
|
>([])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!requestLog?.id_member) return
|
if (!requestLog?.id && !Log_id) return
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.get('service-member/' + (requestLog?.id_member ?? null))
|
.get('service-member/' + (requestLog?.id ?? Log_id))
|
||||||
.then((res) => setServiceOptions(res.data))
|
.then((res) => setServiceOptions(res.data))
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ export default function DetailRequestFinalLog() {
|
|||||||
.get('specialis')
|
.get('specialis')
|
||||||
.then((res) => setSpecialisOptions(res.data))
|
.then((res) => setSpecialisOptions(res.data))
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
}, [requestLog?.id_member])
|
}, [requestLog?.id, Log_id])
|
||||||
|
|
||||||
|
|
||||||
const [serviceCode, setServiceCode] = useState<string>('')
|
const [serviceCode, setServiceCode] = useState<string>('')
|
||||||
|
|||||||
Reference in New Issue
Block a user