mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
fix(webapp): use all drawers name from common enum object
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import React from 'react';
|
||||
import { useAccount, useAccountTransactions } from '@/hooks/query';
|
||||
import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const AccountDrawerContext = React.createContext();
|
||||
|
||||
@@ -33,7 +34,7 @@ function AccountDrawerProvider({ accountId, name, ...props }) {
|
||||
|
||||
return (
|
||||
<DrawerLoading loading={isAccountLoading || isAccountsLoading}>
|
||||
<DrawerHeaderContent name={'account-drawer'} title={drawerTitle} />
|
||||
<DrawerHeaderContent name={DRAWERS.ACCOUNT_DETAILS} title={drawerTitle} />
|
||||
<AccountDrawerContext.Provider value={provider} {...props} />
|
||||
</DrawerLoading>
|
||||
);
|
||||
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
import { BillMenuItem } from './utils';
|
||||
|
||||
import { safeCallback, compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
function BillDetailActionsBar({
|
||||
// #withDialogActions
|
||||
@@ -49,7 +50,7 @@ function BillDetailActionsBar({
|
||||
// Handle edit bill.
|
||||
const onEditBill = () => {
|
||||
history.push(`/bills/${billId}/edit`);
|
||||
closeDrawer('bill-drawer');
|
||||
closeDrawer(DRAWERS.BILL_DETAILS);
|
||||
};
|
||||
|
||||
// Handle convert to vendor credit.
|
||||
@@ -57,7 +58,7 @@ function BillDetailActionsBar({
|
||||
history.push(`/vendor-credits/new?from_bill_id=${billId}`, {
|
||||
billId: billId,
|
||||
});
|
||||
closeDrawer('bill-drawer');
|
||||
closeDrawer(DRAWERS.BILL_DETAILS);
|
||||
};
|
||||
|
||||
// Handle delete bill.
|
||||
|
||||
@@ -5,6 +5,7 @@ import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { useBill, useBillLocatedLandedCost } from '@/hooks/query';
|
||||
import { useFeatureCan } from '@/hooks/state';
|
||||
import { Features } from '@/constants';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const BillDrawerContext = React.createContext();
|
||||
|
||||
@@ -38,7 +39,7 @@ function BillDrawerProvider({ billId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={loading}>
|
||||
<DrawerHeaderContent
|
||||
name="bill-drawer"
|
||||
name={DRAWERS.BILL_DETAILS}
|
||||
title={intl.get('bill.drawer.title', {
|
||||
number: bill.bill_number ? `(${bill.bill_number})` : null,
|
||||
})}
|
||||
|
||||
@@ -12,6 +12,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Bill payment transactions datatable.
|
||||
@@ -48,7 +49,7 @@ function BillPaymentTransactionTable({
|
||||
// Handles edit bill payment transactions.
|
||||
const handleEditBillPaymentTransactions = ({ bill_payment_id }) => {
|
||||
history.push(`/payment-mades/${bill_payment_id}/edit`);
|
||||
closeDrawer('bill-drawer');
|
||||
closeDrawer(DRAWERS.BILL_DETAILS);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -11,12 +11,12 @@ import { useLocatedLandedCostColumns, ActionsMenu } from './components';
|
||||
import { useBillDrawerContext } from './BillDrawerProvider';
|
||||
|
||||
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
import { TableStyle } from '@/constants';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Located landed cost table.
|
||||
@@ -25,9 +25,6 @@ function LocatedLandedCostTable({
|
||||
// #withAlertsActions
|
||||
openAlert,
|
||||
|
||||
// #withDialogActions
|
||||
openDialog,
|
||||
|
||||
// #withDrawerActions
|
||||
openDrawer,
|
||||
}) {
|
||||
@@ -48,12 +45,12 @@ function LocatedLandedCostTable({
|
||||
|
||||
switch (from_transaction_type) {
|
||||
case 'Expense':
|
||||
openDrawer('expense-drawer', { expenseId: from_transaction_id });
|
||||
openDrawer(DRAWERS.EXPENSE_DETAILS, { expenseId: from_transaction_id });
|
||||
break;
|
||||
|
||||
case 'Bill':
|
||||
default:
|
||||
openDrawer('bill-drawer', { billId: from_transaction_id });
|
||||
openDrawer(DRAWERS.BILL_DETAILS, { billId: from_transaction_id });
|
||||
break;
|
||||
}
|
||||
};
|
||||
@@ -79,6 +76,5 @@ function LocatedLandedCostTable({
|
||||
|
||||
export default compose(
|
||||
withAlertsActions,
|
||||
withDialogActions,
|
||||
withDrawerActions,
|
||||
)(LocatedLandedCostTable);
|
||||
|
||||
@@ -4,6 +4,7 @@ import intl from 'react-intl-universal';
|
||||
import { useCashflowTransaction } from '@/hooks/query';
|
||||
|
||||
import { DrawerLoading, DrawerHeaderContent } from '@/components';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const CashflowTransactionDrawerContext = React.createContext();
|
||||
|
||||
@@ -32,7 +33,7 @@ function CashflowTransactionDrawerProvider({ referenceId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isCashflowTransactionLoading}>
|
||||
<DrawerHeaderContent
|
||||
name={'cashflow-transaction-drawer'}
|
||||
name={DRAWERS.CASHFLOW_TRNASACTION_DETAILS}
|
||||
title={intl.get('cash_flow.drawer.label_transaction', {
|
||||
number: cashflowTransaction?.transaction_number,
|
||||
})}
|
||||
|
||||
@@ -26,6 +26,7 @@ import { CreditNoteAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { CreditNoteMenuItem } from './utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Credit note detail actions bar.
|
||||
@@ -47,7 +48,7 @@ function CreditNoteDetailActionsBar({
|
||||
// Handle edit credit note.
|
||||
const handleEditCreditNote = () => {
|
||||
history.push(`/credit-notes/${creditNoteId}/edit`);
|
||||
closeDrawer('credit-note-detail-drawer');
|
||||
closeDrawer(DRAWERS.CREDIT_NOTE_DETAILS);
|
||||
};
|
||||
|
||||
const handleRefundCreditNote = () => {
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
import { Features } from '@/constants';
|
||||
import { useFeatureCan } from '@/hooks/state';
|
||||
import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const CreditNoteDetailDrawerContext = React.createContext();
|
||||
|
||||
@@ -72,7 +73,7 @@ function CreditNoteDetailDrawerProvider({ creditNoteId, ...props }) {
|
||||
}
|
||||
>
|
||||
<DrawerHeaderContent
|
||||
name="credit-note-detail-drawer"
|
||||
name={DRAWERS.CREDIT_NOTE_DETAILS}
|
||||
title={intl.get('credit_note.drawer.title', {
|
||||
number: creditNote.credit_note_number,
|
||||
})}
|
||||
|
||||
@@ -38,6 +38,7 @@ import {
|
||||
CustomerAction,
|
||||
} from '@/constants/abilityOption';
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Customer details actions bar.
|
||||
@@ -58,22 +59,22 @@ function CustomerDetailsActionsBar({
|
||||
// Handle new invoice button click.
|
||||
const handleNewInvoiceClick = () => {
|
||||
history.push('/invoices/new');
|
||||
closeDrawer('customer-detail-drawer');
|
||||
closeDrawer(DRAWERS.CUSTOMER_DETAILS);
|
||||
};
|
||||
// Handle new receipt button click.
|
||||
const handleNewReceiptClick = () => {
|
||||
history.push('/receipts/new');
|
||||
closeDrawer('customer-detail-drawer');
|
||||
closeDrawer(DRAWERS.CUSTOMER_DETAILS);
|
||||
};
|
||||
// Handle new payment receive button click.
|
||||
const handleNewPaymentClick = () => {
|
||||
history.push('/payment-receives/new');
|
||||
closeDrawer('customer-detail-drawer');
|
||||
closeDrawer(DRAWERS.CUSTOMER_DETAILS);
|
||||
};
|
||||
// Handle new estimate button click.
|
||||
const handleNewEstimateClick = () => {
|
||||
history.push('/estimates/new');
|
||||
closeDrawer('customer-detail-drawer');
|
||||
closeDrawer(DRAWERS.CUSTOMER_DETAILS);
|
||||
};
|
||||
// Handles delete customer click.
|
||||
const handleDeleteCustomer = () => {
|
||||
@@ -82,7 +83,7 @@ function CustomerDetailsActionsBar({
|
||||
// Handles edit customer click.
|
||||
const handleEditContact = () => {
|
||||
history.push(`/customers/${customerId}/edit`);
|
||||
closeDrawer('customer-details-drawer');
|
||||
closeDrawer(DRAWERS.CUSTOMER_DETAILS);
|
||||
};
|
||||
// Handle edit opening balance click.
|
||||
const handleEditOpeningBalance = () => {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import React from 'react';
|
||||
import { useCustomer } from '@/hooks/query';
|
||||
import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const ContactDetailDrawerContext = React.createContext();
|
||||
|
||||
@@ -26,7 +27,7 @@ function CustomerDetailsDrawerProvider({ customerId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isCustomerLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="customer-detail-drawer"
|
||||
name={DRAWERS.CUSTOMER_DETAILS}
|
||||
title={customer?.display_name}
|
||||
/>
|
||||
<ContactDetailDrawerContext.Provider value={provider} {...props} />
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
} from '@/components';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Estimate read-only details actions bar of the drawer.
|
||||
@@ -48,7 +49,7 @@ function EstimateDetailActionsBar({
|
||||
// Handle edit sale estimate.
|
||||
const handleEditEstimate = () => {
|
||||
history.push(`/estimates/${estimateId}/edit`);
|
||||
closeDrawer('estimate-detail-drawer');
|
||||
closeDrawer(DRAWERS.ESTIMATE_DETAILS);
|
||||
};
|
||||
|
||||
// Handle delete sale estimate.
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Features } from '@/constants';
|
||||
import { useEstimate } from '@/hooks/query';
|
||||
import { useFeatureCan } from '@/hooks/state';
|
||||
import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const EstimateDetailDrawerContext = React.createContext();
|
||||
|
||||
@@ -29,7 +30,7 @@ function EstimateDetailDrawerProvider({ estimateId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isEstimateLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="estimate-detail-drawer"
|
||||
name={DRAWERS.ESTIMATE_DETAILS}
|
||||
title={intl.get('estimate.drawer.title', {
|
||||
number: estimate.estimate_number,
|
||||
})}
|
||||
|
||||
@@ -21,6 +21,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Expense drawer action bar.
|
||||
@@ -40,7 +41,7 @@ function ExpenseDrawerActionBar({
|
||||
// Handle the expense edit action.
|
||||
const handleEditExpense = () => {
|
||||
history.push(`/expenses/${expense.id}/edit`);
|
||||
closeDrawer('expense-drawer');
|
||||
closeDrawer(DRAWERS.EXPENSE_DETAILS);
|
||||
};
|
||||
|
||||
// Handle the expense delete action.
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useExpense } from '@/hooks/query';
|
||||
import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { Features } from '@/constants';
|
||||
import { useFeatureCan } from '@/hooks/state';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const ExpenseDrawerDrawerContext = React.createContext();
|
||||
|
||||
@@ -36,7 +37,7 @@ function ExpenseDrawerProvider({ expenseId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isExpenseLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="expense-drawer"
|
||||
name={DRAWERS.EXPENSE_DETAILS}
|
||||
title={intl.get('expense.drawer.title')}
|
||||
subTitle={
|
||||
featureCan(Features.Branches)
|
||||
|
||||
@@ -3,6 +3,7 @@ import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { useInventoryAdjustment } from '@/hooks/query';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const InventoryAdjustmentDrawerContext = React.createContext();
|
||||
|
||||
@@ -25,7 +26,7 @@ function InventoryAdjustmentDrawerProvider({ inventoryId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isAdjustmentsLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="inventory-adjustment-drawer"
|
||||
name={DRAWERS.INVENTORY_ADJUSTMENT_DETAILS}
|
||||
title={intl.get('inventory_adjustment.details_drawer.title')}
|
||||
/>
|
||||
<InventoryAdjustmentDrawerContext.Provider value={provider} {...props} />
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { BadDebtMenuItem } from './utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Invoice details action bar.
|
||||
@@ -52,7 +53,7 @@ function InvoiceDetailActionsBar({
|
||||
// Handle edit sale invoice.
|
||||
const handleEditInvoice = () => {
|
||||
history.push(`/invoices/${invoiceId}/edit`);
|
||||
closeDrawer('invoice-detail-drawer');
|
||||
closeDrawer(DRAWERS.INVOICE_DETAILS);
|
||||
};
|
||||
|
||||
// Handle convert to invoice.
|
||||
@@ -60,7 +61,7 @@ function InvoiceDetailActionsBar({
|
||||
history.push(`/credit-notes/new?from_invoice_id=${invoiceId}`, {
|
||||
invoiceId: invoiceId,
|
||||
});
|
||||
closeDrawer('invoice-detail-drawer');
|
||||
closeDrawer(DRAWERS.INVOICE_DETAILS);
|
||||
};
|
||||
|
||||
// Handle delete sale invoice.
|
||||
|
||||
@@ -5,6 +5,7 @@ import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { Features } from '@/constants';
|
||||
import { useInvoice } from '@/hooks/query';
|
||||
import { useFeatureCan } from '@/hooks/state';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const InvoiceDetailDrawerContext = React.createContext();
|
||||
/**
|
||||
@@ -28,7 +29,7 @@ function InvoiceDetailDrawerProvider({ invoiceId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isInvoiceLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="invoice-detail-drawer"
|
||||
name={DRAWERS.INVOICE_DETAILS}
|
||||
title={intl.get('invoice_details.drawer.title', {
|
||||
invoiceNumber: invoice.invoice_no,
|
||||
})}
|
||||
|
||||
@@ -16,6 +16,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Invoice payment transactions datatable.
|
||||
@@ -54,7 +55,7 @@ function InvoicePaymentTransactionsTable({
|
||||
// Handles edit payment transactions.
|
||||
const handleEditPaymentTransactions = ({ payment_receive_id }) => {
|
||||
history.push(`/payment-receives/${payment_receive_id}/edit`);
|
||||
closeDrawer('invoice-detail-drawer');
|
||||
closeDrawer(DRAWERS.INVOICE_DETAILS);
|
||||
};
|
||||
return (
|
||||
<Card>
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
} from '@/components';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Item action-bar of readonly details drawer.
|
||||
@@ -42,7 +43,7 @@ function ItemDetailActionsBar({
|
||||
// Handle edit item.
|
||||
const handleEditItem = () => {
|
||||
history.push(`/items/${itemId}/edit`);
|
||||
closeDrawer('item-detail-drawer');
|
||||
closeDrawer(DRAWERS.ITEM_DETAILS);
|
||||
};
|
||||
|
||||
// Handle delete item.
|
||||
|
||||
@@ -3,6 +3,7 @@ import React from 'react';
|
||||
import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { useItem } from '@/hooks/query';
|
||||
import { inactiveStatus } from './utlis';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const ItemDetailDrawerContext = React.createContext();
|
||||
|
||||
@@ -30,7 +31,7 @@ function ItemDetailDrawerProvider({ itemId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isItemLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="item-detail-drawer"
|
||||
name={DRAWERS.ITEM_DETAILS}
|
||||
title={inactiveStatus(item)}
|
||||
/>
|
||||
<ItemDetailDrawerContext.Provider value={provider} {...props} />
|
||||
|
||||
@@ -12,6 +12,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Bill payment transactions data table.
|
||||
@@ -48,7 +49,7 @@ function BillPaymentTransactions({
|
||||
// Handles edit payment transactions.
|
||||
const handleEditPaymentTransactions = ({ bill_id }) => {
|
||||
history.push(`/bills/${bill_id}/edit`);
|
||||
closeDrawer('item-detail-drawer');
|
||||
closeDrawer(DRAWERS.ITEM_DETAILS);
|
||||
};
|
||||
return (
|
||||
<DataTable
|
||||
|
||||
@@ -13,6 +13,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Esimtate payment transactions.
|
||||
@@ -26,6 +27,7 @@ function EstimatePaymentTransactions({
|
||||
}) {
|
||||
const history = useHistory();
|
||||
|
||||
// Estimate transactions table columns.
|
||||
const columns = useEstimateTransactionsColumns();
|
||||
|
||||
const { itemId } = useItemDetailDrawerContext();
|
||||
@@ -49,7 +51,7 @@ function EstimatePaymentTransactions({
|
||||
// Handles edit payment transactions.
|
||||
const handleEditPaymentTransactions = ({ estimate_id }) => {
|
||||
history.push(`/estimates/${estimate_id}/edit`);
|
||||
closeDrawer('item-detail-drawer');
|
||||
closeDrawer(DRAWERS.ITEM_DETAILS);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -16,6 +16,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Invoice payment transactions.
|
||||
@@ -52,7 +53,7 @@ function InvoicePaymentTransactions({
|
||||
// Handles edit payment transactions.
|
||||
const handleEditPaymentTransactions = ({ invoice_id }) => {
|
||||
history.push(`/invoices/${invoice_id}/edit`);
|
||||
closeDrawer('item-detail-drawer');
|
||||
closeDrawer(DRAWERS.ITEM_DETAILS);
|
||||
};
|
||||
return (
|
||||
<DataTable
|
||||
|
||||
@@ -12,6 +12,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Receipt payment transactions.
|
||||
@@ -48,7 +49,7 @@ function ReceiptPaymentTransactions({
|
||||
// Handles edit payment transactions.
|
||||
const handleEditPaymentTransactions = ({ receipt_id }) => {
|
||||
history.push(`/receipts/${receipt_id}/edit`);
|
||||
closeDrawer('item-detail-drawer');
|
||||
closeDrawer(DRAWERS.ITEM_DETAILS);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -22,6 +22,7 @@ import { useManualJournalDrawerContext } from './ManualJournalDrawerProvider';
|
||||
import { ManualJournalAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Manual journal action bar.
|
||||
@@ -39,7 +40,7 @@ function ManualJournalDrawerActionBar({
|
||||
// Handle edit manual journal action.
|
||||
const handleEditManualJournal = () => {
|
||||
history.push(`/manual-journals/${manualJournalId}/edit`);
|
||||
closeDrawer('journal-drawer');
|
||||
closeDrawer(DRAWERS.JOURNAL_DETAILS);
|
||||
};
|
||||
|
||||
// Handle manual journal delete action.
|
||||
|
||||
@@ -3,6 +3,7 @@ import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { useJournal } from '@/hooks/query';
|
||||
import { DrawerLoading, DrawerHeaderContent } from '@/components';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const ManualJournalDrawerContext = React.createContext();
|
||||
|
||||
@@ -31,7 +32,7 @@ function ManualJournalDrawerProvider({ manualJournalId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isJournalLoading}>
|
||||
<DrawerHeaderContent
|
||||
name={'journal-drawer'}
|
||||
name={DRAWERS.JOURNAL_DETAILS}
|
||||
title={intl.get('manual_journal.drawer.title', {
|
||||
number: manualJournal?.journal_number,
|
||||
})}
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
} from '@/components';
|
||||
import { PaymentMadeAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Payment made - Details panel - actions bar.
|
||||
@@ -42,7 +43,7 @@ function PaymentMadeDetailActionsBar({
|
||||
// Handle edit payment made.
|
||||
const handleEditPaymentMade = () => {
|
||||
history.push(`/payment-mades/${paymentMadeId}/edit`);
|
||||
closeDrawer('payment-made-detail-drawer');
|
||||
closeDrawer(DRAWERS.PAYMENT_MADE_DETAILS);
|
||||
};
|
||||
|
||||
// Handle delete payment made.
|
||||
|
||||
@@ -21,9 +21,13 @@ import {
|
||||
FormattedMessage as T,
|
||||
DrawerActionsBar,
|
||||
} from '@/components';
|
||||
import { PaymentReceiveAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
import {
|
||||
PaymentReceiveAction,
|
||||
AbilitySubject,
|
||||
} from '@/constants/abilityOption';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Payment receive actions bar.
|
||||
@@ -46,7 +50,7 @@ function PaymentReceiveActionsBar({
|
||||
// Handle edit payment receive.
|
||||
const handleEditPaymentReceive = () => {
|
||||
history.push(`/payment-receives/${paymentReceiveId}/edit`);
|
||||
closeDrawer('payment-receive-detail-drawer');
|
||||
closeDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS);
|
||||
};
|
||||
|
||||
// Handle delete payment receive.
|
||||
|
||||
@@ -5,6 +5,7 @@ import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { usePaymentReceive } from '@/hooks/query';
|
||||
import { Features } from '@/constants';
|
||||
import { useFeatureCan } from '@/hooks/state';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const PaymentReceiveDetailContext = React.createContext();
|
||||
|
||||
@@ -34,7 +35,7 @@ function PaymentReceiveDetailProvider({ paymentReceiveId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isPaymentLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="payment-receive-detail-drawer"
|
||||
name={DRAWERS.PAYMENT_RECEIVE_DETAILS}
|
||||
title={intl.get('payment_receive.drawer.title', {
|
||||
number: paymentReceive.payment_receive_no,
|
||||
})}
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
} from '@/components';
|
||||
|
||||
import QuickCustomerFormDrawer from './QuickCustomerFormDrawer';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Quick create/edit customer drawer.
|
||||
@@ -15,7 +16,7 @@ export default function QuickCreateCustomerDrawerContent({ displayName }) {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<DrawerHeaderContent
|
||||
name="quick-create-customer"
|
||||
name={DRAWERS.QUICK_CREATE_CUSTOMER}
|
||||
title={<T id={'create_a_new_customer'} />}
|
||||
/>
|
||||
<DrawerBody>
|
||||
|
||||
@@ -13,6 +13,7 @@ import CustomerFormFormik, {
|
||||
} from '@/containers/Customers/CustomerForm/CustomerFormFormik';
|
||||
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Drawer customer form loading wrapper.
|
||||
@@ -30,11 +31,11 @@ function DrawerCustomerFormLoading({ children }) {
|
||||
function QuickCustomerFormDrawer({ displayName, closeDrawer, customerId }) {
|
||||
// Handle the form submit request success.
|
||||
const handleSubmitSuccess = () => {
|
||||
closeDrawer('quick-create-customer');
|
||||
closeDrawer(DRAWERS.QUICK_CREATE_CUSTOMER);
|
||||
};
|
||||
// Handle the form cancel action.
|
||||
const handleCancelForm = () => {
|
||||
closeDrawer('quick-create-customer');
|
||||
closeDrawer(DRAWERS.QUICK_CREATE_CUSTOMER);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
DrawerHeaderContent,
|
||||
DrawerBody,
|
||||
FormattedMessage as T,
|
||||
Drawer,
|
||||
} from '@/components';
|
||||
|
||||
import QuickCreateItemDrawerForm from './QuickCreateItemDrawerForm';
|
||||
@@ -15,7 +16,7 @@ export default function QuickCreateItemDrawerContent({ itemName }) {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<DrawerHeaderContent
|
||||
name="quick-create-item"
|
||||
name={DRAWER.QUICK_CREATE_ITEM}
|
||||
title={<T id={'create_a_new_item'} />}
|
||||
/>
|
||||
<DrawerBody>
|
||||
|
||||
@@ -15,6 +15,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
||||
|
||||
import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Drawer item form loading.
|
||||
@@ -43,7 +44,7 @@ function QuickCreateItemDrawerForm({
|
||||
// Handle the form submit request success.
|
||||
const handleSubmitSuccess = (values, form, submitPayload, response) => {
|
||||
if (submitPayload.redirect) {
|
||||
closeDrawer('quick-create-item');
|
||||
closeDrawer(DRAWERS.QUICK_CREATE_ITEM);
|
||||
}
|
||||
if (payload.quickActionEvent) {
|
||||
addQuickActionEvent(payload.quickActionEvent, {
|
||||
@@ -53,7 +54,7 @@ function QuickCreateItemDrawerForm({
|
||||
};
|
||||
// Handle the form cancel.
|
||||
const handleFormCancel = () => {
|
||||
closeDrawer('quick-create-item');
|
||||
closeDrawer(DRAWERS.QUICK_CREATE_ITEM);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -16,6 +16,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
||||
|
||||
import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Drawer vendor form loading wrapper.
|
||||
@@ -41,7 +42,7 @@ function QuickVendorFormDrawer({
|
||||
// Handle the form submit request success.
|
||||
const handleSubmitSuccess = (values, form, submitPayload, response) => {
|
||||
if (!submitPayload.noRedirect) {
|
||||
closeDrawer('quick-write-vendor');
|
||||
closeDrawer(DRAWERS.QUICK_WRITE_VENDOR);
|
||||
}
|
||||
if (payload.quickActionEvent) {
|
||||
addQuickActionEvent(payload.quickActionEvent, {
|
||||
@@ -51,7 +52,7 @@ function QuickVendorFormDrawer({
|
||||
};
|
||||
// Handle the form cancel action.
|
||||
const handleCancelForm = () => {
|
||||
closeDrawer('quick-write-vendor');
|
||||
closeDrawer(DRAWERS.QUICK_WRITE_VENDOR);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
} from '@/components';
|
||||
|
||||
import QuickVendorFormDrawer from './QuickVendorFormDrawer';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Quick create/edit vendor drawer.
|
||||
@@ -15,7 +16,7 @@ export default function QuickWriteVendorDrawerContent({ displayName }) {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<DrawerHeaderContent
|
||||
name="quick-create-customer"
|
||||
name={DRAWERS.QUICK_CREATE_CUSTOMER}
|
||||
title={<T id={'create_a_new_vendor'} />}
|
||||
|
||||
/>
|
||||
|
||||
@@ -23,6 +23,7 @@ import { ReceiptMoreMenuItems } from './components';
|
||||
import { useReceiptDetailDrawerContext } from './ReceiptDetailDrawerProvider';
|
||||
import { SaleReceiptAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
import { safeCallback, compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Receipt details actions bar.
|
||||
@@ -44,7 +45,7 @@ function ReceiptDetailActionBar({
|
||||
// Handle edit sale receipt.
|
||||
const onEditReceipt = () => {
|
||||
history.push(`/receipts/${receiptId}/edit`);
|
||||
closeDrawer('receipt-detail-drawer');
|
||||
closeDrawer(DRAWERS.RECEIPT_DETAILS);
|
||||
};
|
||||
|
||||
// Handle delete sale receipt.
|
||||
|
||||
@@ -5,6 +5,7 @@ import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { Features } from '@/constants';
|
||||
import { useFeatureCan } from '@/hooks/state';
|
||||
import { useReceipt } from '@/hooks/query';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
// useTransactionsByReference
|
||||
const ReceiptDetailDrawerContext = React.createContext();
|
||||
@@ -33,7 +34,7 @@ function ReceiptDetailDrawerProvider({ receiptId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isReceiptLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="receipt-detail-drawer"
|
||||
name={DRAWERS.RECEIPT_DETAILS}
|
||||
title={intl.get('receipt.drawer.title', {
|
||||
number: receipt.receipt_number,
|
||||
})}
|
||||
|
||||
@@ -3,6 +3,7 @@ import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { useRefundCreditTransaction } from '@/hooks/query';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const RefundCreditNoteDrawerContext = React.createContext();
|
||||
|
||||
@@ -27,7 +28,7 @@ function RefundCreditNoteDrawerProvider({ refundTransactionId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isRefundCreditTransaction}>
|
||||
<DrawerHeaderContent
|
||||
name="refund-credit-detail-drawer"
|
||||
name={DRAWERS.REFUND_CREDIT_NOTE_DETAILS}
|
||||
title={intl.get('refund_credit.drawer.title')}
|
||||
/>
|
||||
<RefundCreditNoteDrawerContext.Provider value={provider} {...props} />
|
||||
|
||||
@@ -3,6 +3,7 @@ import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { useRefundVendorCreditTransaction } from '@/hooks/query';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const RefundVendorCreditDrawerContent = React.createContext();
|
||||
|
||||
@@ -27,7 +28,7 @@ function RefundVendorCreditDrawerProvider({ refundTransactionId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isRefundVendorTransaction}>
|
||||
<DrawerHeaderContent
|
||||
name="refund-vendor-detail-drawer"
|
||||
name={DRAWERS.REFUND_VENDOR_CREDIT_DETAILS}
|
||||
title={intl.get('refund_vendor_credit.drawer.title')}
|
||||
/>
|
||||
<RefundVendorCreditDrawerContent.Provider value={provider} {...props} />
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
} from '@/components';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Vendor credit detail actions bar.
|
||||
@@ -39,14 +40,13 @@ function VendorCreditDetailActionsBar({
|
||||
// #withDrawerActions
|
||||
closeDrawer,
|
||||
}) {
|
||||
const { vendorCreditId, vendorCredit } = useVendorCreditDetailDrawerContext();
|
||||
|
||||
const history = useHistory();
|
||||
const { vendorCreditId, vendorCredit } = useVendorCreditDetailDrawerContext();
|
||||
|
||||
// Handle edit credit note.
|
||||
const handleEditVendorCredit = () => {
|
||||
history.push(`/vendor-credits/${vendorCreditId}/edit`);
|
||||
closeDrawer('vendor-credit-detail-drawer');
|
||||
closeDrawer(DRAWERS.VENDOR_CREDIT_DETAILS);
|
||||
};
|
||||
|
||||
// Handle delete credit note.
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { useFeatureCan } from '@/hooks/state';
|
||||
import { Features } from '@/constants';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const VendorCreditDetailDrawerContext = React.createContext();
|
||||
|
||||
@@ -61,7 +62,7 @@ function VendorCreditDetailDrawerProvider({ vendorCreditId, ...props }) {
|
||||
}
|
||||
>
|
||||
<DrawerHeaderContent
|
||||
name="vendor-credit-detail-drawer"
|
||||
name={DRAWERS.VENDOR_CREDIT_DETAILS}
|
||||
title={intl.get('vendor_credit.drawer_vendor_credit_detail', {
|
||||
vendorNumber: vendorCredit.vendor_credit_number,
|
||||
})}
|
||||
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
VendorAction,
|
||||
} from '../../../constants/abilityOption';
|
||||
import { safeCallback, compose } from '@/utils';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Vendor details actions bar.
|
||||
@@ -55,7 +56,7 @@ function VendorDetailsActionsBar({
|
||||
// Handle edit vendor.
|
||||
const onEditContact = () => {
|
||||
history.push(`/vendors/${vendorId}/edit`);
|
||||
closeDrawer('vendor-detail-drawer');
|
||||
closeDrawer(DRAWERS.VENDOR_DETAILS);
|
||||
};
|
||||
|
||||
// Handle delete vendor.
|
||||
@@ -63,14 +64,15 @@ function VendorDetailsActionsBar({
|
||||
openAlert(`vendor-delete`, { contactId: vendorId });
|
||||
};
|
||||
|
||||
// Handles clicking on new invoice button.
|
||||
const handleNewInvoiceClick = () => {
|
||||
history.push('/bills/new');
|
||||
closeDrawer('vendor-detail-drawer');
|
||||
closeDrawer(DRAWERS.VENDOR_DETAILS);
|
||||
};
|
||||
|
||||
const handleNewPaymentClick = () => {
|
||||
history.push('/payment-mades/new');
|
||||
closeDrawer('vendor-detail-drawer');
|
||||
closeDrawer(DRAWERS.VENDOR_DETAILS);
|
||||
};
|
||||
|
||||
const handleEditOpeningBalance = () => {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import React from 'react';
|
||||
import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { useVendor } from '@/hooks/query';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const VendorDetailDrawerContext = React.createContext();
|
||||
|
||||
@@ -23,7 +24,7 @@ function VendorDetailsDrawerProvider({ vendorId, ...props }) {
|
||||
return (
|
||||
<DrawerLoading loading={isVendorLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="vendor-detail-drawer"
|
||||
name={DRAWERS.VENDOR_DETAILS}
|
||||
title={vendor?.display_name}
|
||||
/>
|
||||
<VendorDetailDrawerContext.Provider value={provider} {...props} />
|
||||
|
||||
@@ -11,10 +11,12 @@ import {
|
||||
|
||||
import { useWarehouseDetailDrawerContext } from './WarehouseTransferDetailDrawerProvider';
|
||||
import { DrawerActionsBar, Icon, FormattedMessage as T } from '@/components';
|
||||
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
import { compose } from '@/utils';
|
||||
|
||||
/**
|
||||
@@ -34,7 +36,7 @@ function WarehouseTransferDetailActionsBar({
|
||||
// Handle edit warehosue transfer.
|
||||
const handleEditWarehosueTransfer = () => {
|
||||
history.push(`/warehouses-transfers/${warehouseTransferId}/edit`);
|
||||
closeDrawer('warehouse-transfer-detail-drawer');
|
||||
closeDrawer(DRAWERS.WAREHOUSE_TRANSFER_DETAILS);
|
||||
};
|
||||
|
||||
// Handle delete warehouse transfer.
|
||||
|
||||
@@ -3,6 +3,7 @@ import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { useWarehouseTransfer } from '@/hooks/query';
|
||||
import { DrawerHeaderContent, DrawerLoading } from '@/components';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
const WarehouseTransferDetailDrawerContext = React.createContext();
|
||||
|
||||
@@ -27,7 +28,7 @@ function WarehouseTransferDetailDrawerProvider({
|
||||
return (
|
||||
<DrawerLoading loading={isWarehouseTransferLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="warehouse-transfer-detail-drawer"
|
||||
name={DRAWERS.WAREHOUSE_TRANSFER_DETAILS}
|
||||
title={intl.get('warehouse_transfer.drawer.title', {
|
||||
number: warehouseTransfer.transaction_number
|
||||
? `(${warehouseTransfer.transaction_number})`
|
||||
|
||||
Reference in New Issue
Block a user