feat: optimize the style of general ledger sub-accounts rows

This commit is contained in:
Ahmed Bouhuolia
2024-06-05 22:42:12 +02:00
parent 044f11ff74
commit 5dbfd36415
2 changed files with 35 additions and 13 deletions

View File

@@ -83,8 +83,8 @@ export class GeneralLedgerTable extends R.compose(
*/ */
private openingBalanceColumnsAccessors(): IColumnMapperMeta[] { private openingBalanceColumnsAccessors(): IColumnMapperMeta[] {
return [ return [
{ key: 'date', value: this.meta.fromDate }, { key: 'date', value: 'Opening Balance' },
{ key: 'account_name', value: 'Opening Balance' }, { key: 'account_name', value: '' },
{ key: 'reference_type', accessor: '_empty_' }, { key: 'reference_type', accessor: '_empty_' },
{ key: 'reference_number', accessor: '_empty_' }, { key: 'reference_number', accessor: '_empty_' },
{ key: 'description', accessor: 'description' }, { key: 'description', accessor: 'description' },
@@ -97,12 +97,15 @@ export class GeneralLedgerTable extends R.compose(
/** /**
* Closing balance row column accessors. * Closing balance row column accessors.
* @param {IGeneralLedgerSheetAccount} account -
* @returns {ITableColumnAccessor[]} * @returns {ITableColumnAccessor[]}
*/ */
private closingBalanceColumnAccessors(): IColumnMapperMeta[] { private closingBalanceColumnAccessors(
account: IGeneralLedgerSheetAccount
): IColumnMapperMeta[] {
return [ return [
{ key: 'date', value: this.meta.toDate }, { key: 'date', value: `Closing balance for ${account.name}` },
{ key: 'account_name', value: 'Closing Balance' }, { key: 'account_name', value: `` },
{ key: 'reference_type', accessor: '_empty_' }, { key: 'reference_type', accessor: '_empty_' },
{ key: 'reference_number', accessor: '_empty_' }, { key: 'reference_number', accessor: '_empty_' },
{ key: 'description', accessor: '_empty_' }, { key: 'description', accessor: '_empty_' },
@@ -115,12 +118,21 @@ export class GeneralLedgerTable extends R.compose(
/** /**
* Closing balance row column accessors. * Closing balance row column accessors.
* @param {IGeneralLedgerSheetAccount} account -
* @returns {ITableColumnAccessor[]} * @returns {ITableColumnAccessor[]}
*/ */
private closingBalanceWithSubaccountsColumnAccessors(): IColumnMapperMeta[] { private closingBalanceWithSubaccountsColumnAccessors(
account: IGeneralLedgerSheetAccount
): IColumnMapperMeta[] {
return [ 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_type', accessor: '_empty_' },
{ key: 'reference_number', accessor: '_empty_' }, { key: 'reference_number', accessor: '_empty_' },
{ key: 'description', accessor: '_empty_' }, { key: 'description', accessor: '_empty_' },
@@ -205,7 +217,7 @@ export class GeneralLedgerTable extends R.compose(
* @returns {ITableRow} * @returns {ITableRow}
*/ */
private closingBalanceMapper = (account: IGeneralLedgerSheetAccount) => { private closingBalanceMapper = (account: IGeneralLedgerSheetAccount) => {
const columns = this.closingBalanceColumnAccessors(); const columns = this.closingBalanceColumnAccessors(account);
const meta = { const meta = {
rowTypes: [ROW_TYPE.CLOSING_BALANCE], rowTypes: [ROW_TYPE.CLOSING_BALANCE],
}; };
@@ -220,7 +232,7 @@ export class GeneralLedgerTable extends R.compose(
private closingBalanceWithSubaccountsMapper = ( private closingBalanceWithSubaccountsMapper = (
account: IGeneralLedgerSheetAccount account: IGeneralLedgerSheetAccount
): ITableRow => { ): ITableRow => {
const columns = this.closingBalanceWithSubaccountsColumnAccessors(); const columns = this.closingBalanceWithSubaccountsColumnAccessors(account);
const meta = { const meta = {
rowTypes: [ROW_TYPE.CLOSING_BALANCE], rowTypes: [ROW_TYPE.CLOSING_BALANCE],
}; };

View File

@@ -96,12 +96,19 @@ const GeneralLedgerDataTable = styled(ReportDataTable)`
} }
} }
} }
&:not(:first-child).is-expanded .td {
border-top: 1px solid #ddd;
}
} }
&--OPENING_BALANCE, &--OPENING_BALANCE,
&--CLOSING_BALANCE { &--CLOSING_BALANCE {
.td {
color: #000;
}
.date {
font-weight: 500;
.cell-inner {
position: absolute;
}
}
.amount { .amount {
font-weight: 500; font-weight: 500;
} }
@@ -110,6 +117,9 @@ const GeneralLedgerDataTable = styled(ReportDataTable)`
.name { .name {
font-weight: 500; font-weight: 500;
} }
.td {
border-top: 1px solid #ddd;
}
} }
} }
} }