Ketinggalan konflik
This commit is contained in:
@@ -85,7 +85,6 @@ import { format } from 'date-fns';
|
|||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
export default function Detail() {
|
export default function Detail() {
|
||||||
|
|
||||||
//dari hospital portal
|
//dari hospital portal
|
||||||
const [dischargeDate, setDischargeDate] = useState<string>(format(new Date(), "yyyy MMM d HH:mm:ss"));
|
const [dischargeDate, setDischargeDate] = useState<string>(format(new Date(), "yyyy MMM d HH:mm:ss"));
|
||||||
const [serviceOptions, setServiceOptions] = useState([
|
const [serviceOptions, setServiceOptions] = useState([
|
||||||
@@ -199,100 +198,7 @@ function submitRequestFinalLog() {
|
|||||||
setSubmitLoading(false);
|
setSubmitLoading(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
|
||||||
if (!requestLog?.id_member) return
|
|
||||||
axios.get('service-member/'+ (requestLog?.id_member ?? null))
|
|
||||||
.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);
|
|
||||||
});
|
|
||||||
|
|
||||||
}, [requestLog?.id_member]);
|
|
||||||
//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: '-' }
|
|
||||||
]);
|
|
||||||
|
|
||||||
const [serviceCode, setServiceCode] = useState<string>('')
|
|
||||||
const [idSpecialities, setIdSpecialities] = useState<number | null>(null)
|
|
||||||
const [inputDppj, setInputDppj] = useState<string>('')
|
|
||||||
useEffect(() => {
|
|
||||||
if (!requestLog) return
|
|
||||||
setServiceCode(requestLog.service_code ?? '')
|
|
||||||
setIdSpecialities(requestLog.specialitiesID ?? null)
|
|
||||||
setInputDppj(requestLog.dppj ?? '')
|
|
||||||
}, [requestLog])
|
|
||||||
const selectedService = useMemo(
|
|
||||||
() =>
|
|
||||||
serviceOptions.find(
|
|
||||||
(o) => String(o.value) === String(serviceCode)
|
|
||||||
) || null,
|
|
||||||
[serviceOptions, serviceCode]
|
|
||||||
)
|
|
||||||
|
|
||||||
const selectedSpecialis = useMemo(
|
|
||||||
() =>
|
|
||||||
specialisOptions.find(
|
|
||||||
(o) => Number(o.value) === Number(idSpecialities)
|
|
||||||
) || null,
|
|
||||||
[specialisOptions, idSpecialities]
|
|
||||||
)
|
|
||||||
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 updateApproval = async () => {
|
const updateApproval = async () => {
|
||||||
setSubmitLoading(true);
|
setSubmitLoading(true);
|
||||||
axios
|
axios
|
||||||
|
|||||||
Reference in New Issue
Block a user