mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
23 lines
666 B
TypeScript
23 lines
666 B
TypeScript
// @ts-nocheck
|
|
import React from 'react';
|
|
import { chain } from 'lodash';
|
|
import { FormikObserver } from '@/components';
|
|
import { useWarehouseTransferFormContext } from './WarehouseTransferFormProvider';
|
|
|
|
export function WarehouseTransferObserveItemsCost() {
|
|
const { setItemCostQuery } = useWarehouseTransferFormContext();
|
|
|
|
// Handle the form change.
|
|
const handleFormChange = (values) => {
|
|
const { date } = values;
|
|
const itemsIds = chain(values.entries)
|
|
.filter((e) => e.item_id)
|
|
.map((e) => e.item_id)
|
|
.uniq()
|
|
.value();
|
|
|
|
setItemCostQuery({ date, itemsIds });
|
|
};
|
|
return <FormikObserver onChange={handleFormChange} />;
|
|
}
|