fix(webapp): use all drawers name from common enum object

This commit is contained in:
Ahmed Bouhuolia
2023-06-14 19:51:14 +02:00
parent 01c27b56ef
commit d1a09e3b15
99 changed files with 286 additions and 186 deletions

View File

@@ -23,7 +23,7 @@ function CreditNoteUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.CREDIT_NOTE) {
openDrawer(DRAWERS.CREDIT_NOTE_DETAIL_DRAWER, { creditNoteId: resourceId });
openDrawer(DRAWERS.CREDIT_NOTE_DETAILS, { creditNoteId: resourceId });
onAction && onAction();
}
return null;

View File

@@ -24,6 +24,7 @@ import { useCreditNoteTableColumns, ActionsMenu } from './components';
import { useCreditNoteListContext } from './CreditNotesListProvider';
import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/**
* Credit note data table.
@@ -80,7 +81,7 @@ function CreditNotesDataTable({
}
const handleViewDetailCreditNote = ({ id }) => {
openDrawer('credit-note-detail-drawer', { creditNoteId: id });
openDrawer(DRAWERS.CREDIT_NOTE_DETAILS, { creditNoteId: id });
};
// Handle delete credit note.
@@ -95,7 +96,7 @@ function CreditNotesDataTable({
// Handle cell click.
const handleCellClick = (cell, event) => {
openDrawer('credit-note-detail-drawer', {
openDrawer(DRAWERS.CREDIT_NOTE_DETAILS, {
creditNoteId: cell.row.original.id,
});
};

View File

@@ -8,6 +8,7 @@ import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, SaleEstimateAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/**
* Estimate universal search item select action.
@@ -21,7 +22,7 @@ function EstimateUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.ESTIMATE) {
openDrawer('estimate-detail-drawer', { estimateId: resourceId });
openDrawer(DRAWERS.ESTIMATE_DETAILS, { estimateId: resourceId });
}
return null;
}

View File

@@ -21,6 +21,7 @@ import { ActionsMenu, useEstiamtesTableColumns } from './components';
import { useEstimatesListContext } from './EstimatesListProvider';
import { useMemorizedColumnsWidths } from '@/hooks';
import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/**
* Estimates datatable.
@@ -86,7 +87,7 @@ function EstimatesDataTable({
// Handle view detail estimate.
const handleViewDetailEstimate = ({ id }) => {
openDrawer('estimate-detail-drawer', { estimateId: id });
openDrawer(DRAWERS.ESTIMATE_DETAILS, { estimateId: id });
};
// Handle print estimate.
@@ -96,7 +97,7 @@ function EstimatesDataTable({
// Handle cell click.
const handleCellClick = (cell, event) => {
openDrawer('estimate-detail-drawer', { estimateId: cell.row.original.id });
openDrawer(DRAWERS.ESTIMATE_DETAILS, { estimateId: cell.row.original.id });
};
// Local storage memorizing columns widths.

View File

@@ -9,6 +9,7 @@ import { highlightText } from '@/utils';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, SaleInvoiceAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/**
* Universal search invoice item select action.
@@ -22,7 +23,7 @@ function InvoiceUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.INVOICE) {
openDrawer('invoice-detail-drawer', { invoiceId: resourceId });
openDrawer(DRAWERS.INVOICE_DETAILS, { invoiceId: resourceId });
}
return null;
}

View File

@@ -25,6 +25,7 @@ import { useInvoicesTableColumns, ActionsMenu } from './components';
import { useInvoicesListContext } from './InvoicesListProvider';
import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/**
* Invoices datatable.
@@ -89,7 +90,7 @@ function InvoicesDataTable({
// Handle view detail invoice.
const handleViewDetailInvoice = ({ id }) => {
openDrawer('invoice-detail-drawer', { invoiceId: id });
openDrawer(DRAWERS.INVOICE_DETAILS, { invoiceId: id });
};
// Handle print invoices.
@@ -99,7 +100,7 @@ function InvoicesDataTable({
// Handle cell click.
const handleCellClick = (cell, event) => {
openDrawer('invoice-detail-drawer', { invoiceId: cell.row.original.id });
openDrawer(DRAWERS.INVOICE_DETAILS, { invoiceId: cell.row.original.id });
};
// Local storage memorizing columns widths.

View File

@@ -4,10 +4,14 @@ import intl from 'react-intl-universal';
import { MenuItem } from '@blueprintjs/core';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, PaymentReceiveAction } from '@/constants/abilityOption';
import {
AbilitySubject,
PaymentReceiveAction,
} from '@/constants/abilityOption';
import { highlightText } from '@/utils';
import { Icon } from '@/components';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/**
* Payment receive universal search item select action.
@@ -21,7 +25,7 @@ function PaymentReceiveUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.PAYMENT_RECEIVE) {
openDrawer('payment-receive-detail-drawer', {
openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, {
paymentReceiveId: resourceId,
});
}

View File

@@ -22,6 +22,7 @@ import withSettings from '@/containers/Settings/withSettings';
import { usePaymentReceivesColumns, ActionsMenu } from './components';
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
import { useMemorizedColumnsWidths } from '@/hooks';
import { DRAWERS } from '@/constants/drawers';
/**
* Payment receives datatable.
@@ -69,12 +70,12 @@ function PaymentReceivesDataTable({
// Handle view detail payment receive..
const handleViewDetailPaymentReceive = ({ id }) => {
openDrawer('payment-receive-detail-drawer', { paymentReceiveId: id });
openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, { paymentReceiveId: id });
};
// Handle cell click.
const handleCellClick = (cell, event) => {
openDrawer('payment-receive-detail-drawer', {
openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, {
paymentReceiveId: cell.row.original.id,
});
};

View File

@@ -7,6 +7,7 @@ import { Icon, Choose, T } from '@/components';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, SaleReceiptAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/**
* Receipt universal search item select action.
@@ -21,7 +22,7 @@ function ReceiptUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.RECEIPT) {
openDrawer('receipt-detail-drawer', { receiptId: resourceId });
openDrawer(DRAWERS.RECEIPT_DETAILS, { receiptId: resourceId });
onAction && onAction();
}
return null;

View File

@@ -23,6 +23,7 @@ import withSettings from '@/containers/Settings/withSettings';
import { useReceiptsListContext } from './ReceiptsListProvider';
import { useReceiptsTableColumns, ActionsMenu } from './components';
import { useMemorizedColumnsWidths } from '@/hooks';
import { DRAWERS } from '@/constants/drawers';
/**
* Sale receipts datatable.
@@ -77,7 +78,7 @@ function ReceiptsDataTable({
// Handle view detail receipt.
const handleViewDetailReceipt = ({ id }) => {
openDrawer('receipt-detail-drawer', { receiptId: id });
openDrawer(DRAWERS.RECEIPT_DETAILS, { receiptId: id });
};
// Handle print receipt.
@@ -106,7 +107,7 @@ function ReceiptsDataTable({
}
// Handle cell click.
const handleCellClick = (cell, event) => {
openDrawer('receipt-detail-drawer', { receiptId: cell.row.original.id });
openDrawer(DRAWERS.RECEIPT_DETAILS, { receiptId: cell.row.original.id });
};
return (