feat: add section name field to DetailPlantSection and update ListPlantSection to include section name in data handling
This commit is contained in:
@@ -10,6 +10,7 @@ const DetailPlantSection = (props) => {
|
||||
const defaultData = {
|
||||
plant_section_id: '',
|
||||
plantName: '',
|
||||
sectionName: '',
|
||||
status: true,
|
||||
};
|
||||
|
||||
@@ -33,8 +34,19 @@ const DetailPlantSection = (props) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FormData.sectionName) {
|
||||
NotifOk({
|
||||
icon: 'warning',
|
||||
title: 'Peringatan',
|
||||
message: 'Kolom Section Name Tidak Boleh Kosong',
|
||||
});
|
||||
setConfirmLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = {
|
||||
plantName: FormData.plantName,
|
||||
sectionName: FormData.sectionName,
|
||||
status: FormData.status,
|
||||
};
|
||||
|
||||
@@ -45,6 +57,7 @@ const DetailPlantSection = (props) => {
|
||||
statusCode: FormData.plant_section_id ? 200 : 201,
|
||||
data: {
|
||||
plantName: FormData.plantName,
|
||||
sectionName: FormData.sectionName,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -54,7 +67,7 @@ const DetailPlantSection = (props) => {
|
||||
title: 'Berhasil',
|
||||
message: `Data Plant Section "${
|
||||
response.data?.plantName || FormData.plantName
|
||||
}" berhasil ${FormData.plant_section_id ? 'diubah' : 'ditambahkan'}.`,
|
||||
} - ${response.data?.sectionName || FormData.sectionName}" berhasil ${FormData.plant_section_id ? 'diubah' : 'ditambahkan'}.`,
|
||||
});
|
||||
|
||||
props.setActionMode('list');
|
||||
@@ -207,10 +220,21 @@ const DetailPlantSection = (props) => {
|
||||
readOnly={props.readOnly}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ marginBottom: 12 }}>
|
||||
<Text strong>Section Name</Text>
|
||||
<Text style={{ color: 'red' }}> *</Text>
|
||||
<Input
|
||||
name="sectionName"
|
||||
value={FormData.sectionName}
|
||||
onChange={handleInputChange}
|
||||
placeholder="Enter Section Name"
|
||||
readOnly={props.readOnly}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default DetailPlantSection;
|
||||
export default DetailPlantSection;
|
||||
|
||||
Reference in New Issue
Block a user