mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
refactor(FE): Treat kandang_id as optional and use expense id
This commit is contained in:
@@ -73,7 +73,14 @@ export const ExpenseRealizationFormSchema: Yup.ObjectSchema<ExpenseRealizationFo
|
||||
realizations: Yup.array()
|
||||
.of(
|
||||
Yup.object({
|
||||
kandang_id: Yup.number().min(1, 'Wajib memilih kandang!').optional(),
|
||||
kandang_id: Yup.number()
|
||||
.optional()
|
||||
.test('valid-kandang-id', 'Wajib memilih kandang!', (value) => {
|
||||
if (value === undefined || value === null || value === 0) {
|
||||
return true;
|
||||
}
|
||||
return value >= 1;
|
||||
}),
|
||||
cost_items: Yup.array()
|
||||
.of(
|
||||
Yup.object({
|
||||
@@ -175,7 +182,7 @@ export const getExpenseRealizationFormInitialValues = (
|
||||
: [];
|
||||
|
||||
return {
|
||||
kandang_id: kandangExpense.kandang_id,
|
||||
kandang_id: kandangExpense.id,
|
||||
cost_items: costItemsInitialValue,
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user