Koha/koha-tmpl/intranet-tmpl/prog/js/ill-availability-partner.js
Andrew Isherwood fb482d2767
Bug 23173: (follow-up) Display available partners
When selecting partners for search during the "Place request with
partner libraries" workflow, there was no indication of which partners
could actually be searched (i.e. are attached to a Z target and enabled
for partner search). We now list them

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@tudublin.ie>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-06 11:04:59 +01:00

41 lines
1.4 KiB
JavaScript

$(document).ready(function() {
var enabled_names = [];
$('#partners option').each(function() {
var partner = $(this);
var partner_id = partner.data('partner-id');
if (isEnabled(partner_id)) {
enabled_names.push(partner.text().trim());
}
});
$('#generic_confirm_enabled').text(enabled_names.join(', '));
$('#partners').change(function() {
var selected = [];
$('#partners option:selected').each(function() {
var partner_id = $(this).data('partner-id');
if (isEnabled(partner_id)) {
selected.push(partner_id);
}
});
if (selected.length > 0) {
$('#generic_confirm_search').css('visibility', 'initial');
} else {
$('#generic_confirm_search').css('visibility', 'hidden');
}
$('#service_id_restrict').
attr('data-service_id_restrict_ids', selected.join('|'));
});
$('#generic_confirm_search').click(function(e) {
$('#partnerSearch').modal({show:true});
});
$('#partnerSearch').on('show.bs.modal', function() {
doSearch();
});
$('#partnerSearch').on('hide.bs.modal', function() {
$.fn.dataTable.tables({ api: true }).destroy();
});
function isEnabled(id) {
return services[0].enabled.indexOf(id.toString()) > -1;
};
});