Add Spesialis & DPPJ
This commit is contained in:
@@ -138,7 +138,9 @@
|
||||
"txtButtonClose": "Close",
|
||||
"txtLabelFailed": "Failed",
|
||||
"txtAttention": "Attention",
|
||||
"txtAttentionInfo": "There are pending orders that require approval."
|
||||
"txtAttentionInfo": "There are pending orders that require approval.",
|
||||
"txtDPPJ": "DPPJ",
|
||||
"txtSpecialist": "Specialist"
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -138,5 +138,7 @@
|
||||
"txtButtonClose": "Tutup",
|
||||
"txtLabelFailed": "Gagal Pengiriman",
|
||||
"txtAttention": "Perhatian",
|
||||
"txtAttentionInfo": "Terdapat pesanan pending mohon untuk segera di approve."
|
||||
"txtAttentionInfo": "Terdapat pesanan pending mohon untuk segera di approve.",
|
||||
"txtDPPJ": "DPPJ",
|
||||
"txtSpecialist": "Spesialis"
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { LoadingButton } from '@mui/lab';
|
||||
import
|
||||
{
|
||||
import
|
||||
{
|
||||
Avatar,
|
||||
FormControl,
|
||||
InputLabel,
|
||||
Select,
|
||||
FormHelperText,
|
||||
MenuItem
|
||||
MenuItem
|
||||
} from '@mui/material';
|
||||
import { Card } from '@mui/material';
|
||||
import { Stack, Typography } from '@mui/material';
|
||||
import axios from '@/utils/axios';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
import { useRef, useState, useContext, useEffect } from 'react';
|
||||
import React, { useRef, useState, useContext, useEffect } from 'react';
|
||||
import { makeFormData } from '@/utils/jsonToFormData';
|
||||
import { format } from 'date-fns';
|
||||
import { LanguageContext } from '@/contexts/LanguageContext';
|
||||
@@ -28,6 +28,7 @@ interface MemberType {
|
||||
services: any;
|
||||
providers:any;
|
||||
companies:any;
|
||||
specialities:any;
|
||||
}
|
||||
interface FormRequestClaimProps {
|
||||
member: MemberType;
|
||||
@@ -37,6 +38,8 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }: FormRe
|
||||
const { localeData }: any = useContext(LanguageContext);
|
||||
const [serviceCode, setServiceCode] = useState<string>('');
|
||||
const [idProvider, setIdProvider] = useState<number>(0);
|
||||
const [idSpecialities, setIdSpecialities] = useState<number>(0);
|
||||
const [inputDppj, setInputDppj] = useState<string>('');
|
||||
//Submission date
|
||||
const [submissionDate, setSubmissionDate] = useState<string>(format(new Date(), "yyyy MMM d HH:mm:ss"));
|
||||
|
||||
@@ -47,7 +50,7 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }: FormRe
|
||||
setCorporateIdPartner(member?.companies?.map((item: { id: any; name: any; }) => ({ value: item.id, label: item.name })));
|
||||
}, []);
|
||||
const [selectedCorporatID, setSelectedCorporateID] = useState<any>([]);
|
||||
|
||||
|
||||
const handleSelectChangePatner = (event:any, selectedOptions:any) => {
|
||||
const selectedValues = selectedOptions.map((option: { value: any; }) => option.value);
|
||||
setSelectedCorporateID(selectedValues);
|
||||
@@ -77,24 +80,26 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }: FormRe
|
||||
organization_name : name,
|
||||
address_provider: alamat,
|
||||
submission_date: fPostFormat(submissionDate, 'yyyy-MM-dd HH:mm:ss'),
|
||||
corporate_id_partner: selectedCorporatID
|
||||
corporate_id_partner: selectedCorporatID,
|
||||
specialities_id: idSpecialities,
|
||||
dppj: inputDppj
|
||||
};
|
||||
axios
|
||||
.post('/request-log', formData)
|
||||
.then((response) => {
|
||||
if (response && response.data && response.data.meta) {
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 1500);
|
||||
// setTimeout(() => {
|
||||
// window.location.reload();
|
||||
// }, 1500);
|
||||
enqueueSnackbar(response.data.meta.message, { variant: 'success' });
|
||||
handleSubmitSuccess();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
.catch(({ response }) => {
|
||||
if (response && response.data && response.data.meta) {
|
||||
enqueueSnackbar(response.data.meta.message, { variant: 'error' });
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
setSubmitLoading(false);
|
||||
@@ -111,6 +116,11 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }: FormRe
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface Specialities {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
const [showAddNewForm, setShowAddNewForm] = useState(false);
|
||||
const [name, setName] = useState('');
|
||||
const [alamat, setAlamat] = useState('');
|
||||
@@ -191,7 +201,7 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }: FormRe
|
||||
<FormHelperText style={{ color: 'red' }}></FormHelperText>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
|
||||
<Stack direction="row" spacing={2}>
|
||||
<Stack spacing={2} sx={{ width: '100%' }}>
|
||||
<Typography variant='subtitle1'>{localeData.txtDialogMember1} *</Typography>
|
||||
@@ -215,6 +225,45 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }: FormRe
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
{/* Specialist */}
|
||||
<Stack direction="row" spacing={2}>
|
||||
<Stack spacing={2} sx={{ width: '100%' }}>
|
||||
<Typography variant='subtitle1'>{localeData.txtSpecialist}</Typography>
|
||||
<Autocomplete
|
||||
id='specialities'
|
||||
options={member?.specialities || []}
|
||||
getOptionLabel={(option: Specialities) => option.name || ''}
|
||||
value={member?.specialities.find((item: Specialities) => item.id === idSpecialities) || null}
|
||||
onChange={(event: React.ChangeEvent<{}>, newValue : Specialities | null) => {
|
||||
setIdSpecialities(newValue?.id || 0);
|
||||
}}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
{...params}
|
||||
label={localeData.txtSpecialist}
|
||||
fullWidth
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<FormHelperText style={{ color: 'red' }}></FormHelperText>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
<Stack direction="row" spacing={2}>
|
||||
<Stack spacing={2} sx={{ width: '100%' }}>
|
||||
<Typography variant='subtitle1'>{ localeData.txtDPPJ }</Typography>
|
||||
<TextField
|
||||
id='dppj'
|
||||
variant='outlined'
|
||||
placeholder={ localeData.txtDPPJ }
|
||||
onChange={(event) => {
|
||||
setInputDppj(event.target.value);
|
||||
}}
|
||||
fullWidth
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
<Stack direction="row" spacing={2}>
|
||||
<Stack spacing={2} sx={{ width: '100%' }}>
|
||||
<Typography variant='subtitle1'>{localeData.txtDialogMember5} *</Typography>
|
||||
@@ -226,7 +275,7 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }: FormRe
|
||||
setSubmissionDate( (newValue));
|
||||
}}
|
||||
inputFormat="dd-MM-yyyy HH:mm"
|
||||
renderInput={(params) => <TextField sx={{width:'40%'}} {...params} required/>}
|
||||
renderInput={(params) => <TextField sx={{width:'45%'}} {...params} required/>}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
</Stack>
|
||||
|
||||
Reference in New Issue
Block a user