Skip to content

Commit

Permalink
Merge pull request #1751 from fecgov/release/sprint-38
Browse files Browse the repository at this point in the history
Release/sprint 38
  • Loading branch information
Elaine-Krauss-TCG authored Mar 11, 2024
2 parents ef482c5 + 548f184 commit cf82f6e
Show file tree
Hide file tree
Showing 133 changed files with 2,250 additions and 1,232 deletions.
89 changes: 12 additions & 77 deletions front-end/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,104 +1,31 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DashboardComponent } from './dashboard/dashboard.component';
import { BackgroundStyles, LayoutComponent } from './layout/layout.component';
import { SidebarStateResolver } from './shared/resolvers/sidebar-state.resolver';
import { LayoutComponent } from './layout/layout.component';
import { SingleClickResolver } from './shared/resolvers/single-click.resolver';
import { committeeGuard } from './shared/guards/committee.guard';
import { SelectCommitteeComponent } from './committee/select-committee/select-committee.component';
import { LoginComponent } from './login/login/login.component';
import { LoginGuard } from './shared/guards/login-page.guard';
import { UpdateCurrentUserComponent } from './users/update-current-user/update-current-user.component';
import { nameGuard } from './shared/guards/name.guard';
import { SecurityNoticeComponent } from './login/security-notice/security-notice.component';
import { securityNoticeGuard } from './shared/guards/security-notice.guard';
import { HeaderStyles } from './layout/header/header.component';

const routes: Routes = [
{
path: 'login',
component: LayoutComponent,
children: [
{
path: '',
component: LoginComponent,
resolve: { sidebar: SidebarStateResolver },
data: {
showUpperFooter: false,
showCommitteeBanner: false,
headerStyle: HeaderStyles.LOGIN,
backgroundStyle: BackgroundStyles.LOGIN,
},
},
],
},
{
path: 'current',
component: LayoutComponent,
canActivate: [LoginGuard],
children: [
{
path: '',
component: UpdateCurrentUserComponent,
data: {
showCommitteeBanner: false,
showHeader: false,
showUpperFooter: false,
},
},
],
},
{
path: 'security-notice',
title: 'Security Notice',
canActivate: [LoginGuard, nameGuard],
component: LayoutComponent,
children: [
{
path: '',
component: SecurityNoticeComponent,
data: {
showCommitteeBanner: false,
showUpperFooter: false,
showHeader: false,
backgroundStyle: BackgroundStyles.SECURITY_NOTICE,
},
},
],
},
{
path: 'select-committee',
component: LayoutComponent,
canActivate: [LoginGuard, nameGuard, securityNoticeGuard],
children: [
{
path: '',
component: SelectCommitteeComponent,
resolve: { sidebar: SidebarStateResolver },
data: {
showUpperFooter: false,
headerStyle: HeaderStyles.LOGOUT,
},
},
],
},
{
path: '',
component: LayoutComponent,
resolve: { sidebar: SidebarStateResolver, singleClick: SingleClickResolver },
canActivate: [LoginGuard, nameGuard, securityNoticeGuard, committeeGuard],
resolve: { singleClick: SingleClickResolver },
runGuardsAndResolvers: 'always',
children: [
{ path: 'committee', loadChildren: () => import('./committee/committee.module').then((m) => m.CommitteeModule) },
{
path: '',
pathMatch: 'full',
redirectTo: 'login',
redirectTo: 'dashboard',
},
{
path: 'dashboard',
component: DashboardComponent,
title: 'FECFile Dashboard',
canActivate: [LoginGuard, nameGuard, securityNoticeGuard, committeeGuard],
},
{
path: 'login',
Expand All @@ -107,22 +34,30 @@ const routes: Routes = [
{
path: 'reports',
loadChildren: () => import('./reports/reports.module').then((m) => m.ReportsModule),
data: {
showSidebar: true,
},
canActivate: [LoginGuard, nameGuard, securityNoticeGuard, committeeGuard],
},
{
path: 'contacts',
loadChildren: () => import('./contacts/contacts.module').then((m) => m.ContactsModule),
canActivate: [LoginGuard, nameGuard, securityNoticeGuard, committeeGuard],
},
{
path: 'tools',
loadChildren: () => import('./tools/tools.module').then((m) => m.ToolsModule),
canActivate: [LoginGuard, nameGuard, securityNoticeGuard, committeeGuard],
},
{
path: 'help',
loadChildren: () => import('./help/help.module').then((m) => m.HelpModule),
canActivate: [LoginGuard, nameGuard, securityNoticeGuard, committeeGuard],
},
{
path: 'notifications',
loadChildren: () => import('./notifications/notifications.module').then((m) => m.NotificationsModule),
canActivate: [LoginGuard, nameGuard, securityNoticeGuard, committeeGuard],
},
],
},
Expand Down
5 changes: 1 addition & 4 deletions front-end/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import { localStorageSync } from 'ngrx-store-localstorage';
import { activeReportReducer } from './store/active-report.reducer';
import { AppState } from './store/app-state.model';
import { committeeAccountReducer } from './store/committee-account.reducer';
import { LoginEffects } from './store/login.effects';
import { loginReducer } from './store/login.reducer';
import { sidebarStateReducer } from './store/sidebar-state.reducer';
import { singleClickReducer } from './store/single-click.reducer';

// PrimeNG
Expand Down Expand Up @@ -93,11 +91,10 @@ const metaReducers: Array<MetaReducer<AppState, Action>> = [localStorageSyncRedu
singleClickDisabled: singleClickReducer,
userLoginData: loginReducer,
activeReport: activeReportReducer,
sidebarState: sidebarStateReducer,
},
{ metaReducers },
),
EffectsModule.forRoot([LoginEffects]),
EffectsModule.forRoot([]),
MenubarModule,
PanelMenuModule,
PanelModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CommitteeAccount } from 'app/shared/models/committee-account.model';
import { FecFiling } from 'app/shared/models/fec-filing.model';
import { FecApiService } from 'app/shared/services/fec-api.service';
import { LabelUtils, PrimeOptions, StatesCodeLabels } from 'app/shared/utils/label.utils';
import { ValidateUtils } from 'app/shared/utils/validate.utils';
import { SchemaUtils } from 'app/shared/utils/schema.utils';
import { selectCommitteeAccount } from 'app/store/committee-account.selectors';
import { Observable, takeUntil } from 'rxjs';
import { DestroyerComponent } from 'app/shared/components/app-destroyer.component';
Expand Down Expand Up @@ -46,15 +46,15 @@ export class CommitteeInfoComponent extends DestroyerComponent implements OnInit
private store: Store,
private fecApiService: FecApiService,
private fb: FormBuilder,
private readonly changeDetectorRef: ChangeDetectorRef
private readonly changeDetectorRef: ChangeDetectorRef,
) {
super();
}
ngAfterViewInit(): void {
this.committeeAccount$ = this.store.select(selectCommitteeAccount);
this.committeeAccount$?.pipe(takeUntil(this.destroy$)).subscribe((committee: CommitteeAccount) => {
this.fecApiService
.getCommitteeRecentFiling(committee.committee_id)
.getCommitteeRecentF1Filing(committee.committee_id)
.subscribe((mostRecentFiling: FecFiling | undefined) => {
this.mostRecentFilingPdfUrl = mostRecentFiling?.pdf_url;
});
Expand All @@ -72,7 +72,7 @@ export class CommitteeInfoComponent extends DestroyerComponent implements OnInit
}

ngOnInit(): void {
this.form = this.fb.group(ValidateUtils.getFormGroupFields(this.formProperties));
this.form = this.fb.group(SchemaUtils.getFormGroupFields(this.formProperties));
this.stateOptions = LabelUtils.getPrimeOptions(StatesCodeLabels);
}

Expand Down
15 changes: 14 additions & 1 deletion front-end/src/app/committee/committee.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,20 @@ import { SelectCommitteeComponent } from './select-committee/select-committee.co
import { DividerModule } from 'primeng/divider';
import { DropdownModule } from 'primeng/dropdown';
import { CardModule } from 'primeng/card';
import { RegisterCommitteeComponent } from './register-committee/register-committee.component';
import { AutoCompleteModule } from 'primeng/autocomplete';
import { RippleModule } from 'primeng/ripple';
import { DialogModule } from 'primeng/dialog';

@NgModule({
declarations: [ManageCommitteeComponent, SelectCommitteeComponent, CommitteeInfoComponent],
declarations: [
ManageCommitteeComponent,
SelectCommitteeComponent,
CommitteeInfoComponent,
RegisterCommitteeComponent,
],
imports: [
AutoCompleteModule,
CommonModule,
FormsModule,
ReactiveFormsModule,
Expand All @@ -33,7 +43,10 @@ import { CardModule } from 'primeng/card';
ToastModule,
ToolbarModule,
ConfirmDialogModule,
DialogModule,
SharedModule,
RippleModule,
DialogModule,
],
})
export class CommitteeModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<h1>Manage Users</h1>
</ng-template>
<ng-template pTemplate="right">
<button pButton pRipple label="Add User" icon="pi pi-plus" class="p-button"></button>
<button (click)="addItem()" class="p-button" icon="pi pi-plus" label="Add User" pButton pRipple></button>
</ng-template>
</p-toolbar>
<p-divider></p-divider>
Expand All @@ -16,56 +16,62 @@ <h1>Existing Users</h1>
</p-toolbar>

<p-table
#dt
[value]="items"
[lazy]="true"
(onLazyLoad)="loadTableItems($event)"
responsiveLayout="scroll"
dataKey="id"
[selection]="selectedItems"
(selectionChange)="onSelectionChange($event)"
[selectAll]="selectAll"
(selectAllChange)="onSelectAllChange($event)"
(selectionChange)="onSelectionChange($event)"
[globalFilterFields]="['first_name', 'last_name', 'email', 'role', 'is_active']"
[lazy]="true"
[loading]="loading"
[paginator]="true"
[rows]="10"
[selectAll]="selectAll"
[selection]="selectedItems"
[showCurrentPageReport]="true"
[totalRecords]="totalItems"
[loading]="loading"
[globalFilterFields]="['first_name', 'last_name', 'email', 'role', 'is_active']"
[value]="items"
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} users"
[showCurrentPageReport]="true"
dataKey="id"
responsiveLayout="scroll"
sortField="created"
>
<ng-template pTemplate="caption">
<div class="flex align-items-center justify-content-between">
<h3 class="m-0">Existing Users</h3>
</div>
</ng-template>
<ng-template pTemplate="sorticon" let-sortOrder>
<ng-template let-sortOrder pTemplate="sorticon">
<app-table-sort-icon [sortOrder]="sortOrder"></app-table-sort-icon>
</ng-template>
<ng-template pTemplate="header">
<tr role="row">
<th pSortableColumn="name" id="name-column" role="columnheader">Name <p-sortIcon field="name"></p-sortIcon></th>
<th pSortableColumn="email" id="email-column" role="columnheader">
Email <p-sortIcon field="email"></p-sortIcon>
<th id="name-column" pSortableColumn="name" role="columnheader">Name
<p-sortIcon field="name"></p-sortIcon>
</th>
<th id="email-column" pSortableColumn="email" role="columnheader">
Email
<p-sortIcon field="email"></p-sortIcon>
</th>
<th pSortableColumn="role" id="role-column" role="columnheader">Role <p-sortIcon field="role"></p-sortIcon></th>
<th pSortableColumn="is_active" id="active-column" role="columnheader">
Status <p-sortIcon field="is_active"></p-sortIcon>
<th id="role-column" pSortableColumn="role" role="columnheader">Role
<p-sortIcon field="role"></p-sortIcon>
</th>
<th id="active-column" pSortableColumn="is_active" role="columnheader">
Status
<p-sortIcon field="is_active"></p-sortIcon>
</th>
<th id="buttons" role="columnheader">Actions</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-item>
<ng-template let-item pTemplate="body">
<tr role="row">
<td>{{ item.last_name }}, {{ item.first_name }}</td>
<td>{{ item.name }}</td>
<td>{{ item.email }}</td>
<td>{{ item.getRoleLabel() }}</td>
<td>Registered</td>
<td>{{ item.is_active ? 'Active' : 'Pending' }}</td>
<td>
<app-table-actions-button
[tableActions]="rowActions"
[actionItem]="item"
(tableActionClick)="onRowActionClick($event.action, $event.actionItem)"
[actionItem]="item"
[tableActions]="rowActions"
buttonIcon="pi pi-ellipsis-v"
buttonStyleClass="flex justify-content-center p-button-rounded p-button-primary p-button-text mr-2"
></app-table-actions-button>
Expand All @@ -75,4 +81,20 @@ <h3 class="m-0">Existing Users</h3>
</p-table>
</p-card>

<p-confirmDialog #cd [style]="{ width: '450px' }">
<ng-template pTemplate="footer">
<span class="confirm-footer">
<button (click)="cd.reject()" class="p-button-secondary" label="Cancel" pButton type="button"></button>
<button (click)="cd.accept()" label="Confirm" pButton type="button"></button>
</span>
</ng-template>
</p-confirmDialog>

<app-committee-member-dialog
(detailClose)="detailVisible = false"
(saveMembership)="saveMembership($event)"
[(detailVisible)]="detailVisible"
></app-committee-member-dialog>

<p-confirmDialog [style]="{ width: '450px' }"></p-confirmDialog>

Loading

0 comments on commit cf82f6e

Please sign in to comment.