Koha/koha-tmpl/intranet-tmpl/prog/js/register_selection.js
Martin Renvoize 30b23c5f1d Bug 24786: Allow selection of cash register at login
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-06 15:39:59 +01:00

27 lines
915 B
JavaScript

$(document).ready(function() {
$("#branch").on("change", function() {
var selectedBranch = $("#branch").children(
"option:selected").val();
$("#register_id").children().each(function() {
// default to no-register
if ($(this).is("#noregister")) {
$(this).prop("selected", true)
}
// display branch registers
else if ($(this).hasClass(selectedBranch)) {
$(this).prop("disabled", false);
$(this).show();
// default to branch default if there is one
if ($(this).hasClass("default")) {
$(this).prop("selected", true)
}
}
// hide non-branch registers
else {
$(this).hide();
$(this).prop("disabled", true);
}
});
});
});