From 184e0d9c424e7c28cd42f8a13f0759f2e75aea3c Mon Sep 17 00:00:00 2001 From: Jeff Peterson <1045033+gpeterso@users.noreply.github.com> Date: Tue, 16 Apr 2024 11:59:42 -0500 Subject: [PATCH] Set default rapido pickup location (#8) Forces the pickup location to be null by default when making a Rapido physical request. --- .../ngrs/prm-get-it-request-after.component.spec.ts | 5 +++++ .../full-view/ngrs/prm-get-it-request-after.component.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/shared/components/search/full-view/ngrs/prm-get-it-request-after.component.spec.ts b/src/shared/components/search/full-view/ngrs/prm-get-it-request-after.component.spec.ts index 4af2b60..81b0d49 100644 --- a/src/shared/components/search/full-view/ngrs/prm-get-it-request-after.component.spec.ts +++ b/src/shared/components/search/full-view/ngrs/prm-get-it-request-after.component.spec.ts @@ -64,4 +64,9 @@ describe("prmGetItRequestAfterComponent", () => { expect(parentCtrl.noteField.mandatory).toBeFalse(); expect(parentCtrl.noteField.label).toEqual("nui.ngrs.request.note"); }); + + it("sets the parent controller's default location to null", () => { + ctrl.$onInit(); + expect(parentCtrl.getDefaultValue()).toBeNull(); + }); }); diff --git a/src/shared/components/search/full-view/ngrs/prm-get-it-request-after.component.ts b/src/shared/components/search/full-view/ngrs/prm-get-it-request-after.component.ts index b218bc9..11aee5b 100644 --- a/src/shared/components/search/full-view/ngrs/prm-get-it-request-after.component.ts +++ b/src/shared/components/search/full-view/ngrs/prm-get-it-request-after.component.ts @@ -29,6 +29,7 @@ export class PrmGetItRequestAfterController implements ng.IController { } $onInit(): void { + this.overrideDefaultLocation(); this.locationField.events = { onChange: () => this.setMandatoryFields(), }; @@ -59,6 +60,10 @@ export class PrmGetItRequestAfterController implements ng.IController { return this.parentCtrl.formData.myLocation === option.value; } + private overrideDefaultLocation(): void { + this.parentCtrl.getDefaultValue = (): void => null; + } + get locationField(): FormField { return this.parentCtrl.locationField; }