diff --git a/front-end/src/app/app-routing.module.ts b/front-end/src/app/app-routing.module.ts index 5d0fe0d94b..f1cd096052 100644 --- a/front-end/src/app/app-routing.module.ts +++ b/front-end/src/app/app-routing.module.ts @@ -20,7 +20,7 @@ const routes: Routes = [ path: '', component: LayoutComponent, children: [ - { path: 'dashboard', component: DashboardComponent }, + { path: 'dashboard', component: DashboardComponent, title: 'FECFile Dashboard' }, { path: 'reports', loadChildren: () => import('./reports/reports.module').then((m) => m.ReportsModule) }, { path: 'contacts', loadChildren: () => import('./contacts/contacts.module').then((m) => m.ContactsModule) }, { path: 'committee/users', loadChildren: () => import('./users/users.module').then((m) => m.UsersModule) }, diff --git a/front-end/src/app/contacts/contacts-routing.module.ts b/front-end/src/app/contacts/contacts-routing.module.ts index e967eedaf2..a7191cecdc 100644 --- a/front-end/src/app/contacts/contacts-routing.module.ts +++ b/front-end/src/app/contacts/contacts-routing.module.ts @@ -5,6 +5,7 @@ import { ContactListComponent } from './contact-list/contact-list.component'; const routes: Routes = [ { path: '', + title: 'Manage Contacts', component: ContactListComponent, pathMatch: 'full', }, diff --git a/front-end/src/app/profile/profile-routing.module.ts b/front-end/src/app/profile/profile-routing.module.ts index 0a2727cb13..4c1e50a2a3 100644 --- a/front-end/src/app/profile/profile-routing.module.ts +++ b/front-end/src/app/profile/profile-routing.module.ts @@ -1,14 +1,15 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { AccountInfoComponent } from "./account-info/account-info.component"; +import { AccountInfoComponent } from './account-info/account-info.component'; const routes: Routes = [ { path: 'account', + title: 'Account Page', component: AccountInfoComponent, pathMatch: 'full', }, - { path: '**', redirectTo: '' } + { path: '**', redirectTo: '' }, ]; @NgModule({ diff --git a/front-end/src/app/reports/reports-routing.module.ts b/front-end/src/app/reports/reports-routing.module.ts index fcbc8a4e8c..34a2eaa583 100644 --- a/front-end/src/app/reports/reports-routing.module.ts +++ b/front-end/src/app/reports/reports-routing.module.ts @@ -26,61 +26,73 @@ import { ReportIsEditableGuard } from '../shared/guards/report-is-editable.guard const routes: Routes = [ { path: '', + title: 'Manage Reports', component: ReportListComponent, pathMatch: 'full', }, { path: 'f3x/create/cash-on-hand/:reportId', + title: 'Cash on hand', component: CashOnHandComponent, canActivate: [ReportIsEditableGuard, CashOnHandGuard], }, { path: 'f3x/create/step1', + title: 'Create a report', component: CreateF3XStep1Component, }, { path: 'f3x/create/step1/:reportId', + title: 'Create a report', component: CreateF3XStep1Component, canActivate: [ReportIsEditableGuard], }, { path: 'f3x/create/step2/:reportId', + title: 'Report Form 3X', component: CreateF3xStep2Component, canActivate: [ReportIsEditableGuard], }, { path: 'f3x/summary/:reportId', + title: 'View summary page', component: ReportSummaryComponent, resolve: { report: ReportResolver }, }, { path: 'f3x/detailed-summary/:reportId', + title: 'View detailed summary page', component: ReportDetailedSummaryComponent, resolve: { report: ReportResolver }, }, { path: 'f3x/web-print/:reportId', + title: 'Print preview', component: ReportWebPrintComponent, resolve: { report: ReportResolver }, }, { path: 'f3x/memo/:reportId', + title: 'Add a report level memo', component: ReportLevelMemoComponent, canActivate: [ReportIsEditableGuard], resolve: { report: ReportResolver }, }, { path: 'f3x/submit/step1/:reportId', + title: 'Confirm information', component: SubmitF3xStep1Component, canActivate: [ReportIsEditableGuard], }, { path: 'f3x/submit/step2/:reportId', + title: 'Submit report', component: SubmitF3xStep2Component, canActivate: [ReportIsEditableGuard], }, { path: 'f3x/submit/status/:reportId', + title: 'Report status', component: ReportSubmissionStatusComponent, resolve: { report: ReportResolver }, }, diff --git a/front-end/src/app/shared/components/transaction-type-base/transaction-type-base.component.ts b/front-end/src/app/shared/components/transaction-type-base/transaction-type-base.component.ts index 67a3c6514e..f7111db84e 100644 --- a/front-end/src/app/shared/components/transaction-type-base/transaction-type-base.component.ts +++ b/front-end/src/app/shared/components/transaction-type-base/transaction-type-base.component.ts @@ -15,10 +15,10 @@ import { ContactTypeLabels, ContactTypes } from '../../models/contact.model'; template: '', }) export abstract class TransactionTypeBaseComponent implements OnInit, OnDestroy { - @Input() title = ''; - @Input() schema: JsonSchema | null = null; - @Input() transaction: Transaction | null = null; - @Input() contributionPurposeDescrip = ''; + @Input() title: string | undefined; + @Input() schema: JsonSchema | undefined; + @Input() transaction: Transaction | undefined; + @Input() contributionPurposeDescrip: string | undefined; abstract formProperties: string[]; diff --git a/front-end/src/app/shared/interfaces/transaction-type.interface.ts b/front-end/src/app/shared/interfaces/transaction-type.interface.ts index 6325ed36ea..28fe1a830b 100644 --- a/front-end/src/app/shared/interfaces/transaction-type.interface.ts +++ b/front-end/src/app/shared/interfaces/transaction-type.interface.ts @@ -10,8 +10,8 @@ export interface TransactionType { componentGroupId: string; title: string; schema: JsonSchema; - transaction: Transaction | null; - parent: Transaction | null; + transaction: Transaction | undefined; + parent: Transaction | undefined; contributionPurposeDescripReadonly(): string; getNewTransaction(): Transaction; } diff --git a/front-end/src/app/shared/models/transaction-types/INDV_REC.model.ts b/front-end/src/app/shared/models/transaction-types/INDV_REC.model.ts index 1bad575ec1..6aa6f38b5e 100644 --- a/front-end/src/app/shared/models/transaction-types/INDV_REC.model.ts +++ b/front-end/src/app/shared/models/transaction-types/INDV_REC.model.ts @@ -8,8 +8,8 @@ export class INDV_REC implements TransactionType { componentGroupId = 'A'; title = LabelUtils.get(ScheduleATransactionTypeLabels, ScheduleATransactionTypes.INDIVIDUAL_RECEIPT); schema = schema; - transaction = null; - parent = null; + transaction = undefined; + parent = undefined; contributionPurposeDescripReadonly(): string { return ''; diff --git a/front-end/src/app/shared/models/transaction-types/JF_TRAN.model.ts b/front-end/src/app/shared/models/transaction-types/JF_TRAN.model.ts index e38137e7a5..2d91906a8d 100644 --- a/front-end/src/app/shared/models/transaction-types/JF_TRAN.model.ts +++ b/front-end/src/app/shared/models/transaction-types/JF_TRAN.model.ts @@ -8,8 +8,8 @@ export class JF_TRAN implements TransactionType { componentGroupId = 'E'; title = LabelUtils.get(ScheduleATransactionTypeLabels, ScheduleATransactionTypes.JF_TRANSFER); schema = schema; - transaction = null; - parent = null; + transaction = undefined; + parent = undefined; contributionPurposeDescripReadonly(): string { return 'Transfer of JF Proceeds'; diff --git a/front-end/src/app/shared/models/transaction-types/JF_TRAN_PAC_MEMO.model.ts b/front-end/src/app/shared/models/transaction-types/JF_TRAN_PAC_MEMO.model.ts index 30ef6e27ef..d442412e64 100644 --- a/front-end/src/app/shared/models/transaction-types/JF_TRAN_PAC_MEMO.model.ts +++ b/front-end/src/app/shared/models/transaction-types/JF_TRAN_PAC_MEMO.model.ts @@ -9,8 +9,8 @@ export class JF_TRAN_PAC_MEMO implements TransactionType { componentGroupId = 'F'; title = LabelUtils.get(ScheduleATransactionTypeLabels, ScheduleATransactionTypes.JF_TRAN_PAC_MEMO); schema = schema; - transaction: Transaction | null = null; - parent: SchATransaction | null = null; + transaction: Transaction | undefined; + parent: SchATransaction | undefined; contributionPurposeDescripReadonly(): string { return `JF Memo: ${this.parent?.contributor_organization_name}`; diff --git a/front-end/src/app/shared/models/transaction-types/OFFSET_TO_OPEX.model.ts b/front-end/src/app/shared/models/transaction-types/OFFSET_TO_OPEX.model.ts index 5768d93afe..487a83cee0 100644 --- a/front-end/src/app/shared/models/transaction-types/OFFSET_TO_OPEX.model.ts +++ b/front-end/src/app/shared/models/transaction-types/OFFSET_TO_OPEX.model.ts @@ -8,8 +8,8 @@ export class OFFSET_TO_OPEX implements TransactionType { componentGroupId = 'B'; title = LabelUtils.get(ScheduleATransactionTypeLabels, ScheduleATransactionTypes.OFFSETS_TO_OPERATING_EXPENDITURES); schema = schema; - transaction = null; - parent = null; + transaction = undefined; + parent = undefined; contributionPurposeDescripReadonly(): string { return ''; diff --git a/front-end/src/app/shared/models/transaction-types/OTH_REC.model.ts b/front-end/src/app/shared/models/transaction-types/OTH_REC.model.ts index 4f17d7a0e3..a8778424a0 100644 --- a/front-end/src/app/shared/models/transaction-types/OTH_REC.model.ts +++ b/front-end/src/app/shared/models/transaction-types/OTH_REC.model.ts @@ -8,8 +8,8 @@ export class OTH_REC implements TransactionType { componentGroupId = 'C'; title = LabelUtils.get(ScheduleATransactionTypeLabels, ScheduleATransactionTypes.OTHER_RECEIPTS); schema = schema; - transaction = null; - parent = null; + transaction = undefined; + parent = undefined; contributionPurposeDescripReadonly(): string { return ''; diff --git a/front-end/src/app/shared/models/transaction-types/TRIB_REC.model.ts b/front-end/src/app/shared/models/transaction-types/TRIB_REC.model.ts index 30e145db4f..881a503897 100644 --- a/front-end/src/app/shared/models/transaction-types/TRIB_REC.model.ts +++ b/front-end/src/app/shared/models/transaction-types/TRIB_REC.model.ts @@ -8,8 +8,8 @@ export class TRIB_REC implements TransactionType { componentGroupId = 'D'; title = LabelUtils.get(ScheduleATransactionTypeLabels, ScheduleATransactionTypes.TRIBAL_RECEIPT); schema = schema; - transaction = null; - parent = null; + transaction = undefined; + parent = undefined; contributionPurposeDescripReadonly(): string { return 'Tribal Receipt'; diff --git a/front-end/src/app/shared/services/validate.service.spec.ts b/front-end/src/app/shared/services/validate.service.spec.ts index 9255a12f9e..5223730882 100644 --- a/front-end/src/app/shared/services/validate.service.spec.ts +++ b/front-end/src/app/shared/services/validate.service.spec.ts @@ -99,7 +99,7 @@ describe('ValidateService', () => { }); it('#getSchemaProperties() should return empty array when no schema', () => { - const properties: string[] = service.getSchemaProperties(null); + const properties: string[] = service.getSchemaProperties(undefined); expect(properties.length).toBe(0); }); }); diff --git a/front-end/src/app/shared/services/validate.service.ts b/front-end/src/app/shared/services/validate.service.ts index 54c33a8870..d099fe4ce6 100644 --- a/front-end/src/app/shared/services/validate.service.ts +++ b/front-end/src/app/shared/services/validate.service.ts @@ -12,13 +12,13 @@ export class ValidateService { * @property - This property is a placeholder for the schema to use in the form element * custom validator located in the method formValidator() below. */ - formValidatorSchema: JsonSchema | null = null; + formValidatorSchema: JsonSchema | undefined; /** * @property - This property is a placeholder for the ng reactive form to use in the form * element custom validator located in the method formValidator() below. */ - formValidatorForm: FormGroup | null = null; + formValidatorForm: FormGroup | undefined; /** * Validate a data object against a JSON Schema document @@ -37,7 +37,7 @@ export class ValidateService { * @param {JsonSchema} schema * @returns {string[]} list of property names */ - getSchemaProperties(schema: JsonSchema | null): string[] { + getSchemaProperties(schema: JsonSchema | undefined): string[] { if (schema) { return Object.keys(schema.properties); } diff --git a/front-end/src/app/transactions/transaction-container/transaction-container.component.html b/front-end/src/app/transactions/transaction-container/transaction-container.component.html index df36a81d4c..6dc3666d93 100644 --- a/front-end/src/app/transactions/transaction-container/transaction-container.component.html +++ b/front-end/src/app/transactions/transaction-container/transaction-container.component.html @@ -1,48 +1,48 @@ - + - + - + - + - + - + diff --git a/front-end/src/app/transactions/transaction-container/transaction-container.component.spec.ts b/front-end/src/app/transactions/transaction-container/transaction-container.component.spec.ts index 4f9d096a3d..5ae3cbfad6 100644 --- a/front-end/src/app/transactions/transaction-container/transaction-container.component.spec.ts +++ b/front-end/src/app/transactions/transaction-container/transaction-container.component.spec.ts @@ -20,6 +20,7 @@ import { CheckboxModule } from 'primeng/checkbox'; import { InputTextModule } from 'primeng/inputtext'; import { InputTextareaModule } from 'primeng/inputtextarea'; import { InputNumberModule } from 'primeng/inputnumber'; +import { of } from 'rxjs'; describe('TransactionContainerComponent', () => { let component: TransactionContainerComponent; @@ -53,11 +54,9 @@ describe('TransactionContainerComponent', () => { { provide: ActivatedRoute, useValue: { - snapshot: { - data: { - transactionType: TransactionTypeUtils.factory('OFFSET_TO_OPEX'), - }, - }, + data: of({ + transactionType: TransactionTypeUtils.factory('OFFSET_TO_OPEX'), + }), }, }, provideMockStore({ diff --git a/front-end/src/app/transactions/transaction-container/transaction-container.component.ts b/front-end/src/app/transactions/transaction-container/transaction-container.component.ts index c2144c46d7..73eb37a79d 100644 --- a/front-end/src/app/transactions/transaction-container/transaction-container.component.ts +++ b/front-end/src/app/transactions/transaction-container/transaction-container.component.ts @@ -5,23 +5,32 @@ import { TransactionType } from '../../shared/interfaces/transaction-type.interf import { Store } from '@ngrx/store'; import { selectCommitteeAccount } from '../../store/committee-account.selectors'; import { CommitteeAccount } from '../../shared/models/committee-account.model'; +import { Title } from '@angular/platform-browser'; @Component({ selector: 'app-transaction-container', templateUrl: './transaction-container.component.html', }) export class TransactionContainerComponent implements OnInit, OnDestroy { - transactionType: TransactionType = this.activatedRoute.snapshot.data['transactionType']; + transactionType: TransactionType | undefined; destroy$: Subject = new Subject(); - constructor(private activatedRoute: ActivatedRoute, private store: Store) {} + constructor(private activatedRoute: ActivatedRoute, private store: Store, private titleService: Title) { + activatedRoute.data.pipe(takeUntil(this.destroy$)).subscribe((data) => { + this.transactionType = data['transactionType']; + if (this.transactionType) { + const title = this.transactionType['title']; + this.titleService.setTitle(title); + } + }); + } ngOnInit(): void { this.store .select(selectCommitteeAccount) .pipe(takeUntil(this.destroy$)) .subscribe((committeeAccount: CommitteeAccount) => { - if (this.transactionType.transaction) { + if (this.transactionType?.transaction) { this.transactionType.transaction.filer_committee_id_number = committeeAccount.committee_id; } }); diff --git a/front-end/src/app/transactions/transactions-routing.module.ts b/front-end/src/app/transactions/transactions-routing.module.ts index a3e96b2132..ed21c56fec 100644 --- a/front-end/src/app/transactions/transactions-routing.module.ts +++ b/front-end/src/app/transactions/transactions-routing.module.ts @@ -17,11 +17,13 @@ import { TransactionListComponent } from './transaction-list/transaction-list.co const routes: Routes = [ { path: 'report/:reportId/list', + title: 'Manage your transactions', component: TransactionListComponent, resolve: { report: ReportResolver }, }, { path: 'report/:reportId/create', + title: 'Add a receipt', component: TransactionTypePickerComponent, canActivate: [ReportIsEditableGuard], }, diff --git a/front-end/src/app/users/users-routing.module.ts b/front-end/src/app/users/users-routing.module.ts index 081a24e787..c9fb88852e 100644 --- a/front-end/src/app/users/users-routing.module.ts +++ b/front-end/src/app/users/users-routing.module.ts @@ -6,6 +6,7 @@ const routes: Routes = [ { path: '', component: UserListComponent, + title: 'Manage Users', pathMatch: 'full', }, { path: '**', redirectTo: '' },