Skip to content

Commit

Permalink
PRIME-2360 Community Site and HA Site Snapshot (#2548)
Browse files Browse the repository at this point in the history
* initial commit

* Update mock-community-site.service.ts

* fix unit tests

* add hyper link to download business licence document from site snapshot

* fix PR issue

* update site submission detail to use the same component for contacts as site overview

* bug fix

* fix PR issue

* fix PR issue

* fix PR issue

* fix PR issues

* fix migration error

* update comments

* fix PR issue

* fix PR issues

* Minor changes for readability

* remove unused references

---------

Co-authored-by: Alan Leung <[email protected]>
  • Loading branch information
bergomi02 and neophyte57 authored Nov 25, 2024
1 parent 14b9797 commit f32c63a
Show file tree
Hide file tree
Showing 58 changed files with 21,783 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class HealthAuthorityResource {
});
return healthAuthoritySite;
}),
tap((healthAuthoritySite: HealthAuthoritySiteAdmin) => this.logger.info('HEALTH_AUTHORITY_SITE', healthAuthoritySite)),
tap((healthAuthoritySite: HealthAuthoritySiteAdmin) => this.logger.info('HEALTH_AUTHORITY_SITE 2', healthAuthoritySite)),
catchError((error: any) => {
this.toastService.openErrorToast('Health authority site could not be retrieved');
this.logger.error('[Core] HealthAuthorityResource::getHealthAuthorityAdminSite error has occurred: ', error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class HealthAuthoritySiteResource {
return { ...healthAuthoritySite, businessHours };
}),
map((healthAuthoritySiteDto: HealthAuthoritySiteDto) => HealthAuthoritySite.toHealthAuthoritySite(healthAuthoritySiteDto)),
tap((healthAuthoritySite: HealthAuthoritySite) => this.logger.info('HEALTH_AUTHORITY_SITE', healthAuthoritySite)),
tap((healthAuthoritySite: HealthAuthoritySite) => this.logger.info('HEALTH_AUTHORITY_SITE 1', healthAuthoritySite)),
catchError((error: any) => {
if (error.status === HttpStatusCode.NotFound) {
return of(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { SiteAdjudicationDocument } from '@registration/shared/models/adjudicati
import { BusinessLicence } from '@registration/shared/models/business-licence.model';
import { IndividualDeviceProvider } from '@registration/shared/models/individual-device-provider.model';
import { SiteRegistrationListViewModel } from '@registration/shared/models/site-registration.model';
import { SiteSubmission } from '@shared/models/site-submission.model';

@Injectable({
providedIn: 'root'
Expand Down Expand Up @@ -99,6 +100,29 @@ export class SiteResource {
);
}

public getSiteSubmissions(siteId: number): Observable<SiteSubmission[]> {
return this.apiResource.get<SiteSubmission[]>(`sites/${siteId}/site-submissions`, null, null, true)
.pipe(
tap((siteSubmissions: SiteSubmission[]) => this.logger.info('SITE_SUBMISSIONS', siteSubmissions)),
catchError((error: any) => {
this.toastService.openErrorToast('Site Submissions could not be retrieved');
this.logger.error('[SiteSubmissions] getSiteSubmissions::getSiteSubmissions error has occurred: ', error);
throw error;
})
);
}

public getSiteSubmission(siteId: number, siteSubmissionId: number): Observable<SiteSubmission> {
return this.apiResource.get<SiteSubmission>(`sites/${siteId}/site-submission/${siteSubmissionId}`, null, null, true)
.pipe(
tap((siteSubmission: SiteSubmission) => this.logger.info('SITE_SUBMISSION', siteSubmission)),
catchError((error: any) => {
this.toastService.openErrorToast('Site Submission could not be retrieved');
this.logger.error('[SiteSubmission] getSiteSubmission::getSiteSubmission error has occurred: ', error);
throw error;
})
);
}
public getSiteContacts(siteId: number): Observable<{ label: string, email: string }[]> {
return this.getSiteById(siteId)
.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ import { SiteOverviewPageComponent } from './pages/health-authorities/site-overv
import { SiteEventsPageComponent } from './pages/health-authorities/site-events-page/site-events-page.component';
import { SiteNotesPageComponent } from './pages/health-authorities/site-notes-page/site-notes-page.component';
import { SiteDocumentsPageComponent } from './pages/health-authorities/site-documents-page/site-documents-page.component';
import { HaSiteSubmissionListPageComponent } from './pages/health-authorities/ha-site-submission-list-page/ha-site-submission-list-page.component';
import { HaSiteSubmissionPageComponent } from './pages/health-authorities/ha-site-submission-page/ha-site-submission-page.component';
import { CommunitySiteSubmissionPageComponent } from './pages/community-site-submission-page/community-site-submission-page.component';
import { CommunitySiteSubmissionListPageComponent } from './pages/community-site-submission-list-page/community-site-submission-list-page.component';
import { AdminUsersPageComponent } from './pages/admin-users-page/admin-users-page.component';

const routes: Routes = [
Expand Down Expand Up @@ -311,7 +315,22 @@ const routes: Routes = [
path: AdjudicationRoutes.EVENT_LOG,
component: SiteEventsComponent,
data: { title: 'Event Log' }
}
},
{
path: AdjudicationRoutes.SITE_SUBMISSION_LIST,
children: [
{
path: '',
component: CommunitySiteSubmissionListPageComponent,
data: { title: 'Site Submission List' }
},
{
path: `:ssid/${AdjudicationRoutes.SITE_SUBMISSION}`,
component: CommunitySiteSubmissionPageComponent,
data: { title: 'Site Submission' }
}
]
},
]
},
{
Expand Down Expand Up @@ -375,6 +394,7 @@ const routes: Routes = [
}
]
},

{
// Site registrations is synonymous with site with regards
// to Health Authorities
Expand All @@ -399,7 +419,22 @@ const routes: Routes = [
path: AdjudicationRoutes.DOCUMENT_UPLOAD,
component: SiteDocumentsPageComponent,
data: { title: 'Adjudicator Documents' }
}
},
{
path: AdjudicationRoutes.SITE_SUBMISSION_LIST,
children: [
{
path: '',
component: HaSiteSubmissionListPageComponent,
data: { title: 'Site Submission List' }
},
{
path: `:ssid/${AdjudicationRoutes.SITE_SUBMISSION}`,
component: HaSiteSubmissionPageComponent,
data: { title: 'Site Submission' }
}
]
},
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ import { SiteOverviewPageComponent } from './pages/health-authorities/site-overv
import { SiteEventsPageComponent } from './pages/health-authorities/site-events-page/site-events-page.component';
import { SiteNotesPageComponent } from './pages/health-authorities/site-notes-page/site-notes-page.component';
import { SiteDocumentsPageComponent } from './pages/health-authorities/site-documents-page/site-documents-page.component';
import { CommunitySiteSubmissionPageComponent } from './pages/community-site-submission-page/community-site-submission-page.component';
import { CommunitySiteSubmissionListPageComponent } from './pages/community-site-submission-list-page/community-site-submission-list-page.component';
import { HaSiteSubmissionListPageComponent } from './pages/health-authorities/ha-site-submission-list-page/ha-site-submission-list-page.component';
import { HaSiteSubmissionPageComponent } from './pages/health-authorities/ha-site-submission-page/ha-site-submission-page.component';
import { SiteSubmissionListComponent } from './shared/components/site-submission-list/site-submission-list.component';
import { SiteSubmissionComponent } from './shared/components/site-submission/site-submission.component';
import { AdminUsersContainerComponent } from './shared/components/admin-users-container/admin-users-container.component';
import { AdminUsersPageComponent } from './pages/admin-users-page/admin-users-page.component';
import { AdminUsersTableComponent } from './shared/components/admin-users-table/admin-users-table.component';
Expand Down Expand Up @@ -161,6 +167,12 @@ import { AdminUsersTableComponent } from './shared/components/admin-users-table/
SiteEventsPageComponent,
SiteNotesPageComponent,
SiteDocumentsPageComponent,
CommunitySiteSubmissionPageComponent,
CommunitySiteSubmissionListPageComponent,
HaSiteSubmissionListPageComponent,
HaSiteSubmissionPageComponent,
SiteSubmissionComponent,
SiteSubmissionListComponent,
AdminUsersContainerComponent,
AdminUsersPageComponent,
AdminUsersTableComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export class AdjudicationRoutes {
public static SITE_REMOTE_USERS = 'remote-users';
public static SITE_INFORMATION = 'site-information';

public static SITE_SUBMISSION_LIST = 'site-submission-list';
public static SITE_SUBMISSION = 'site-submission';

public static HEALTH_AUTHORITIES = 'health-authorities';
public static HEALTH_AUTH_CARE_TYPES = 'health-auth-care-types';
public static HEALTH_AUTH_VENDORS = 'vendors';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<app-site-registration-container [content]="content"
[hasActions]="hasActions">
<app-page-header>Site Submission List</app-page-header>
</app-site-registration-container>

<ng-template #content>
<app-site-submission-list [siteId]="siteId"
[currentSubmissionId]="currentSubmissionId"></app-site-submission-list>
</ng-template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { CommunitySiteSubmissionListPageComponent } from './community-site-submission-list-page.component';
import { RouterTestingModule } from '@angular/router/testing';
import { APP_CONFIG, APP_DI_CONFIG } from 'app/app-config.module';
import { KeycloakService } from 'keycloak-angular';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { AdjudicationModule } from '@adjudication/adjudication.module';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CommunitySiteSubmissionListPageComponent],
imports: [
BrowserAnimationsModule,
HttpClientTestingModule,
RouterTestingModule,
AdjudicationModule
],
providers: [
{
provide: APP_CONFIG,
useValue: APP_DI_CONFIG
},
KeycloakService
],
})
.compileComponents();
});

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { SiteResource } from '@core/resources/site-resource.service';

@Component({
selector: 'app-community-site-submission-list-page',
templateUrl: './community-site-submission-list-page.component.html',
styleUrls: ['./community-site-submission-list-page.component.scss']
})
export class CommunitySiteSubmissionListPageComponent implements OnInit {
public hasActions: boolean;
public siteId: number;
public currentSubmissionId: number;

constructor(
private route: ActivatedRoute,
private siteResource: SiteResource,
) {
this.hasActions = false;
}

ngOnInit(): void {
this.siteId = +this.route.snapshot.params.sid;
this.siteResource.getSiteById(this.siteId)
.subscribe(site => this.currentSubmissionId = site.currentSubmission?.id);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<app-site-registration-container [content]="content"
[hasActions]="hasActions">
<app-page-header>Site Information</app-page-header>
</app-site-registration-container>

<ng-template #content>
<app-site-submission [siteId]="siteId"
[siteSubmissionId]="siteSubmissionId"></app-site-submission>
</ng-template>

<div class="row justify-content-between">
<div class="col pt-4">

<button mat-stroked-button
type="button"
(click)="routeRelativeTo(['../'])">Back</button>

</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { CommunitySiteSubmissionPageComponent } from './community-site-submission-page.component';
import { RouterTestingModule } from '@angular/router/testing';
import { APP_CONFIG, APP_DI_CONFIG } from 'app/app-config.module';
import { KeycloakService } from 'keycloak-angular';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { AdjudicationModule } from '@adjudication/adjudication.module';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CommunitySiteSubmissionPageComponent],
imports: [
BrowserAnimationsModule,
HttpClientTestingModule,
RouterTestingModule,
AdjudicationModule
],
providers: [
{
provide: APP_CONFIG,
useValue: APP_DI_CONFIG
},
KeycloakService
],
})
.compileComponents();
});

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { AbstractComponent } from '@shared/classes/abstract-component';

@Component({
selector: 'app-community-site-submission-page',
templateUrl: './community-site-submission-page.component.html',
styleUrls: ['./community-site-submission-page.component.scss']
})
export class CommunitySiteSubmissionPageComponent extends AbstractComponent implements OnInit {
public hasActions: boolean;

public siteId: number;
public siteSubmissionId: number;

constructor(
protected route: ActivatedRoute,
protected router: Router,
) {
super(route, router);
this.hasActions = false;
}

ngOnInit(): void {
this.siteId = +this.route.snapshot.params.sid;
this.siteSubmissionId = +this.route.snapshot.params.ssid;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<app-health-authority-site-container [content]="content"
[hasActions]="hasActions">
<app-page-header>Site Submission List</app-page-header>
</app-health-authority-site-container>

<ng-template #content>
<app-site-submission-list [siteId]="siteId"
[currentSubmissionId]="currentSubmissionId"></app-site-submission-list>
</ng-template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { HaSiteSubmissionListPageComponent } from './ha-site-submission-list-page.component';
import { RouterTestingModule } from '@angular/router/testing';
import { APP_CONFIG, APP_DI_CONFIG } from 'app/app-config.module';
import { KeycloakService } from 'keycloak-angular';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { AdjudicationModule } from '@adjudication/adjudication.module';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [HaSiteSubmissionListPageComponent],
imports: [
BrowserAnimationsModule,
HttpClientTestingModule,
RouterTestingModule,
AdjudicationModule
],
providers: [
{
provide: APP_CONFIG,
useValue: APP_DI_CONFIG
},
KeycloakService
],
})
.compileComponents();
});

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit f32c63a

Please sign in to comment.