mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
fix(webapp): filter by customers, vendors and items in reports do not work
This commit is contained in:
@@ -2,25 +2,33 @@
|
||||
import React from 'react';
|
||||
import moment from 'moment';
|
||||
import { castArray } from 'lodash';
|
||||
import * as Yup from 'yup';
|
||||
|
||||
import { useAppQueryString } from '@/hooks';
|
||||
import { transformToForm } from '@/utils';
|
||||
|
||||
/**
|
||||
* Retrieves the inventory valuation sheet default query.
|
||||
* Retrieves the validation schema of inventory valuation query.
|
||||
*/
|
||||
export const getInventoryValuationQuery = () => {
|
||||
return {
|
||||
asDate: moment().endOf('day').format('YYYY-MM-DD'),
|
||||
filterByOption: 'with-transactions',
|
||||
|
||||
branchesIds: [],
|
||||
warehousesIds: [],
|
||||
};
|
||||
export const getInventoryValuationQuerySchema = () => {
|
||||
return Yup.object().shape({
|
||||
asDate: Yup.date().required().label('asDate'),
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses inventory valiation location query to report query.
|
||||
* Retrieves the inventory valuation sheet default query.
|
||||
*/
|
||||
export const getInventoryValuationQuery = () => ({
|
||||
asDate: moment().endOf('day').format('YYYY-MM-DD'),
|
||||
filterByOption: 'with-transactions',
|
||||
itemsIds: [],
|
||||
branchesIds: [],
|
||||
warehousesIds: [],
|
||||
});
|
||||
|
||||
/**
|
||||
* Parses inventory valuation location query to report query.
|
||||
*/
|
||||
const parseInventoryValuationQuery = (locationQuery) => {
|
||||
const defaultQuery = getInventoryValuationQuery();
|
||||
@@ -33,6 +41,8 @@ const parseInventoryValuationQuery = (locationQuery) => {
|
||||
...transformed,
|
||||
|
||||
// Ensures the branches/warehouses ids is always array.
|
||||
itemsIds: castArray(transformed.itemsIds),
|
||||
|
||||
branchesIds: castArray(transformed.branchesIds),
|
||||
warehousesIds: castArray(transformed.warehousesIds),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user