mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
refactor(FE): Treat kandang_id as optional and use expense id
This commit is contained in:
@@ -101,13 +101,23 @@ const ExpenseRealizationForm = ({
|
||||
|
||||
values.realizations.forEach((realization) => {
|
||||
realization.cost_items.forEach((costItem) => {
|
||||
const realizationItem = {
|
||||
const realizationItem: {
|
||||
expense_nonstock_id: number;
|
||||
qty: number;
|
||||
price: number;
|
||||
notes: string;
|
||||
kandang_id?: number;
|
||||
} = {
|
||||
expense_nonstock_id: costItem.nonstock?.value as number,
|
||||
qty: parseFloat(String(costItem.quantity)) as number,
|
||||
price: parseFloat(String(costItem.price)) as number,
|
||||
notes: costItem.notes ?? '',
|
||||
};
|
||||
|
||||
if (realization.kandang_id && realization.kandang_id > 0) {
|
||||
realizationItem.kandang_id = realization.kandang_id;
|
||||
}
|
||||
|
||||
realizations.push(realizationItem);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user