diff --git a/frontend/dashboard/src/pages/CustomerService/Request/Components/DialogConfirmation.tsx b/frontend/dashboard/src/pages/CustomerService/Request/Components/DialogConfirmation.tsx index 375e5f13..c30af4af 100755 --- a/frontend/dashboard/src/pages/CustomerService/Request/Components/DialogConfirmation.tsx +++ b/frontend/dashboard/src/pages/CustomerService/Request/Components/DialogConfirmation.tsx @@ -30,6 +30,7 @@ export default function DialogConfirmation({requestLog, setOpenDialog, openDialo penempatan_kamar: '', type_of_member: '' }); + const [error, setError] = useState(false); useEffect(() => { // Update formData setiap kali approve berubah @@ -57,16 +58,22 @@ export default function DialogConfirmation({requestLog, setOpenDialog, openDialo const handleSubmit = () => { - axios - .put(`customer-service/request/${requestLog?.id}`, formData) - .then((response) => { - enqueueSnackbar('Verification Request LOG Success', { variant: 'success' }); - setOpenDialog(false); - navigate('/custormer-service/request') - }) - .catch(({ response }) => { - enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' }); - }); + if (formData.type_of_member === "") { + setError(true); + alert('Silakan pilih Type Of Member sebelum mengirimkan data.'); + } else { + axios + .put(`customer-service/request/${requestLog?.id}`, formData) + .then((response) => { + enqueueSnackbar('Verification Request LOG Success', { variant: 'success' }); + setOpenDialog(false); + navigate('/custormer-service/request') + }) + .catch(({ response }) => { + enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' }); + }); + + } } const style1 = { @@ -200,13 +207,15 @@ export default function DialogConfirmation({requestLog, setOpenDialog, openDialo /> - Type Of Member + Type Of Member* handleChange('type_of_member', e.target.value)} variant="outlined" displayEmpty + required + error={error} > Type Member