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 733-738
Link Here
|
733 |
if ( $("#branchcode_filter").val() ) { |
769 |
if ( $("#branchcode_filter").val() ) { |
734 |
searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); |
770 |
searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); |
735 |
} |
771 |
} |
|
|
772 |
if ( $("#sort1_filter").val() ) { |
773 |
searched += _(" with sort1 ") |
774 |
if ( $("select#sort1_filter") ) { |
775 |
searched += $("select#sort1_filter").find("option:selected").text(); |
776 |
} |
777 |
else { |
778 |
searched += $("#sort1_filter").val(); |
779 |
} |
780 |
} |
781 |
if ( $("#sort2_filter").val() ) { |
782 |
searched += _(" with sort2 "); |
783 |
if ( $("select#sort2_filter") ) { |
784 |
searched += $("select#sort2_filter").find("option:selected").text(); |
785 |
} |
786 |
else { |
787 |
searched += $("#sort2_filter").val(); |
788 |
} |
789 |
} |
736 |
$("#searchpattern").text(searched); |
790 |
$("#searchpattern").text(searched); |
737 |
$("#searchpattern").parent().show(); |
791 |
$("#searchpattern").parent().show(); |
738 |
} |
792 |
} |
Lines 790-795
Link Here
|
790 |
$("#searchtype_filter option[value='contain']").prop("selected", true); |
844 |
$("#searchtype_filter option[value='contain']").prop("selected", true); |
791 |
$("#categorycode_filter option:first").prop("selected", true); |
845 |
$("#categorycode_filter option:first").prop("selected", true); |
792 |
$("#branchcode_filter option:first").prop("selected", true); |
846 |
$("#branchcode_filter option:first").prop("selected", true); |
|
|
847 |
$("#sort1_filter").val('').trigger("change"); |
848 |
$("#sort2_filter").val('').trigger("change"); |
793 |
$("#firstletter_filter").val(''); |
849 |
$("#firstletter_filter").val(''); |
794 |
$("#search_patron_filter").val(''); |
850 |
$("#search_patron_filter").val(''); |
795 |
/* remove any search string added by firstletter search */ |
851 |
/* remove any search string added by firstletter search */ |