diff --git a/src/components/AvaterCell.js b/src/components/AvaterCell.js new file mode 100644 index 000000000..189042a61 --- /dev/null +++ b/src/components/AvaterCell.js @@ -0,0 +1,10 @@ +import React from 'react'; +import { firstLettersArgs } from 'utils'; + +export default function AvatarCell({ row: { original }, size }) { + return ( + + {firstLettersArgs(original?.display_name)} + + ); +} diff --git a/src/components/Pagination.js b/src/components/Pagination.js index b3e16ab36..c3e634560 100644 --- a/src/components/Pagination.js +++ b/src/components/Pagination.js @@ -86,7 +86,7 @@ function Pagination({ currentPage, total, size, - pageSizesOptions = [5, 12, 20, 30, 50, 75, 100, 150], + pageSizesOptions = [20, 30, 50, 75, 100, 150], onPageChange, onPageSizeChange, }) { diff --git a/src/components/UniversalSearch/UniversalSearch.js b/src/components/UniversalSearch/UniversalSearch.js index a0c054ba7..251e23f0f 100644 --- a/src/components/UniversalSearch/UniversalSearch.js +++ b/src/components/UniversalSearch/UniversalSearch.js @@ -141,7 +141,6 @@ function UniversalSearchBar({ isOpen, onSearchTypeChange, ...listProps }) { {...handlers} > } placeholder={intl.get('universal_search.placeholder')} diff --git a/src/components/index.js b/src/components/index.js index 836e7706f..4c93d1628 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -58,6 +58,7 @@ import AccountsSuggestField from './AccountsSuggestField'; import MaterialProgressBar from './MaterialProgressBar'; import { MoneyFieldCell } from './DataTableCells'; import Card from './Card'; +import AvaterCell from './AvaterCell'; import { ItemsMultiSelect } from './Items'; @@ -71,13 +72,13 @@ export * from './PdfPreview'; export * from './Details'; export * from './Drawer/DrawerInsider'; export * from './Drawer/DrawerMainTabs'; -export * from './TotalLines/index' +export * from './TotalLines/index'; export * from './Alert'; export * from './Subscriptions'; export * from './Dashboard'; export * from './Drawer'; export * from './Forms'; -export * from './MultiSelectTaggable' +export * from './MultiSelectTaggable'; export * from './Utils/FormatNumber'; export * from './Utils/FormatDate'; @@ -150,4 +151,5 @@ export { MoneyFieldCell, ItemsMultiSelect, Card, + AvaterCell, }; diff --git a/src/containers/Accounting/JournalsLanding/ManualJournalActionsBar.js b/src/containers/Accounting/JournalsLanding/ManualJournalActionsBar.js index c75fc1a57..a3f65be13 100644 --- a/src/containers/Accounting/JournalsLanding/ManualJournalActionsBar.js +++ b/src/containers/Accounting/JournalsLanding/ManualJournalActionsBar.js @@ -73,7 +73,7 @@ function ManualJournalActionsBar({ // Handle table row size change. const handleTableRowSizeChange = (size) => { - addSetting('manual_journal', 'tableSize', size); + addSetting('manualJournals', 'tableSize', size); }; return ( diff --git a/src/containers/Accounting/JournalsLanding/ManualJournalsDataTable.js b/src/containers/Accounting/JournalsLanding/ManualJournalsDataTable.js index 4b5efad04..7e2da9537 100644 --- a/src/containers/Accounting/JournalsLanding/ManualJournalsDataTable.js +++ b/src/containers/Accounting/JournalsLanding/ManualJournalsDataTable.js @@ -13,6 +13,7 @@ import withManualJournals from './withManualJournals'; import withManualJournalsActions from './withManualJournalsActions'; import withAlertsActions from 'containers/Alert/withAlertActions'; import withDrawerActions from 'containers/Drawer/withDrawerActions'; +import withSettings from '../../Settings/withSettings'; import { useManualJournalsContext } from './ManualJournalsListProvider'; import { useMemorizedColumnsWidths } from 'hooks'; @@ -38,6 +39,9 @@ function ManualJournalsDataTable({ // #ownProps onSelectedRowsChange, + + // #withSettings + manualJournalsTableSize, }) { // Manual journals context. const { @@ -125,6 +129,7 @@ function ManualJournalsDataTable({ onCellClick={handleCellClick} initialColumnsWidths={initialColumnsWidths} onColumnResizing={handleColumnResizing} + size={manualJournalsTableSize} payload={{ onDelete: handleDeleteJournal, onPublish: handlePublishJournal, @@ -143,4 +148,7 @@ export default compose( })), withAlertsActions, withDrawerActions, + withSettings(({ manualJournalsSettings }) => ({ + manualJournalsTableSize: manualJournalsSettings?.tableSize, + })), )(ManualJournalsDataTable); diff --git a/src/containers/Accounting/JournalsLanding/utils.js b/src/containers/Accounting/JournalsLanding/utils.js index 1a6dc19cb..d493958c2 100644 --- a/src/containers/Accounting/JournalsLanding/utils.js +++ b/src/containers/Accounting/JournalsLanding/utils.js @@ -37,6 +37,7 @@ export const useManualJournalsColumns = () => { className: 'journal_number', width: 100, clickable: true, + textOverview: true, }, { id: 'journal_type', @@ -44,6 +45,7 @@ export const useManualJournalsColumns = () => { accessor: 'journal_type', width: 110, clickable: true, + textOverview: true, }, { id: 'status', diff --git a/src/containers/Accounts/AccountsActionsBar.js b/src/containers/Accounts/AccountsActionsBar.js index 3e85b13d5..e96d69c8a 100644 --- a/src/containers/Accounts/AccountsActionsBar.js +++ b/src/containers/Accounts/AccountsActionsBar.js @@ -17,7 +17,7 @@ import { If, DashboardActionViewsList, DashboardFilterButton, - DashboardRowsHeightButton + DashboardRowsHeightButton, } from 'components'; import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; @@ -28,7 +28,8 @@ import withDialogActions from 'containers/Dialog/withDialogActions'; import withAccounts from 'containers/Accounts/withAccounts'; import withAlertActions from 'containers/Alert/withAlertActions'; import withAccountsTableActions from './withAccountsTableActions'; - +import withSettings from '../Settings/withSettings'; +import withSettingsActions from '../Settings/withSettingsActions'; import { compose } from 'utils'; /** @@ -51,6 +52,12 @@ function AccountsActionsBar({ // #ownProps onFilterChanged, + + // #withSettings + accountsTableSize, + + // #withSettingsActions + addSetting, }) { const { resourceViews, fields } = useAccountsChartContext(); @@ -94,6 +101,10 @@ function AccountsActionsBar({ refresh(); }; + // Handle table row size change. + const handleTableRowSizeChange = (size) => { + addSetting('accounts', 'tableSize', size); + }; return ( @@ -167,7 +178,10 @@ function AccountsActionsBar({ text={} /> - + } @@ -189,10 +203,14 @@ function AccountsActionsBar({ export default compose( withDialogActions, withAlertActions, + withSettingsActions, withAccounts(({ accountsSelectedRows, accountsTableState }) => ({ accountsSelectedRows, accountsInactiveMode: accountsTableState.inactiveMode, accountsFilterConditions: accountsTableState.filterRoles, })), + withSettings(({ accountsSettings }) => ({ + accountsTableSize: accountsSettings.tableSize, + })), withAccountsTableActions, )(AccountsActionsBar); diff --git a/src/containers/Accounts/AccountsDataTable.js b/src/containers/Accounts/AccountsDataTable.js index e004d501d..8d12404ee 100644 --- a/src/containers/Accounts/AccountsDataTable.js +++ b/src/containers/Accounts/AccountsDataTable.js @@ -10,6 +10,7 @@ import { TABLES } from 'common/tables'; import TableVirtualizedListRows from 'components/Datatable/TableVirtualizedRows'; import TableSkeletonRows from 'components/Datatable/TableSkeletonRows'; import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton'; +import withSettings from '../Settings/withSettings'; import { useAccountsChartContext } from './AccountsChartProvider'; import { useMemorizedColumnsWidths } from '../../hooks'; @@ -30,6 +31,9 @@ function AccountsDataTable({ // #withDrawerActions openDrawer, + + // #withSettings + accountsTableSize, }) { const { isAccountsLoading, isAccountsFetching, accounts } = useAccountsChartContext(); @@ -102,11 +106,12 @@ function AccountsDataTable({ TableHeaderSkeletonRenderer={TableSkeletonHeader} ContextMenu={ActionsMenu} // #TableVirtualizedListRows props. - vListrowHeight={42} + vListrowHeight={accountsTableSize == 'small' ? 40 : 42} vListOverscanRowCount={0} onCellClick={handleCellClick} initialColumnsWidths={initialColumnsWidths} onColumnResizing={handleColumnResizing} + size={accountsTableSize} payload={{ onEdit: handleEditAccount, onDelete: handleDeleteAccount, @@ -123,4 +128,7 @@ export default compose( withAlertsActions, withDrawerActions, withDialogActions, + withSettings(({ accountsSettings }) => ({ + accountsTableSize: accountsSettings.tableSize, + })), )(AccountsDataTable); diff --git a/src/containers/Alerts/Customers/CustomerBulkDeleteAlert.js b/src/containers/Alerts/Customers/CustomerBulkDeleteAlert.js index 7b71469ac..2dc6b0042 100644 --- a/src/containers/Alerts/Customers/CustomerBulkDeleteAlert.js +++ b/src/containers/Alerts/Customers/CustomerBulkDeleteAlert.js @@ -31,7 +31,7 @@ function CustomerBulkDeleteAlert({ closeAlert(name); }; - console.log(customersIds, 'EE'); + // Handle confirm customers bulk delete. const handleConfirmBulkDelete = useCallback(() => { diff --git a/src/containers/Customers/CustomersLanding/CustomersActionsBar.js b/src/containers/Customers/CustomersLanding/CustomersActionsBar.js index f90fd24fa..c8ed0fdb6 100644 --- a/src/containers/Customers/CustomersLanding/CustomersActionsBar.js +++ b/src/containers/Customers/CustomersLanding/CustomersActionsBar.js @@ -86,10 +86,10 @@ function CustomerActionsBar({ const handleRefreshBtnClick = () => { refresh(); }; - + // Handle table row size change. const handleTableRowSizeChange = (size) => { - addSetting('customer', 'tableSize', size); + addSetting('custoemrs', 'tableSize', size); }; return ( @@ -177,8 +177,8 @@ export default compose( accountsInactiveMode: customersTableState.inactiveMode, customersFilterConditions: customersTableState.filterRoles, })), - // withSettings(({ }) => ({ - // customersTableSize: - // })), + withSettings(({ customersSettings }) => ({ + customersTableSize: customersSettings?.tableSize, + })), withAlertActions, )(CustomerActionsBar); diff --git a/src/containers/Customers/CustomersLanding/CustomersTable.js b/src/containers/Customers/CustomersLanding/CustomersTable.js index 317468215..7619936ac 100644 --- a/src/containers/Customers/CustomersLanding/CustomersTable.js +++ b/src/containers/Customers/CustomersLanding/CustomersTable.js @@ -14,6 +14,7 @@ import withCustomersActions from './withCustomersActions'; import withAlertsActions from 'containers/Alert/withAlertActions'; import withDialogActions from 'containers/Dialog/withDialogActions'; import withDrawerActions from 'containers/Drawer/withDrawerActions'; +import withSettings from '../../Settings/withSettings'; import { useCustomersListContext } from './CustomersListProvider'; import { useMemorizedColumnsWidths } from 'hooks'; @@ -38,6 +39,9 @@ function CustomersTable({ // #withDialogActions openDialog, + + // #withSettings + customersTableSize, }) { const history = useHistory(); @@ -135,6 +139,7 @@ function CustomersTable({ onCellClick={handleCellClick} initialColumnsWidths={initialColumnsWidths} onColumnResizing={handleColumnResizing} + size={customersTableSize} payload={{ onDelete: handleCustomerDelete, onEdit: handleCustomerEdit, @@ -155,4 +160,7 @@ export default compose( withCustomersActions, withDrawerActions, withCustomers(({ customersTableState }) => ({ customersTableState })), + withSettings(({ customersSettings }) => ({ + customersTableSize: customersSettings?.tableSize, + })), )(CustomersTable); diff --git a/src/containers/Customers/CustomersLanding/components.js b/src/containers/Customers/CustomersLanding/components.js index 958563ae2..0cce24139 100644 --- a/src/containers/Customers/CustomersLanding/components.js +++ b/src/containers/Customers/CustomersLanding/components.js @@ -1,17 +1,12 @@ import React, { useMemo } from 'react'; -import { - Menu, - MenuItem, - MenuDivider, - Intent, -} from '@blueprintjs/core'; +import { Menu, MenuItem, MenuDivider, Intent } from '@blueprintjs/core'; import clsx from 'classnames'; + import intl from 'react-intl-universal'; -import { CLASSES } from '../../../common/classes'; -import { Icon, Money, If } from 'components'; -import { } from 'utils'; -import { safeCallback, firstLettersArgs } from 'utils'; +import { Icon, Money, If, AvaterCell } from 'components'; + +import { safeCallback } from 'utils'; /** * Actions menu. @@ -69,13 +64,6 @@ export function ActionsMenu({ ); } -/** - * Avatar cell. - */ -export function AvatarCell(row) { - return {firstLettersArgs(row.display_name)}; -} - /** * Phone number accessor. */ @@ -99,7 +87,7 @@ export function useCustomersTableColumns() { { id: 'avatar', Header: '', - accessor: AvatarCell, + Cell: AvaterCell, className: 'avatar', width: 45, disableResizing: true, diff --git a/src/containers/Dialogs/QuickPaymentMadeFormDialog/utils.js b/src/containers/Dialogs/QuickPaymentMadeFormDialog/utils.js index 95f14bfe6..b39a1d86e 100644 --- a/src/containers/Dialogs/QuickPaymentMadeFormDialog/utils.js +++ b/src/containers/Dialogs/QuickPaymentMadeFormDialog/utils.js @@ -21,7 +21,7 @@ export const transformErrors = (errors, { setFieldError }) => { intl.get('payment_number_is_not_unique'), ); } - if (getError('INVALID_PAYMENT_AMOUNT')) { + if (getError('INVALID_BILL_PAYMENT_AMOUNT')) { setFieldError( 'payment_amount', intl.get('the_payment_amount_bigger_than_invoice_due_amount'), diff --git a/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js b/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js index 78947d9fb..65bf1a998 100644 --- a/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js +++ b/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js @@ -16,7 +16,7 @@ import withDialogActions from 'containers/Dialog/withDialogActions'; import withAlertsActions from 'containers/Alert/withAlertActions'; import withDrawerActions from 'containers/Drawer/withDrawerActions'; -import { Icon, FormattedMessage as T } from 'components'; +import { If, Icon, FormattedMessage as T } from 'components'; import { safeCallback, compose } from 'utils'; @@ -32,7 +32,7 @@ function BillDetailActionsBar({ }) { const history = useHistory(); - const { billId } = useBillDrawerContext(); + const { billId, bill } = useBillDrawerContext(); // Handle edit bill. const onEditBill = () => { @@ -45,6 +45,11 @@ function BillDetailActionsBar({ openAlert('bill-delete', { billId }); }; + // Handle quick bill payment . + const handleQuickBillPayment = () => { + openDialog('quick-payment-made', { billId }); + }; + return ( @@ -54,6 +59,14 @@ function BillDetailActionsBar({ text={} onClick={safeCallback(onEditBill)} /> + +