|
Lines 44-54
Link Here
|
| 44 |
|
44 |
|
| 45 |
[% IF ( lists ) %] |
45 |
[% IF ( lists ) %] |
| 46 |
|
46 |
|
|
|
47 |
<form action="/cgi-bin/koha/patron_lists/delete.pl" method="post" id="patrons_lists_form"> |
| 48 |
[% INCLUDE 'csrf-token.inc' %] |
| 49 |
<input type="hidden" name="op" value="cud-delete" /> |
| 50 |
<div id="searchheader" class="searchheader noprint sticky"> |
| 51 |
<div class="btn-group"> |
| 52 |
<button type="submit" class="btn btn-default btn-sm disabled" id="delete_selected_lists"><i class="fa fa-trash" aria-hidden="true"></i> Delete selected lists</button> |
| 53 |
</div> |
| 54 |
</div> |
| 55 |
|
| 47 |
<div class="page-section"> |
56 |
<div class="page-section"> |
| 48 |
<table id="patron-lists-table"> |
57 |
<table id="patron-lists-table"> |
| 49 |
<thead> |
58 |
<thead> |
| 50 |
<tr> |
59 |
<tr> |
| 51 |
<input type="button" type="submit" class="btn btn-default btn-sm disabled" value="Delete selected lists" id="delete_selected_lists"/> |
60 |
<th class="NoSort"></th> |
| 52 |
<th>Name</th> |
61 |
<th>Name</th> |
| 53 |
<th>Patrons in list</th> |
62 |
<th>Patrons in list</th> |
| 54 |
<th>Shared</th> |
63 |
<th>Shared</th> |
|
Lines 61-67
Link Here
|
| 61 |
[% SET shared_by_other = l.owner.id != logged_in_user.id %] |
70 |
[% SET shared_by_other = l.owner.id != logged_in_user.id %] |
| 62 |
<tr> |
71 |
<tr> |
| 63 |
<td> |
72 |
<td> |
| 64 |
<input class="select_patron" type="checkbox" autocomplete="off" data-patron-list-id="[% l.patron_list_id | html %]"> |
73 |
<input class="select_list" name="patron_lists_ids" value="[% l.patron_list_id | html %]" type="checkbox" autocomplete="off" data-patron-list-id="[% l.patron_list_id | html %]" /> |
|
|
74 |
</td> |
| 75 |
<td> |
| 65 |
<a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]">[% l.name | html %]</a> |
76 |
<a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]">[% l.name | html %]</a> |
| 66 |
</td> |
77 |
</td> |
| 67 |
<td>[% l.patron_list_patrons_rs.count || 0 | html %]</td> |
78 |
<td>[% l.patron_list_patrons_rs.count || 0 | html %]</td> |
|
Lines 84-90
Link Here
|
| 84 |
<li><a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]"><i class="fa fa-user"></i> Add patrons</a></li> |
95 |
<li><a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]"><i class="fa fa-user"></i> Add patrons</a></li> |
| 85 |
[% UNLESS shared_by_other %] |
96 |
[% UNLESS shared_by_other %] |
| 86 |
<li><a href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit list</a></li> |
97 |
<li><a href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit list</a></li> |
| 87 |
<li><a class="delete_patron" href="/cgi-bin/koha/patron_lists/delete.pl?patron_list_id=[% l.patron_list_id | html %]" data-list-name="[% l.name | html %]"><i class="fa fa-trash-can"></i> Delete list</a></li> |
98 |
<li> |
|
|
99 |
<a class="dropdown-item submit-form-link" href="#" data-patron_list_id="[% l.patron_list_id | html %]" data-action="delete.pl" data-method="post" data-op="cud-delete" data-confirmation-msg="Are you sure you want to delete this list?" ><i class="fa fa-trash-can"></i> Delete list</a> |
| 100 |
</li> |
| 88 |
[% END %] |
101 |
[% END %] |
| 89 |
[% IF ( l.patron_list_patrons_rs.count ) %] |
102 |
[% IF ( l.patron_list_patrons_rs.count ) %] |
| 90 |
<li class="divider"></li> |
103 |
<li class="divider"></li> |
|
Lines 114-119
Link Here
|
| 114 |
</tbody> |
127 |
</tbody> |
| 115 |
</table> |
128 |
</table> |
| 116 |
</div> <!-- /.page-section --> |
129 |
</div> <!-- /.page-section --> |
|
|
130 |
</form> |
| 131 |
<!-- /#patron_lists_form --> |
| 117 |
|
132 |
|
| 118 |
<!-- Modal to print patron cards --> |
133 |
<!-- Modal to print patron cards --> |
| 119 |
<div class="modal" id="patronExportModal" tabindex="-1" role="dialog" aria-labelledby="patronExportModal_label" aria-hidden="true"> |
134 |
<div class="modal" id="patronExportModal" tabindex="-1" role="dialog" aria-labelledby="patronExportModal_label" aria-hidden="true"> |
|
Lines 146-151
Link Here
|
| 146 |
|
161 |
|
| 147 |
[% MACRO jsinclude BLOCK %] |
162 |
[% MACRO jsinclude BLOCK %] |
| 148 |
[% Asset.js("js/tools-menu.js") | $raw %] |
163 |
[% Asset.js("js/tools-menu.js") | $raw %] |
|
|
164 |
[% Asset.js("js/form-submit.js") | $raw %] |
| 149 |
[% INCLUDE 'datatables.inc' %] |
165 |
[% INCLUDE 'datatables.inc' %] |
| 150 |
|
166 |
|
| 151 |
<script> |
167 |
<script> |
|
Lines 160-194
Link Here
|
| 160 |
"columnDefs": [ |
176 |
"columnDefs": [ |
| 161 |
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] } |
177 |
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] } |
| 162 |
], |
178 |
], |
| 163 |
"pagingType": "full" |
179 |
"pagingType": "full", |
|
|
180 |
"sorting": [[ 1, "asc" ]] |
| 164 |
} )); |
181 |
} )); |
| 165 |
$(".delete_patron").on("click", function(){ |
|
|
| 166 |
$(".dropdown").removeClass("open"); |
| 167 |
var list = $(this).data("list-name"); |
| 168 |
return confirmDelete( _("Are you sure you want to delete the list %s?").format(list)); |
| 169 |
}); |
| 170 |
|
182 |
|
| 171 |
$("#delete_selected_lists").on("click", function() { |
183 |
$("#patrons_lists_form").submit(function(){ |
| 172 |
if (selectedPatronLists.length != 0) { |
184 |
var checkedItems = $("input[name=patron_lists_ids]:checked"); |
| 173 |
if (confirm(_("Are you sure you want to delete the selected lists ?"))) { |
185 |
if ( checkedItems.size() == 0) { |
| 174 |
var delete_lists_url = '/cgi-bin/koha/patron_lists/delete.pl?patron_lists_ids=' + selectedPatronLists.join("&patron_lists_ids="); |
186 |
alert(_("You must select one or more lists to delete")); |
| 175 |
window.location.href = delete_lists_url; |
187 |
return false; |
| 176 |
} |
188 |
} |
| 177 |
} |
189 |
if( confirm(_("Are you sure you want to delete the selected lists?")) ) { |
| 178 |
}); |
190 |
return true; |
| 179 |
|
191 |
} else { |
| 180 |
$(document).on("click", ".select_patron", function() { |
192 |
return false; |
| 181 |
if($(this).is(':checked')){ |
193 |
} |
| 182 |
$("#delete_selected_lists").attr("class","btn btn-default btn-sm"); |
194 |
}); |
| 183 |
selectedPatronLists.push($(this).data("patron-list-id")); |
195 |
|
| 184 |
} |
196 |
$(document).on("click", ".select_list", function() { |
| 185 |
else { |
197 |
var checkedItems = $("input[name=patron_lists_ids]:checked"); |
| 186 |
selectedPatronLists = selectedPatronLists.filter(item => item !== $(this).data("patron-list-id")); |
198 |
if ( checkedItems.size() == 0 ) { |
| 187 |
if(selectedPatronLists.length === 0){ |
199 |
$("#delete_selected_lists").addClass("disabled").prop("disabled", true); |
| 188 |
$("#delete_selected_lists").attr("class","btn btn-default btn-sm disabled"); |
200 |
} else { |
| 189 |
} |
201 |
$("#delete_selected_lists").removeClass("disabled").prop("disabled", false); |
| 190 |
} |
202 |
} |
| 191 |
}); |
203 |
}); |
| 192 |
|
204 |
|
| 193 |
$(".print_cards").on("click", function(e){ |
205 |
$(".print_cards").on("click", function(e){ |
| 194 |
e.preventDefault(); |
206 |
e.preventDefault(); |