Skip to content

Commit

Permalink
Show checkbox for Welch and Homewood
Browse files Browse the repository at this point in the history
  • Loading branch information
little9 committed May 3, 2024
1 parent 2b9acc3 commit f9fca5d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions 01JHU_INST-JHU/css/prm-request-after.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#form_field_genericCheckBox { display: none; }
47 changes: 47 additions & 0 deletions 01JHU_INST-JHU/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,38 @@
}
});


app.component('prmRequestAfter', {
bindings: { parentCtrl: '<' },
template: '<div></div>',
controller: ['primawsRest', '$scope', function ($scope) {

this.$onInit = function () {

// Watch for changes in the dropdown value
$scope.$watch(() => this.parentCtrl.formData["pickupLocation"], (newValue, oldValue) => {
if (newValue !== oldValue) { // Check if the value has actually changed
this.updateCheckboxVisibility(newValue);
}
});
};

this.updateCheckboxVisibility = function (selectedLocationId) {
const homewoodId = "126006350007861$$LIBRARY";
const welchId = "126007910007861$$LIBRARY";

const checkbox = document.getElementById('form_field_genericCheckBox');

if (checkbox != null && (selectedLocationId === homewoodId || selectedLocationId === welchId)) {
checkbox.style.display = 'block';
console.log(selectedLocationId === homewoodId ? "Homewood selected" : "Welch selected");
} else {
checkbox.style.display = 'none';
}
};
}]
});

/*Services */

/* Simple service used to capitalize the first letter of a string */
Expand All @@ -70,6 +102,21 @@
}
});

/* This service is used to get the patron/user's info -- may not be needed, but could be handy */
app.service("primawsRest", ['$http', function ($http) {
this.myAccountPersonalSettings = function () {
return $http({
method: 'GET',
url: '/primaws/rest/priv/myaccount/personal_settings',
headers: {
'Authorization': 'Bearer "' + sessionStorage.primoExploreJwt + '"',
}
});
}
}]);



/* This service is used to keep track of whether the user is logged in or not. */
app.service('AuthService', function () {
var isLoggedIn = false;
Expand Down

0 comments on commit f9fca5d

Please sign in to comment.