mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
refactor(FE): Allow null for select fields and track id fields
This commit is contained in:
@@ -25,7 +25,7 @@ interface ExpenseRequestKandangDetailExpenseProps {
|
||||
location?: {
|
||||
value: number;
|
||||
label: string;
|
||||
};
|
||||
} | null;
|
||||
className?: {
|
||||
wrapper?: string;
|
||||
};
|
||||
@@ -59,13 +59,20 @@ const ExpenseRequestKandangDetailExpense: React.FC<
|
||||
`expense_nonstocks[${kandangExpenseIdx}].cost_items[${expenseIdx}].nonstock`,
|
||||
val
|
||||
);
|
||||
|
||||
const nonstockId = Array.isArray(val) ? val[0]?.value : val?.value;
|
||||
formik.setFieldValue(
|
||||
`expense_nonstocks[${kandangExpenseIdx}].cost_items[${expenseIdx}].nonstock_id`,
|
||||
nonstockId ?? 0
|
||||
);
|
||||
};
|
||||
|
||||
const addExpenseItemHandler = (kandangExpenseIdx: number) => {
|
||||
const newExpensesValue = [
|
||||
...formik.values.expense_nonstocks[kandangExpenseIdx].cost_items,
|
||||
{
|
||||
nonstock: undefined,
|
||||
nonstock: null,
|
||||
nonstock_id: 0,
|
||||
price: undefined,
|
||||
quantity: undefined,
|
||||
notes: '',
|
||||
|
||||
Reference in New Issue
Block a user