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