|
|
|
@ -33,7 +33,9 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
const [divisionId, setDivisionId] = useState('') |
|
|
|
|
const [statusResource, setStatusResource] = useState('active') |
|
|
|
|
const [statusRestriction, setStatusRestriction] = useState(false) |
|
|
|
|
const [statusCustomer, setStatusCustomer] = useState(false) |
|
|
|
|
const { t } = useTranslation() |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (typeDialog === "Edit" || typeDialog === "Set") { |
|
|
|
|
setId(dataEdit.id) |
|
|
|
@ -55,6 +57,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
setDivisionId(dataEdit.divisi_id) |
|
|
|
|
setAddress(dataEdit.address) |
|
|
|
|
setStatusRestriction(dataEdit.status_boundary) |
|
|
|
|
setStatusCustomer(dataEdit.is_customer) |
|
|
|
|
} else { |
|
|
|
|
setId(0) |
|
|
|
|
setResourceName('') |
|
|
|
@ -76,6 +79,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
setCompanyId(null) |
|
|
|
|
setStatusResource('active') |
|
|
|
|
setStatusRestriction(false) |
|
|
|
|
setStatusCustomer(false) |
|
|
|
|
} |
|
|
|
|
}, [dataEdit, openDialog]) |
|
|
|
|
|
|
|
|
@ -104,14 +108,17 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
gender, |
|
|
|
|
birth_place: birthPlace, |
|
|
|
|
ktp_number: ktpNumber, |
|
|
|
|
role_id: roleId, |
|
|
|
|
divisi_id: divisionId, |
|
|
|
|
address, |
|
|
|
|
status_resource: statusResource, |
|
|
|
|
status_boundary: statusRestriction, |
|
|
|
|
company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(statusCustomer === false) { |
|
|
|
|
data.role_id = roleId; |
|
|
|
|
data.divisi_id = divisionId; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (birthDate && birthDate != "") { |
|
|
|
|
data['birth_date'] = birthDate; |
|
|
|
|
} |
|
|
|
@ -153,13 +160,16 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
blood_type: bloodType, |
|
|
|
|
ktp_number: ktpNumber, |
|
|
|
|
biaya_per_jam: biayaPerJam.replace('.', ''), |
|
|
|
|
role_id: roleId, |
|
|
|
|
divisi_id: divisionId, |
|
|
|
|
address, |
|
|
|
|
status_resource: statusResource, |
|
|
|
|
status_boundary: statusRestriction, |
|
|
|
|
is_customer: statusCustomer, |
|
|
|
|
company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id) |
|
|
|
|
} |
|
|
|
|
if(statusCustomer === false) { |
|
|
|
|
data.role_id = roleId; |
|
|
|
|
data.divisi_id = divisionId; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (birthDate && birthDate != "") { |
|
|
|
|
data['birth_date'] = birthDate; |
|
|
|
@ -283,6 +293,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
|
</Row> |
|
|
|
|
{ |
|
|
|
|
statusCustomer === false && ( |
|
|
|
|
<Row> |
|
|
|
|
<Col md={6}> |
|
|
|
|
<FormGroup> |
|
|
|
@ -301,7 +313,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
|
</Row> |
|
|
|
|
|
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
<Row> |
|
|
|
|
{ |
|
|
|
|
role_name === 'Super Admin' && ( |
|
|
|
@ -329,8 +342,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
<Col md={6}> |
|
|
|
|
<Label className="capitalize">{t('restrictions')}</Label> |
|
|
|
|
<Select style={{ width: "100%" }} defaultValue={statusRestriction} onChange={(e) => setStatusRestriction(e)}> |
|
|
|
|
<Label className="capitalize">{t('Customer')}</Label> |
|
|
|
|
<Select style={{ width: "100%" }} defaultValue={statusCustomer} onChange={(e) => setStatusCustomer(e)}> |
|
|
|
|
<Option value={true}>Ya</Option> |
|
|
|
|
<Option value={false}>Tidak</Option> |
|
|
|
|
</Select> |
|
|
|
@ -342,13 +355,19 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
|
|
|
|
|
<Option value={'inactive'}>Inactive</Option> |
|
|
|
|
</Select> |
|
|
|
|
</Col> |
|
|
|
|
<Col md={6}> |
|
|
|
|
<Col md={6} style={{ marginTop:'13px' }}> |
|
|
|
|
<Label className="capitalize">{t('restrictions')}</Label> |
|
|
|
|
<Select style={{ width: "100%" }} defaultValue={statusRestriction} onChange={(e) => setStatusRestriction(e)}> |
|
|
|
|
<Option value={true}>Ya</Option> |
|
|
|
|
<Option value={false}>Tidak</Option> |
|
|
|
|
</Select> |
|
|
|
|
</Col> |
|
|
|
|
<Col md={6} style={{ marginTop:'13px' }}> |
|
|
|
|
<FormGroup> |
|
|
|
|
<Label className="capitalize">{t('address')}</Label> |
|
|
|
|
<Input type="textarea" value={address} onChange={(e) => setAddress(e.target.value)} placeholder={t('inputaddress')} /> |
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
|
|
|
|
|
|
</Row> |
|
|
|
|
</Form> |
|
|
|
|
) |
|
|
|
|