|
|
|
@ -135,6 +135,10 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
alert("Password doesn't match"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (password.length < 8) { |
|
|
|
|
alert("Password minimum 8 character"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
data = { |
|
|
|
|
id, |
|
|
|
|
username, |
|
|
|
@ -199,7 +203,10 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
</> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const isValidEmail = (email) => { |
|
|
|
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; |
|
|
|
|
return emailRegex.test(email); |
|
|
|
|
}; |
|
|
|
|
const renderForm = () => { |
|
|
|
|
return ( |
|
|
|
|
<Form> |
|
|
|
@ -213,7 +220,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
<FormGroup> |
|
|
|
|
<Label className="capitalize">{t('nik')} <span style={{ color: "red" }}>*</span></Label> |
|
|
|
|
{/* <Input type="text" value={ktpNumber} onChange={(e) => setKtpNumber(e.target.value.replace(/[^0-9]/g, ''))} placeholder={`Input NIK (KTP)...`} maxLength="16" /> */} |
|
|
|
|
<Input type="text" value={ktpNumber} onChange={(e) => setKtpNumber(e.target.value)} placeholder={t('inputNik')} maxLength="16" /> |
|
|
|
|
<Input type="text" value={ktpNumber} onChange={(e) => setKtpNumber(e.target.value.replace(/[^0-9]/g, ''))} placeholder={t('inputNik')} maxLength="16" /> |
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
|
<Col md={6}> |
|
|
|
@ -246,7 +253,13 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
<Col md={6}> |
|
|
|
|
<FormGroup> |
|
|
|
|
<Label className="capitalize">Email</Label> |
|
|
|
|
<Input type="text" value={email} onChange={(e) => setEmail(e.target.value)} placeholder={t('inputEmail')} /> |
|
|
|
|
<Input type="email" value={email} onChange={(e) => setEmail(e.target.value)} placeholder={t('inputEmail')} |
|
|
|
|
onBlur={(e) => { |
|
|
|
|
if (!isValidEmail(e.target.value)) { |
|
|
|
|
alert("Masukkan email yang valid."); |
|
|
|
|
} |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
|
<Col md={6}> |
|
|
|
@ -327,7 +340,13 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
<Col md={6}> |
|
|
|
|
<FormGroup> |
|
|
|
|
<Label className="capitalize">Email</Label> |
|
|
|
|
<Input type="text" defaultValue={""} value={email} onChange={(e) => setEmail(e.target.value)} placeholder={`Email...`} /> |
|
|
|
|
<Input type="email" defaultValue={""} value={email} onChange={(e) => setEmail(e.target.value)} placeholder={`Email...`} |
|
|
|
|
onBlur={(e) => { |
|
|
|
|
if (!isValidEmail(e.target.value)) { |
|
|
|
|
alert("Masukkan email yang valid."); |
|
|
|
|
} |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
|
<Col md={6}> |
|
|
|
|