Bug 35194: Remove obsoleted sortable function
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / patron_lists / lists.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% PROCESS 'i18n.inc' %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% FILTER collapse %]
7     [% t("Patron lists") | html %] &rsaquo;
8     [% t("Tools") | html %] &rsaquo;
9     [% t("Koha") | html %]
10 [% END %]</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% INCLUDE 'greybox.inc' %]
13 </head>
14
15 <body id="patlist_lists" class="pat patlist">
16 [% WRAPPER 'header.inc' %]
17     [% INCLUDE 'cat-search.inc' %]
18 [% END %]
19
20 [% WRAPPER 'sub-header.inc' %]
21     [% WRAPPER breadcrumbs %]
22         [% WRAPPER breadcrumb_item %]
23             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
24         [% END %]
25         [% WRAPPER breadcrumb_item bc_active= 1 %]
26             <span>Patron lists</span>
27         [% END %]
28     [% END #/ WRAPPER breadcrumbs %]
29 [% END #/ WRAPPER sub-header.inc %]
30
31 <div class="main container-fluid">
32     <div class="row">
33         <div class="col-sm-10 col-sm-push-2">
34             <main>
35
36         <div id="toolbar" class="btn-toolbar">
37             <div class="btn-group">
38                 <a class="btn btn-default" href="add-modify.pl"><i class="fa fa-plus"></i> New patron list</a>
39             </div>
40         </div>
41
42         <h1>Patron lists</h1>
43
44         [% IF ( lists ) %]
45
46         <div class="page-section">
47             <table id="patron-lists-table">
48                 <thead>
49                     <tr>
50                         <input type="button" type="submit" class="btn btn-default btn-sm disabled" value="Delete selected lists" id="delete_selected_lists"/>
51                         <th>Name</th>
52                         <th>Patrons in list</th>
53                         <th>Shared</th>
54                         <th class="NoSort">&nbsp;</th>
55                     </tr>
56                 </thead>
57
58                 <tbody>
59                     [% FOREACH l IN lists %]
60                         [% SET shared_by_other = l.owner.id != logged_in_user.id %]
61                         <tr>
62                             <td>
63                                 <input class="select_patron" type="checkbox" autocomplete="off" data-patron-list-id="[% l.patron_list_id | html %]">
64                                 <a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]">[% l.name | html %]</a>
65                             </td>
66                             <td>[% l.patron_list_patrons_rs.count || 0 | html %]</td>
67                             <td>
68                                 [% IF l.shared %]
69                                     [% IF shared_by_other %]
70                                         by <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% l.owner.id | uri %]">[% INCLUDE 'patron-title.inc' patron=l.owner %]</a>
71                                     [% ELSE %]
72                                         by you
73                                     [% END %]
74                                 [% END %]
75
76                             </td>
77                             <td>
78                                 <div class="btn-group dropup">
79                                     <a class="btn btn-default btn-xs dropdown-toggle" id="listactions[% l.patron_list_id | html %]" role="button" data-toggle="dropdown" href="#">
80                                     Actions <b class="caret"></b>
81                                     </a>
82                                     <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="listactions[% l.patron_list_id | html %]">
83                                         <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>
84                                         [% UNLESS shared_by_other %]
85                                             <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>
86                                             <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>
87                                         [% END %]
88                                         [% IF ( l.patron_list_patrons_rs.count ) %]
89                                             <li class="divider"></li>
90                                             <li>
91                                                 <a class="print_cards" 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>
92                                             </li>
93                                             [% IF CAN_user_tools_edit_patrons %]
94                                                 <li>
95                                                     <a href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id | uri %]&op=show">
96                                                         <i class="fa-solid fa-pencil" aria-hidden="true"></i> Batch edit patrons
97                                                     </a>
98                                                 </li>
99                                             [% END %]
100                                             [% IF CAN_user_tools_delete_anonymize_patrons %]
101                                                 <li>
102                                                     <a href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id | uri %]&checkbox=borrower">
103                                                         <i class="fa fa-trash-can"></i> Batch delete patrons
104                                                     </a>
105                                                 </li>
106                                             [% END %]
107                                         [% END %]
108                                     </ul>
109                                 </div>
110                             </td>
111                         </tr>
112                     [% END %]
113                 </tbody>
114             </table>
115         </div> <!-- /.page-section -->
116
117             <!-- Modal to print patron cards -->
118             <div class="modal" id="patronExportModal" tabindex="-1" role="dialog" aria-labelledby="patronExportModal_label" aria-hidden="true">
119                 <div class="modal-dialog">
120                 <div class="modal-content">
121                 <div class="modal-header">
122                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">&times;</button>
123                     <h3 id="patronExportModal_label">Print patron cards</h3>
124                 </div>
125                 <div class="modal-body">
126                     <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
127                 </div>
128                 </div>
129                 </div>
130             </div>
131
132         [% ELSE %]
133            <div class="dialog message">There are no patron lists.</div>
134         [% END %]
135
136             </main>
137         </div> <!-- /.col-sm-10.col-sm-push-2 -->
138
139         <div class="col-sm-2 col-sm-pull-10">
140             <aside>
141                 [% INCLUDE 'tools-menu.inc' %]
142             </aside>
143         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
144      </div> <!-- /.row -->
145
146 [% MACRO jsinclude BLOCK %]
147     [% Asset.js("js/tools-menu.js") | $raw %]
148     [% INCLUDE 'datatables.inc' %]
149
150     <script>
151         $(document).ready(function() {
152             var patronExportModal = $("#patronExportModal");
153             var patronExportModalBody = $("#patronExportModal .modal-body");
154
155             let selectedPatronLists = new Array();
156
157             $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, {
158                 "autoWidth": false,
159                 "aoColumnDefs": [
160                     {"bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ]}
161                 ],
162                 "sPaginationType": "full"
163             } ));
164             $(".delete_patron").on("click", function(){
165                 $(".dropdown").removeClass("open");
166                 var list = $(this).data("list-name");
167                 return confirmDelete( _("Are you sure you want to delete the list %s?").format(list));
168             });
169
170             $("#delete_selected_lists").on("click", function() {
171                 if (selectedPatronLists.length != 0) {
172                     if (confirm(_("Are you sure you want to delete the selected lists ?"))) {
173                     var delete_lists_url = '/cgi-bin/koha/patron_lists/delete.pl?patron_lists_ids=' + selectedPatronLists.join("&patron_lists_ids=");
174                     window.location.href = delete_lists_url;
175                     }
176                 }
177             });
178
179             $(".select_patron").on("click", function() {
180                 if($(this).is(':checked')){
181                     $("#delete_selected_lists").attr("class","btn btn-default btn-sm");
182                     selectedPatronLists.push($(this).data("patron-list-id"));
183                 }
184                 else {
185                     selectedPatronLists = selectedPatronLists.filter(item => item !== $(this).data("patron-list-id"));
186                     if(selectedPatronLists.length === 0){
187                         $("#delete_selected_lists").attr("class","btn btn-default btn-sm disabled");
188                     }
189                 }
190             });
191
192             $(".print_cards").on("click", function(e){
193                 e.preventDefault();
194                 var page = $(this).attr("href");
195                 patronExportModalBody.load(page + " #exportingf");
196                 patronExportModal.modal("show");
197             });
198
199             patronExportModal.on("hidden.bs.modal", function(){
200                 patronExportModalBody.html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
201             });
202
203             patronExportModal.on("submit", "#exportingf", function(e){
204                 e.preventDefault();
205                 modal_body = patronExportModalBody;
206                 modal_body.html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
207                 target_url = $(this).attr("action");
208                 params =  $( this ).serialize();
209                 $("#patronExportModal .modal-body").load( target_url + "?" + params + " #export_patron_list");
210             });
211
212             patronExportModal.on("click",".closebtn,.gb-close",function(e){
213                 e.preventDefault();
214                 patronExportModal.modal("hide");
215             });
216
217         });
218     </script>
219 [% END %]
220
221 [% INCLUDE 'intranet-bottom.inc' %]