Skip to content

Commit

Permalink
EMBCESSMOD-5076: etransfer eligibility flag in search results (#2388)
Browse files Browse the repository at this point in the history
  • Loading branch information
ytqsl authored Jul 17, 2024
1 parent b04085f commit 4bed282
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class RegistrantProfileSearchResult
public IEnumerable<EvacuationFileSearchResult> EvacuationFiles { get; set; }
public bool IsProfileCompleted { get; set; }
public bool IsAuthenticated { get; set; }
public bool IsMinor { get; set; }
}

public class EvacuationFileSearchResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Injectable } from '@angular/core';
providedIn: 'root'
})
export class ApiConfiguration {
rootUrl: string = 'https://dev-era-responders.apps.silver.devops.gov.bc.ca';
rootUrl: string = '';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface RegistrantProfileSearchResult {
firstName?: string | null;
id?: string | null;
isAuthenticated?: boolean;
isMinor?: boolean;
isProfileCompleted?: boolean;
isRestricted?: boolean;
lastName?: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ export interface EvacueeSearchResults {
export interface RegistrantProfileSearchResultModel extends RegistrantProfileSearchResult {
primaryAddress?: null | AddressModel;
evacuationFiles?: null | Array<EvacuationFileSearchResultModel>;
etransferEligible?: boolean;
}

export interface EvacuationFileSearchResultModel extends EvacuationFileSearchResult {
evacuatedFrom?: null | AddressModel;
etransferEligible?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { AddressModel } from '../models/address.model';
import { EvacuationFileSearchResultModel } from '../models/evacuation-file-search-result.model';
import { EvacuationFileSummaryModel } from '../models/evacuation-file-summary.model';
import { EvacueeDetailsModel } from '../models/evacuee-search-context.model';
import { EvacueeSearchResults } from '../models/evacuee-search-results';
import { EvacueeSearchResults, RegistrantProfileSearchResultModel } from '../models/evacuee-search-results';
import { FileLinkRequestModel } from '../models/fileLinkRequest.model';
import { RegistrantProfileModel } from '../models/registrant-profile.model';
import { ComputeRulesService } from './computeRules.service';
Expand Down Expand Up @@ -103,6 +103,7 @@ export class EvacueeProfileService {
...addressModel,
...registrant.primaryAddress
};
registrant.etransferEligible = this.isEtransferEligible(registrant);
}

for (const file of essFiles) {
Expand All @@ -115,6 +116,10 @@ export class EvacueeProfileService {
...fileAddressModel,
...file.evacuatedFrom
};
const householdMemberProfile = registrants.find(
(r) => r.id === file.householdMembers.find((hm) => hm.isSearchMatch === true)?.id
);
file.etransferEligible = householdMemberProfile?.etransferEligible ?? false;
}

searchResult?.files?.sort((a, b) => new Date(b.modifiedOn).valueOf() - new Date(a.modifiedOn).valueOf());
Expand Down Expand Up @@ -293,4 +298,13 @@ export class EvacueeProfileService {
country
};
}

private isEtransferEligible(registrant: RegistrantProfileSearchResultModel): boolean {
return (
registrant.isAuthenticated &&
registrant.primaryAddress?.stateProvinceCode === 'BC' &&
registrant.primaryAddress?.postalCode !== null &&
!registrant.isMinor
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export class SearchDataService extends DashboardService {
tap({
next: (result) => {},
error: (error) => {
console.error('Error searching for evacuee:', error);
this.alertService.clearAlert();
this.alertService.setAlert('danger', globalConst.evacueeSearchError);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
<div class="col-md-3">
<div class="row">
<div class="col-md-12 metaData-align">
@if (fileResult?.etransferEligible) {
<p class="etransfer-chip">e-Transfer eligible</p>
}
<p>
ESS File Created:
<b>{{ fileResult?.createdOn | date: 'dd-MMM-yyyy' }}</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@

.metaData-align {
text-align: right;

.etransfer-chip {
background-color: #3c9d0f;
color: #fff;
padding: 5px 10px;
text-align: center;
font-weight: bold;
border-radius: 52px;
margin-right: 0;
margin-left: auto;
display: table;
}
}

.member-type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
Component,
Input,
OnChanges,
OnInit,
SimpleChanges,
ViewChild
} from '@angular/core';
Expand Down Expand Up @@ -112,6 +111,7 @@ export class EssFilesResultsComponent implements OnChanges, AfterViewInit, After
}, 200);
},
error: (error) => {
console.error(error);
this.essFilesResultsService.setloadingOverlay(false);
this.alertService.clearAlert();
this.alertService.setAlert('danger', globalConst.securityPhraseError);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<div class="col-md-4">
<div class="row">
<div class="col-md-12 metaData-align">
@if (registrantResult?.etransferEligible) {
<p class="etransfer-chip">e-Transfer eligible</p>
}
<p>
Profile Created:
<b>{{ registrantResult?.createdOn | date: 'dd-MMM-yyyy' }}</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@

.metaData-align {
text-align: right;

.etransfer-chip {
background-color: #3c9d0f;
color: #fff;
padding: 5px 10px;
text-align: center;
font-weight: bold;
border-radius: 52px;
margin-right: 0;
margin-left: auto;
display: table;
}
}

.section-heading {
Expand Down

0 comments on commit 4bed282

Please sign in to comment.