fix: branch & warehouse multi select.

This commit is contained in:
elforjani13
2022-03-16 22:59:26 +02:00
parent d85133b35e
commit 7f3a494c8d
9 changed files with 14 additions and 12 deletions

View File

@@ -38,8 +38,8 @@ const branchItemRenderer = (
active={modifiers.active}
disabled={modifiers.disabled}
icon={isSelected ? 'tick' : 'blank'}
text={branch.name.toString()}
label={branch.code.toString()}
text={branch.name}
label={branch.code}
key={branch.id}
onClick={handleClick}
/>
@@ -50,7 +50,7 @@ const branchSelectProps = {
itemPredicate: branchItemPredicate,
itemRenderer: branchItemRenderer,
valueAccessor: (item) => item.id,
labelAccessor: (item) => item.label,
labelAccessor: (item) => item.code,
tagRenderer: (item) => item.name,
};

View File

@@ -40,8 +40,8 @@ const warehouseItemRenderer = (
active={modifiers.active}
disabled={modifiers.disabled}
icon={isSelected ? 'tick' : 'blank'}
text={warehouse.name.toString()}
label={warehouse.code.toString()}
text={warehouse.name}
label={warehouse.code}
key={warehouse.id}
onClick={handleClick}
/>
@@ -52,7 +52,7 @@ const warehouseSelectProps = {
itemPredicate: warehouseItemPredicate,
itemRenderer: warehouseItemRenderer,
valueAccessor: (item) => item.id,
labelAccessor: (item) => item.label,
labelAccessor: (item) => item.code,
tagRenderer: (item) => item.name,
};

View File

@@ -54,10 +54,7 @@ function APAgingSummaryHeader({
filterByOption: 'without-zero-balance',
};
// Formik initial values.
const initialValues = transformToForm(
{ ...pageFilter, branchesIds: [] },
defaultValues,
);
const initialValues = transformToForm({ ...pageFilter }, defaultValues);
// Handle form submit.
const handleSubmit = (values, { setSubmitting }) => {

View File

@@ -11,6 +11,7 @@ export const getDefaultAPAgingSummaryQuery = () => {
agingDaysBefore: 30,
agingPeriods: 3,
vendorsIds: [],
branchesIds: [],
filterByOption: 'without-zero-balance',
}
}

View File

@@ -51,13 +51,12 @@ function ARAgingSummaryHeader({
branchesIds: [],
filterByOption: 'without-zero-balance',
};
// Initial values.
const initialValues = transformToForm(
{
...pageFilter,
asDate: moment(pageFilter.asDate).toDate(),
branchesIds: [],
},
defaultValues,
);

View File

@@ -15,5 +15,6 @@ export const getDefaultARAgingSummaryQuery = () => {
agingPeriods: 3,
customersIds: [],
filterByOption: 'without-zero-balance',
branchesIds: [],
};
};

View File

@@ -47,6 +47,7 @@ export const useBalanceSheetQuery = () => {
return {
...defaultQuery,
...transformToForm(locationQuery, defaultQuery),
branchesIds: [],
};
}, [locationQuery]);

View File

@@ -49,6 +49,7 @@ export const useProfitLossSheetQuery = () => {
return {
...defaultQuery,
...transformToForm(locationQuery, defaultQuery),
branchesIds: [],
};
}, [locationQuery]);

View File

@@ -6,5 +6,7 @@ export function getDefaultTrialBalanceQuery() {
toDate: moment().endOf('year').format('YYYY-MM-DD'),
basis: 'accural',
filterByOption: 'with-transactions',
branchesIds: [],
};
}