+[% USE Asset %]
+[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Patron lists</title>
+<title>Koha › Tools › Patron lists</title>
[% INCLUDE 'doc-head-close.inc' %]
-
-<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
-[% INCLUDE 'datatables-strings.inc' %]
-<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
-
-<script type="text/javascript">
-//<![CDATA[
- $(document).ready(function() {
- $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults));
- });
-
- function ConfirmDelete( list ) {
- return confirm( _("Are you sure you want to delete the list ") + list + "?" );
- }
-//]]>
-</script>
-
+[% INCLUDE 'greybox.inc' %]
+[% Asset.css("css/datatables.css") %]
</head>
-<body>
+<body id="patlist_lists" class="pat patlist">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › Patron lists</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › Patron lists</div>
-<div class="yui-t7">
- <div class="yui-main">
- <h1>Your patron lists</h1>
+<div id="doc3" class="yui-t2">
+ <div id="bd">
+ <div id="yui-main">
+ <div class="yui-b">
- <div class="btn-group">
- <a class="btn btn-small" href="add-modify.pl"><i class="icon-plus"></i> New patron list</a>
+ <div id="toolbar" class="btn-toolbar">
+ <div class="btn-group">
+ <a class="btn btn-default btn-sm" href="add-modify.pl"><i class="fa fa-plus"></i> New patron list</a>
+ </div>
</div>
+ <h1>Your patron lists</h1>
+
+ [% IF ( lists ) %]
+
<table id="patron-lists-table">
<thead>
<tr>
<th>Name</th>
<th>Patrons in list</th>
- <th> </th>
- <th> </th>
- <th> </th>
+ <th>Shared</th>
+ <th class="NoSort"> </th>
</tr>
</thead>
<tbody>
[% FOREACH l IN lists %]
+ [% SET shared_by_other = l.owner.id != logged_in_user.id %]
<tr>
- <td>[% l.name %]</td>
- <td>[% l.patron_list_patrons.size || 0 %]</td>
- <td>
- <a class="btn" href="list.pl?patron_list_id=[% l.patron_list_id %]">
- <i class="icon-plus-sign"></i> Add patrons <i class="icon-user"></i>
- </a>
- </td>
+ <td><a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id %]">[% l.name |html%]</a></td>
+ <td>[% l.patron_list_patrons_rs.count || 0 %]</td>
<td>
- <a class="btn" href="add-modify.pl?patron_list_id=[% l.patron_list_id %]">
- <i class="icon-edit"></i> Edit
- </a>
+ [% IF l.shared %]
+ [% IF shared_by_other %]
+ by <a href=/cgi-bin/koha/members/moremember.pl?borrowernumber=[% l.owner.id %]">[% INCLUDE 'patron-title.inc' patron=l.owner %]</a>
+ [% ELSE %]
+ by you
+ [% END %]
+ [% END %]
</td>
<td>
- <a class="btn" href="delete.pl?patron_list_id=[% l.patron_list_id %]" onclick='return ConfirmDelete("[% l.name | html %]")'>
- <i class="icon-trash"></i> Delete
- </a>
+ <div class="dropdown">
+ <a class="btn btn-default btn-xs dropdown-toggle" id="listactions[% l.patron_list_id %]" role="button" data-toggle="dropdown" href="#">
+ Actions <b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="listactions[% l.patron_list_id %]">
+ <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>
+ [% UNLESS shared_by_other %]
+ <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>
+ <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>
+ [% END %]
+ [% IF ( l.patron_list_patrons_rs.count ) %]
+ <li class="divider"></li>
+ <li>
+ <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>
+ </li>
+ [% IF CAN_user_tools_edit_patrons %]
+ <li>
+ <a href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id %]&op=show">
+ <i class="fa fa-pencil"></i> Batch edit patrons
+ </a>
+ </li>
+ [% END %]
+ [% IF CAN_user_tools_delete_anonymize_patrons %]
+ <li>
+ <a href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id %]&checkbox=borrower">
+ <i class="fa fa-trash"></i> Batch delete patrons
+ </a>
+ </li>
+ [% END %]
+ [% END %]
+ </ul>
+ </div>
</td>
</tr>
[% END %]
</tbody>
</table>
+
+ <!-- Modal to print patron cards -->
+ <div class="modal" id="patronExportModal" tabindex="-1" role="dialog" aria-labelledby="patronExportModal_label" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
+ <h3 id="patronExportModal_label">Print patron cards</h3>
+ </div>
+ <div class="modal-body">
+ <div id="loading"> <img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /> Loading </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ [% ELSE %]
+ <div class="dialog message">There are no patron lists.</div>
+ [% END %]
+
+ </div>
+ </div>
+ <div class="yui-b noprint">
+ [% INCLUDE 'tools-menu.inc' %]
+ </div>
</div>
-</div>
+
+[% MACRO jsinclude BLOCK %]
+ [% Asset.js("js/tools-menu.js") %]
+ [% INCLUDE 'datatables.inc' %]
+
+ <script type="text/javascript">
+ $(document).ready(function() {
+ var patronExportModal = $("#patronExportModal");
+ var patronExportModalBody = $("#patronExportModal .modal-body")
+
+ $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, {
+ "autoWidth": false,
+ "aoColumnDefs": [
+ { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }
+ ],
+ "sPaginationType": "four_button"
+ } ));
+ $(".delete_patron").on("click", function(){
+ $(".dropdown").removeClass("open");
+ var list = $(this).data("list-name");
+ return confirmDelete( _("Are you sure you want to delete the list %s?").format(list) );
+ });
+
+ $(".print_cards").on("click", function(e){
+ e.preventDefault();
+ var page = $(this).attr("href");
+ patronExportModalBody.load(page + " #exportingf");
+ patronExportModal.modal("show");
+ });
+
+ patronExportModal.on("hidden", function(){
+ patronExportModalBody.html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
+ });
+
+ patronExportModal.on("submit", "#exportingf", function(e){
+ e.preventDefault();
+ modal_body = patronExportModalBody;
+ modal_body.html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
+ target_url = $(this).attr("action");
+ params = $( this ).serialize();
+ modal_body.load( target_url + "?" + params + " #custom-doc");
+ });
+
+ patronExportModal.on("click",".closebtn,.gb-close",function(e){
+ e.preventDefault();
+ patronExportModal.modal("hide");
+ });
+
+ });
+ </script>
+[% END %]
+
[% INCLUDE 'intranet-bottom.inc' %]