Bug 10565: Add a "Patron List" feature for storing and manipulating collections of...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / patron_lists / list.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Patron lists &rsaquo; New list</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5
6 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
7 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
8 [% INCLUDE 'datatables-strings.inc' %]
9 <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
10
11 <script type="text/javascript">
12 //<![CDATA[
13 $(document).ready(function() {
14     $('#patrons_to_add_fieldset').hide();
15
16     $('#patron-list-table').dataTable($.extend(true, {}, dataTablesDefaults));
17
18     $( "#find_patron" ).autocomplete({
19         source: "/cgi-bin/koha/circ/ysearch.pl",
20         minLength: 3,
21         select: function( event, ui ) {
22             AddPatron( ui.item.firstname + " " + ui.item.surname, ui.item.cardnumber );
23             return false;
24         }
25     })
26     .data( "autocomplete" )._renderItem = function( ul, item ) {
27         return $( "<li></li>" )
28         .data( "item.autocomplete", item )
29         .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
30         .appendTo( ul );
31     };
32 });
33
34 function AddPatron( name, cardnumber ) {
35     div = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='javascript:void()' onclick='RemovePatron(" + cardnumber + ");'> Remove </a> ) <input type='hidden' name='patrons_to_add' value='" + cardnumber + "' /></div>";
36     $('#patrons_to_add').append( div );
37
38     $('#find_patron').val('').focus();
39
40     $('#patrons_to_add_fieldset').show( 800 );
41 }
42
43 function RemovePatron( cardnumber ) {
44     $( '#borrower_' + cardnumber ).remove();
45
46     if ( ! $('#patrons_to_add').html() ) {
47         $('#patrons_to_add_fieldset').hide( 800 );
48     }
49 }
50 //]]>
51 </script>
52
53 </head>
54
55 <body>
56 [% INCLUDE 'header.inc' %]
57 [% INCLUDE 'cat-search.inc' %]
58 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="lists.pl">Patron lists</a> &rsaquo; Add patrons</div>
59
60 <div class="yui-t7">
61     <div class="yui-main">
62         <h1>[% list.name %]</h1>
63
64         <form action="list.pl" method="post">
65             <fieldset>
66                 <legend>Add patrons</legend>
67
68                     <label for="find_patron">Patron search: </label>
69                     <input autocomplete="off" id="find_patron" type="text" style="width:150px" class="noEnterSubmit" />
70                     <div id="find_patron_container"></div>
71
72                 <fieldset id="patrons_to_add_fieldset">
73                     <legend>Patrons to be added</legend>
74                     <div id="patrons_to_add"></div>
75                 </fieldset>
76
77             </fieldset>
78
79             <p>
80                 <input type="submit" class="btn" value="Update" />
81                 <a href="lists.pl" class="cancel">Cancel</a>
82             </p>
83
84             <table id="patron-list-table">
85                 <thead>
86                     <tr>
87                         <th><i title="Remove patron from list" class="icon-trash"></i></th>
88                         <th>Card</th>
89                         <th>Firstname</th>
90                         <th>Surname</th>
91                         <th>Address</th>
92                         <th>Category</th>
93                         <th>Library</th>
94                         <th>Expires on</th>
95                         <th>Circ notes</th>
96                     </tr>
97                 </thead>
98
99                 <tbody>
100                     [% FOREACH p IN list.patron_list_patrons %]
101                         <tr>
102                             <td><input type="checkbox" name="patrons_to_remove" value="[% p.patron_list_patron_id %]" /></td>
103                             <td>
104                                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% p.borrowernumber.borrowernumber %]">
105                                     [% p.borrowernumber.cardnumber %]
106                                 </a>
107                             </td>
108                             <td>[% p.borrowernumber.firstname %]</td>
109                             <td>[% p.borrowernumber.surname %]</td>
110                             <td>
111                                 [% p.borrowernumber.address %]
112                                 [% p.borrowernumber.address2 %]
113                                 [% p.borrowernumber.city %]
114                                 [% p.borrowernumber.state %]
115                                 [% p.borrowernumber.country %]
116                             </td>
117                             <td>[% p.borrowernumber.categorycode.description %] ([% p.borrowernumber.categorycode.categorycode %])</td>
118                             <td>[% p.borrowernumber.branchcode.branchname %]</td>
119                             <td>[% p.borrowernumber.dateexpiry | $KohaDates %]</td>
120                             <td>[% p.borrowernumber.borrowernotes %]</td>
121                         </tr>
122                     [% END %]
123                 </tbody>
124             </table>
125
126             <input type="hidden" name="patron_list_id" value="[% list.patron_list_id %]" />
127             <input type="submit" class="btn" value="Update" />
128             <a href="lists.pl" class="cancel">Cancel</a>
129         </form>
130     </div>
131 </div>
132 [% INCLUDE 'intranet-bottom.inc' %]