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