|
Lines 11-16
Link Here
|
| 11 |
<title>[% t("Restore deleted patrons") | html %] › [% t("Tools") | html %] › [% t("Koha") | html %]</title> |
11 |
<title>[% t("Restore deleted patrons") | html %] › [% t("Tools") | html %] › [% t("Koha") | html %]</title> |
| 12 |
[% END %] |
12 |
[% END %] |
| 13 |
[% INCLUDE 'doc-head-close.inc' %] |
13 |
[% INCLUDE 'doc-head-close.inc' %] |
|
|
14 |
<style> |
| 15 |
#search_form input[type="text"] { |
| 16 |
width: 30%; |
| 17 |
} |
| 18 |
</style> |
| 14 |
</head> |
19 |
</head> |
| 15 |
|
20 |
|
| 16 |
<body id="tools_restore_deleted_borrowers" class="tools"> |
21 |
<body id="tools_restore_deleted_borrowers" class="tools"> |
|
Lines 127-133
Link Here
|
| 127 |
</li> |
132 |
</li> |
| 128 |
<li> |
133 |
<li> |
| 129 |
<label for="categorycode">Patron category:</label> |
134 |
<label for="categorycode">Patron category:</label> |
| 130 |
<select name="categorycode" id="categorycode"> |
135 |
<select name="categorycode" id="categorycode" multiple="multiple"> |
| 131 |
<option value="">All categories</option> |
136 |
<option value="">All categories</option> |
| 132 |
[% FOREACH cat IN Categories.all() %] |
137 |
[% FOREACH cat IN Categories.all() %] |
| 133 |
<option value="[% cat.categorycode | html %]"> [% cat.description | html %] </option> |
138 |
<option value="[% cat.categorycode | html %]"> [% cat.description | html %] </option> |
|
Lines 136-142
Link Here
|
| 136 |
</li> |
141 |
</li> |
| 137 |
<li> |
142 |
<li> |
| 138 |
<label for="branchcode">Library:</label> |
143 |
<label for="branchcode">Library:</label> |
| 139 |
<select name="branchcode" id="branchcode"> |
144 |
<select name="branchcode" id="branchcode" multiple="multiple"> |
| 140 |
[% IF can_view_all_libraries %] |
145 |
[% IF can_view_all_libraries %] |
| 141 |
<option value="">All libraries</option> |
146 |
<option value="">All libraries</option> |
| 142 |
[% END %] |
147 |
[% END %] |
|
Lines 284-294
Link Here
|
| 284 |
[% INCLUDE 'calendar.inc' %] |
289 |
[% INCLUDE 'calendar.inc' %] |
| 285 |
[% Asset.js("js/tools-menu.js") | $raw %] |
290 |
[% Asset.js("js/tools-menu.js") | $raw %] |
| 286 |
[% INCLUDE 'datatables.inc' %] |
291 |
[% INCLUDE 'datatables.inc' %] |
|
|
292 |
[% INCLUDE 'select2.inc' %] |
| 287 |
<script> |
293 |
<script> |
| 288 |
$(document).ready(function() { |
294 |
$(document).ready(function() { |
|
|
295 |
let selectFields = document.querySelectorAll('select[multiple]'); |
| 296 |
selectFields.forEach((selectField) => { |
| 297 |
$(selectField).select2({ |
| 298 |
width: "30%", |
| 299 |
allowClear: true, |
| 300 |
}); |
| 301 |
}); |
| 302 |
|
| 303 |
$('#search_form').on('submit', function(e) { |
| 304 |
//check regular fields for values before submission |
| 305 |
var fields = ['#cardnumber', '#borrowernumber', '#firstname', '#surname', '#deleted_from', '#deleted_to']; |
| 306 |
var hasValue = fields.some(function(field) { |
| 307 |
var val = $(field).val(); |
| 308 |
return val !== '' && val !== null; |
| 309 |
}); |
| 310 |
|
| 311 |
//if no values yet, check select2 fields |
| 312 |
if (!hasValue) { |
| 313 |
var branchcodeData = $('#branchcode').select2('data'); |
| 314 |
if (branchcodeData && branchcodeData.length > 0 && branchcodeData[0].id) { |
| 315 |
hasValue = true; |
| 316 |
} |
| 317 |
var catergoycodeData = $('#categorycode').select2('data'); |
| 318 |
if (catergoycodeData && catergoycodeData.length > 0 && catergoycodeData[0].id) { |
| 319 |
hasValue = true; |
| 320 |
} |
| 321 |
} |
| 289 |
|
322 |
|
| 290 |
$('#search_form').on('submit' , function(e) { |
323 |
if (!hasValue) { |
| 291 |
if ( $('#cardnumber').val() == '' && $('#borrowernumber').val() == '' && $('#firstname').val() == '' && $('#surname').val() == '' && $('#categorycode').val() == '' && $('#branchcode').val() == '' && $('#deleted_from').val() == '' && $('#deleted_to').val() == '' ) { |
|
|
| 292 |
e.preventDefault(); |
324 |
e.preventDefault(); |
| 293 |
alert('Please fill out at least one search field.'); |
325 |
alert('Please fill out at least one search field.'); |
| 294 |
return false; |
326 |
return false; |