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 = {
|
const defaultData = {
|
||||||
plant_section_id: '',
|
plant_section_id: '',
|
||||||
plantName: '',
|
plantName: '',
|
||||||
|
sectionName: '',
|
||||||
status: true,
|
status: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -33,8 +34,19 @@ const DetailPlantSection = (props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!FormData.sectionName) {
|
||||||
|
NotifOk({
|
||||||
|
icon: 'warning',
|
||||||
|
title: 'Peringatan',
|
||||||
|
message: 'Kolom Section Name Tidak Boleh Kosong',
|
||||||
|
});
|
||||||
|
setConfirmLoading(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
plantName: FormData.plantName,
|
plantName: FormData.plantName,
|
||||||
|
sectionName: FormData.sectionName,
|
||||||
status: FormData.status,
|
status: FormData.status,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -45,6 +57,7 @@ const DetailPlantSection = (props) => {
|
|||||||
statusCode: FormData.plant_section_id ? 200 : 201,
|
statusCode: FormData.plant_section_id ? 200 : 201,
|
||||||
data: {
|
data: {
|
||||||
plantName: FormData.plantName,
|
plantName: FormData.plantName,
|
||||||
|
sectionName: FormData.sectionName,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -54,7 +67,7 @@ const DetailPlantSection = (props) => {
|
|||||||
title: 'Berhasil',
|
title: 'Berhasil',
|
||||||
message: `Data Plant Section "${
|
message: `Data Plant Section "${
|
||||||
response.data?.plantName || FormData.plantName
|
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');
|
props.setActionMode('list');
|
||||||
@@ -207,6 +220,17 @@ const DetailPlantSection = (props) => {
|
|||||||
readOnly={props.readOnly}
|
readOnly={props.readOnly}
|
||||||
/>
|
/>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -16,16 +16,25 @@ const initialPlantSectionData = [
|
|||||||
{
|
{
|
||||||
plant_section_id: 1,
|
plant_section_id: 1,
|
||||||
plantName: 'Assembly',
|
plantName: 'Assembly',
|
||||||
|
sectionName: 'Line 1',
|
||||||
status: 'Active',
|
status: 'Active',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
plant_section_id: 2,
|
plant_section_id: 2,
|
||||||
plantName: 'Painting',
|
plantName: 'Assembly',
|
||||||
|
sectionName: 'Line 2',
|
||||||
status: 'Active',
|
status: 'Active',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
plant_section_id: 3,
|
plant_section_id: 3,
|
||||||
|
plantName: 'Painting',
|
||||||
|
sectionName: 'Booth A',
|
||||||
|
status: 'Active',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
plant_section_id: 4,
|
||||||
plantName: 'Warehouse',
|
plantName: 'Warehouse',
|
||||||
|
sectionName: 'Receiving',
|
||||||
status: 'Inactive',
|
status: 'Inactive',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -42,7 +51,13 @@ const columns = (showPreviewModal, showEditModal, showDeleteDialog) => [
|
|||||||
title: 'Plant Name',
|
title: 'Plant Name',
|
||||||
dataIndex: 'plantName',
|
dataIndex: 'plantName',
|
||||||
key: 'plantName',
|
key: 'plantName',
|
||||||
width: '65%',
|
width: '30%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Section Name',
|
||||||
|
dataIndex: 'sectionName',
|
||||||
|
key: 'sectionName',
|
||||||
|
width: '30%',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Status',
|
title: 'Status',
|
||||||
@@ -122,7 +137,8 @@ const ListPlantSection = memo(function ListPlantSection(props) {
|
|||||||
const searchLower = searchParam.toLowerCase();
|
const searchLower = searchParam.toLowerCase();
|
||||||
filteredPlantSections = plantSectionData.filter(
|
filteredPlantSections = plantSectionData.filter(
|
||||||
(plant) =>
|
(plant) =>
|
||||||
plant.plantName.toLowerCase().includes(searchLower)
|
plant.plantName.toLowerCase().includes(searchLower) ||
|
||||||
|
plant.sectionName.toLowerCase().includes(searchLower)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +210,7 @@ const ListPlantSection = memo(function ListPlantSection(props) {
|
|||||||
NotifConfirmDialog({
|
NotifConfirmDialog({
|
||||||
icon: 'question',
|
icon: 'question',
|
||||||
title: 'Konfirmasi',
|
title: 'Konfirmasi',
|
||||||
message: 'Apakah anda yakin hapus data "' + param.plantName + '" ?',
|
message: 'Apakah anda yakin hapus data "' + param.plantName + ' - ' + param.sectionName + '" ?',
|
||||||
onConfirm: () => handleDelete(param.plant_section_id),
|
onConfirm: () => handleDelete(param.plant_section_id),
|
||||||
onCancel: () => props.setSelectedData(null),
|
onCancel: () => props.setSelectedData(null),
|
||||||
});
|
});
|
||||||
@@ -211,7 +227,7 @@ const ListPlantSection = memo(function ListPlantSection(props) {
|
|||||||
NotifAlert({
|
NotifAlert({
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
title: 'Berhasil',
|
title: 'Berhasil',
|
||||||
message: `Data Plant Section "${plantToDelete?.plantName || ''}" berhasil dihapus.`,
|
message: `Data Plant Section "${plantToDelete?.plantName || ''} - ${plantToDelete?.sectionName || ''}" berhasil dihapus.`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -285,6 +301,7 @@ const ListPlantSection = memo(function ListPlantSection(props) {
|
|||||||
mobile
|
mobile
|
||||||
cardColor={'#42AAFF'}
|
cardColor={'#42AAFF'}
|
||||||
header={'plantName'}
|
header={'plantName'}
|
||||||
|
subHeader={'sectionName'}
|
||||||
showPreviewModal={showPreviewModal}
|
showPreviewModal={showPreviewModal}
|
||||||
showEditModal={showEditModal}
|
showEditModal={showEditModal}
|
||||||
showDeleteDialog={showDeleteDialog}
|
showDeleteDialog={showDeleteDialog}
|
||||||
|
|||||||
Reference in New Issue
Block a user