Lines 56-61
Link Here
|
56 |
[% END %] |
56 |
[% END %] |
57 |
</select> |
57 |
</select> |
58 |
</li> |
58 |
</li> |
|
|
59 |
[% CASE 'sort1' %] |
60 |
<li> |
61 |
<label for="sort1_filter">Sort1:</label> |
62 |
[% PROCESS 'av-build-dropbox.inc' name="sort1_filter", category="Bsort1", empty=1, size = 20 %] |
63 |
</li> |
64 |
[% CASE 'sort2' %] |
65 |
<li> |
66 |
<label for="sort2_filter">Sort2:</label> |
67 |
[% PROCESS 'av-build-dropbox.inc' name="sort2_filter", category="Bsort2", empty=1, size = 20 %] |
68 |
</li> |
59 |
[% CASE 'search_field' %] |
69 |
[% CASE 'search_field' %] |
60 |
<li> |
70 |
<li> |
61 |
[% INCLUDE patron_fields_dropdown %] |
71 |
[% INCLUDE patron_fields_dropdown %] |
Lines 197-202
Link Here
|
197 |
[% IF redirect_if_one_result && !redirect_url %] |
207 |
[% IF redirect_if_one_result && !redirect_url %] |
198 |
<script>console.log("Wrong call of patron_searh_js - missing redirect_url");</script> |
208 |
<script>console.log("Wrong call of patron_searh_js - missing redirect_url");</script> |
199 |
[% END %] |
209 |
[% END %] |
|
|
210 |
|
211 |
[% INCLUDE 'select2.inc' %] |
200 |
<script> |
212 |
<script> |
201 |
let categories = [% To.json(categories) | $raw %].map(e => { |
213 |
let categories = [% To.json(categories) | $raw %].map(e => { |
202 |
e['_id'] = e.categorycode.toLowerCase(); |
214 |
e['_id'] = e.categorycode.toLowerCase(); |
Lines 221-226
Link Here
|
221 |
let extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %]; |
233 |
let extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %]; |
222 |
[% END %] |
234 |
[% END %] |
223 |
|
235 |
|
|
|
236 |
$(document).ready(function() { |
237 |
$('select#sort1_filter').select2({allowClear:true}); |
238 |
$('select#sort2_filter').select2({allowClear:true}); |
239 |
}); |
224 |
</script> |
240 |
</script> |
225 |
|
241 |
|
226 |
[% INCLUDE 'datatables.inc' %] |
242 |
[% INCLUDE 'datatables.inc' %] |
Lines 298-308
Link Here
|
298 |
return { "like": start_with + "%" } |
314 |
return { "like": start_with + "%" } |
299 |
}, |
315 |
}, |
300 |
"-and": function(){ |
316 |
"-and": function(){ |
|
|
317 |
let filters = []; |
318 |
let f_sort1 = $("#sort1_filter").val(); |
319 |
if ( f_sort1 ) { |
320 |
filters.push({ |
321 |
"me.sort1": f_sort1 |
322 |
}); |
323 |
} |
324 |
let f_sort2 = $("#sort2_filter").val(); |
325 |
if ( f_sort2 ) { |
326 |
filters.push({ |
327 |
"me.sort2": f_sort2 |
328 |
}); |
329 |
} |
330 |
|
301 |
let pattern = $("#search_patron_filter").val(); |
331 |
let pattern = $("#search_patron_filter").val(); |
302 |
if (!pattern) return ""; |
332 |
if (!pattern) { |
|
|
333 |
if ( filters.length == 0 ) { |
334 |
return ""; |
335 |
} |
336 |
else { |
337 |
return filters; |
338 |
} |
339 |
} |
303 |
let patterns = pattern.split(/[\s,]+/).filter(function(s){ return s.length }); |
340 |
let patterns = pattern.split(/[\s,]+/).filter(function(s){ return s.length }); |
304 |
|
341 |
|
305 |
let filters = []; |
|
|
306 |
let search_type = $("#searchtype_filter").val() || "contain"; |
342 |
let search_type = $("#searchtype_filter").val() || "contain"; |
307 |
let search_fields = $("#searchfieldstype_filter").val(); |
343 |
let search_fields = $("#searchfieldstype_filter").val(); |
308 |
if ( !search_fields ) { |
344 |
if ( !search_fields ) { |
Lines 729-734
Link Here
|
729 |
if ( $("#branchcode_filter").val() ) { |
765 |
if ( $("#branchcode_filter").val() ) { |
730 |
searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); |
766 |
searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); |
731 |
} |
767 |
} |
|
|
768 |
if ( $("#sort1_filter").val() ) { |
769 |
searched += _(" with sort1 ") |
770 |
if ( $("select#sort1_filter") ) { |
771 |
searched += $("select#sort1_filter").find("option:selected").text(); |
772 |
} |
773 |
else { |
774 |
searched += $("#sort1_filter").val(); |
775 |
} |
776 |
} |
777 |
if ( $("#sort2_filter").val() ) { |
778 |
searched += _(" with sort2 "); |
779 |
if ( $("select#sort2_filter") ) { |
780 |
searched += $("select#sort2_filter").find("option:selected").text(); |
781 |
} |
782 |
else { |
783 |
searched += $("#sort2_filter").val(); |
784 |
} |
785 |
} |
732 |
$("#searchpattern").text(searched); |
786 |
$("#searchpattern").text(searched); |
733 |
$("#searchpattern").parent().show(); |
787 |
$("#searchpattern").parent().show(); |
734 |
} |
788 |
} |
Lines 786-791
Link Here
|
786 |
$("#searchtype_filter option[value='contain']").prop("selected", true); |
840 |
$("#searchtype_filter option[value='contain']").prop("selected", true); |
787 |
$("#categorycode_filter option:first").prop("selected", true); |
841 |
$("#categorycode_filter option:first").prop("selected", true); |
788 |
$("#branchcode_filter option:first").prop("selected", true); |
842 |
$("#branchcode_filter option:first").prop("selected", true); |
|
|
843 |
$("#sort1_filter").val('').trigger("change"); |
844 |
$("#sort2_filter").val('').trigger("change"); |
789 |
$("#firstletter_filter").val(''); |
845 |
$("#firstletter_filter").val(''); |
790 |
$("#search_patron_filter").val(''); |
846 |
$("#search_patron_filter").val(''); |
791 |
/* remove any search string added by firstletter search */ |
847 |
/* remove any search string added by firstletter search */ |