Bug 19647: Move patron lists templates JS to the footer
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / patron_lists / lists.tt
blobe0b13ad2ddc34f0f43a197c33ef3fb9c497ebd8c
1 [% SET footerjs = 1 %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Tools &rsaquo; Patron lists</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 [% INCLUDE 'greybox.inc' %]
6 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
7 </head>
9 <body id="patlist_lists" class="pat patlist">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'cat-search.inc' %]
12 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Patron lists</div>
14 <div id="doc3" class="yui-t2">
15    <div id="bd">
16     <div id="yui-main">
17         <div class="yui-b">
19         <div id="toolbar" class="btn-toolbar">
20             <div class="btn-group">
21                 <a class="btn btn-default btn-sm" href="add-modify.pl"><i class="fa fa-plus"></i> New patron list</a>
22             </div>
23         </div>
25         <h1>Your patron lists</h1>
27         [% IF ( lists ) %]
29         <table id="patron-lists-table">
30             <thead>
31                 <tr>
32                     <th>Name</th>
33                     <th>Patrons in list</th>
34                     <th class="NoSort">&nbsp;</th>
35                 </tr>
36             </thead>
38             <tbody>
39                 [% FOREACH l IN lists %]
40                     <tr>
41                         <td><a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id %]">[% l.name |html%]</a></td>
42                         <td>[% l.patron_list_patrons_rs.count || 0 %]</td>
43                         <td>
44                             <div class="dropdown">
45                                 <a class="btn btn-default btn-xs dropdown-toggle" id="listactions[% l.patron_list_id %]" role="button" data-toggle="dropdown" href="#">
46                                    Actions <b class="caret"></b>
47                                 </a>
48                                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="listactions[% l.patron_list_id %]">
49                                     <li><a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id %]"><i class="fa fa-user"></i> Add patrons</a></li>
50                                     <li><a href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id %]"><i class="fa fa-pencil"></i> Edit list</a></li>
51                                     <li><a class="delete_patron" href="/cgi-bin/koha/patron_lists/delete.pl?patron_list_id=[% l.patron_list_id %]" data-list-name="[% l.name %]"><i class="fa fa-trash"></i> Delete list</a></li>
52                                     [% IF ( l.patron_list_patrons_rs.count ) %]
53                                         <li class="divider"></li>
54                                         <li>
55                                             <a class="print_cards" href="/cgi-bin/koha/patroncards/print.pl?patronlist_id=[% l.patron_list_id %]" data-patron_list_id="[% l.patron_list_id %]"><i class="fa fa-print"></i> Print patron cards</a>
56                                         </li>
57                                         [% IF CAN_user_tools_edit_patrons %]
58                                             <li>
59                                                 <a href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id %]&op=show">
60                                                     <i class="fa fa-pencil"></i> Batch edit patrons
61                                                 </a>
62                                             </li>
63                                         [% END %]
64                                         [% IF CAN_user_tools_delete_anonymize_patrons %]
65                                             <li>
66                                                 <a href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id %]&checkbox=borrower">
67                                                     <i class="fa fa-trash"></i> Batch delete patrons
68                                                 </a>
69                                             </li>
70                                         [% END %]
71                                     [% END %]
72                                 </ul>
73                             </div>
74                         </td>
75                     </tr>
76                 [% END %]
77             </tbody>
78         </table>
80             <!-- Modal to print patron cards -->
81             <div class="modal" id="patronExportModal" tabindex="-1" role="dialog" aria-labelledby="patronExportModal_label" aria-hidden="true">
82                 <div class="modal-dialog">
83                 <div class="modal-content">
84                 <div class="modal-header">
85                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">&times;</button>
86                     <h3 id="patronExportModal_label">Print patron cards</h3>
87                 </div>
88                 <div class="modal-body">
89                     <div id="loading"> <img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /> Loading </div>
90                 </div>
91                 </div>
92                 </div>
93             </div>
95         [% ELSE %]
96            <div class="dialog message">There are no patron lists.</div>
97         [% END %]
99             </div>
100         </div>
101         <div class="yui-b noprint">
102             [% INCLUDE 'tools-menu.inc' %]
103         </div>
104     </div>
106 [% MACRO jsinclude BLOCK %]
107     <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
108     [% INCLUDE 'datatables.inc' %]
110     <script type="text/javascript">
111         $(document).ready(function() {
112             var patronExportModal = $("#patronExportModal");
113             var patronExportModalBody = $("#patronExportModal .modal-body")
115             $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, {
116                 "autoWidth": false,
117                 "aoColumnDefs": [
118                     { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }
119                 ],
120                 "sPaginationType": "four_button"
121             } ));
122             $(".delete_patron").on("click", function(){
123                 $(".dropdown").removeClass("open");
124                 var list = $(this).data("list-name");
125                 return confirmDelete( _("Are you sure you want to delete the list %s?").format(list) );
126             });
128             $(".print_cards").on("click", function(e){
129                 e.preventDefault();
130                 var page = $(this).attr("href");
131                 patronExportModalBody.load(page + " #exportingf");
132                 patronExportModal.modal("show");
133             });
135             patronExportModal.on("hidden", function(){
136                 patronExportModalBody.html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
137             });
139             patronExportModal.on("submit", "#exportingf", function(e){
140                 e.preventDefault();
141                 modal_body = patronExportModalBody;
142                 modal_body.html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
143                 target_url = $(this).attr("action");
144                 params =  $( this ).serialize();
145                 modal_body.load( target_url + "?" + params + " #custom-doc");
146             });
148             patronExportModal.on("click",".closebtn,.gb-close",function(e){
149                 e.preventDefault();
150                 patronExportModal.modal("hide");
151             });
153         });
154     </script>
155 [% END %]
157 [% INCLUDE 'intranet-bottom.inc' %]