Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/66 2 #1770

Merged
merged 4 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ <h5 class="m-0">Recent reports</h5>
<ng-template pTemplate="body" let-item>
<tr role="row">
<td>{{ item.formLabel }}</td>
<td>{{ item.report_code_label }}</td>
<td>{{ item.reportLabel }}</td>
<td>
<ng-container *ngIf="item.coverage_from_date || item.coverage_through_date"
>{{ item.coverage_from_date | fecDate }} - {{ item.coverage_through_date | fecDate }}</ng-container
>{{ item.coverage_from_date | fecDate }} - {{ item.coverage_through_date | fecDate }}
</ng-container
>
</td>
<td>{{ item.report_status }}</td>
Expand Down
26 changes: 13 additions & 13 deletions front-end/src/app/reports/report-list/report-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, ElementRef, OnDestroy, OnInit } from '@angular/core';
import { take, takeUntil } from 'rxjs';
import { ConfirmationService, MessageService } from 'primeng/api';
import { TableAction, TableListBaseComponent } from '../../shared/components/table-list-base/table-list-base.component';
import { Report, ReportTypes, ReportStatus } from '../../shared/models/report.model';
import { Report, ReportStatus, ReportTypes } from '../../shared/models/report.model';
import { ReportService } from '../../shared/services/report.service';
import { Form3X } from 'app/shared/models/form-3x.model';
import { Router } from '@angular/router';
Expand All @@ -17,13 +17,13 @@ export class ReportListComponent extends TableListBaseComponent<Report> implemen
new TableAction(
'Edit report',
this.editItem.bind(this),
(report: Report) => report.report_status === ReportStatus.IN_PROGRESS
(report: Report) => report.report_status === ReportStatus.IN_PROGRESS,
),
new TableAction('Amend', this.amendReport.bind(this), (report: Report) => report.canAmend),
new TableAction(
'Review report',
this.editItem.bind(this),
(report: Report) => report.report_status !== ReportStatus.IN_PROGRESS
(report: Report) => report.report_status !== ReportStatus.IN_PROGRESS,
),
new TableAction('Download as .fec', this.goToTest.bind(this)),
];
Expand All @@ -33,7 +33,7 @@ export class ReportListComponent extends TableListBaseComponent<Report> implemen
protected override confirmationService: ConfirmationService,
protected override elementRef: ElementRef,
protected override itemService: ReportService,
public router: Router
public router: Router,
) {
super(messageService, confirmationService, elementRef);
this.caption =
Expand All @@ -49,28 +49,28 @@ export class ReportListComponent extends TableListBaseComponent<Report> implemen
return new Form3X();
}

public override editItem(item: Report): void {
public override async editItem(item: Report): Promise<void> {
if (!this.itemService.isEditable(item)) {
this.router.navigateByUrl(`/reports/${item.report_type.toLocaleLowerCase()}/submit/status/${item.id}`);
await this.router.navigateByUrl(`/reports/${item.report_type.toLocaleLowerCase()}/submit/status/${item.id}`);
return;
}

switch (item.report_type) {
case ReportTypes.F3X:
if (item.is_first) {
this.router.navigateByUrl(`/reports/f3x/create/cash-on-hand/${item.id}`);
await this.router.navigateByUrl(`/reports/f3x/create/cash-on-hand/${item.id}`);
} else {
this.router.navigateByUrl(`/reports/transactions/report/${item.id}/list`);
await this.router.navigateByUrl(`/reports/transactions/report/${item.id}/list`);
}
break;
case ReportTypes.F99:
this.router.navigateByUrl(`/reports/f99/edit/${item.id}`);
await this.router.navigateByUrl(`/reports/f99/edit/${item.id}`);
break;
case ReportTypes.F24:
this.router.navigateByUrl(`/reports/transactions/report/${item.id}/list`);
await this.router.navigateByUrl(`/reports/transactions/report/${item.id}/list`);
break;
case ReportTypes.F1M:
this.router.navigateByUrl(`/reports/f1m/edit/${item.id}`);
await this.router.navigateByUrl(`/reports/f1m/edit/${item.id}`);
break;
}
}
Expand All @@ -84,8 +84,8 @@ export class ReportListComponent extends TableListBaseComponent<Report> implemen
});
}

public goToTest(item: Report): void {
this.router.navigateByUrl(`/reports/f3x/test-dot-fec/${item.id}`);
public async goToTest(item: Report): Promise<void> {
await this.router.navigateByUrl(`/reports/f3x/test-dot-fec/${item.id}`);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Store } from '@ngrx/store';
import { DestroyerComponent } from 'app/shared/components/app-destroyer.component';
import { CommitteeAccount } from 'app/shared/models/committee-account.model';
import { Report } from 'app/shared/models/report.model';
import { ReportService, getReportFromJSON } from 'app/shared/services/report.service';
import { getReportFromJSON, ReportService } from 'app/shared/services/report.service';
import { CountryCodeLabels, LabelUtils, PrimeOptions, StatesCodeLabels } from 'app/shared/utils/label.utils';
import { SchemaUtils } from 'app/shared/utils/schema.utils';
import { buildGuaranteeUniqueValuesValidator, emailValidator } from 'app/shared/utils/validators.utils';
Expand Down Expand Up @@ -90,7 +90,7 @@ export class SubmitReportStep1Component extends DestroyerComponent implements On
}
}

public continue(): void {
public async continue(): Promise<void> {
this.formSubmitted = true;
if (this.form.invalid || this.report == undefined) {
this.store.dispatch(singleClickEnableAction());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1>{{ transaction?.transactionType?.title }}</h1>
<div *ngIf="transactionType?.subTitle">{{ transactionType?.subTitle }}</div>
<app-independent-expenditure-create-f3x-input
*ngIf="(activeReport$ | async)?.report_type == reportTypes.F24"
*ngIf="(activeReport$ | async)?.report_type === reportTypes.F24"
></app-independent-expenditure-create-f3x-input>
<h4 class="read-only-tag subtitle" *ngIf="!isEditable">READ ONLY</h4>
<p class="group-description">{{ transactionType?.description }}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h1 [ngClass]="{ 'dark-gray-text': transactionType?.showParentTransactionTitle }
</h1>
<div *ngIf="transactionType?.subTitle">{{ transactionType?.subTitle }}</div>
<app-independent-expenditure-create-f3x-input
*ngIf="(activeReport$ | async)?.report_type == reportTypes.F24"
*ngIf="(activeReport$ | async)?.report_type === reportTypes.F24"
></app-independent-expenditure-create-f3x-input>
<h4 class="read-only-tag subtitle" *ngIf="!isEditable">READ ONLY</h4>
<h4 class="read-only-tag subtitle" *ngIf="isDebtRepayment(transaction)">DEBT REPAYMENT</h4>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1>{{ transaction?.transactionType?.title }}</h1>
<div *ngIf="transactionType?.subTitle">{{ transactionType?.subTitle }}</div>
<app-independent-expenditure-create-f3x-input
*ngIf="(activeReport$ | async)?.report_type == reportTypes.F24"
*ngIf="(activeReport$ | async)?.report_type === reportTypes.F24"
></app-independent-expenditure-create-f3x-input>
<h4 class="read-only-tag subtitle" *ngIf="!isEditable">READ ONLY</h4>
<p class="group-description">{{ transactionType?.description }}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h3>Contact</h3>
<div class="col-6">
<div class="field">
<label for="candidate_id">CANDIDATE ID</label>
<input type="text" pInputText id="candidate_id" formControlName="candidate_id" />
<input type="text" pInputText id="candidate_id" formControlName="candidate_id"/>
<app-error-messages
[form]="form"
fieldName="candidate_id"
Expand All @@ -59,7 +59,7 @@ <h3>Contact</h3>
<div class="col-4">
<div class="field">
<label for="committee_id">COMMITTEE ID</label>
<input type="text" pInputText id="committee_id" formControlName="committee_id" />
<input type="text" pInputText id="committee_id" formControlName="committee_id"/>
<app-error-messages
[form]="form"
fieldName="committee_id"
Expand All @@ -71,8 +71,9 @@ <h3>Contact</h3>
<div class="col-8">
<div class="field">
<label for="name">NAME</label>
<input type="text" pInputText id="name" formControlName="name" />
<app-error-messages [form]="form" fieldName="name" [formSubmitted]="formSubmitted"></app-error-messages>
<input type="text" pInputText id="name" formControlName="name"/>
<app-error-messages [form]="form" fieldName="name"
[formSubmitted]="formSubmitted"></app-error-messages>
</div>
</div>
<ng-container *ngIf="contactType === ContactTypes.ORGANIZATION">
Expand All @@ -85,7 +86,7 @@ <h3>Contact</h3>
<div class="col-4">
<div class="field">
<label for="last_name">LAST NAME</label>
<input type="text" pInputText id="last_name" formControlName="last_name" />
<input type="text" pInputText id="last_name" formControlName="last_name"/>
<app-error-messages
[form]="form"
fieldName="last_name"
Expand All @@ -96,7 +97,7 @@ <h3>Contact</h3>
<div class="col-4">
<div class="field">
<label for="first_name">FIRST NAME</label>
<input type="text" pInputText id="first_name" formControlName="first_name" />
<input type="text" pInputText id="first_name" formControlName="first_name"/>
<app-error-messages
[form]="form"
fieldName="first_name"
Expand All @@ -107,7 +108,7 @@ <h3>Contact</h3>
<div class="col-4">
<div class="field">
<label for="middle_name">MIDDLE NAME (OPTIONAL)</label>
<input type="text" pInputText id="middle_name" formControlName="middle_name" />
<input type="text" pInputText id="middle_name" formControlName="middle_name"/>
<app-error-messages
[form]="form"
fieldName="middle_name"
Expand All @@ -120,7 +121,7 @@ <h3>Contact</h3>
<div class="col-3">
<div class="field">
<label for="prefix">PREFIX (OPTIONAL)</label>
<input type="text" pInputText id="prefix" formControlName="prefix" />
<input type="text" pInputText id="prefix" formControlName="prefix"/>
<app-error-messages
[form]="form"
fieldName="prefix"
Expand All @@ -131,7 +132,7 @@ <h3>Contact</h3>
<div class="col-3">
<div class="field">
<label for="suffix">SUFFIX (OPTIONAL)</label>
<input type="text" pInputText id="suffix" formControlName="suffix" />
<input type="text" pInputText id="suffix" formControlName="suffix"/>
<app-error-messages
[form]="form"
fieldName="suffix"
Expand All @@ -144,7 +145,7 @@ <h3>Contact</h3>
</ng-container>
<div class="grid">
<div class="col-12">
<hr />
<hr/>
</div>
</div>
<div class="grid">
Expand All @@ -156,7 +157,8 @@ <h3>Address</h3>
<div class="col-6">
<div class="field">
<label for="country">COUNTRY/REGION</label>
<p-dropdown inputId="country" formControlName="country" [options]="countryOptions"></p-dropdown>
<p-dropdown inputId="country" formControlName="country"
[options]="countryOptions"></p-dropdown>
</div>
</div>
<div class="col-6"></div>
Expand All @@ -165,7 +167,7 @@ <h3>Address</h3>
<div class="col-6">
<div class="field">
<label for="street_1">STREET ADDRESS</label>
<input type="text" pInputText id="street_1" formControlName="street_1" />
<input type="text" pInputText id="street_1" formControlName="street_1"/>
<app-error-messages
[form]="form"
fieldName="street_1"
Expand All @@ -176,7 +178,7 @@ <h3>Address</h3>
<div class="col-6">
<div class="field">
<label for="street_2">APARTMENT, SUITE, ETC. (OPTIONAL)</label>
<input type="text" pInputText id="street_2" formControlName="street_2" />
<input type="text" pInputText id="street_2" formControlName="street_2"/>
<app-error-messages
[form]="form"
fieldName="street_2"
Expand All @@ -189,8 +191,9 @@ <h3>Address</h3>
<div class="col-6">
<div class="field">
<label for="city">CITY</label>
<input type="text" pInputText id="city" formControlName="city" />
<app-error-messages [form]="form" fieldName="city" [formSubmitted]="formSubmitted"></app-error-messages>
<input type="text" pInputText id="city" formControlName="city"/>
<app-error-messages [form]="form" fieldName="city"
[formSubmitted]="formSubmitted"></app-error-messages>
</div>
</div>
<div class="col-3">
Expand All @@ -203,14 +206,16 @@ <h3>Address</h3>
[autoDisplayFirst]="false"
appendTo="body"
></p-dropdown>
<app-error-messages [form]="form" fieldName="state" [formSubmitted]="formSubmitted"></app-error-messages>
<app-error-messages [form]="form" fieldName="state"
[formSubmitted]="formSubmitted"></app-error-messages>
</div>
</div>
<div class="col-3">
<div class="field">
<label for="zip">ZIP/POSTAL CODE</label>
<input type="text" pInputText id="zip" formControlName="zip" />
<app-error-messages [form]="form" fieldName="zip" [formSubmitted]="formSubmitted"></app-error-messages>
<input type="text" pInputText id="zip" formControlName="zip"/>
<app-error-messages [form]="form" fieldName="zip"
[formSubmitted]="formSubmitted"></app-error-messages>
</div>
</div>
</div>
Expand All @@ -233,7 +238,7 @@ <h3>Address</h3>
<ng-container *ngIf="[ContactTypes.INDIVIDUAL, ContactTypes.CANDIDATE].includes(contactType)">
<div class="grid">
<div class="col-12">
<hr />
<hr/>
</div>
</div>
<div class="grid">
Expand All @@ -245,7 +250,7 @@ <h3>Employer</h3>
<div class="col-6">
<div class="field">
<label for="employer">EMPLOYER (OPTIONAL)</label>
<input type="text" pInputText id="employer" formControlName="employer" />
<input type="text" pInputText id="employer" formControlName="employer"/>
<app-error-messages
[form]="form"
fieldName="employer"
Expand All @@ -256,7 +261,7 @@ <h3>Employer</h3>
<div class="col-6">
<div class="field">
<label for="occupation">OCCUPATION (OPTIONAL)</label>
<input type="text" pInputText id="occupation" formControlName="occupation" />
<input type="text" pInputText id="occupation" formControlName="occupation"/>
<app-error-messages
[form]="form"
fieldName="occupation"
Expand All @@ -269,7 +274,7 @@ <h3>Employer</h3>
<ng-container *ngIf="contactType === ContactTypes.CANDIDATE">
<div class="grid">
<div class="col-12">
<hr />
<hr/>
</div>
</div>
<div class="grid">
Expand All @@ -288,7 +293,7 @@ <h3>Office</h3>
</ng-container>
</form>

<div *ngIf="showHistory">
<div *ngIf="showHistory && !isNewItem">
<p-table
[value]="transactions"
responsiveLayout="scroll"
Expand Down Expand Up @@ -321,9 +326,9 @@ <h2 class="m-0">Transaction history</h2>
{{ transaction.transaction_type_identifier | label: scheduleTransactionTypeLabels }}
</a>
</td>
<td>{{ transaction.form_type }}</td>
<td>{{ transaction.report?.report_type }}</td>
<td>{{ transaction.date }}</td>
<td>{{ transaction.formType }}</td>
<td>{{ transaction.reportType }}</td>
<td>{{ transaction.date | date:'MM/dd/yyyy' }}</td>
<td>{{ transaction.amount | currency }}</td>
</tr>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getTestTransactionByType, testContact, testMockStore } from 'app/shared
import { DropdownModule } from 'primeng/dropdown';
import { ErrorMessagesComponent } from '../error-messages/error-messages.component';
import { FecInternationalPhoneInputComponent } from '../fec-international-phone-input/fec-international-phone-input.component';
import { ContactDialogComponent } from './contact-dialog.component';
import { ContactDialogComponent, TransactionData } from './contact-dialog.component';
import { ContactLookupComponent } from '../contact-lookup/contact-lookup.component';
import { AutoCompleteModule } from 'primeng/autocomplete';
import { LabelPipe } from 'app/shared/pipes/label.pipe';
Expand Down Expand Up @@ -119,7 +119,7 @@ describe('ContactDialogComponent', () => {

it('should route to transaction', () => {
const spy = spyOn(component.router, 'navigate');
component.openTransaction(transaction);
component.openTransaction(new TransactionData(transaction));
expect(spy).toHaveBeenCalledWith([`reports/transactions/report/${transaction.report_id}/list/${transaction.id}`]);
});

Expand Down
Loading