/*global VuFind */ /*exported setUpHoldRequestForm, setupHoldEditForm */ function setUpHoldRequestForm(recordId) { var $select = $('#pickUpLocation'); var $icon = $('#pickUpLocationLabel .loading-icon'); var $emptyOption = $("#pickUpLocation option[value='']"); var $noResults = $('').text(VuFind.translate('No pickup locations available')); $select.parent().append($noResults); $noResults.hide(); $('#requestGroupId').on("change", function requestGroupChange() { var $self = $(this); $select.find("option[value!='']").remove(); if ($self.val() === '') { $select.attr('disabled', 'disabled'); return; } $icon.removeClass('hidden'); var params = { method: 'getRequestGroupPickupLocations', id: recordId, requestGroupId: $self.val() }; $.ajax({ data: params, dataType: 'json', cache: false, url: VuFind.path + '/AJAX/JSON' }) .done(function holdPickupLocationsDone(response) { var defaultValue = $select.data('default'); if (response.data.locations && response.data.locations.length > 0) { $noResults.hide(); $.each(response.data.locations, function holdPickupLocationEach() { var option = $('