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