refactor(FE-435): Allow realizations without kandang

This commit is contained in:
rstubryan
2025-12-30 19:28:38 +07:00
parent a81a61135f
commit 2bf0f2874e
5 changed files with 219 additions and 187 deletions
@@ -122,7 +122,7 @@ const ExpenseRequestForm = ({
})),
};
return expenseNonstock.kandang_id !== null
return expenseNonstock.kandang_id
? { ...basePayload, kandang_id: expenseNonstock.kandang_id }
: basePayload;
}),
@@ -151,7 +151,7 @@ const ExpenseRequestForm = ({
})),
};
return expenseNonstock.kandang_id !== null
return expenseNonstock.kandang_id
? { ...basePayload, kandang_id: expenseNonstock.kandang_id }
: basePayload;
}
@@ -199,7 +199,6 @@ const ExpenseRequestForm = ({
// Auto-create expense item for location (without kandang)
formik.setFieldValue('expense_nonstocks', [
{
kandang_id: null,
cost_items: [
{
nonstock: undefined,
@@ -222,7 +221,6 @@ const ExpenseRequestForm = ({
if (kandangs.length === 0) {
formik.setFieldValue('expense_nonstocks', [
{
kandang_id: null,
cost_items: [
{
nonstock: undefined,