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