Lines 45-120
Link Here
|
45 |
|
45 |
|
46 |
[% IF ( lists ) %] |
46 |
[% IF ( lists ) %] |
47 |
|
47 |
|
48 |
<div class="page-section"> |
48 |
<form action="/cgi-bin/koha/patron_lists/delete.pl" method="post" id="patrons_lists_form"> |
49 |
<table id="patron-lists-table"> |
49 |
[% INCLUDE 'csrf-token.inc' %] |
50 |
<thead> |
50 |
<input type="hidden" name="op" value="cud-delete" /> |
51 |
<tr> |
51 |
<div id="searchheader" class="searchheader noprint sticky"> |
52 |
<input type="button" type="submit" class="btn btn-default btn-sm disabled" value="Delete selected lists" id="delete_selected_lists"/> |
52 |
<div class="btn-group"> |
53 |
<th>Name</th> |
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 |
<th>Patrons in list</th> |
54 |
</div> |
55 |
<th>Shared</th> |
55 |
</div> |
56 |
<th class="NoSort"> </th> |
56 |
|
57 |
</tr> |
57 |
<div class="page-section"> |
58 |
</thead> |
58 |
<table id="patron-lists-table"> |
59 |
|
59 |
<thead> |
60 |
<tbody> |
|
|
61 |
[% FOREACH l IN lists %] |
62 |
[% SET shared_by_other = l.owner.id != logged_in_user.id %] |
63 |
<tr> |
60 |
<tr> |
64 |
<td> |
61 |
<th class="NoSort"></th> |
65 |
<input class="select_patron" type="checkbox" autocomplete="off" data-patron-list-id="[% l.patron_list_id | html %]"> |
62 |
<th>Name</th> |
66 |
<a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]">[% l.name | html %]</a> |
63 |
<th>Patrons in list</th> |
67 |
</td> |
64 |
<th>Shared</th> |
68 |
<td>[% l.patron_list_patrons_rs.count || 0 | html %]</td> |
65 |
<th class="NoSort"> </th> |
69 |
<td> |
66 |
</tr> |
70 |
[% IF l.shared %] |
67 |
</thead> |
71 |
[% IF shared_by_other %] |
68 |
|
72 |
by <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% l.owner.id | uri %]">[% INCLUDE 'patron-title.inc' patron=l.owner %]</a> |
69 |
<tbody> |
73 |
[% ELSE %] |
70 |
[% FOREACH l IN lists %] |
74 |
by you |
71 |
[% SET shared_by_other = l.owner.id != logged_in_user.id %] |
75 |
[% END %] |
72 |
<tr> |
76 |
[% END %] |
73 |
<td> |
77 |
|
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 %]" /> |
78 |
</td> |
75 |
</td> |
79 |
<td> |
76 |
<td> |
80 |
<div class="btn-group dropup"> |
77 |
<a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]">[% l.name | html %]</a> |
81 |
<a class="btn btn-default btn-xs dropdown-toggle" id="listactions[% l.patron_list_id | html %]" role="button" data-bs-toggle="dropdown" href="#"> |
78 |
</td> |
82 |
Actions |
79 |
<td>[% l.patron_list_patrons_rs.count || 0 | html %]</td> |
83 |
</a> |
80 |
<td> |
84 |
<ul class="dropdown-menu" role="menu" aria-labelledby="listactions[% l.patron_list_id | html %]"> |
81 |
[% IF l.shared %] |
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> |
82 |
[% IF shared_by_other %] |
86 |
[% UNLESS shared_by_other %] |
83 |
by <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% l.owner.id | uri %]">[% INCLUDE 'patron-title.inc' patron=l.owner %]</a> |
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> |
84 |
[% ELSE %] |
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> |
85 |
by you |
89 |
[% END %] |
86 |
[% END %] |
90 |
[% IF ( l.patron_list_patrons_rs.count ) %] |
87 |
[% END %] |
91 |
<li><hr class="dropdown-divider" /></li> |
88 |
|
92 |
<li> |
89 |
</td> |
93 |
<a class="print_cards dropdown-item" href="/cgi-bin/koha/patroncards/print.pl?patronlist_id=[% l.patron_list_id | html %]" data-patron_list_id="[% l.patron_list_id | html %]"><i class="fa fa-print"></i> Print patron cards</a> |
90 |
<td> |
94 |
</li> |
91 |
<div class="btn-group dropup"> |
95 |
[% IF CAN_user_tools_edit_patrons %] |
92 |
<a class="btn btn-default btn-xs dropdown-toggle" id="listactions[% l.patron_list_id | html %]" role="button" data-bs-toggle="dropdown" href="#"> |
|
|
93 |
Actions |
94 |
</a> |
95 |
<ul class="dropdown-menu" role="menu" aria-labelledby="listactions[% l.patron_list_id | html %]"> |
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> |
97 |
[% UNLESS shared_by_other %] |
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> |
96 |
<li> |
99 |
<li> |
97 |
<a class="dropdown-item dropdown-item" href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id | uri %]&op=show"> |
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> |
98 |
<i class="fa-solid fa-pencil" aria-hidden="true"></i> Batch edit patrons |
|
|
99 |
</a> |
100 |
</li> |
101 |
</li> |
101 |
[% END %] |
102 |
[% END %] |
102 |
[% IF CAN_user_tools_delete_anonymize_patrons %] |
103 |
[% IF ( l.patron_list_patrons_rs.count ) %] |
|
|
104 |
<li><hr class="dropdown-divider" /></li> |
103 |
<li> |
105 |
<li> |
104 |
<a class="dropdown-item" href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id | uri %]&checkbox=borrower"> |
106 |
<a class="print_cards dropdown-item" href="/cgi-bin/koha/patroncards/print.pl?patronlist_id=[% l.patron_list_id | html %]" data-patron_list_id="[% l.patron_list_id | html %]"><i class="fa fa-print"></i> Print patron cards</a> |
105 |
<i class="fa fa-trash-can"></i> Batch delete patrons |
|
|
106 |
</a> |
107 |
</li> |
107 |
</li> |
|
|
108 |
[% IF CAN_user_tools_edit_patrons %] |
109 |
<li> |
110 |
<a class="dropdown-item dropdown-item" href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id | uri %]&op=show"> |
111 |
<i class="fa-solid fa-pencil" aria-hidden="true"></i> Batch edit patrons |
112 |
</a> |
113 |
</li> |
114 |
[% END %] |
115 |
[% IF CAN_user_tools_delete_anonymize_patrons %] |
116 |
<li> |
117 |
<a class="dropdown-item" href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id | uri %]&checkbox=borrower"> |
118 |
<i class="fa fa-trash-can"></i> Batch delete patrons |
119 |
</a> |
120 |
</li> |
121 |
[% END %] |
108 |
[% END %] |
122 |
[% END %] |
109 |
[% END %] |
123 |
</ul> |
110 |
</ul> |
124 |
</div> |
111 |
</div> |
125 |
</td> |
112 |
</td> |
126 |
</tr> |
113 |
</tr> |
127 |
[% END %] |
114 |
[% END %] |
128 |
</tbody> |
115 |
</tbody> |
129 |
</table> |
116 |
</table> |
130 |
</div> <!-- /.page-section --> |
117 |
</div> <!-- /.page-section --> |
131 |
</form> <!-- /#patron_lists_form --> |
118 |
|
132 |
|
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"> |
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-193
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 |
} |
188 |
} |
|
|
189 |
if( confirm(_("Are you sure you want to delete the selected lists?")) ) { |
190 |
return true; |
191 |
} else { |
192 |
return false; |
178 |
} |
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")); |
|
|
188 |
if(selectedPatronLists.length === 0){ |
189 |
$("#delete_selected_lists").attr("class","btn btn-default btn-sm disabled"); |
190 |
} |
191 |
} |
202 |
} |
192 |
}); |
203 |
}); |
193 |
|
204 |
|