From 5dbfd36415b521f5551524a2b41a758f014505ba Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Wed, 5 Jun 2024 22:42:12 +0200 Subject: [PATCH] feat: optimize the style of general ledger sub-accounts rows --- .../GeneralLedger/GeneralLedgerTable.ts | 32 +++++++++++++------ .../GeneralLedger/GeneralLedgerTable.tsx | 16 ++++++++-- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/packages/server/src/services/FinancialStatements/GeneralLedger/GeneralLedgerTable.ts b/packages/server/src/services/FinancialStatements/GeneralLedger/GeneralLedgerTable.ts index 9ab77a992..4ca71578c 100644 --- a/packages/server/src/services/FinancialStatements/GeneralLedger/GeneralLedgerTable.ts +++ b/packages/server/src/services/FinancialStatements/GeneralLedger/GeneralLedgerTable.ts @@ -83,8 +83,8 @@ export class GeneralLedgerTable extends R.compose( */ private openingBalanceColumnsAccessors(): IColumnMapperMeta[] { return [ - { key: 'date', value: this.meta.fromDate }, - { key: 'account_name', value: 'Opening Balance' }, + { key: 'date', value: 'Opening Balance' }, + { key: 'account_name', value: '' }, { key: 'reference_type', accessor: '_empty_' }, { key: 'reference_number', accessor: '_empty_' }, { key: 'description', accessor: 'description' }, @@ -97,12 +97,15 @@ export class GeneralLedgerTable extends R.compose( /** * Closing balance row column accessors. + * @param {IGeneralLedgerSheetAccount} account - * @returns {ITableColumnAccessor[]} */ - private closingBalanceColumnAccessors(): IColumnMapperMeta[] { + private closingBalanceColumnAccessors( + account: IGeneralLedgerSheetAccount + ): IColumnMapperMeta[] { return [ - { key: 'date', value: this.meta.toDate }, - { key: 'account_name', value: 'Closing Balance' }, + { key: 'date', value: `Closing balance for ${account.name}` }, + { key: 'account_name', value: `` }, { key: 'reference_type', accessor: '_empty_' }, { key: 'reference_number', accessor: '_empty_' }, { key: 'description', accessor: '_empty_' }, @@ -115,12 +118,21 @@ export class GeneralLedgerTable extends R.compose( /** * Closing balance row column accessors. + * @param {IGeneralLedgerSheetAccount} account - * @returns {ITableColumnAccessor[]} */ - private closingBalanceWithSubaccountsColumnAccessors(): IColumnMapperMeta[] { + private closingBalanceWithSubaccountsColumnAccessors( + account: IGeneralLedgerSheetAccount + ): IColumnMapperMeta[] { return [ - { key: 'date', value: this.meta.toDate }, - { key: 'account_name', value: 'Closing Balance with sub-accounts' }, + { + key: 'date', + value: `Closing Balance for ${account.name} with sub-accounts`, + }, + { + key: 'account_name', + value: ``, + }, { key: 'reference_type', accessor: '_empty_' }, { key: 'reference_number', accessor: '_empty_' }, { key: 'description', accessor: '_empty_' }, @@ -205,7 +217,7 @@ export class GeneralLedgerTable extends R.compose( * @returns {ITableRow} */ private closingBalanceMapper = (account: IGeneralLedgerSheetAccount) => { - const columns = this.closingBalanceColumnAccessors(); + const columns = this.closingBalanceColumnAccessors(account); const meta = { rowTypes: [ROW_TYPE.CLOSING_BALANCE], }; @@ -220,7 +232,7 @@ export class GeneralLedgerTable extends R.compose( private closingBalanceWithSubaccountsMapper = ( account: IGeneralLedgerSheetAccount ): ITableRow => { - const columns = this.closingBalanceWithSubaccountsColumnAccessors(); + const columns = this.closingBalanceWithSubaccountsColumnAccessors(account); const meta = { rowTypes: [ROW_TYPE.CLOSING_BALANCE], }; diff --git a/packages/webapp/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerTable.tsx b/packages/webapp/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerTable.tsx index 13a012be0..6566a2773 100644 --- a/packages/webapp/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerTable.tsx +++ b/packages/webapp/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerTable.tsx @@ -96,12 +96,19 @@ const GeneralLedgerDataTable = styled(ReportDataTable)` } } } - &:not(:first-child).is-expanded .td { - border-top: 1px solid #ddd; - } } &--OPENING_BALANCE, &--CLOSING_BALANCE { + .td { + color: #000; + } + .date { + font-weight: 500; + + .cell-inner { + position: absolute; + } + } .amount { font-weight: 500; } @@ -110,6 +117,9 @@ const GeneralLedgerDataTable = styled(ReportDataTable)` .name { font-weight: 500; } + .td { + border-top: 1px solid #ddd; + } } } }