mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
fix(webapp): no default branch for customer/vendor opening balance branch
This commit is contained in:
@@ -5,59 +5,20 @@ import { MenuItem, Button } from '@blueprintjs/core';
|
|||||||
import { FSelect } from '../Forms';
|
import { FSelect } from '../Forms';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Branch select field.
|
||||||
* @param {*} query
|
|
||||||
* @param {*} branch
|
|
||||||
* @param {*} _index
|
|
||||||
* @param {*} exactMatch
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const branchItemPredicate = (query, branch, _index, exactMatch) => {
|
|
||||||
const normalizedTitle = branch.name.toLowerCase();
|
|
||||||
const normalizedQuery = query.toLowerCase();
|
|
||||||
|
|
||||||
if (exactMatch) {
|
|
||||||
return normalizedTitle === normalizedQuery;
|
|
||||||
} else {
|
|
||||||
return `${branch.code}. ${normalizedTitle}`.indexOf(normalizedQuery) >= 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {*} film
|
|
||||||
* @param {*} param1
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const branchItemRenderer = (branch, { handleClick, modifiers, query }) => {
|
|
||||||
const text = `${branch.name}`;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<MenuItem
|
|
||||||
active={modifiers.active}
|
|
||||||
disabled={modifiers.disabled}
|
|
||||||
label={branch.code}
|
|
||||||
key={branch.id}
|
|
||||||
onClick={handleClick}
|
|
||||||
text={text}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const branchSelectProps = {
|
|
||||||
itemPredicate: branchItemPredicate,
|
|
||||||
itemRenderer: branchItemRenderer,
|
|
||||||
valueAccessor: 'id',
|
|
||||||
labelAccessor: 'name',
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {*} param0
|
* @param {*} param0
|
||||||
* @returns
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export function BranchSelect({ branches, ...rest }) {
|
export function BranchSelect({ branches, ...rest }) {
|
||||||
return <FSelect {...branchSelectProps} {...rest} items={branches} />;
|
return (
|
||||||
|
<FSelect
|
||||||
|
valueAccessor={'id'}
|
||||||
|
textAccessor={'name'}
|
||||||
|
labelAccessor={'code'}
|
||||||
|
{...rest}
|
||||||
|
items={branches}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export function FSelect({ ...props }) {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
return <Select input={input} {...props} fill={true} />;
|
return <Select input={input} fill={true} {...props} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SelectButton = styled(Button)`
|
const SelectButton = styled(Button)`
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import React from 'react';
|
||||||
|
import intl from 'react-intl-universal';
|
||||||
|
import { Button } from '@blueprintjs/core';
|
||||||
|
import { Icon } from '@/components';
|
||||||
|
|
||||||
|
export function FormWarehouseSelectButton({ text }) {
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
text={intl.get('page_form.warehouse_button.label', { text })}
|
||||||
|
minimal={true}
|
||||||
|
small={true}
|
||||||
|
icon={<Icon icon={'warehouse-16'} iconSize={16} />}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function FormBranchSelectButton({ text }) {
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
text={intl.get('page_form.branch_button.label', { text })}
|
||||||
|
minimal={true}
|
||||||
|
small={true}
|
||||||
|
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
export * from './FormTopbar';
|
export * from './FormTopbar';
|
||||||
|
export * from './FormTopbarSelectInputs';
|
||||||
export * from './PageFormBigNumber';
|
export * from './PageFormBigNumber';
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
FeatureCan,
|
FeatureCan,
|
||||||
FormTopbar,
|
FormTopbar,
|
||||||
DetailsBarSkeletonBase,
|
DetailsBarSkeletonBase,
|
||||||
|
FormBranchSelectButton,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { useMakeJournalFormContext } from './MakeJournalProvider';
|
import { useMakeJournalFormContext } from './MakeJournalProvider';
|
||||||
|
|
||||||
@@ -51,18 +52,9 @@ function MakeJournalFormSelectBranch() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={MakeJournalBranchSelectButton}
|
input={FormBranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
fill={false}
|
||||||
);
|
|
||||||
}
|
|
||||||
function MakeJournalBranchSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('make_journal.branch_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {
|
|||||||
InputPrependText,
|
InputPrependText,
|
||||||
CurrencySelectList,
|
CurrencySelectList,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
BranchSelectButton,
|
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
Row,
|
Row,
|
||||||
Col,
|
Col,
|
||||||
@@ -78,12 +77,10 @@ export default function CustomerFinancialPanel() {
|
|||||||
label={<T id={'customer.label.opening_branch'} />}
|
label={<T id={'customer.label.opening_branch'} />}
|
||||||
name={'opening_balance_branch_id'}
|
name={'opening_balance_branch_id'}
|
||||||
inline={true}
|
inline={true}
|
||||||
className={classNames('form-group--select-list', Classes.FILL)}
|
|
||||||
>
|
>
|
||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'opening_balance_branch_id'}
|
name={'opening_balance_branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={BranchSelectButton}
|
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import { Alignment, NavbarGroup, Classes } from '@blueprintjs/core';
|
||||||
import { Button, Alignment, NavbarGroup, Classes } from '@blueprintjs/core';
|
|
||||||
import { useSetPrimaryBranchToForm } from './utils';
|
import { useSetPrimaryBranchToForm } from './utils';
|
||||||
import { useFeatureCan } from '@/hooks/state';
|
import { useFeatureCan } from '@/hooks/state';
|
||||||
import { Features } from '@/constants';
|
import { Features } from '@/constants';
|
||||||
import {
|
import {
|
||||||
Icon,
|
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
FormTopbar,
|
FormTopbar,
|
||||||
DetailsBarSkeletonBase,
|
DetailsBarSkeletonBase,
|
||||||
|
FormBranchSelectButton,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { useExpenseFormContext } from './ExpenseFormPageProvider';
|
import { useExpenseFormContext } from './ExpenseFormPageProvider';
|
||||||
|
|
||||||
@@ -51,19 +50,9 @@ function ExpenseFormSelectBranch() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={ExpenseBranchSelectButton}
|
input={FormBranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
fill={false}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ExpenseBranchSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('expense.branch_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
|
||||||
import {
|
import {
|
||||||
Alignment,
|
Alignment,
|
||||||
NavbarGroup,
|
NavbarGroup,
|
||||||
NavbarDivider,
|
NavbarDivider,
|
||||||
Button,
|
|
||||||
Classes,
|
Classes,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import {
|
import {
|
||||||
@@ -14,12 +12,13 @@ import {
|
|||||||
} from './utils';
|
} from './utils';
|
||||||
import { useFeatureCan } from '@/hooks/state';
|
import { useFeatureCan } from '@/hooks/state';
|
||||||
import {
|
import {
|
||||||
Icon,
|
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
WarehouseSelect,
|
WarehouseSelect,
|
||||||
FormTopbar,
|
FormTopbar,
|
||||||
DetailsBarSkeletonBase,
|
DetailsBarSkeletonBase,
|
||||||
|
FormWarehouseSelectButton,
|
||||||
|
FormBranchSelectButton,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { useBillFormContext } from './BillFormProvider';
|
import { useBillFormContext } from './BillFormProvider';
|
||||||
import { Features } from '@/constants';
|
import { Features } from '@/constants';
|
||||||
@@ -70,8 +69,9 @@ function BillFormSelectBranch() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={BillBranchSelectButton}
|
input={FormBranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
|
fill={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -86,30 +86,9 @@ function BillFormSelectWarehouse() {
|
|||||||
<WarehouseSelect
|
<WarehouseSelect
|
||||||
name={'warehouse_id'}
|
name={'warehouse_id'}
|
||||||
warehouses={warehouses}
|
warehouses={warehouses}
|
||||||
input={BillWarehouseSelectButton}
|
input={FormWarehouseSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
fill={false}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function BillWarehouseSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('bill.warehouse_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'warehouse-16'} iconSize={16} />}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function BillBranchSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('bill.branch_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
|
||||||
import {
|
import {
|
||||||
Alignment,
|
Alignment,
|
||||||
NavbarGroup,
|
NavbarGroup,
|
||||||
@@ -20,6 +19,8 @@ import {
|
|||||||
WarehouseSelect,
|
WarehouseSelect,
|
||||||
FormTopbar,
|
FormTopbar,
|
||||||
DetailsBarSkeletonBase,
|
DetailsBarSkeletonBase,
|
||||||
|
FormWarehouseSelectButton,
|
||||||
|
FormBranchSelectButton,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { useVendorCreditNoteFormContext } from './VendorCreditNoteFormProvider';
|
import { useVendorCreditNoteFormContext } from './VendorCreditNoteFormProvider';
|
||||||
import { Features } from '@/constants';
|
import { Features } from '@/constants';
|
||||||
@@ -70,8 +71,9 @@ function VendorCreditNoteFormSelectBranch() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={VendorCreditNoteBranchSelectButton}
|
input={FormBranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
|
fill={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -86,30 +88,9 @@ function VendorCreditFormSelectWarehouse() {
|
|||||||
<WarehouseSelect
|
<WarehouseSelect
|
||||||
name={'warehouse_id'}
|
name={'warehouse_id'}
|
||||||
warehouses={warehouses}
|
warehouses={warehouses}
|
||||||
input={VendorCreditNoteWarehouseSelectButton}
|
input={FormWarehouseSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
fill={false}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function VendorCreditNoteWarehouseSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('vendor_credit.warehouse_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'warehouse-16'} iconSize={16} />}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function VendorCreditNoteBranchSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('vendor_credit.branch_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import { Alignment, NavbarGroup, Classes } from '@blueprintjs/core';
|
||||||
import { Alignment, NavbarGroup, Button, Classes } from '@blueprintjs/core';
|
|
||||||
import { useSetPrimaryBranchToForm } from './utils';
|
import { useSetPrimaryBranchToForm } from './utils';
|
||||||
import { useFeatureCan } from '@/hooks/state';
|
import { useFeatureCan } from '@/hooks/state';
|
||||||
import {
|
import {
|
||||||
Icon,
|
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
FormTopbar,
|
FormTopbar,
|
||||||
DetailsBarSkeletonBase,
|
DetailsBarSkeletonBase,
|
||||||
|
FormBranchSelectButton,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { usePaymentMadeFormContext } from './PaymentMadeFormProvider';
|
import { usePaymentMadeFormContext } from './PaymentMadeFormProvider';
|
||||||
import { Features } from '@/constants';
|
import { Features } from '@/constants';
|
||||||
@@ -50,19 +49,9 @@ function PaymentMadeFormSelectBranch() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={PaymentMadeBranchSelectButton}
|
input={FormBranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
fill={false}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function PaymentMadeBranchSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('payment_made.branch_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
|
||||||
import {
|
import {
|
||||||
Alignment,
|
Alignment,
|
||||||
NavbarGroup,
|
NavbarGroup,
|
||||||
NavbarDivider,
|
NavbarDivider,
|
||||||
Button,
|
|
||||||
Classes,
|
Classes,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import {
|
import {
|
||||||
@@ -15,12 +14,13 @@ import {
|
|||||||
import { Features } from '@/constants';
|
import { Features } from '@/constants';
|
||||||
import { useFeatureCan } from '@/hooks/state';
|
import { useFeatureCan } from '@/hooks/state';
|
||||||
import {
|
import {
|
||||||
Icon,
|
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
WarehouseSelect,
|
WarehouseSelect,
|
||||||
FormTopbar,
|
FormTopbar,
|
||||||
DetailsBarSkeletonBase,
|
DetailsBarSkeletonBase,
|
||||||
|
FormWarehouseSelectButton,
|
||||||
|
FormBranchSelectButton,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { useCreditNoteFormContext } from './CreditNoteFormProvider';
|
import { useCreditNoteFormContext } from './CreditNoteFormProvider';
|
||||||
|
|
||||||
@@ -70,8 +70,9 @@ function CreditNoteFormSelectBranch() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={CreditNoteBranchSelectButton}
|
input={FormBranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
|
fill={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -86,30 +87,9 @@ function CreditFormSelectWarehouse() {
|
|||||||
<WarehouseSelect
|
<WarehouseSelect
|
||||||
name={'warehouse_id'}
|
name={'warehouse_id'}
|
||||||
warehouses={warehouses}
|
warehouses={warehouses}
|
||||||
input={CreditNoteWarehouseSelectButton}
|
input={FormWarehouseSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
fill={false}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function CreditNoteWarehouseSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('credit_note.warehouse_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'warehouse-16'} iconSize={16} />}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function CreditNoteBranchSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('credit_note.branch_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
|
||||||
import {
|
import {
|
||||||
Alignment,
|
Alignment,
|
||||||
NavbarGroup,
|
NavbarGroup,
|
||||||
NavbarDivider,
|
NavbarDivider,
|
||||||
Button,
|
|
||||||
Classes,
|
Classes,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import {
|
import {
|
||||||
@@ -15,12 +13,13 @@ import {
|
|||||||
import { Features } from '@/constants';
|
import { Features } from '@/constants';
|
||||||
import { useFeatureCan } from '@/hooks/state';
|
import { useFeatureCan } from '@/hooks/state';
|
||||||
import {
|
import {
|
||||||
Icon,
|
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
WarehouseSelect,
|
WarehouseSelect,
|
||||||
FormTopbar,
|
FormTopbar,
|
||||||
DetailsBarSkeletonBase,
|
DetailsBarSkeletonBase,
|
||||||
|
FormWarehouseSelectButton,
|
||||||
|
FormBranchSelectButton,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { useEstimateFormContext } from './EstimateFormProvider';
|
import { useEstimateFormContext } from './EstimateFormProvider';
|
||||||
|
|
||||||
@@ -70,8 +69,9 @@ function EstimateFormSelectBranch() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={EstimateBranchSelectButton}
|
input={FormBranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
|
fill={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -86,30 +86,9 @@ function EstimateFormSelectWarehouse() {
|
|||||||
<WarehouseSelect
|
<WarehouseSelect
|
||||||
name={'warehouse_id'}
|
name={'warehouse_id'}
|
||||||
warehouses={warehouses}
|
warehouses={warehouses}
|
||||||
input={EstimateWarehouseSelectButton}
|
input={FormWarehouseSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
fill={false}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function EstimateWarehouseSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('estimate.warehouse_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'warehouse-16'} iconSize={16} />}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function EstimateBranchSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('estimate.branch_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import {
|
import {
|
||||||
Alignment,
|
Alignment,
|
||||||
NavbarGroup,
|
NavbarGroup,
|
||||||
NavbarDivider,
|
NavbarDivider,
|
||||||
Button,
|
|
||||||
Classes,
|
Classes,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import {
|
import {
|
||||||
@@ -18,11 +16,12 @@ import { Features } from '@/constants';
|
|||||||
import { useInvoiceFormContext } from './InvoiceFormProvider';
|
import { useInvoiceFormContext } from './InvoiceFormProvider';
|
||||||
import { useFeatureCan } from '@/hooks/state';
|
import { useFeatureCan } from '@/hooks/state';
|
||||||
import {
|
import {
|
||||||
Icon,
|
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
WarehouseSelect,
|
WarehouseSelect,
|
||||||
FormTopbar,
|
FormTopbar,
|
||||||
|
FormWarehouseSelectButton,
|
||||||
|
FormBranchSelectButton,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,8 +69,9 @@ function InvoiceFormSelectBranch() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={InvoiceBranchSelectButton}
|
input={FormBranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
|
fill={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -86,30 +86,9 @@ function InvoiceFormSelectWarehouse() {
|
|||||||
<WarehouseSelect
|
<WarehouseSelect
|
||||||
name={'warehouse_id'}
|
name={'warehouse_id'}
|
||||||
warehouses={warehouses}
|
warehouses={warehouses}
|
||||||
input={InvoiceWarehouseSelectButton}
|
input={FormWarehouseSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
fill={false}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function InvoiceWarehouseSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('invoice.warehouse_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'warehouse-16'} iconSize={16} />}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function InvoiceBranchSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('invoice.branch_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import { Alignment, NavbarGroup, Classes } from '@blueprintjs/core';
|
||||||
import { Alignment, NavbarGroup, Button, Classes } from '@blueprintjs/core';
|
|
||||||
import { useSetPrimaryBranchToForm } from './utils';
|
import { useSetPrimaryBranchToForm } from './utils';
|
||||||
import { useFeatureCan } from '@/hooks/state';
|
import { useFeatureCan } from '@/hooks/state';
|
||||||
import {
|
import {
|
||||||
Icon,
|
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
FormTopbar,
|
FormTopbar,
|
||||||
DetailsBarSkeletonBase,
|
DetailsBarSkeletonBase,
|
||||||
|
FormBranchSelectButton,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { usePaymentReceiveFormContext } from './PaymentReceiveFormProvider';
|
import { usePaymentReceiveFormContext } from './PaymentReceiveFormProvider';
|
||||||
import { Features } from '@/constants';
|
import { Features } from '@/constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment receive from top bar.
|
* Payment receive from top bar.
|
||||||
* @returns
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export default function PaymentReceiveFormTopBar() {
|
export default function PaymentReceiveFormTopBar() {
|
||||||
// Features guard.
|
// Features guard.
|
||||||
@@ -29,7 +28,6 @@ export default function PaymentReceiveFormTopBar() {
|
|||||||
if (!featureCan(Features.Branches)) {
|
if (!featureCan(Features.Branches)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormTopbar>
|
<FormTopbar>
|
||||||
<NavbarGroup align={Alignment.LEFT}>
|
<NavbarGroup align={Alignment.LEFT}>
|
||||||
@@ -41,6 +39,10 @@ export default function PaymentReceiveFormTopBar() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Branch select of payment receive form.
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
function PaymentReceiveFormSelectBranch() {
|
function PaymentReceiveFormSelectBranch() {
|
||||||
// payment receive form context.
|
// payment receive form context.
|
||||||
const { branches, isBranchesLoading } = usePaymentReceiveFormContext();
|
const { branches, isBranchesLoading } = usePaymentReceiveFormContext();
|
||||||
@@ -51,19 +53,9 @@ function PaymentReceiveFormSelectBranch() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={PaymentReceiveBranchSelectButton}
|
input={FormBranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
fill={false}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function PaymentReceiveBranchSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('payment_receive.branch_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
|
||||||
import styled from 'styled-components';
|
|
||||||
import {
|
import {
|
||||||
Alignment,
|
Alignment,
|
||||||
NavbarGroup,
|
NavbarGroup,
|
||||||
NavbarDivider,
|
NavbarDivider,
|
||||||
Button,
|
|
||||||
Classes,
|
Classes,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import {
|
import {
|
||||||
@@ -18,12 +15,13 @@ import { Features } from '@/constants';
|
|||||||
import { useFeatureCan } from '@/hooks/state';
|
import { useFeatureCan } from '@/hooks/state';
|
||||||
import { useReceiptFormContext } from './ReceiptFormProvider';
|
import { useReceiptFormContext } from './ReceiptFormProvider';
|
||||||
import {
|
import {
|
||||||
Icon,
|
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
WarehouseSelect,
|
WarehouseSelect,
|
||||||
FormTopbar,
|
FormTopbar,
|
||||||
DetailsBarSkeletonBase,
|
DetailsBarSkeletonBase,
|
||||||
|
FormBranchSelectButton,
|
||||||
|
FormWarehouseSelectButton,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,8 +74,9 @@ function ReceiptFormSelectBranch() {
|
|||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'branch_id'}
|
name={'branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={ReceiptBranchSelectButton}
|
input={FormBranchSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
|
fill={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -96,30 +95,9 @@ function ReceiptFormSelectWarehouse() {
|
|||||||
<WarehouseSelect
|
<WarehouseSelect
|
||||||
name={'warehouse_id'}
|
name={'warehouse_id'}
|
||||||
warehouses={warehouses}
|
warehouses={warehouses}
|
||||||
input={ReceiptWarehouseSelectButton}
|
input={FormWarehouseSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
fill={false}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ReceiptBranchSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('receipt.branch_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ReceiptWarehouseSelectButton({ label }) {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
text={intl.get('receipt.warehouse_button.label', { label })}
|
|
||||||
minimal={true}
|
|
||||||
small={true}
|
|
||||||
icon={<Icon icon={'warehouse-16'} iconSize={16} />}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import {
|
|||||||
InputPrependText,
|
InputPrependText,
|
||||||
CurrencySelectList,
|
CurrencySelectList,
|
||||||
BranchSelect,
|
BranchSelect,
|
||||||
BranchSelectButton,
|
|
||||||
FeatureCan,
|
FeatureCan,
|
||||||
Row,
|
Row,
|
||||||
Col,
|
Col,
|
||||||
@@ -75,12 +74,10 @@ export default function VendorFinanicalPanelTab() {
|
|||||||
label={<T id={'vendor.label.opening_branch'} />}
|
label={<T id={'vendor.label.opening_branch'} />}
|
||||||
name={'opening_balance_branch_id'}
|
name={'opening_balance_branch_id'}
|
||||||
inline={true}
|
inline={true}
|
||||||
className={classNames('form-group--select-list', Classes.FILL)}
|
|
||||||
>
|
>
|
||||||
<BranchSelect
|
<BranchSelect
|
||||||
name={'opening_balance_branch_id'}
|
name={'opening_balance_branch_id'}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
input={BranchSelectButton}
|
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
@@ -1938,8 +1938,8 @@
|
|||||||
"warehouse.alert.mark_primary_message": "The given warehouse has been marked as primary.",
|
"warehouse.alert.mark_primary_message": "The given warehouse has been marked as primary.",
|
||||||
"warehouse.alert.are_you_sure_you_want_to_make": "Are you sure you want to make a primary warehouse?",
|
"warehouse.alert.are_you_sure_you_want_to_make": "Are you sure you want to make a primary warehouse?",
|
||||||
"make_primary": "Make as Primary",
|
"make_primary": "Make as Primary",
|
||||||
"invoice.branch_button.label": "Branch: {label}",
|
"page_form.branch_button.label": "Branch: {text}",
|
||||||
"invoice.warehouse_button.label": "Warehouse: {label}",
|
"page_form.warehouse_button.label": "Warehouse: {text}",
|
||||||
"branches_multi_select.label": "Branches",
|
"branches_multi_select.label": "Branches",
|
||||||
"branches_multi_select.placeholder": "Filter by branches…",
|
"branches_multi_select.placeholder": "Filter by branches…",
|
||||||
"warehouses_multi_select.label": "Warehouses",
|
"warehouses_multi_select.label": "Warehouses",
|
||||||
@@ -2024,20 +2024,6 @@
|
|||||||
"make_journal.label.total": "TOTAL",
|
"make_journal.label.total": "TOTAL",
|
||||||
"expense.label.subtotal": "Subtotal",
|
"expense.label.subtotal": "Subtotal",
|
||||||
"expense.label.total": "TOTAL",
|
"expense.label.total": "TOTAL",
|
||||||
"expense.branch_button.label": "Branch: {label}",
|
|
||||||
"make_journal.branch_button.label": "Branch: {label}",
|
|
||||||
"bill.branch_button.label": "Branch: {label}",
|
|
||||||
"bill.warehouse_button.label": "Warehouse: {label}",
|
|
||||||
"vendor_credit.branch_button.label": "Branch: {label}",
|
|
||||||
"vendor_credit.warehouse_button.label": "Warehouse: {label}",
|
|
||||||
"payment_receive.branch_button.label": "Branch: {label}",
|
|
||||||
"payment_made.branch_button.label": "Branch: {label}",
|
|
||||||
"credit_note.branch_button.label": "Branch: {label}",
|
|
||||||
"credit_note.warehouse_button.label": "Warehouse: {label}",
|
|
||||||
"estimate.branch_button.label": "Branch: {label}",
|
|
||||||
"estimate.warehouse_button.label": "Warehouse: {label}",
|
|
||||||
"receipt.branch_button.label": "Branch: {label}",
|
|
||||||
"receipt.warehouse_button.label": "Warehouse: {label}",
|
|
||||||
"warehouse_transfer.empty_status.title": "Manage transfer orders between warehouses.",
|
"warehouse_transfer.empty_status.title": "Manage transfer orders between warehouses.",
|
||||||
"warehouse_transfer.empty_status.description": "Business with multiply warehouses often transfers items from on warehouse to another when they are in immediate need of vendors.",
|
"warehouse_transfer.empty_status.description": "Business with multiply warehouses often transfers items from on warehouse to another when they are in immediate need of vendors.",
|
||||||
"warehouse_transfer.form.reason.label": "Reason",
|
"warehouse_transfer.form.reason.label": "Reason",
|
||||||
|
|||||||
Reference in New Issue
Block a user