Skip to content

Commit

Permalink
Merge pull request #1360 from fecgov/release/sprint-30
Browse files Browse the repository at this point in the history
Release/sprint 30
  • Loading branch information
mjtravers authored Sep 14, 2023
2 parents 7abbc81 + 33917c3 commit 3bf5676
Show file tree
Hide file tree
Showing 106 changed files with 3,157 additions and 849 deletions.
4 changes: 2 additions & 2 deletions front-end/cypress/e2e/reports-f3x-transactions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ describe('Transactions', () => {
.find('td')
.eq(TransactionTableColumns.transaction_type)
.should('contain', 'Partnership Attribution');
cy.get('@row-1').find('td').eq(TransactionTableColumns.transaction_type).should('not.contain', 'Unitemized');
cy.get('@row-1').find('td').eq(TransactionTableColumns.transaction_type).should('contain', 'Unitemized');
cy.get('@row-1').find('td').eq(TransactionTableColumns.memo_code).should('contain', 'Y');
cy.get('@row-1').find('td').eq(TransactionTableColumns.aggregate).should('contain', '$201.10');

Expand Down Expand Up @@ -593,7 +593,7 @@ describe('Transactions', () => {
.find('td')
.eq(TransactionTableColumns.transaction_type)
.should('contain', 'Partnership Receipt Joint Fundraising Transfer Memo');
cy.get('@row-2').find('td').eq(TransactionTableColumns.transaction_type).should('contain', 'Unitemized');
cy.get('@row-2').find('td').eq(TransactionTableColumns.transaction_type).should('not.contain', 'Unitemized');
cy.get('@row-2').find('td').eq(TransactionTableColumns.memo_code).should('contain', 'Y');
cy.get('@row-2').find('td').eq(TransactionTableColumns.aggregate).should('contain', '$100.55');

Expand Down
1,306 changes: 724 additions & 582 deletions front-end/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion front-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@types/ws": "8.5.4",
"bootstrap": "5.1.3",
"class-transformer": "^0.5.1",
"fecfile-validate": "https://github.com/fecgov/fecfile-validate#f801280c3ab220c452e98eafae196245cf165416",
"fecfile-validate": "https://github.com/fecgov/fecfile-validate#5325acade54ec333539b5149eb118e8f90c0fd82",
"intl-tel-input": "^17.0.18",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
Expand Down
9 changes: 8 additions & 1 deletion front-end/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ const routes: Routes = [
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
imports: [
RouterModule.forRoot(routes, {
onSameUrlNavigation: 'reload',
// Fixes bug that had window scroll position being preserved between routes.
// https://stackoverflow.com/questions/39601026/angular-2-scroll-to-top-on-route-change
scrollPositionRestoration: 'top',
}),
],
exports: [RouterModule],
})
export class AppRoutingModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ <h3>{{ transactionType?.contactTitle }}</h3>
(primaryContactSelect)="updateFormWithPrimaryContact($event)"
(candidateContactSelect)="updateFormWithCandidateContact($event)"
(secondaryContactSelect)="updateFormWithSecondaryContact($event)"
(tertiaryContactSelect)="updateFormWithTertiaryContact($event)"
>
</app-transaction-input>
</form>
Expand Down Expand Up @@ -59,13 +60,16 @@ <h3>{{ childTransactionType?.contactTitle }}</h3>
(primaryContactSelect)="childUpdateFormWithPrimaryContact($event)"
(candidateContactSelect)="childUpdateFormWithCandidateContact($event)"
(secondaryContactSelect)="childUpdateFormWithSecondaryContact($event)"
(tertiaryContactSelect)="childUpdateFormWithTertiaryContact($event)"
>
</app-transaction-input>
</form>
</div>
</p-accordionTab>
</p-accordion>

<app-transaction-children-list-container [transaction]="transaction"></app-transaction-children-list-container>

<app-transaction-navigation
[isEditable]="isEditable"
[transaction]="transaction"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ng-container *ngIf="transaction?.transactionType?.showGuarantorTable">
<app-transaction-guarantors [transactions]="transaction?.children"></app-transaction-guarantors>
</ng-container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { of } from 'rxjs';
import { provideMockStore } from '@ngrx/store/testing';
import { testMockStore } from 'app/shared/utils/unit-test.utils';
import { F3xSummary } from 'app/shared/models/f3x-summary.model';
import { ConfirmationService, MessageService } from 'primeng/api';
import { ToolbarModule } from 'primeng/toolbar';
import { TableModule } from 'primeng/table';
import { DropdownModule } from 'primeng/dropdown';
import { SharedModule } from 'app/shared/shared.module';
import { TransactionChildrenListContainerComponent } from './transaction-children-list-container.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TransactionSchAService } from 'app/shared/services/transaction-schA.service';
import { SchATransaction } from 'app/shared/models/scha-transaction.model';

describe('TransactionChildrenListContainerComponent', () => {
let fixture: ComponentFixture<TransactionChildrenListContainerComponent>;
let component: TransactionChildrenListContainerComponent;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ToolbarModule, TableModule, SharedModule, HttpClientTestingModule, DropdownModule, FormsModule],
declarations: [TransactionChildrenListContainerComponent],
providers: [
MessageService,
ConfirmationService,
provideMockStore(testMockStore),
{
provide: ActivatedRoute,
useValue: {
snapshot: {
data: {
report: F3xSummary.fromJSON({}),
},
params: {
reportId: '999',
},
},
},
},
{
provide: TransactionSchAService,
useValue: {
get: (transactionId: string) =>
of(
SchATransaction.fromJSON({
id: transactionId,
transaction_type_identifier: 'OFFSET_TO_OPERATING_EXPENDITURES',
})
),
getTableData: () => of([]),
update: () => of([]),
},
},
],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(TransactionChildrenListContainerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Component, Input } from '@angular/core';
import { Transaction } from 'app/shared/models/transaction.model';

@Component({
selector: 'app-transaction-children-list-container',
templateUrl: 'transaction-children-list-container.component.html',
styleUrls: ['../transaction.scss'],
})
export class TransactionChildrenListContainerComponent {
@Input() transaction?: Transaction;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ <h3>Contact</h3>
(primaryContactSelect)="updateFormWithPrimaryContact($event)"
(candidateContactSelect)="updateFormWithCandidateContact($event)"
(secondaryContactSelect)="updateFormWithSecondaryContact($event)"
(tertiaryContactSelect)="updateFormWithTertiaryContact($event)"
>
</app-transaction-input>
</form>
</div>

<app-transaction-children-list-container [transaction]="transaction"></app-transaction-children-list-container>

<app-transaction-navigation
[isEditable]="isEditable"
[transaction]="transaction"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ <h3>{{ transaction?.transactionType?.amountInputHeader }}</h3>
[memoCodeCheckboxLabel]="(memoCodeCheckboxLabel$ | async)!"
></app-amount-input>
</ng-container>
<ng-container *ngIf="transaction?.transactionType?.hasDebtInput">
<p-divider></p-divider>
<h3>{{ transaction?.transactionType?.debtInputHeader }}</h3>
<app-debt-input
[form]="form"
[formSubmitted]="formSubmitted"
[templateMap]="templateMap"
[transaction]="transaction"
></app-debt-input>
</ng-container>
<ng-container *ngIf="transactionType?.hasLoanFinanceFields()">
<p-divider></p-divider>
<h3>{{ transactionType.amountInputHeader }}</h3>
Expand Down Expand Up @@ -129,34 +139,61 @@ <h3>Additional information</h3>
</ng-container>

<ng-template #candidateInfo>
<ng-container *ngIf="transactionType?.hasCandidateInformation()">
<ng-container *ngIf="transactionType?.hasCommitteeOrCandidateInformation()">
<p-divider></p-divider>
<h3>Committee/Candidate Information</h3>
<app-committee-input
*ngIf="transaction?.transactionType?.hasCandidateCommittee"
[form]="form"
[formSubmitted]="formSubmitted"
[templateMap]="templateMap"
entityRole="COMMITTEE"
[includeFecId]="true"
[readonly]="true"
></app-committee-input>
<app-transaction-contact-lookup
[form]="form"
[formSubmitted]="formSubmitted"
[contactTypeOptions]="candidateContactTypeOptions"
[contactTypeFormControl]="candidateContactTypeFormControl"
selectedContactFormControlName="contact_2"
[contactTypeReadOnly]="true"
(contactSelect)="updateFormWithCandidateContact($event)"
></app-transaction-contact-lookup>
<ng-container *ngIf="transaction?.contact_2">
<app-candidate-input
<h3>Committee/Candidate information</h3>
<ng-container *ngIf="!transactionType?.contact3IsRequired">
<app-committee-input
*ngIf="transaction?.transactionType?.hasCandidateCommittee"
[form]="form"
[formSubmitted]="formSubmitted"
[templateMap]="templateMap"
entityRole="COMMITTEE"
[includeFecId]="true"
[readonly]="true"
[transaction]="transaction"
></app-committee-input>
</ng-container>
<ng-container *ngIf="transactionType?.contact3IsRequired">
<app-transaction-contact-lookup
[form]="form"
[formSubmitted]="formSubmitted"
[contactTypeOptions]="committeeContactTypeOptions"
[contactTypeFormControl]="committeeContactTypeFormControl"
selectedContactFormControlName="contact_3"
[contactTypeReadOnly]="true"
(contactSelect)="updateFormWithTertiaryContact($event)"
></app-transaction-contact-lookup>
<app-committee-input
*ngIf="transaction?.contact_3"
[form]="form"
[formSubmitted]="formSubmitted"
[templateMap]="templateMap"
[hasCandidateOfficeInput]="!!transactionType.hasCandidateOffice()"
></app-candidate-input>
entityRole="COMMITTEE"
[includeFecId]="true"
[readonly]="false"
[transaction]="transaction"
[tertiaryContact]="true"
></app-committee-input>
</ng-container>
<ng-container *ngIf="transaction?.transactionType?.hasCandidateInformation()">
<app-transaction-contact-lookup
[form]="form"
[formSubmitted]="formSubmitted"
[contactTypeOptions]="candidateContactTypeOptions"
[contactTypeFormControl]="candidateContactTypeFormControl"
selectedContactFormControlName="contact_2"
[contactTypeReadOnly]="true"
(contactSelect)="updateFormWithCandidateContact($event)"
></app-transaction-contact-lookup>
<ng-container *ngIf="transaction?.contact_2">
<app-candidate-input
[form]="form"
[formSubmitted]="formSubmitted"
[templateMap]="templateMap"
[hasCandidateOfficeInput]="!!transactionType.hasCandidateOffice()"
></app-candidate-input>
</ng-container>
</ng-container>
</ng-container>
<ng-container *ngIf="transactionType?.hasElectionInformation()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ export class TransactionInputComponent implements OnInit {
ContactTypes.CANDIDATE,
]);
@Input() candidateContactTypeFormControl: FormControl = new FormControl(ContactTypes.CANDIDATE);
@Input() committeeContactTypeOptions: PrimeOptions = LabelUtils.getPrimeOptions(ContactTypeLabels, [
ContactTypes.COMMITTEE,
]);
@Input() committeeContactTypeFormControl: FormControl = new FormControl(ContactTypes.COMMITTEE);
@Input() memoCodeCheckboxLabel$?: Observable<string>;
@Input() contributionAmountReadOnly = false;
@Input() contactLookupLabel = 'CONTACT LOOKUP';
@Input() contactLookupLabel = 'CONTACT TYPE';
@Input() candidateInfoPosition = 'low';

@Output() primaryContactSelect = new EventEmitter<SelectItem<Contact>>();
@Output() candidateContactSelect = new EventEmitter<SelectItem<Contact>>();
@Output() secondaryContactSelect = new EventEmitter<SelectItem<Contact>>();
@Output() tertiaryContactSelect = new EventEmitter<SelectItem<Contact>>();

ContactTypes = ContactTypes;
transactionType: TransactionType = {} as TransactionType;
Expand All @@ -54,4 +59,8 @@ export class TransactionInputComponent implements OnInit {
updateFormWithSecondaryContact(selectItem: SelectItem<Contact>) {
this.secondaryContactSelect.emit(selectItem);
}

updateFormWithTertiaryContact(selectItem: SelectItem<Contact>) {
this.tertiaryContactSelect.emit(selectItem);
}
}
Loading

0 comments on commit 3bf5676

Please sign in to comment.