Bug 11570 - Upgrade jQueryUI to latest version in the staff client
[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; Tools &rsaquo; Patron lists &rsaquo; [% list.name %] &rsaquo; Add patrons</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             "aoColumns": [
16                 null,null,null,null,null,null,null,{ "sType": "title-string" },null
17             ],
18             "aoColumnDefs": [
19                 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
20             ]
21         } ));
22
23     $( "#find_patron" ).autocomplete({
24         source: "/cgi-bin/koha/circ/ysearch.pl",
25         minLength: 3,
26         select: function( event, ui ) {
27             AddPatron( ui.item.firstname + " " + ui.item.surname, ui.item.cardnumber );
28             return false;
29         }
30     })
31     .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
32         return $( "<li></li>" )
33         .data( "ui-autocomplete-item", item )
34         .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
35         .appendTo( ul );
36     };
37
38     $("body").on("click",".removePatron",function(e){
39         e.preventDefault();
40         var divid = $(this).parent().attr("id");
41         var cardnumber = divid.replace("borrower_","");
42         RemovePatron(cardnumber);
43     });
44
45     var checkBoxes = $("input[type='checkbox']","#patron-list-table");
46
47     $("#CheckAll").click(function(e){
48         e.preventDefault();
49         checkBoxes.each(function(){
50             $(this).prop("checked",1);
51         });
52     });
53     $("#CheckNone").click(function(e){
54         e.preventDefault();
55         checkBoxes.each(function(){
56             $(this).prop("checked",0);
57         });
58     });
59
60     $("#remove_patrons").submit(function(){
61         var checkedItems = $("input:checked");
62         if ($(checkedItems).size() == 0) {
63             alert(_("You must select one or more patrons to remove"));
64             return false;
65         }
66         $(checkedItems).parents('tr').addClass("warn");
67         if( confirm(_("Are you sure you want to remove the selected patrons?")) ) {
68             return true;
69         } else {
70             $(checkedItems).parents('tr').removeClass("warn");
71             return false;
72         }
73     });
74 });
75
76 function AddPatron( name, cardnumber ) {
77     div = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='#' class='removePatron'> " + _("Remove") + " </a> ) <input type='hidden' name='patrons_to_add' value='" + cardnumber + "' /></div>";
78     $('#patrons_to_add').append( div );
79
80     $('#find_patron').val('').focus();
81
82     $('#patrons_to_add_fieldset').show( 800 );
83 }
84
85 function RemovePatron( cardnumber ) {
86     $( '#borrower_' + cardnumber ).remove();
87
88     if ( ! $('#patrons_to_add').html() ) {
89         $('#patrons_to_add_fieldset').hide( 800 );
90     }
91 }
92 //]]>
93 </script>
94
95 </head>
96
97 <body>
98 [% INCLUDE 'header.inc' %]
99 [% INCLUDE 'cat-search.inc' %]
100 <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; <a href="lists.pl">Patron lists</a> &rsaquo; <a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% list.id %]">[% list.name %]</a> &rsaquo; Add patrons</div>
101
102 <div class="yui-t7">
103     <div class="yui-main">
104         <h1>[% list.name %]</h1>
105
106         <form action="list.pl" id="add_patrons" method="post">
107             <fieldset>
108                 <legend>Add patrons</legend>
109
110                     <label for="find_patron">Patron search: </label>
111                     <input autocomplete="off" id="find_patron" type="text" style="width:150px" class="noEnterSubmit" />
112                     <div id="find_patron_container"></div>
113
114                 <fieldset id="patrons_to_add_fieldset">
115                     <legend>Patrons to be added</legend>
116                     <div id="patrons_to_add"></div>
117
118                     <fieldset class="action">
119                         <input type="hidden" name="patron_list_id" value="[% list.patron_list_id %]" />
120                         <input type="submit" value="Add patrons" />
121                         <a href="lists.pl" class="cancel">Cancel</a>
122                     </fieldset>
123                 </fieldset>
124
125             </fieldset>
126         </form>
127
128         <form action="list.pl" id="remove_patrons" method="post">
129
130             <div id="searchheader">
131                 <span class="checkall"><a id="CheckAll" href="#">Select all</a></span> |
132                 <span class="clearall"><a id="CheckNone" href="#">Clear all</a></span> |
133                 <div class="btn-group">
134                     <button class="btn btn-mini list-remove" type="submit"><i class="icon-remove-sign"></i> Remove selected</button>
135                 </div>
136             </div>
137
138             <table id="patron-list-table">
139                 <thead>
140                     <tr>
141                         <th>&nbsp;</th>
142                         <th>Card</th>
143                         <th>Firstname</th>
144                         <th>Surname</th>
145                         <th>Address</th>
146                         <th>Category</th>
147                         <th>Library</th>
148                         <th>Expires on</th>
149                         <th>Circ notes</th>
150                     </tr>
151                 </thead>
152
153                 <tbody>
154                     [% FOREACH p IN list.patron_list_patrons %]
155                         <tr>
156                             <td><input type="checkbox" name="patrons_to_remove" value="[% p.patron_list_patron_id %]" /></td>
157                             <td>
158                                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% p.borrowernumber.borrowernumber %]">
159                                     [% p.borrowernumber.cardnumber %]
160                                 </a>
161                             </td>
162                             <td>[% p.borrowernumber.firstname %]</td>
163                             <td>[% p.borrowernumber.surname %]</td>
164                             <td>
165                                 [% p.borrowernumber.address %]
166                                 [% p.borrowernumber.address2 %]
167                                 [% p.borrowernumber.city %]
168                                 [% p.borrowernumber.state %]
169                                 [% p.borrowernumber.country %]
170                             </td>
171                             <td>[% p.borrowernumber.categorycode.description %] ([% p.borrowernumber.categorycode.categorycode %])</td>
172                             <td>[% p.borrowernumber.branchcode.branchname %]</td>
173                             <td><span title="[% p.borrowernumber.dateexpiry %]">[% p.borrowernumber.dateexpiry | $KohaDates %]</span></td>
174                             <td>[% p.borrowernumber.borrowernotes %]</td>
175                         </tr>
176                     [% END %]
177                 </tbody>
178             </table>
179
180             <input type="hidden" name="patron_list_id" value="[% list.patron_list_id %]" />
181             <input type="submit" value="Remove selected patrons" />
182         </form>
183     </div>
184 </div>
185 [% INCLUDE 'intranet-bottom.inc' %]