diff --git a/src/components/pages/expense/form/ExpenseRequestKandangDetailExpense.tsx b/src/components/pages/expense/form/ExpenseRequestKandangDetailExpense.tsx index ca9edf37..73e6c9b7 100644 --- a/src/components/pages/expense/form/ExpenseRequestKandangDetailExpense.tsx +++ b/src/components/pages/expense/form/ExpenseRequestKandangDetailExpense.tsx @@ -41,28 +41,28 @@ const ExpenseRequestKandangDetailExpense: React.FC< val: OptionType | OptionType[] | null ) => { formik.setFieldTouched( - `kandangExpenses[${kandangExpenseIdx}].expenses[${expenseIdx}].nonstock`, + `cost_per_kandangs[${kandangExpenseIdx}].cost_items[${expenseIdx}].nonstock`, true ); formik.setFieldValue( - `kandangExpenses[${kandangExpenseIdx}].expenses[${expenseIdx}].nonstock`, + `cost_per_kandangs[${kandangExpenseIdx}].cost_items[${expenseIdx}].nonstock`, val ); }; const addExpenseItemHandler = (kandangExpenseIdx: number) => { const newExpensesValue = [ - ...formik.values.kandangExpenses[kandangExpenseIdx].expenses, + ...formik.values.cost_per_kandangs[kandangExpenseIdx].cost_items, { nonstock: undefined, - totalExpense: undefined, - totalQuantity: undefined, + total_cost: undefined, + quantity: undefined, notes: '', }, ]; formik.setFieldValue( - `kandangExpenses[${kandangExpenseIdx}].expenses`, + `cost_per_kandangs[${kandangExpenseIdx}].cost_items`, newExpensesValue ); }; @@ -71,27 +71,28 @@ const ExpenseRequestKandangDetailExpense: React.FC< kandangExpenseIdx: number, expenseIdx: number ) => { - const path = `kandangExpenses[${kandangExpenseIdx}].expenses`; + const path = `cost_per_kandangs[${kandangExpenseIdx}].cost_items`; // trims values, errors, and touched at expenseIdx removeArrayItemAndSync(formik, path, expenseIdx); }; const isExpenseRepeaterInputError = ( - column: 'nonstock' | 'totalQuantity' | 'totalExpense' | 'notes', + column: 'nonstock' | 'quantity' | 'total_cost' | 'notes', kandangExpenseIdx: number, expenseIdx: number ) => { return ( - formik.touched.kandangExpenses?.[kandangExpenseIdx]?.expenses?.[ + formik.touched.cost_per_kandangs?.[kandangExpenseIdx]?.cost_items?.[ expenseIdx ]?.[column] && Boolean( - formik.errors.kandangExpenses?.[kandangExpenseIdx] instanceof Object && - formik.errors.kandangExpenses?.[kandangExpenseIdx].expenses?.[ + formik.errors.cost_per_kandangs?.[kandangExpenseIdx] instanceof + Object && + formik.errors.cost_per_kandangs?.[kandangExpenseIdx].cost_items?.[ expenseIdx ] instanceof Object && - formik.errors.kandangExpenses?.[kandangExpenseIdx].expenses?.[ + formik.errors.cost_per_kandangs?.[kandangExpenseIdx].cost_items?.[ expenseIdx ]?.[column] ) @@ -112,7 +113,8 @@ const ExpenseRequestKandangDetailExpense: React.FC<
Pilih kandang terlebih dahulu! @@ -120,168 +122,171 @@ const ExpenseRequestKandangDetailExpense: React.FC<
| Nonstock | -Total Kuantitas | -Total Biaya | -Catatan | - {type !== 'detail' &&Aksi | } -
|---|
| Nonstock | +Total Kuantitas | +Total Biaya | +Catatan | + {type !== 'detail' &&Aksi | } +
|---|---|---|---|---|
|
- |
-
-
- |
-
-
- |
-
-
- |
-
- {type !== 'detail' && (
- - |