Skip to content

Commit

Permalink
access code fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
carolcarpenter committed Jan 17, 2024
1 parent 4dec78e commit 31693f4
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 128 deletions.
46 changes: 19 additions & 27 deletions src/Spd.Presentation.Licensing/ClientApp/.nx/cache/file-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
},
{
"file": ".nx/cache/file-map.json",
"hash": "8334336200047552064"
"hash": "509937833778042236"
},
{
"file": ".nx/cache/lockfile.hash",
Expand Down Expand Up @@ -213,10 +213,6 @@
"file": "src/app/api/models/configuration-response.ts",
"hash": "3872334593921033656"
},
{
"file": "src/app/api/models/contact-authorization-type-code.ts",
"hash": "7594419930114176676"
},
{
"file": "src/app/api/models/document-base.ts",
"hash": "16564521065091111334"
Expand Down Expand Up @@ -275,7 +271,7 @@
},
{
"file": "src/app/api/models/licence-lookup-response.ts",
"hash": "18131248392085906962"
"hash": "8696757787484223492"
},
{
"file": "src/app/api/models/licence-term-code.ts",
Expand All @@ -293,10 +289,6 @@
"file": "src/app/api/models/oidc-configuration.ts",
"hash": "3048514842015352159"
},
{
"file": "src/app/api/models/org-registration-status-code.ts",
"hash": "3364455885041880542"
},
{
"file": "src/app/api/models/org-settings.ts",
"hash": "14626719410571548999"
Expand Down Expand Up @@ -355,7 +347,7 @@
},
{
"file": "src/app/api/models/user-info.ts",
"hash": "13146137555046981628"
"hash": "1305281606154071172"
},
{
"file": "src/app/api/models/weight-unit-code.ts",
Expand Down Expand Up @@ -399,7 +391,7 @@
},
{
"file": "src/app/api/models.ts",
"hash": "6258148284039421139"
"hash": "17288780380715090601"
},
{
"file": "src/app/api/request-builder.ts",
Expand Down Expand Up @@ -555,7 +547,7 @@
},
{
"file": "src/app/modules/licence-application/components/anonymous/permit-wizard-steps/step-permit-access-code.component.ts",
"hash": "8141940318203562273"
"hash": "8053711516490131267"
},
{
"file": "src/app/modules/licence-application/components/anonymous/permit-wizard-steps/step-permit-aliases.component.ts",
Expand Down Expand Up @@ -695,11 +687,11 @@
},
{
"file": "src/app/modules/licence-application/components/anonymous/worker-licence-wizard-steps/step-licence-access-code.component.ts",
"hash": "6282889295472640155"
"hash": "3078489583827913308"
},
{
"file": "src/app/modules/licence-application/components/anonymous/worker-licence-wizard-steps/step-licence-confirmation.component.ts",
"hash": "8044648565876888469"
"hash": "7980824043471437944"
},
{
"file": "src/app/modules/licence-application/components/anonymous/worker-licence-wizard-steps/step-licence-type-anonymous.component.ts",
Expand Down Expand Up @@ -781,14 +773,14 @@
"file": "src/app/modules/licence-application/components/authenticated/worker-licence-wizard-authenticated-update.component.ts",
"hash": "15831010724008170242"
},
{
"file": "src/app/modules/licence-application/components/authenticated/worker-licence-wizard-steps/step-access-code-authorized.component.ts",
"hash": "9172484270885406679"
},
{
"file": "src/app/modules/licence-application/components/authenticated/worker-licence-wizard-steps/step-application-type-authenticated.component.ts",
"hash": "11319786597800719188"
},
{
"file": "src/app/modules/licence-application/components/authenticated/worker-licence-wizard-steps/step-licence-access-code-authorized.component.ts",
"hash": "3893182538200324630"
},
{
"file": "src/app/modules/licence-application/components/authenticated/worker-licence-wizard-steps/step-licence-type-authenticated.component.ts",
"hash": "14236532689133394520"
Expand Down Expand Up @@ -835,7 +827,7 @@
},
{
"file": "src/app/modules/licence-application/components/shared/step-components/common-access-code-anonymous.component.ts",
"hash": "1595984844568122686"
"hash": "2144447900906973381"
},
{
"file": "src/app/modules/licence-application/components/shared/step-components/common-alias-list.component.ts",
Expand Down Expand Up @@ -1011,7 +1003,7 @@
},
{
"file": "src/app/modules/licence-application/components/shared/worker-licence-wizard-child-steps/step-licence-category.component.ts",
"hash": "8296564541068628181"
"hash": "15009823995386634972"
},
{
"file": "src/app/modules/licence-application/components/shared/worker-licence-wizard-child-steps/step-licence-expired.component.ts",
Expand Down Expand Up @@ -1079,31 +1071,31 @@
},
{
"file": "src/app/modules/licence-application/licence-application-routing.module.ts",
"hash": "4964193410197447363"
"hash": "7030828396616958080"
},
{
"file": "src/app/modules/licence-application/licence-application.component.ts",
"hash": "10579808801989463356"
},
{
"file": "src/app/modules/licence-application/licence-application.module.ts",
"hash": "10342210031159576994"
"hash": "2932798054397701042"
},
{
"file": "src/app/modules/licence-application/services/licence-application.helper.ts",
"hash": "11876989241804692608"
"hash": "6226828735327190122"
},
{
"file": "src/app/modules/licence-application/services/licence-application.service.ts",
"hash": "6583048963069493776"
"hash": "13395453065370133746"
},
{
"file": "src/app/modules/licence-application/services/permit-application.helper.ts",
"hash": "17011768831667633879"
"hash": "7035018015195134244"
},
{
"file": "src/app/modules/licence-application/services/permit-application.service.ts",
"hash": "16522978599222170229"
"hash": "3651606952645580921"
},
{
"file": "src/app/modules/licence-portal/components/active-licences.component.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ export const SPD_CONSTANTS = {
dateTimeFormat: 'YYYY-MM-DD HH:mm',
backendDateFormat: 'YYYY-MM-DD',
},
periods: {
notSubmittedLicenceWarningDays: 14, // show warning 14 days before the 30 day mark
notSubmittedLicenceErrorDays: 7, // show error 7 days before the 30 day mark
notSubmittedLicenceHide: 30, // do not show licence 30 days after created
replacementPeriodPreventionDays: 14, // cannot replace within 14 days of expiry
updatePeriodPreventionDays: 14, // cannot update within 14 days of expiry
renewPeriodDays: 90, // can only renew within 90 days of expiry
},
phone: {
spdPhoneNumber: '1-855-587-0185',
displayMask: '(000) 000-0000',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class StepPermitAccessCodeComponent implements OnInit, LicenceChildSteppe
}

const accessCodeData = this.form.value;
accessCodeData.linkedLicenceId = '468075a7-550e-4820-a7ca-00ea6dde3025'; // TODO fix
accessCodeData.linkedLicenceId = '468075a7-550e-4820-a7ca-00ea6dde3025'; // TODO hardcoded ID fix

this.permitApplicationService
.loadPermit(accessCodeData.linkedLicenceId, this.workerLicenceTypeCode, this.applicationTypeCode!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,17 @@ export class StepLicenceAccessCodeComponent implements OnInit, LicenceChildStepp
return;
}

console.log('step next', this.form.value);

const accessCodeData = this.form.value;

accessCodeData.linkedLicenceId = '468075a7-550e-4820-a7ca-00ea6dde3025'; // TODO fix
accessCodeData.linkedLicenceId = '468075a7-550e-4820-a7ca-00ea6dde3025'; // TODO hardcoded ID fix

this.licenceApplicationService
.loadLicence(accessCodeData.linkedLicenceId, this.workerLicenceTypeCode, this.applicationTypeCode!)
.loadLicence(accessCodeData.linkedLicenceId, this.applicationTypeCode!)
.pipe(
tap((_resp: any) => {
this.licenceApplicationService.licenceModelFormGroup.patchValue(
{
licenceNumber: accessCodeData.licenceNumber,
licenceExpiryDate: accessCodeData.expiryDate,
licenceExpiryDate: accessCodeData.licenceExpiryDate,
},
{ emitEvent: false }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Subscription, take, tap } from 'rxjs';
import { WorkerLicensingService } from 'src/app/api/services';
import { DialogComponent, DialogOptions } from 'src/app/shared/components/dialog.component';
import { LicenceApplicationRoutes } from '../../licence-application-routing.module';
import { PermitApplicationService } from '../../services/permit-application.service';

export interface WorkerLicenceInProgress extends WorkerLicenceAppListResponse {
isWarningMessage: boolean;
Expand Down Expand Up @@ -468,6 +469,7 @@ export class UserApplicationsAuthenticatedComponent implements OnInit, OnDestroy
private dialog: MatDialog,
private authProcessService: AuthProcessService,
private workerLicensingService: WorkerLicensingService,
private permitApplicationService: PermitApplicationService,
private licenceApplicationService: LicenceApplicationService
) {}

Expand All @@ -479,14 +481,18 @@ export class UserApplicationsAuthenticatedComponent implements OnInit, OnDestroy
.apiWorkerLicenceApplicationsGet()
.pipe()
.subscribe((resp: Array<WorkerLicenceAppListResponse>) => {
const notSubmittedLicenceErrorDays = SPD_CONSTANTS.periods.notSubmittedLicenceErrorDays;
const notSubmittedLicenceWarningDays = SPD_CONSTANTS.periods.notSubmittedLicenceWarningDays;
const notSubmittedLicenceHide = SPD_CONSTANTS.periods.notSubmittedLicenceHide;

// TODO remove when backend updated...
// If 30 days or more have passed since the last save, the application does not appear in this list
const inProgressResults = resp.filter(
(item: WorkerLicenceAppListResponse) =>
item.applicationPortalStatusCode === ApplicationPortalStatusCode.InProgress ||
// item.applicationPortalStatusCode === ApplicationPortalStatusCode.Draft
(item.applicationPortalStatusCode === ApplicationPortalStatusCode.Draft &&
moment().isBefore(moment(item.createdOn).add(31, 'days')))
moment().isSameOrBefore(moment(item.createdOn).add(notSubmittedLicenceHide, 'days')))
);

const activeResults = resp.filter(
Expand All @@ -507,13 +513,15 @@ export class UserApplicationsAuthenticatedComponent implements OnInit, OnDestroy

inProgressResults.map((item: any) => {
if (item.applicationPortalStatusCode === ApplicationPortalStatusCode.Draft) {
item.expiresOn = moment(item.createdOn).add(30, 'days');
item.expiresOn = moment(item.createdOn).add(notSubmittedLicenceHide, 'days');
item.isWarningMessage = false;
item.isErrorMessage = false;

if (moment().isSameOrAfter(moment(item.expiresOn).subtract(7, 'days'))) {
if (moment().isSameOrAfter(moment(item.expiresOn).subtract(notSubmittedLicenceErrorDays, 'days'))) {
item.isErrorMessage = true;
} else if (moment().isSameOrAfter(moment(item.expiresOn).subtract(14, 'days'))) {
} else if (
moment().isSameOrAfter(moment(item.expiresOn).subtract(notSubmittedLicenceWarningDays, 'days'))
) {
item.isWarningMessage = true;
}
}
Expand Down Expand Up @@ -616,35 +624,67 @@ export class UserApplicationsAuthenticatedComponent implements OnInit, OnDestroy
}

onResume(appl: WorkerLicenceAppListResponse): void {
this.licenceApplicationService
.loadLicence(appl.licenceAppId!, appl.serviceTypeCode!, appl.applicationTypeCode!)
.pipe(
tap((_resp: any) => {
this.router.navigateByUrl(
LicenceApplicationRoutes.pathSecurityWorkerLicenceAuthenticated(
LicenceApplicationRoutes.WORKER_LICENCE_NEW_AUTHENTICATED
)
);
}),
take(1)
)
.subscribe();
if (appl.serviceTypeCode == WorkerLicenceTypeCode.SecurityWorkerLicence) {
this.licenceApplicationService
.loadLicence(appl.licenceAppId!, appl.applicationTypeCode!)
.pipe(
tap((_resp: any) => {
this.router.navigateByUrl(
LicenceApplicationRoutes.pathSecurityWorkerLicenceAuthenticated(
LicenceApplicationRoutes.WORKER_LICENCE_NEW_AUTHENTICATED
)
);
}),
take(1)
)
.subscribe();
// } else {
// this.permitApplicationService
// .loadPermit(appl.licenceAppId!, appl.serviceTypeCode!, appl.applicationTypeCode!)
// .pipe(
// tap((_resp: any) => {
// this.router.navigateByUrl(
// LicenceApplicationRoutes.pathSecurityWorkerLicenceAuthenticated(
// LicenceApplicationRoutes.WORKER_LICENCE_NEW_AUTHENTICATED
// )
// );
// }),
// take(1)
// )
// .subscribe();
}
}

onUpdate(appl: WorkerLicenceInProgress): void {
this.licenceApplicationService
.loadLicence('468075a7-550e-4820-a7ca-00ea6dde3025', appl.serviceTypeCode!, ApplicationTypeCode.Update)
.pipe(
tap((_resp: any) => {
this.router.navigateByUrl(
LicenceApplicationRoutes.pathSecurityWorkerLicenceAuthenticated(
LicenceApplicationRoutes.WORKER_LICENCE_UPDATE_AUTHENTICATED
)
);
}),
take(1)
)
.subscribe();
if (appl.serviceTypeCode == WorkerLicenceTypeCode.SecurityWorkerLicence) {
this.licenceApplicationService
.loadLicence('468075a7-550e-4820-a7ca-00ea6dde3025', ApplicationTypeCode.Update) //TODO hardcoded ID
.pipe(
tap((_resp: any) => {
this.router.navigateByUrl(
LicenceApplicationRoutes.pathSecurityWorkerLicenceAuthenticated(
LicenceApplicationRoutes.WORKER_LICENCE_UPDATE_AUTHENTICATED
)
);
}),
take(1)
)
.subscribe();
// } else {
// this.permitApplicationService
// .loadPermit(appl.licenceAppId!, appl.serviceTypeCode!, appl.applicationTypeCode!)
// .pipe(
// tap((_resp: any) => {
// this.router.navigateByUrl(
// LicenceApplicationRoutes.pathSecurityWorkerLicenceAuthenticated(
// LicenceApplicationRoutes.PERMIT_NEW_AUTHENTICATED
// )
// );
// }),
// take(1)
// )
// .subscribe();
}
}

// onReapply(appl: WorkerLicenceInProgress): void {
Expand Down
Loading

0 comments on commit 31693f4

Please sign in to comment.