Skip to content

Commit

Permalink
Merge pull request #1759 from fecgov/feature/1651-no-force-aggregate-…
Browse files Browse the repository at this point in the history
…or-itemize-on-form24

Feature/1651 - Itemization/Aggregation changes for Form24
  • Loading branch information
toddlees authored Mar 7, 2024
2 parents b7765cf + 7b7d90a commit b80c9d4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<div class="card">
<p-table
#dt
[value]="items"
[lazy]="true"
(onLazyLoad)="loadTableItems($event)"
responsiveLayout="scroll"
dataKey="id"
[paginator]="true"
[rows]="rowsPerPage"
[totalRecords]="totalItems"
[loading]="loading"
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} transactions"
[showCurrentPageReport]="true"
sortField="line_label_order_key,created"
#dt
[value]="items"
[lazy]="true"
(onLazyLoad)="loadTableItems($event)"
responsiveLayout="scroll"
dataKey="id"
[paginator]="true"
[rows]="rowsPerPage"
[totalRecords]="totalItems"
[loading]="loading"
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} transactions"
[showCurrentPageReport]="true"
sortField="line_label_order_key,created"
>
<ng-template pTemplate="caption">
<div class="grid">
Expand Down Expand Up @@ -42,10 +42,12 @@ <h5 class="gandhi-bold size-24">Disbursements</h5>
Type
<p-sortIcon field="transaction_type_identifier"></p-sortIcon>
</th>
<th pSortableColumn="name" id="name-column" role="columnheader">Name
<th pSortableColumn="name" id="name-column" role="columnheader">
Name
<p-sortIcon field="name"></p-sortIcon>
</th>
<th pSortableColumn="date" id="date-column" role="columnheader">Date
<th pSortableColumn="date" id="date-column" role="columnheader">
Date
<p-sortIcon field="date"></p-sortIcon>
</th>
<th pSortableColumn="memo_code" id="memo-code-column" role="columnheader">
Expand All @@ -67,11 +69,9 @@ <h5 class="gandhi-bold size-24">Disbursements</h5>
{{ item.line_label }}
</td>
<td>
<a [routerLink]="[item?.id]">{{
item.transaction_type_identifier | label : scheduleTransactionTypeLabels
}}</a>
<a [routerLink]="[item?.id]">{{ item.transaction_type_identifier | label: scheduleTransactionTypeLabels }}</a>
<div *ngIf="item?.force_unaggregated"><strong>Unaggregated</strong></div>
<div *ngIf="!item?.itemized"><strong>Unitemized</strong></div>
<div *ngIf="!item?.itemized && report?.report_type !== form24ReportType"><strong>Unitemized</strong></div>
</td>
<td>
{{ item.name }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ElementRef, OnInit } from '@angular/core';
import { Component, ElementRef, Input, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ConfirmationService, MessageService } from 'primeng/api';
import { TransactionSchBService } from 'app/shared/services/transaction-schB.service';
Expand All @@ -9,13 +9,17 @@ import { TransactionListTableBaseComponent } from '../transaction-list-table-bas
import { Store } from '@ngrx/store';
import { ReportService } from 'app/shared/services/report.service';
import { DateUtils } from 'app/shared/utils/date.utils';
import { Report, ReportTypes } from 'app/shared/models/report.model';

@Component({
selector: 'app-transaction-disbursements',
templateUrl: './transaction-disbursements.component.html',
styleUrls: ['../../transaction.scss'],
})
export class TransactionDisbursementsComponent extends TransactionListTableBaseComponent implements OnInit {
@Input() report?: Report;
form24ReportType = ReportTypes.F24;

scheduleTransactionTypeLabels: LabelList = [...ScheduleBTransactionTypeLabels, ...ScheduleETransactionTypeLabels];

constructor(
Expand All @@ -26,7 +30,7 @@ export class TransactionDisbursementsComponent extends TransactionListTableBaseC
protected override router: Router,
protected override itemService: TransactionSchBService,
protected override store: Store,
protected override reportService: ReportService
protected override reportService: ReportService,
) {
super(messageService, confirmationService, elementRef, activatedRoute, router, store, reportService);
this.caption =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { TableAction, TableListBaseComponent } from 'app/shared/components/table-list-base/table-list-base.component';
import { Form3X } from 'app/shared/models/form-3x.model';
import { ReportTypes } from 'app/shared/models/report.model';
import { ScheduleATransactionTypes } from 'app/shared/models/scha-transaction.model';
import { ScheduleBTransactionTypes } from 'app/shared/models/schb-transaction.model';
import { ScheduleCTransactionTypes } from 'app/shared/models/schc-transaction.model';
Expand Down Expand Up @@ -44,6 +45,7 @@ export abstract class TransactionListTableBaseComponent extends TableListBaseCom
(transaction: Transaction) =>
!!transaction.force_unaggregated &&
this.reportIsEditable &&
transaction.report?.report_type !== ReportTypes.F24 &&
!transaction.parent_transaction &&
!transaction.parent_transaction_id &&
[ScheduleIds.A, ScheduleIds.E].includes(transaction.transactionType.scheduleId),
Expand All @@ -55,6 +57,7 @@ export abstract class TransactionListTableBaseComponent extends TableListBaseCom
(transaction: Transaction) =>
!transaction.force_unaggregated &&
this.reportIsEditable &&
transaction.report?.report_type !== ReportTypes.F24 &&
!transaction.parent_transaction &&
!transaction.parent_transaction_id &&
[ScheduleIds.A, ScheduleIds.E].includes(transaction.transactionType.scheduleId),
Expand All @@ -66,6 +69,7 @@ export abstract class TransactionListTableBaseComponent extends TableListBaseCom
(transaction: Transaction) =>
transaction.itemized === false &&
this.reportIsEditable &&
transaction.report?.report_type !== ReportTypes.F24 &&
!transaction.parent_transaction &&
!transaction.parent_transaction_id &&
![ScheduleIds.C, ScheduleIds.D].includes(transaction.transactionType.scheduleId),
Expand All @@ -77,6 +81,7 @@ export abstract class TransactionListTableBaseComponent extends TableListBaseCom
(transaction: Transaction) =>
transaction.itemized === true &&
this.reportIsEditable &&
transaction.report?.report_type !== ReportTypes.F24 &&
!transaction.parent_transaction &&
!transaction.parent_transaction_id &&
![ScheduleIds.C, ScheduleIds.D].includes(transaction.transactionType.scheduleId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h1 class="gandhi-bold size-36">Transactions in this report</h1>
</ng-template>
</p-toolbar>
<app-transaction-receipts *ngIf="report?.report_type !== reportTypes.F24"></app-transaction-receipts>
<app-transaction-disbursements></app-transaction-disbursements>
<app-transaction-disbursements [report]="report"></app-transaction-disbursements>
<app-transaction-loans-and-debts *ngIf="report?.report_type !== reportTypes.F24"></app-transaction-loans-and-debts>
</div>

Expand All @@ -41,4 +41,4 @@ <h1 class="gandhi-bold size-36">Transactions in this report</h1>
</ng-template>
</p-confirmDialog>

<app-select-report-dialog></app-select-report-dialog>
<app-select-report-dialog></app-select-report-dialog>
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('TransactionListComponent', () => {
SchATransaction.fromJSON({
id: transactionId,
transaction_type_identifier: 'OFFSET_TO_OPERATING_EXPENDITURES',
})
}),
),
getTableData: () => of([]),
update: () => of([]),
Expand Down

0 comments on commit b80c9d4

Please sign in to comment.