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