Lines 40-123
Link Here
|
40 |
<h1>Patron lists</h1> |
40 |
<h1>Patron lists</h1> |
41 |
|
41 |
|
42 |
[% IF ( lists ) %] |
42 |
[% IF ( lists ) %] |
43 |
<div class="page-section"> |
43 |
<form action="/cgi-bin/koha/patron_lists/delete.pl" method="post" id="patrons_lists_form"> |
44 |
<table id="patron-lists-table"> |
44 |
[% INCLUDE 'csrf-token.inc' %] |
45 |
<thead> |
45 |
<input type="hidden" name="op" value="cud-delete" /> |
46 |
<tr> |
46 |
<div id="searchheader" class="searchheader noprint sticky"> |
47 |
<input type="button" type="submit" class="btn btn-default btn-sm disabled" value="Delete selected lists" id="delete_selected_lists" /> |
47 |
<div class="btn-group"> |
48 |
<th>Name</th> |
48 |
<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> |
49 |
<th>Patrons in list</th> |
49 |
</div> |
50 |
<th>Shared</th> |
50 |
</div> |
51 |
<th class="NoSort"> </th> |
51 |
|
52 |
</tr> |
52 |
<div class="page-section"> |
53 |
</thead> |
53 |
<table id="patron-lists-table"> |
54 |
|
54 |
<thead> |
55 |
<tbody> |
|
|
56 |
[% FOREACH l IN lists %] |
57 |
[% SET shared_by_other = l.owner.id != logged_in_user.id %] |
58 |
<tr> |
55 |
<tr> |
59 |
<td> |
56 |
<th class="NoSort"></th> |
60 |
<input class="select_patron" type="checkbox" autocomplete="off" data-patron-list-id="[% l.patron_list_id | html %]" /> |
57 |
<th>Name</th> |
61 |
<a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]">[% l.name | html %]</a> |
58 |
<th>Patrons in list</th> |
62 |
</td> |
59 |
<th>Shared</th> |
63 |
<td>[% l.patron_list_patrons_rs.count || 0 | html %]</td> |
60 |
<th class="NoSort"> </th> |
64 |
<td> |
61 |
</tr> |
65 |
[% IF l.shared %] |
62 |
</thead> |
66 |
[% IF shared_by_other %] |
63 |
|
67 |
by <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% l.owner.id | uri %]">[% INCLUDE 'patron-title.inc' patron=l.owner %]</a> |
64 |
<tbody> |
68 |
[% ELSE %] |
65 |
[% FOREACH l IN lists %] |
69 |
by you |
66 |
[% SET shared_by_other = l.owner.id != logged_in_user.id %] |
|
|
67 |
<tr> |
68 |
<td> |
69 |
<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 %]" /> |
70 |
</td> |
71 |
<td> |
72 |
<a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]">[% l.name | html %]</a> |
73 |
</td> |
74 |
<td>[% l.patron_list_patrons_rs.count || 0 | html %]</td> |
75 |
<td> |
76 |
[% IF l.shared %] |
77 |
[% IF shared_by_other %] |
78 |
by <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% l.owner.id | uri %]">[% INCLUDE 'patron-title.inc' patron=l.owner %]</a> |
79 |
[% ELSE %] |
80 |
by you |
81 |
[% END %] |
70 |
[% END %] |
82 |
[% END %] |
71 |
[% END %] |
83 |
</td> |
72 |
</td> |
84 |
<td> |
73 |
<td> |
85 |
<div class="btn-group dropup"> |
74 |
<div class="btn-group dropup"> |
86 |
<a class="btn btn-default btn-xs dropdown-toggle" id="listactions[% l.patron_list_id | html %]" role="button" data-bs-toggle="dropdown" href="#"> Actions </a> |
75 |
<a class="btn btn-default btn-xs dropdown-toggle" id="listactions[% l.patron_list_id | html %]" role="button" data-bs-toggle="dropdown" href="#"> Actions </a> |
87 |
<ul class="dropdown-menu" role="menu" aria-labelledby="listactions[% l.patron_list_id | html %]"> |
76 |
<ul class="dropdown-menu" role="menu" aria-labelledby="listactions[% l.patron_list_id | html %]"> |
|
|
77 |
<li |
78 |
><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 |
79 |
> |
80 |
[% UNLESS shared_by_other %] |
81 |
<li |
82 |
><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 |
83 |
> |
84 |
<li |
88 |
<li |
85 |
><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 %]" |
89 |
><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 |
><i class="fa fa-trash-can"></i> Delete list</a |
|
|
87 |
></li |
88 |
> |
90 |
> |
89 |
[% END %] |
91 |
[% UNLESS shared_by_other %] |
90 |
[% IF ( l.patron_list_patrons_rs.count ) %] |
92 |
<li |
91 |
<li><hr class="dropdown-divider" /></li> |
93 |
><a class="dropdown-item" href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id | uri %]" |
92 |
<li> |
94 |
><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit list</a |
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 %]" |
95 |
></li |
94 |
><i class="fa fa-print"></i> Print patron cards</a |
|
|
95 |
> |
96 |
> |
96 |
</li> |
|
|
97 |
[% IF CAN_user_tools_edit_patrons %] |
98 |
<li> |
97 |
<li> |
99 |
<a class="dropdown-item dropdown-item" href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id | uri %]&op=show"> |
98 |
<a |
100 |
<i class="fa-solid fa-pencil" aria-hidden="true"></i> Batch edit patrons |
99 |
class="dropdown-item submit-form-link" |
101 |
</a> |
100 |
href="#" |
|
|
101 |
data-patron_list_id="[% l.patron_list_id | html %]" |
102 |
data-action="delete.pl" |
103 |
data-method="post" |
104 |
data-op="cud-delete" |
105 |
data-confirmation-msg="Are you sure you want to delete this list?" |
106 |
><i class="fa fa-trash-can"></i> Delete list</a |
107 |
> |
102 |
</li> |
108 |
</li> |
103 |
[% END %] |
109 |
[% END %] |
104 |
[% IF CAN_user_tools_delete_anonymize_patrons %] |
110 |
[% IF ( l.patron_list_patrons_rs.count ) %] |
|
|
111 |
<li><hr class="dropdown-divider" /></li> |
105 |
<li> |
112 |
<li> |
106 |
<a class="dropdown-item" href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id | uri %]&checkbox=borrower"> |
113 |
<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 %]" |
107 |
<i class="fa fa-trash-can"></i> Batch delete patrons |
114 |
><i class="fa fa-print"></i> Print patron cards</a |
108 |
</a> |
115 |
> |
109 |
</li> |
116 |
</li> |
|
|
117 |
[% IF CAN_user_tools_edit_patrons %] |
118 |
<li> |
119 |
<a class="dropdown-item dropdown-item" href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id | uri %]&op=show"> |
120 |
<i class="fa-solid fa-pencil" aria-hidden="true"></i> Batch edit patrons |
121 |
</a> |
122 |
</li> |
123 |
[% END %] |
124 |
[% IF CAN_user_tools_delete_anonymize_patrons %] |
125 |
<li> |
126 |
<a class="dropdown-item" href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id | uri %]&checkbox=borrower"> |
127 |
<i class="fa fa-trash-can"></i> Batch delete patrons |
128 |
</a> |
129 |
</li> |
130 |
[% END %] |
110 |
[% END %] |
131 |
[% END %] |
111 |
[% END %] |
132 |
</ul> |
112 |
</ul> |
133 |
</div> |
113 |
</div> |
134 |
</td> |
114 |
</td> |
135 |
</tr> |
115 |
</tr> |
136 |
[% END %] |
116 |
[% END %] |
137 |
</tbody> |
117 |
</tbody> |
138 |
</table> |
118 |
</table> |
139 |
</div> |
119 |
</div> |
140 |
<!-- /.page-section --> |
120 |
<!-- /.page-section --> |
141 |
</form> |
|
|
142 |
<!-- /#patron_lists_form --> |
121 |
|
143 |
|
122 |
<!-- Modal to print patron cards --> |
144 |
<!-- Modal to print patron cards --> |
123 |
<div class="modal" id="patronExportModal" tabindex="-1" role="dialog" aria-labelledby="patronExportModal_label" aria-hidden="true"> |
145 |
<div class="modal" id="patronExportModal" tabindex="-1" role="dialog" aria-labelledby="patronExportModal_label" aria-hidden="true"> |
Lines 140-145
Link Here
|
140 |
|
162 |
|
141 |
[% MACRO jsinclude BLOCK %] |
163 |
[% MACRO jsinclude BLOCK %] |
142 |
[% Asset.js("js/tools-menu.js") | $raw %] |
164 |
[% Asset.js("js/tools-menu.js") | $raw %] |
|
|
165 |
[% Asset.js("js/form-submit.js") | $raw %] |
143 |
[% INCLUDE 'datatables.inc' %] |
166 |
[% INCLUDE 'datatables.inc' %] |
144 |
<script> |
167 |
<script> |
145 |
$(document).ready(function() { |
168 |
$(document).ready(function() { |
Lines 153-185
Link Here
|
153 |
"columnDefs": [ |
176 |
"columnDefs": [ |
154 |
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] } |
177 |
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] } |
155 |
], |
178 |
], |
156 |
"pagingType": "full" |
179 |
"pagingType": "full", |
|
|
180 |
"sorting": [[ 1, "asc" ]] |
157 |
} )); |
181 |
} )); |
158 |
$(".delete_patron").on("click", function(){ |
|
|
159 |
$(".dropdown").removeClass("open"); |
160 |
var list = $(this).data("list-name"); |
161 |
return confirmDelete( _("Are you sure you want to delete the list %s?").format(list)); |
162 |
}); |
163 |
|
182 |
|
164 |
$("#delete_selected_lists").on("click", function() { |
183 |
$("#patrons_lists_form").submit(function(){ |
165 |
if (selectedPatronLists.length != 0) { |
184 |
var checkedItems = $("input[name=patron_lists_ids]:checked"); |
166 |
if (confirm(_("Are you sure you want to delete the selected lists ?"))) { |
185 |
if ( checkedItems.size() == 0) { |
167 |
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")); |
168 |
window.location.href = delete_lists_url; |
187 |
return false; |
169 |
} |
188 |
} |
|
|
189 |
if( confirm(_("Are you sure you want to delete the selected lists?")) ) { |
190 |
return true; |
191 |
} else { |
192 |
return false; |
170 |
} |
193 |
} |
171 |
}); |
194 |
}); |
172 |
|
195 |
|
173 |
$(document).on("click", ".select_patron", function() { |
196 |
$(document).on("click", ".select_list", function() { |
174 |
if($(this).is(':checked')){ |
197 |
var checkedItems = $("input[name=patron_lists_ids]:checked"); |
175 |
$("#delete_selected_lists").attr("class","btn btn-default btn-sm"); |
198 |
if ( checkedItems.size() == 0 ) { |
176 |
selectedPatronLists.push($(this).data("patron-list-id")); |
199 |
$("#delete_selected_lists").addClass("disabled").prop("disabled", true); |
177 |
} |
200 |
} else { |
178 |
else { |
201 |
$("#delete_selected_lists").removeClass("disabled").prop("disabled", false); |
179 |
selectedPatronLists = selectedPatronLists.filter(item => item !== $(this).data("patron-list-id")); |
|
|
180 |
if(selectedPatronLists.length === 0){ |
181 |
$("#delete_selected_lists").attr("class","btn btn-default btn-sm disabled"); |
182 |
} |
183 |
} |
202 |
} |
184 |
}); |
203 |
}); |
185 |
|
204 |
|