|
|
@ -29,46 +29,66 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi |
|
|
|
} |
|
|
|
} |
|
|
|
}, [dataEdit, openDialog]) |
|
|
|
}, [dataEdit, openDialog]) |
|
|
|
|
|
|
|
|
|
|
|
const handleSave = () => { |
|
|
|
const validation = () => { |
|
|
|
let data = ''; |
|
|
|
if (!name || name === "") { |
|
|
|
if (typeDialog === "Save") { |
|
|
|
alert("Division Name cannot be empty!"); |
|
|
|
data = { |
|
|
|
return true; |
|
|
|
name: name, |
|
|
|
} |
|
|
|
description, |
|
|
|
} |
|
|
|
parent |
|
|
|
const handleSave = () => { |
|
|
|
} |
|
|
|
let data = ''; |
|
|
|
closeDialog('save', data); |
|
|
|
const err = validation(); |
|
|
|
} else { |
|
|
|
|
|
|
|
data = { |
|
|
|
if (!err) { |
|
|
|
id, |
|
|
|
if (typeDialog === "Save") { |
|
|
|
name: name, |
|
|
|
data = { |
|
|
|
description, |
|
|
|
name: name, |
|
|
|
parent |
|
|
|
description, |
|
|
|
} |
|
|
|
parent |
|
|
|
closeDialog('edit', data); |
|
|
|
} |
|
|
|
} |
|
|
|
closeDialog('save', data); |
|
|
|
setId(0) |
|
|
|
} else { |
|
|
|
setDescription('') |
|
|
|
data = { |
|
|
|
|
|
|
|
id, |
|
|
|
|
|
|
|
name: name, |
|
|
|
|
|
|
|
description, |
|
|
|
|
|
|
|
parent |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
closeDialog('edit', data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setId(0) |
|
|
|
|
|
|
|
setDescription('') |
|
|
|
|
|
|
|
setName('') |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const handleCancel = () => { |
|
|
|
const handleCancel = () => { |
|
|
|
closeDialog('cancel', 'none') |
|
|
|
closeDialog('cancel', 'none') |
|
|
|
setId(0) |
|
|
|
setId(0) |
|
|
|
setDescription('') |
|
|
|
setDescription('') |
|
|
|
|
|
|
|
setName('') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const renderForm = () => { |
|
|
|
const renderForm = () => { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Form> |
|
|
|
<Form> |
|
|
|
|
|
|
|
<Row> |
|
|
|
|
|
|
|
<Col md={12}> |
|
|
|
|
|
|
|
<span style={{ color: "red" }}>*</span> Wajib diisi. |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
</Row> |
|
|
|
<Row> |
|
|
|
<Row> |
|
|
|
<Col md={6}> |
|
|
|
<Col md={6}> |
|
|
|
<FormGroup> |
|
|
|
<FormGroup> |
|
|
|
<Label className="capitalize">{t('name')}</Label> |
|
|
|
<Label className="capitalize">{t('name')}<span style={{ color: "red" }}>*</span></Label> |
|
|
|
<Input type="text" value={name} onChange={(e) => setName(e.target.value)} placeholder={t('inputName')} /> |
|
|
|
<Input |
|
|
|
|
|
|
|
type="text" |
|
|
|
|
|
|
|
value={name} |
|
|
|
|
|
|
|
onChange={(e) => setName(e.target.value)} |
|
|
|
|
|
|
|
placeholder={t('inputName')} |
|
|
|
|
|
|
|
/> |
|
|
|
</FormGroup> |
|
|
|
</FormGroup> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
</Row> |
|
|
|
<Col md={6}> |
|
|
|
<Row> |
|
|
|
|
|
|
|
<Col md={6}> |
|
|
|
|
|
|
|
<FormGroup> |
|
|
|
<FormGroup> |
|
|
|
<Label className="capitalize">{t('nameDivision')}</Label> |
|
|
|
<Label className="capitalize">{t('nameDivision')}</Label> |
|
|
|
<Select showSearch |
|
|
|
<Select showSearch |
|
|
@ -85,7 +105,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
</Row> |
|
|
|
</Row> |
|
|
|
<Row> |
|
|
|
<Row> |
|
|
|
<Col md={6}> |
|
|
|
<Col md={12}> |
|
|
|
<FormGroup> |
|
|
|
<FormGroup> |
|
|
|
<Label className="capitalize">{t('description')}</Label> |
|
|
|
<Label className="capitalize">{t('description')}</Label> |
|
|
|
<Input row="4" type="textarea" value={description} onChange={(e) => setDescription(e.target.value)} placeholder={t('inputDescription')} /> |
|
|
|
<Input row="4" type="textarea" value={description} onChange={(e) => setDescription(e.target.value)} placeholder={t('inputDescription')} /> |
|
|
|