Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bergomi02 committed Oct 22, 2024
1 parent 93a02c3 commit 9b5dc84
Show file tree
Hide file tree
Showing 17 changed files with 291 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { SiteRegistrationNote } from '@shared/models/site-registration-note.mode

import { AdjudicationRoutes } from '@adjudication/adjudication.routes';
import { AdjudicationResource } from '../services/adjudication-resource.service';
import { SiteActionEnum, SiteArchiveRestoreComponent } from '@shared/components/dialogs/content/site-archive-restore/site-archive-restore.component';

export abstract class AbstractSiteAdminPage {
public abstract busy: Subscription;
Expand Down Expand Up @@ -198,7 +199,7 @@ export abstract class AbstractSiteAdminPage {
message: 'Are you sure you want to reject this Site Registration?',
actionText: 'Reject Site Registration',
actionType: 'warn',
component: NoteComponent
component: NoteComponent,
};

this.busy = this.dialog.open(ConfirmDialogComponent, { data })
Expand Down Expand Up @@ -227,30 +228,16 @@ export abstract class AbstractSiteAdminPage {

public onArchive(siteId: number): void {
const data: DialogOptions = {
title: 'Archive Site Registration',
message: 'Are you sure you want to archive this Site Registration?',
actionText: 'Archive Site',
actionType: 'warn',
component: NoteComponent
data: {
siteId: siteId,
action: SiteActionEnum.Archive,
}
};

this.busy = this.dialog.open(ConfirmDialogComponent, { data })
this.busy = this.dialog.open(SiteArchiveRestoreComponent, { data })
.afterClosed()
.pipe(
exhaustMap((result: { output: string }) =>
(result)
? of(result.output ?? null)
: EMPTY
),
exhaustMap((note: string) =>
this.siteResource.archiveSite(siteId, note)
.pipe(
map(() => this.updateSite(siteId, { status: SiteStatusType.ARCHIVED })),
map(() => note)
)
)
)
.subscribe(() => this.onRefresh());
.subscribe((result: { reload: boolean }) => (result?.reload) ?
this.getDataset(this.route.snapshot.queryParams) : noop);
}

public onRestore(siteId: number): void {
Expand All @@ -260,33 +247,20 @@ export abstract class AbstractSiteAdminPage {

if (value) {
const data: DialogOptions = {
title: 'Restore Archived Site Registration',
message: 'Are you sure you want to restore this Site Registration?',
actionText: 'Restore Site',
actionType: 'warn',
component: NoteComponent
data: {
siteId: siteId,
action: SiteActionEnum.Restore,
}
};

this.busy = this.dialog.open(ConfirmDialogComponent, { data })
this.busy = this.dialog.open(SiteArchiveRestoreComponent, { data })
.afterClosed()
.pipe(
exhaustMap((result: { output: string }) =>
(result)
? of(result.output ?? null)
: EMPTY
),
exhaustMap((note: string) =>
this.siteResource.restoreArchivedSite(siteId, note)
.pipe(
map(() => this.updateSite(siteId, { status: SiteStatusType.EDITABLE })),
map(() => note)
)
)
)
.subscribe(() => this.onRefresh());
.subscribe((result: { reload: boolean }) => (result?.reload) ?
this.getDataset(this.route.snapshot.queryParams) : noop);

} else {
const data: DialogOptions = {
title: 'Restore Archived Site Registration',
title: 'Restore Archived Site',
message: 'Site ID has been used in a different site. This Site can\'t be restored.',
cancelText: "Close",
actionType: 'warn',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ export class SiteRegistrationActionsComponent implements OnInit {
case SiteStatusType.IN_REVIEW:
return (action === SiteAdjudicationAction.REQUEST_CHANGES
|| action === SiteAdjudicationAction.APPROVE
|| action === SiteAdjudicationAction.REJECT);
|| action === SiteAdjudicationAction.REJECT
|| action === SiteAdjudicationAction.ARCHIVE);
case SiteStatusType.LOCKED:
return (action === SiteAdjudicationAction.UNREJECT);
case SiteStatusType.ARCHIVED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export class SiteRegistrationContainerComponent extends AbstractSiteAdminPage im
signingAuthority,
signingAuthorityName: `${signingAuthority.firstName ? signingAuthority.firstName : ''} ${signingAuthority.lastName}`,
organizationName: name,
duplicatePecSiteCount: 0,
name,
organizationDoingBusinessAs: doingBusinessAs,
hasClaim,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,17 @@
*matHeaderCellDef
scope="col"> Site ID </th>
<td mat-cell
*matCellDef="let row;"> {{ row.pec | default }} </td>
*matCellDef="let row;">
<div class="d-flex align-items-center">
{{ row.pec | default }}
<mat-icon *ngIf="row?.duplicatePecSiteCount && row?.duplicatePecSiteCount > 0"
[matTooltip]="getDuplicatePecText(row)"
class="pec-alert"
(click)="onPecFilter(row.pec)"
matTooltipPosition="after">info
</mat-icon>
</div>
</td>
</ng-container>

<ng-container matColumnDef="remoteUsers">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@
.red {
color: orangered;
}

.pec-alert {
color: theme-palette(yellow);
font-size: large;
}

.prefix-container {
height: 48px;
width: 24px;
padding-top: 3px;
padding-bottom: 3px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class SiteRegistrationTableComponent implements OnInit, AfterViewInit {
@Output() public notify: EventEmitter<{ siteId: number }>;
@Output() public reload: EventEmitter<number>;
@Output() public route: EventEmitter<string | (string | number)[]>;
@Output() public pecFilter: EventEmitter<string>;

@ViewChild(MatPaginator, { static: true }) public paginator: MatPaginator;
@ViewChild('secondaryPaginator', { static: true }) public secondaryPaginator: MatPaginator;
Expand Down Expand Up @@ -71,7 +72,7 @@ export class SiteRegistrationTableComponent implements OnInit, AfterViewInit {
this.reload = new EventEmitter<number>();
this.route = new EventEmitter<string | (string | number)[]>();
this.routeUtils = new RouteUtils(activatedRoute, router, AdjudicationRoutes.routePath(AdjudicationRoutes.SITE_REGISTRATIONS));

this.pecFilter = new EventEmitter<string>();
}

public onAssign(siteId: number): void {
Expand Down Expand Up @@ -172,6 +173,14 @@ export class SiteRegistrationTableComponent implements OnInit, AfterViewInit {
}
});
}

public getDuplicatePecText(row: SiteRegistrationListViewModel) {
return `${row.duplicatePecSiteCount + 1} sites share the same site ID`;
}

public onPecFilter(pec: string) {
this.pecFilter.emit(pec);
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
[id]="CareSettingEnum.HEALTH_AUTHORITY">
<ng-template matTabContent>
<div class="mt-3">
<app-search-ha-form #searchHaForm
<app-search-ha-form #searchHaSiteForm
(search)="onSearch($event)"
(siteStatus)="onSiteStatusChange($event)"
(vendor)="onVendorChange($event)"
Expand All @@ -57,7 +57,7 @@
(notify)="onNotify($event)"
(route)="onRoute($event)"
(reload)="onRefresh()"
(pecFilter)="onTextSearch($event)"></app-health-authority-table>
(pecFilter)="onTextSearchHaSite($event)"></app-health-authority-table>
</div>
</ng-template>
</mat-tab>
Expand All @@ -67,7 +67,8 @@
let-columns="columns"
let-localStoragePrefix="localStoragePrefix">
<div class="mt-3">
<app-search-form *ngIf="showSearchFilter"
<app-search-form #searchComSiteForm
*ngIf="showSearchFilter"
[hideStatus]="false"
[statusType]="SearchFormStatusType.SiteStatuses"
[localStoragePrefix]="localStoragePrefix"
Expand All @@ -84,6 +85,7 @@
(reassign)="onReassign($event)"
(notify)="onNotify($event)"
(route)="onRoute($event)"
(reload)="onRefresh()"></app-site-registration-table>
(reload)="onRefresh()"
(pecFilter)="onTextSearchComSite($event)"></app-site-registration-table>
</ng-template>
</app-page>
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import { SearchHAFormComponent } from '../search-ha-form/search-ha-form.componen
export class SiteRegistrationTabsComponent extends AbstractSiteAdminPage implements OnInit {
public busy: Subscription;
@Input() public refresh: Observable<boolean>;
@ViewChild('searchHaForm') searchHaForm: SearchHAFormComponent;
@ViewChild('searchHaSiteForm') searchHaSiteForm: SearchHAFormComponent;
@ViewChild('searchComSiteForm') searchComSiteForm: SearchHAFormComponent;

public dataSource: MatTableDataSource<SiteRegistrationListViewModel>;
public healthAuthoritySites: HealthAuthoritySiteAdminList[];
Expand Down Expand Up @@ -129,9 +130,14 @@ export class SiteRegistrationTabsComponent extends AbstractSiteAdminPage impleme
this.routeUtils.removeQueryParams({ careSetting: this.tabIndexToCareSettingMap[tabChangeEvent.index], page: null });
}

public onTextSearch(textSearch: string | null): void {
public onTextSearchHaSite(textSearch: string | null): void {
this.routeUtils.updateQueryParams({ textSearch, page: null });
this.searchHaForm.textSearch.setValue(textSearch);
this.searchHaSiteForm.textSearch.setValue(textSearch);
}

public onTextSearchComSite(textSearch: string | null): void {
this.routeUtils.updateQueryParams({ textSearch, page: null });
this.searchComSiteForm.textSearch.setValue(textSearch);
}

public ngOnInit(): void {
Expand Down Expand Up @@ -175,6 +181,10 @@ export class SiteRegistrationTabsComponent extends AbstractSiteAdminPage impleme
} else {
this.busy = this.getPaginatedSites({ careSettingCode, ...queryParams })
.subscribe((paginatedList: PaginatedList<SiteRegistrationListViewModel>) => {
paginatedList.results.forEach((s: SiteRegistrationListViewModel) => {
s.duplicatePecSiteCount = paginatedList.results.filter((innerSite: SiteRegistrationListViewModel) => innerSite.id !== s.id
&& innerSite.pec && innerSite.pec === s.pec).length;
});
this.dataSource.data = paginatedList.results;
this.pagination = paginatedList;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
[ngTemplateOutletContext]="{
props: {
icon: 'not_interested',
text: 'Closed'
text: 'Archived'
}
}">
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ export interface OrganizationSearchListViewModel {
export interface SiteRegistrationListViewModel extends OrganizationListViewModelPartial, SiteListViewModelPartial {
signingAuthorityName: string;
organizationName: string;

duplicatePecSiteCount: number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<h2 mat-dialog-title
class="d-flex align-items-stretch">
<mat-icon color="warn">warning</mat-icon>
<span class="flex-grow-1">
{{ title }}
</span>
</h2>
<mat-dialog-content>
<p>
{{ message }}
</p>
<form [formGroup]="form">
<mat-form-field class="w-100">
<textarea matInput
placeholder="Note"
rows="10"
formControlName="note"></textarea>
<mat-error *ngIf="note.hasError('required')">Required</mat-error>
</mat-form-field>
</form>
<div class="mt-4">
<div class="row">
<div class="col-6">
<button mat-stroked-button
(click)="onCancel()"
class="my-2 mr-2">Cancel</button>
</div>
<div class="col-6 text-right">
<button mat-flat-button
(click)="onSubmit()"
color="warn"
class="my-2 mr-1">
{{ actionText }}
</button>
</div>
</div>
</div>
</mat-dialog-content>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@import 'palette';
@import 'bootstrap/bootstrap-imports';

h2 {
color: theme-palette(blue);

.mat-icon {
font-size: 3rem;
}

img,
.mat-icon {
margin-right: 15px;
width: 50px;
height: 50px;
}

span {
border-bottom: 1px solid #eeee;
font-size: 1.75rem;
line-height: 3rem;
}
}
Loading

0 comments on commit 9b5dc84

Please sign in to comment.