diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/common-application.service.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/common-application.service.ts index ad15a2c57..98fbe45d8 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/common-application.service.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/common-application.service.ts @@ -670,8 +670,7 @@ export class CommonApplicationService { const selServiceTypeCodeDesc = this.optionsPipe.transform(serviceTypeCode, 'ServiceTypes'); if (licence) { if (licence.serviceTypeCode !== serviceTypeCode) { - // ServiceTypeCode does not match - messageError = `This licence number is not a ${selServiceTypeCodeDesc}.`; + messageError = this.getLicenceLookupServiceTypeCodeMismatchErrorMessage(selServiceTypeCodeDesc); } else { if (!isExpired) { const securityIndustryLicensingUrl = SPD_CONSTANTS.urls.securityIndustryLicensingUrl; @@ -683,16 +682,27 @@ export class CommonApplicationService { } } } else { - if (serviceTypeCode === ServiceTypeCode.SecurityBusinessLicence) { - messageError = `This ${selServiceTypeCodeDesc} number does not match any existing ${selServiceTypeCodeDesc}s for your business in BC.`; - } else { - messageError = `This ${selServiceTypeCodeDesc} number does not match any existing ${selServiceTypeCodeDesc}s.`; - } + messageError = this.getLicenceLookupNoMatchErrorMessage(serviceTypeCode, selServiceTypeCodeDesc); } return [messageWarn, messageError]; } + setLicenceLookupMessage(licence: LicenceResponse | null, serviceTypeCode: ServiceTypeCode): string | null { + let messageError = null; + + const selServiceTypeCodeDesc = this.optionsPipe.transform(serviceTypeCode, 'ServiceTypes'); + if (licence) { + if (licence.serviceTypeCode !== serviceTypeCode) { + messageError = this.getLicenceLookupServiceTypeCodeMismatchErrorMessage(selServiceTypeCodeDesc); + } + } else { + messageError = this.getLicenceLookupNoMatchErrorMessage(serviceTypeCode, selServiceTypeCodeDesc); + } + + return messageError; + } + getApplicationIsInProgress(appls: Array): boolean { return !!appls.find( (item: MainApplicationResponse) => @@ -872,6 +882,21 @@ export class CommonApplicationService { } } + private getLicenceLookupServiceTypeCodeMismatchErrorMessage(selServiceTypeCodeDesc: string): string { + return `This licence number is not a ${selServiceTypeCodeDesc}.`; + } + + private getLicenceLookupNoMatchErrorMessage( + serviceTypeCode: ServiceTypeCode, + selServiceTypeCodeDesc: string + ): string { + if (serviceTypeCode === ServiceTypeCode.SecurityBusinessLicence) { + return `This ${selServiceTypeCodeDesc} number does not match any existing ${selServiceTypeCodeDesc}s for your business in BC.`; + } else { + return `This ${selServiceTypeCodeDesc} number does not match any existing ${selServiceTypeCodeDesc}s.`; + } + } + private setApplicationFlags(item: MainApplicationResponse) { const applicationNotSubmittedWarningDays = SPD_CONSTANTS.periods.applicationNotSubmittedWarningDays; const applicationNotSubmittedErrorDays = SPD_CONSTANTS.periods.applicationNotSubmittedErrorDays; @@ -906,7 +931,7 @@ export class CommonApplicationService { isFoundValid = this.isLicenceActive(licence.licenceStatusCode); } - const isExpired = !isFoundValid; + const isExpired = isFound && !isFoundValid; const isInRenewalPeriod = !isFoundValid ? false : this.getIsInRenewalPeriod(licence.expiryDate, licence.licenceTermCode); diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/shared/components/alert.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/shared/components/alert.component.ts index 3fb0f7d3d..7cfe97b23 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/shared/components/alert.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/shared/components/alert.component.ts @@ -3,8 +3,8 @@ import { Component, ContentChild, ElementRef, Input } from '@angular/core'; export type AlertType = 'success' | 'warning' | 'danger' | 'info'; @Component({ - selector: 'app-alert', - template: ` + selector: 'app-alert', + template: ` `, - styles: [ - ` + styles: [ + ` .alert-info { - border: 1px solid rgba(217, 234, 247, 1); - background-color: rgba(217, 234, 247, 1); + border: 1px solid #b6d4fe; + background-color: #d9eaf7; border-radius: 5px; font-weight: 500; font-style: normal; @@ -26,7 +26,7 @@ export type AlertType = 'success' | 'warning' | 'danger' | 'info'; } .alert-success { - border: 1px solid #e8f5eb; + border: 1px solid #badbcc; background-color: #e8f5eb; border-radius: 5px; font-weight: 500; @@ -37,8 +37,8 @@ export type AlertType = 'success' | 'warning' | 'danger' | 'info'; } .alert-warning { - border: 1px solid rgba(250, 235, 204, 1); - background-color: rgba(249, 241, 198, 1); + border: 1px solid #ffecb5; + background-color: #f9f1c6; border-radius: 5px; font-weight: 500; font-style: normal; @@ -48,8 +48,8 @@ export type AlertType = 'success' | 'warning' | 'danger' | 'info'; } .alert-danger { - border: 1px solid rgba(235, 204, 209, 1); - background-color: rgba(242, 222, 222, 1); + border: 1px solid #f5c2c7; + background-color: #f2dede; border-radius: 5px; font-weight: 500; font-style: normal; @@ -58,8 +58,8 @@ export type AlertType = 'success' | 'warning' | 'danger' | 'info'; line-height: 1.5 !important; } `, - ], - standalone: false + ], + standalone: false, }) export class AlertComponent { @Input() public type: AlertType = 'warning'; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/shared/components/modal-lookup-by-licence-number.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/shared/components/modal-lookup-by-licence-number.component.ts index 15ad5ad03..84c245256 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/shared/components/modal-lookup-by-licence-number.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/shared/components/modal-lookup-by-licence-number.component.ts @@ -19,12 +19,21 @@ export interface LookupByLicenceNumberDialogData { } @Component({ - selector: 'app-modal-lookup-by-licence-number', - template: ` + selector: 'app-modal-lookup-by-licence-number', + template: `
{{ title }}
{{ subtitle }}
+ + Enter the Licence Number and click the search button. + + + + Enter the Licence Number, perform the reCaptcha and then click the search button. + + +
@@ -68,17 +77,6 @@ export interface LookupByLicenceNumberDialogData {
- - - Enter the Licence Number and click the search button. - - - - Enter the Licence Number, perform the reCaptcha and then click the search button. - - - -
@@ -122,7 +120,7 @@ export interface LookupByLicenceNumberDialogData {
- +
This licence is not valid {{ lookupServiceTypeCode | options: 'ServiceTypes' }}
@@ -171,9 +169,9 @@ export interface LookupByLicenceNumberDialogData {
`, - styles: [], - animations: [showHideTriggerSlideAnimation], - standalone: false + styles: [], + animations: [showHideTriggerSlideAnimation], + standalone: false, }) export class ModalLookupByLicenceNumberComponent implements OnInit { form = this.businessApplicationService.swlLookupLicenceFormGroup; @@ -274,17 +272,18 @@ export class ModalLookupByLicenceNumberComponent implements OnInit { } private handleSearchResults(resp: LicenceLookupResult) { + this.messageError = this.commonApplicationService.setLicenceLookupMessage( + resp.searchResult, + this.lookupServiceTypeCode + ); + this.isSearchPerformed = true; this.isFound = resp.isFound; - this.isFoundValid = resp.isFoundValid; + this.messageWarn = null; - if (resp.searchResult) { - if (resp.searchResult.serviceTypeCode !== this.lookupServiceTypeCode) { - this.isFoundValid = false; - } + this.searchResultDisplay = resp.searchResult; - this.searchResultDisplay = resp.searchResult; - } + this.isFoundValid = !!this.searchResultDisplay && !resp.isExpired && !this.messageError; } private handlexpiredLicenceSearchResults(resp: LicenceLookupResult) {