Skip to content

Commit

Permalink
Add optional Rapido work address field
Browse files Browse the repository at this point in the history
If a user selects "Work Address" as a pickup location in the Rapido
physical copy request form, request an optional delivery address to
be supplied in the form's note field.
  • Loading branch information
gpeterso committed Mar 28, 2024
1 parent 1739c72 commit 83f8c53
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("prmGetItRequestAfterComponent", () => {
{ label: "Library B", value: "2" },
{ label: "Library C", value: "3" },
{ label: "Home Address", value: "4" },
{ label: "Work Address", value: "5" },
],
},
};
Expand Down Expand Up @@ -46,7 +47,17 @@ describe("prmGetItRequestAfterComponent", () => {
);
});

it("disables a mandatory address field when Home Address is not selected", () => {
it("enables an optional address field when Work Address is selected", () => {
ctrl.$onInit();
parentCtrl.formData.myLocation = "5";
parentCtrl.locationField.events.onChange();
expect(parentCtrl.noteField.mandatory).toBeFalse();
expect(parentCtrl.noteField.label).toEqual(
"umn.almaRequest.workDeliveryAddress"
);
});

it("disables a mandatory address field by default", () => {
ctrl.$onInit();
parentCtrl.formData.myLocation = "1";
parentCtrl.locationField.events.onChange();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export class PrmGetItRequestAfterController implements ng.IController {
if (this.isLocationSelected("Home Address")) {
this.noteField.mandatory = true;
this.noteField.label = "umn.almaRequest.homeDeliveryAddress";
} else if (this.isLocationSelected("Work Address")) {
this.noteField.mandatory = false;
this.noteField.label = "umn.almaRequest.workDeliveryAddress";
} else {
this.noteField.mandatory = false;
this.noteField.label = "nui.ngrs.request.note";
Expand Down

0 comments on commit 83f8c53

Please sign in to comment.