repair: delete error code

This commit is contained in:
2025-12-09 11:06:28 +07:00
parent 5703ff0e8d
commit 3225a0865e
4 changed files with 332 additions and 201 deletions

View File

@@ -53,13 +53,6 @@ const AddBrandDevice = () => {
const {
solutionFields,
solutionTypes,
solutionStatuses,
solutionsToDelete,
firstSolutionValid,
handleAddSolutionField,
handleRemoveSolutionField,
handleSolutionTypeChange,
handleSolutionStatusChange,
resetSolutionFields,
getSolutionData,
setSolutionsForExistingRecord,
@@ -72,7 +65,6 @@ const AddBrandDevice = () => {
const brandValues = await brandForm.validateFields();
const userId = JSON.parse(localStorage.getItem('user') || '{}').user_id || 1;
// Prepare brand data for API
const brandApiData = {
brand_name: brandValues.brand_name,
brand_type: brandValues.brand_type || '',
@@ -97,7 +89,6 @@ const AddBrandDevice = () => {
});
setCurrentStep(1);
// Trigger refresh untuk error codes table di fase 2
setTimeout(() => {
setTrigerFilter(prev => !prev);
}, 100);
@@ -239,7 +230,6 @@ const AddBrandDevice = () => {
let allErrorCodes = [];
// Get error codes from API if brand is created
if (createdBrandId) {
const queryParams = new URLSearchParams({
page: page.toString(),
@@ -258,10 +248,8 @@ const AddBrandDevice = () => {
}
}
// Add temp error codes
allErrorCodes = [...allErrorCodes, ...tempErrorCodes.filter(ec => ec.status !== 'deleted')];
// Filter by search text if needed
if (searchText) {
allErrorCodes = allErrorCodes.filter(ec =>
ec.error_code.toLowerCase().includes(searchText.toLowerCase()) ||
@@ -313,7 +301,6 @@ const AddBrandDevice = () => {
render: (text, record) => (
<Space>
{text}
{record.status === 'new' && <Tag color="green">New</Tag>}
</Space>
),
},
@@ -360,7 +347,6 @@ const AddBrandDevice = () => {
},
];
// Query params for table
const queryParams = useMemo(() => {
const params = new URLSearchParams();
params.set('page', '1');
@@ -424,8 +410,6 @@ const AddBrandDevice = () => {
solution: solutionData || [],
spareparts: selectedSparepartIds || []
};
// For create, include error_code field (required)
if (isAddingNewErrorCode) {
payload.error_code = errorCodeValues.error_code;
}
@@ -473,7 +457,6 @@ const AddBrandDevice = () => {
const handleFinish = async () => {
setConfirmLoading(true);
try {
// Fase 2 completion - brand sudah dibuat di fase 1
NotifOk({
icon: 'success',
title: 'Brand Device Tersimpan',