mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
feat: add quick create & sortable.
This commit is contained in:
@@ -10,18 +10,13 @@ import {
|
|||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||||
import { useCreditNoteDetailDrawerContext } from './CreditNoteDetailDrawerProvider';
|
import { useCreditNoteDetailDrawerContext } from './CreditNoteDetailDrawerProvider';
|
||||||
|
import { CreditNoteMenuItem } from './utils';
|
||||||
|
|
||||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
import {
|
import { Icon, FormattedMessage as T, If, Can } from 'components';
|
||||||
Icon,
|
|
||||||
FormattedMessage as T,
|
|
||||||
If,
|
|
||||||
MoreMenuItems,
|
|
||||||
Can,
|
|
||||||
} from 'components';
|
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
@@ -52,6 +47,10 @@ function CreditNoteDetailActionsBar({
|
|||||||
openDialog('refund-credit-note', { creditNoteId });
|
openDialog('refund-credit-note', { creditNoteId });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleReconcileCreditNote = () => {
|
||||||
|
openDialog('reconcile-credit-note', { creditNoteId });
|
||||||
|
};
|
||||||
|
|
||||||
// Handle delete credit note.
|
// Handle delete credit note.
|
||||||
const handleDeleteCreditNote = () => {
|
const handleDeleteCreditNote = () => {
|
||||||
openAlert('credit-note-delete', { creditNoteId });
|
openAlert('credit-note-delete', { creditNoteId });
|
||||||
@@ -83,6 +82,20 @@ function CreditNoteDetailActionsBar({
|
|||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={handleDeleteCreditNote}
|
onClick={handleDeleteCreditNote}
|
||||||
/>
|
/>
|
||||||
|
<If
|
||||||
|
condition={
|
||||||
|
!creditNote.is_draft &&
|
||||||
|
!creditNote.is_closed
|
||||||
|
// creditNote.is_published
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<NavbarDivider />
|
||||||
|
<CreditNoteMenuItem
|
||||||
|
payload={{
|
||||||
|
onReconcile: handleReconcileCreditNote,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</If>
|
||||||
</NavbarGroup>
|
</NavbarGroup>
|
||||||
</DashboardActionsBar>
|
</DashboardActionsBar>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,18 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import { FormatNumberCell } from '../../../components';
|
import {
|
||||||
|
Button,
|
||||||
|
Popover,
|
||||||
|
PopoverInteractionKind,
|
||||||
|
Position,
|
||||||
|
MenuItem,
|
||||||
|
Menu,
|
||||||
|
} from '@blueprintjs/core';
|
||||||
|
import {
|
||||||
|
Icon,
|
||||||
|
FormattedMessage as T,
|
||||||
|
FormatNumberCell,
|
||||||
|
} from '../../../components';
|
||||||
|
|
||||||
export const useCreditNoteReadOnlyEntriesColumns = () =>
|
export const useCreditNoteReadOnlyEntriesColumns = () =>
|
||||||
React.useMemo(
|
React.useMemo(
|
||||||
@@ -45,3 +57,26 @@ export const useCreditNoteReadOnlyEntriesColumns = () =>
|
|||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const CreditNoteMenuItem = ({ payload: { onReconcile } }) => {
|
||||||
|
return (
|
||||||
|
<Popover
|
||||||
|
minimal={true}
|
||||||
|
interactionKind={PopoverInteractionKind.CLICK}
|
||||||
|
position={Position.BOTTOM_LEFT}
|
||||||
|
modifiers={{
|
||||||
|
offset: { offset: '0, 4' },
|
||||||
|
}}
|
||||||
|
content={
|
||||||
|
<Menu>
|
||||||
|
<MenuItem
|
||||||
|
onClick={onReconcile}
|
||||||
|
text={<T id={'credit_note.action.reconcile_with_invoices'} />}
|
||||||
|
/>
|
||||||
|
</Menu>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Button icon={<Icon icon="more-vert" iconSize={16} />} minimal={true} />
|
||||||
|
</Popover>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||||
import { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider';
|
import { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider';
|
||||||
|
import { VendorCreditMenuItem } from './utils';
|
||||||
|
|
||||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
@@ -51,6 +52,10 @@ function VendorCreditDetailActionsBar({
|
|||||||
openDialog('refund-vendor-credit', { vendorCreditId });
|
openDialog('refund-vendor-credit', { vendorCreditId });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleReconcileVendorCredit = () => {
|
||||||
|
openDialog('reconcile-vendor-credit', { vendorCreditId });
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardActionsBar>
|
<DashboardActionsBar>
|
||||||
<NavbarGroup>
|
<NavbarGroup>
|
||||||
@@ -77,6 +82,20 @@ function VendorCreditDetailActionsBar({
|
|||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={handleDeleteVendorCredit}
|
onClick={handleDeleteVendorCredit}
|
||||||
/>
|
/>
|
||||||
|
<If
|
||||||
|
condition={
|
||||||
|
!vendorCredit.is_closed &&
|
||||||
|
!vendorCredit.is_draft
|
||||||
|
// vendorCredit.is_published
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<NavbarDivider />
|
||||||
|
<VendorCreditMenuItem
|
||||||
|
payload={{
|
||||||
|
onReconcile: handleReconcileVendorCredit,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</If>
|
||||||
</NavbarGroup>
|
</NavbarGroup>
|
||||||
</DashboardActionsBar>
|
</DashboardActionsBar>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
|
import {
|
||||||
import { FormatNumberCell } from '../../../components';
|
Button,
|
||||||
|
Popover,
|
||||||
|
PopoverInteractionKind,
|
||||||
|
Position,
|
||||||
|
MenuItem,
|
||||||
|
Menu,
|
||||||
|
} from '@blueprintjs/core';
|
||||||
|
import {
|
||||||
|
FormatNumberCell,
|
||||||
|
Icon,
|
||||||
|
FormattedMessage as T,
|
||||||
|
} from '../../../components';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve vendor credit readonly details entries table columns.
|
* Retrieve vendor credit readonly details entries table columns.
|
||||||
@@ -49,3 +60,26 @@ export const useVendorCreditReadonlyEntriesTableColumns = () =>
|
|||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const VendorCreditMenuItem = ({ payload: { onReconcile } }) => {
|
||||||
|
return (
|
||||||
|
<Popover
|
||||||
|
minimal={true}
|
||||||
|
interactionKind={PopoverInteractionKind.CLICK}
|
||||||
|
position={Position.BOTTOM_LEFT}
|
||||||
|
modifiers={{
|
||||||
|
offset: { offset: '0, 4' },
|
||||||
|
}}
|
||||||
|
content={
|
||||||
|
<Menu>
|
||||||
|
<MenuItem
|
||||||
|
onClick={onReconcile}
|
||||||
|
text={intl.get('vendor_credits.action.reconcile_with_bills')}
|
||||||
|
/>
|
||||||
|
</Menu>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Button icon={<Icon icon="more-vert" iconSize={16} />} minimal={true} />
|
||||||
|
</Popover>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { FastField, Field, ErrorMessage } from 'formik';
|
|||||||
import { CLASSES } from 'common/classes';
|
import { CLASSES } from 'common/classes';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import {
|
import {
|
||||||
ContactSelecetList,
|
VendorSelectField,
|
||||||
FieldRequiredHint,
|
FieldRequiredHint,
|
||||||
InputPrependButton,
|
InputPrependButton,
|
||||||
Icon,
|
Icon,
|
||||||
@@ -78,30 +78,27 @@ function VendorCreditNoteFormHeaderFields({
|
|||||||
{/* ----------- Vendor name ----------- */}
|
{/* ----------- Vendor name ----------- */}
|
||||||
<FastField
|
<FastField
|
||||||
name={'vendor_id'}
|
name={'vendor_id'}
|
||||||
customers={vendors}
|
vendors={vendors}
|
||||||
shouldUpdate={vendorsFieldShouldUpdate}
|
shouldUpdate={vendorsFieldShouldUpdate}
|
||||||
>
|
>
|
||||||
{({ form, field: { value }, meta: { error, touched } }) => (
|
{({ form, field: { value }, meta: { error, touched } }) => (
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={<T id={'vendor_name'} />}
|
label={<T id={'vendor_name'} />}
|
||||||
inline={true}
|
inline={true}
|
||||||
className={classNames(
|
className={classNames(CLASSES.FILL, 'form-group--vendor')}
|
||||||
'form-group--vendor-name',
|
|
||||||
'form-group--select-list',
|
|
||||||
CLASSES.FILL,
|
|
||||||
)}
|
|
||||||
labelInfo={<FieldRequiredHint />}
|
labelInfo={<FieldRequiredHint />}
|
||||||
intent={inputIntent({ error, touched })}
|
intent={inputIntent({ error, touched })}
|
||||||
helperText={<ErrorMessage name={'vendor_id'} />}
|
helperText={<ErrorMessage name={'vendor_id'} />}
|
||||||
>
|
>
|
||||||
<ContactSelecetList
|
<VendorSelectField
|
||||||
contactsList={vendors}
|
contacts={vendors}
|
||||||
selectedContactId={value}
|
selectedContactId={value}
|
||||||
defaultSelectText={<T id={'select_vender_account'} />}
|
defaultSelectText={<T id={'select_vender_account'} />}
|
||||||
onContactSelected={(vendor) => {
|
onContactSelected={(contact) => {
|
||||||
form.setFieldValue('vendor_id', vendor.id);
|
form.setFieldValue('vendor_id', contact.id);
|
||||||
}}
|
}}
|
||||||
popoverFill={true}
|
popoverFill={true}
|
||||||
|
allowCreate={true}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -66,7 +66,12 @@ function VendorCreditNoteFormProvider({ vendorCreditId, ...props }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardInsider
|
<DashboardInsider
|
||||||
loading={isItemsLoading || isVendorsLoading || isVendorCreditLoading}
|
loading={
|
||||||
|
isVendorCreditLoading ||
|
||||||
|
isItemsLoading ||
|
||||||
|
isVendorsLoading ||
|
||||||
|
isVendorCreditLoading
|
||||||
|
}
|
||||||
name={'vendor-credit-form'}
|
name={'vendor-credit-form'}
|
||||||
>
|
>
|
||||||
<VendorCreditNoteFormContext.Provider value={provider} {...props} />
|
<VendorCreditNoteFormContext.Provider value={provider} {...props} />
|
||||||
|
|||||||
@@ -100,12 +100,12 @@ export function useVendorsCreditNoteTableColumns() {
|
|||||||
return React.useMemo(
|
return React.useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
id: 'vendor_credit_date',
|
id: 'credit_date',
|
||||||
Header: intl.get('date'),
|
Header: intl.get('date'),
|
||||||
accessor: 'formatted_vendor_credit_date',
|
accessor: 'formatted_vendor_credit_date',
|
||||||
Cell: FormatDateCell,
|
Cell: FormatDateCell,
|
||||||
width: 110,
|
width: 110,
|
||||||
className: 'vendor_credit_date',
|
className: 'credit_date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
},
|
},
|
||||||
@@ -119,11 +119,11 @@ export function useVendorsCreditNoteTableColumns() {
|
|||||||
textOverview: true,
|
textOverview: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'vendor_credit_number',
|
id: 'credit_number',
|
||||||
Header: intl.get('vendor_credits.column.vendor_credit_no'),
|
Header: intl.get('vendor_credits.column.vendor_credit_no'),
|
||||||
accessor: 'vendor_credit_number',
|
accessor: 'vendor_credit_number',
|
||||||
width: 100,
|
width: 100,
|
||||||
className: 'vendor_credit_number',
|
className: 'credit_number',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
},
|
},
|
||||||
@@ -145,6 +145,7 @@ export function useVendorsCreditNoteTableColumns() {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
|
disableSortBy: true,
|
||||||
className: clsx(CLASSES.FONT_BOLD),
|
className: clsx(CLASSES.FONT_BOLD),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { FastField, Field, ErrorMessage } from 'formik';
|
|||||||
import { CLASSES } from 'common/classes';
|
import { CLASSES } from 'common/classes';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import {
|
import {
|
||||||
ContactSelecetList,
|
CustomerSelectField,
|
||||||
FieldRequiredHint,
|
FieldRequiredHint,
|
||||||
InputPrependButton,
|
InputPrependButton,
|
||||||
Icon,
|
Icon,
|
||||||
@@ -91,14 +91,15 @@ function CreditNoteFormHeaderFields({
|
|||||||
intent={inputIntent({ error, touched })}
|
intent={inputIntent({ error, touched })}
|
||||||
helperText={<ErrorMessage name={'customer_id'} />}
|
helperText={<ErrorMessage name={'customer_id'} />}
|
||||||
>
|
>
|
||||||
<ContactSelecetList
|
<CustomerSelectField
|
||||||
contactsList={customers}
|
contacts={customers}
|
||||||
selectedContactId={value}
|
selectedContactId={value}
|
||||||
defaultSelectText={<T id={'select_customer_account'} />}
|
defaultSelectText={<T id={'select_customer_account'} />}
|
||||||
onContactSelected={(customer) => {
|
onContactSelected={(customer) => {
|
||||||
form.setFieldValue('customer_id', customer.id);
|
form.setFieldValue('customer_id', customer.id);
|
||||||
}}
|
}}
|
||||||
popoverFill={true}
|
popoverFill={true}
|
||||||
|
allowCreate={true}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ function CreditNotesDataTable({
|
|||||||
headerLoading={isCreditNotesLoading}
|
headerLoading={isCreditNotesLoading}
|
||||||
progressBarLoading={isCreditNotesFetching}
|
progressBarLoading={isCreditNotesFetching}
|
||||||
onFetchData={handleDataTableFetchData}
|
onFetchData={handleDataTableFetchData}
|
||||||
|
manualSortBy={true}
|
||||||
selectionColumn={true}
|
selectionColumn={true}
|
||||||
noInitialFetch={true}
|
noInitialFetch={true}
|
||||||
sticky={true}
|
sticky={true}
|
||||||
|
|||||||
@@ -44,7 +44,11 @@ export function ActionsMenu({
|
|||||||
onClick={safeCallback(onOpen, original)}
|
onClick={safeCallback(onOpen, original)}
|
||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
<If condition={!original.is_draft && original.is_published}>
|
<If
|
||||||
|
condition={
|
||||||
|
!original.is_draft && !original.is_closed && original.is_published
|
||||||
|
}
|
||||||
|
>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('credit_note.action.reconcile_with_invoices')}
|
text={intl.get('credit_note.action.reconcile_with_invoices')}
|
||||||
// icon={<Icon icon="quick-payment-16" />}
|
// icon={<Icon icon="quick-payment-16" />}
|
||||||
@@ -97,12 +101,12 @@ export function useCreditNoteTableColumns() {
|
|||||||
return React.useMemo(
|
return React.useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
id: 'credit_note_date',
|
id: 'credit_date',
|
||||||
Header: intl.get('credit_note.column.credit_date'),
|
Header: intl.get('credit_note.column.credit_date'),
|
||||||
accessor: 'formatted_credit_note_date',
|
accessor: 'formatted_credit_note_date',
|
||||||
Cell: FormatDateCell,
|
Cell: FormatDateCell,
|
||||||
width: 110,
|
width: 110,
|
||||||
className: 'credit_note_date',
|
className: 'credit_date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
},
|
},
|
||||||
@@ -111,16 +115,16 @@ export function useCreditNoteTableColumns() {
|
|||||||
Header: intl.get('customer_name'),
|
Header: intl.get('customer_name'),
|
||||||
accessor: 'customer.display_name',
|
accessor: 'customer.display_name',
|
||||||
width: 180,
|
width: 180,
|
||||||
className: 'customer_id',
|
className: 'customer',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'credit_note_number',
|
id: 'credit_number',
|
||||||
Header: intl.get('credit_note.column.credit_note_no'),
|
Header: intl.get('credit_note.column.credit_note_no'),
|
||||||
accessor: 'credit_note_number',
|
accessor: 'credit_note_number',
|
||||||
width: 100,
|
width: 100,
|
||||||
className: 'credit_note_number',
|
className: 'credit_number',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
},
|
},
|
||||||
@@ -142,6 +146,7 @@ export function useCreditNoteTableColumns() {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
|
disableSortBy: true,
|
||||||
className: clsx(CLASSES.FONT_BOLD),
|
className: clsx(CLASSES.FONT_BOLD),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,13 @@ const commonInvalidateQueries = (client) => {
|
|||||||
// Invalidate the cashflow transactions.
|
// Invalidate the cashflow transactions.
|
||||||
client.invalidateQueries(t.CASH_FLOW_TRANSACTIONS);
|
client.invalidateQueries(t.CASH_FLOW_TRANSACTIONS);
|
||||||
client.invalidateQueries(t.CASHFLOW_ACCOUNT_TRANSACTIONS_INFINITY);
|
client.invalidateQueries(t.CASHFLOW_ACCOUNT_TRANSACTIONS_INFINITY);
|
||||||
|
|
||||||
|
client.invalidateQueries(t.CREDIT_NOTE);
|
||||||
|
client.invalidateQueries(t.CREDIT_NOTES);
|
||||||
|
|
||||||
|
// Invalidate reconcile.
|
||||||
|
client.invalidateQueries(t.RECONCILE_CREDIT_NOTE);
|
||||||
|
client.invalidateQueries(t.RECONCILE_CREDIT_NOTES);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Transform payment receives.
|
// Transform payment receives.
|
||||||
|
|||||||
Reference in New Issue
Block a user