Bug 27846: (follow-up) Add id back to breadcrumbs container
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / patron_lists / list.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE TablesSettings %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 [% INCLUDE 'columns_settings.inc' %]
8 <title>Koha &rsaquo; Tools &rsaquo; Patron lists &rsaquo; [% list.name | html %] &rsaquo; Add patrons</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10
11 <style>
12     #add_patrons_by_search {
13         display: none;
14     }
15     #patron_barcodes_line {
16         display: none;
17     }
18     #patron_barcodes_submit {
19         display: none;
20     }
21     #searchheader {
22         margin-top: 1em;
23     }
24 </style>
25 </head>
26
27 <body id="patlist_list" class="pat patlist">
28 [% INCLUDE 'header.inc' %]
29 [% INCLUDE 'cat-search.inc' %]
30
31 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
32     <ol>
33         <li>
34             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
35         </li>
36         <li>
37             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
38         </li>
39         <li>
40             <a href="lists.pl">Patron lists</a>
41         </li>
42         <li>
43             <a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% list.id | uri %]">[% list.name | html %]</a>
44         </li>
45         <li>
46             <a href="#" aria-current="page">
47                 Add patrons
48             </a>
49         </li>
50     </ol>
51 </nav>
52
53 <div class="main container-fluid">
54     <div class="row">
55         <div class="col-sm-10 col-sm-push-2">
56             <main>
57
58         <h1>[% list.name | html %]</h1>
59
60         [% IF ( not_found.size > 0 ) %]
61         <div class="dialog alert"><p>Warning, the following cardnumbers were not found:</p></div>
62         <table style="margin:auto;">
63             <thead>
64                 <tr><th>Cardnumbers not found</th></tr>
65             </thead>
66             <tbody>
67             [% FOREACH nf IN not_found %]
68                 <tr><td>[% nf | html %]</td></td>
69             [% END %]
70             </tbody>
71         </table>
72         [% END %]
73
74         [% IF ( existed.size > 0 ) %]
75         <div class="dialog alert"><p>Warning, the following cardnumbers were already in this list:</p></div>
76         <table style="margin:auto;">
77             <thead>
78                 <tr><th>Cardnumbers already in list</th></tr>
79             </thead>
80             <tbody>
81             [% FOREACH ed IN existed %]
82                 <tr><td>[% ed | html %]</td></td>
83             [% END %]
84             </tbody>
85         </table>
86         [% END %]
87
88         <form action="list.pl" id="add_patrons" method="post" class="clearfix">
89             <fieldset class="rows">
90                 <legend>Add patrons</legend>
91                 <ol>
92                     <li id="patron_search_line">
93                         <label for="find_patron">Patron search: </label>
94                         <input autocomplete="off" id="find_patron" type="text" style="width:150px" class="noEnterSubmit" />
95                     </li>
96                     <li id="add_patrons_by_search"><a href="#">
97                         <span class="label">&nbsp;</span>
98                         <i class="fa fa-plus"></i> Search for patrons</a></li>
99                     <li id="add_patrons_by_barcode"><a href="#">
100                         <span class="label">&nbsp;</span>
101                         <i class="fa fa-plus"></i> Enter multiple card numbers</a></li>
102                     <li id="patron_barcodes_line">
103                         <label for="patrons_by_barcode">Card number list (one barcode per line):</label>
104                         <textarea id="patrons_by_barcode" name="patrons_by_barcode" id="" cols="30" rows="10"></textarea>
105                     </li>
106                 </ol>
107             </fieldset>
108             <fieldset id="patron_barcodes_submit" class="action">
109                 <input type="submit" value="Submit" />
110             </fieldset>
111
112             <div class="clearfix"></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 | html %]" />
120                     <input type="submit" value="Add patrons" />
121                     <a href="lists.pl" class="cancel">Cancel</a>
122                 </fieldset>
123             </fieldset>
124         </form>
125
126         <form action="list.pl" id="remove_patrons" method="post">
127
128             <div class="searchheader" id="searchheader">
129                 <span class="checkall"><a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a></span> |
130                 <span class="clearall"><a id="CheckNone" href="#"><i class="fa fa-remove"></i> Clear all</a></span> |
131                 <div class="btn-group">
132                     <button class="btn btn-default btn-xs list-remove" type="submit"><i class="fa fa-trash"></i> Remove selected</button>
133                 </div>
134                 |
135                 <div class="btn-group">
136                     <button class="btn btn-default btn-xs merge-patrons"><i class="fa fa-compress"></i> Merge selected patrons</button>
137                 </div>
138             </div>
139
140             <table id="patron-list-table">
141                 <thead>
142                     <tr>
143                         <th class="NoSort">&nbsp;</th>
144                         <th>Card</th>
145                         <th>First name</th>
146                         <th>Surname</th>
147                         <th>Address</th>
148                         <th>Category</th>
149                         <th>Library</th>
150                         <th class="title-string">Expires on</th>
151                         <th>Circ notes</th>
152                     </tr>
153                 </thead>
154
155                 <tbody>
156                     [% FOREACH p IN list.patron_list_patrons %]
157                         <tr>
158                             <td>
159                                 <input type="checkbox" name="patrons_to_remove" class="selection" value="[% p.patron_list_patron_id | html %]" />
160                                 <input type="hidden" id="borrowernumber_[% p.patron_list_patron_id | html %]" value="[% p.borrowernumber.id | html %]" />
161                             </td>
162                             <td>
163                                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% p.borrowernumber.borrowernumber | uri %]">
164                                     [% p.borrowernumber.cardnumber | html %]
165                                 </a>
166                             </td>
167                             <td>[% p.borrowernumber.firstname | html %]</td>
168                             <td>[% p.borrowernumber.surname | html %]</td>
169                             <td>
170                                 [% p.borrowernumber.address | html %]
171                                 [% p.borrowernumber.address2 | html %]
172                                 [% p.borrowernumber.city | html %]
173                                 [% p.borrowernumber.state | html %]
174                                 [% p.borrowernumber.country | html %]
175                             </td>
176                             <td>[% p.borrowernumber.categorycode.description | html %] ([% p.borrowernumber.categorycode.categorycode | html %])</td>
177                             <td>[% p.borrowernumber.branchcode.branchname | html %]</td>
178                             <td><span title="[% p.borrowernumber.dateexpiry | html %]">[% p.borrowernumber.dateexpiry | $KohaDates %]</span></td>
179                             <td>[% p.borrowernumber.borrowernotes | html %]</td>
180                         </tr>
181                     [% END %]
182                 </tbody>
183             </table>
184
185             <input type="hidden" name="patron_list_id" value="[% list.patron_list_id | html %]" />
186             <button type="submit" class="btn btn-default btn-sm list-remove"><i class="fa fa-trash" aria-hidden="true"></i> Remove selected patrons</button>
187             <button class="btn btn-default btn-sm merge-patrons" type="submit"><i class="fa fa-compress"></i> Merge selected patrons</button>
188         </form>
189
190             </main>
191         </div> <!-- /.col-sm-10.col-sm-push-2 -->
192
193         <div class="col-sm-2 col-sm-pull-10">
194             <aside>
195                 [% INCLUDE 'tools-menu.inc' %]
196             </aside>
197         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
198      </div> <!-- /.row -->
199
200 [% MACRO jsinclude BLOCK %]
201     [% Asset.js("js/tools-menu.js") | $raw %]
202     [% INCLUDE 'datatables.inc' %]
203
204     [% Asset.js("js/autocomplete/patrons.js") | $raw %]
205     <script>
206         var MSG_REMOVE_PATRON = _("Remove");
207         $(document).ready(function() {
208             $('#patrons_to_add_fieldset').hide();
209
210                 var columns_settings_table = [% TablesSettings.GetColumns('members', 'patron-lists', 'patron-list-table', 'json') | $raw %]
211                 KohaTable('patron-list-table', {
212                     "order": [[ 3, "asc" ]],
213                     "sPaginationType": "full"
214                 }, columns_settings_table);
215
216             patron_autocomplete({
217                 patron_container: $("#patrons_to_add"),
218                 input_autocomplete: $("#find_patron"),
219                 patron_input_name: 'patrons_to_add'
220             });
221
222             var checkBoxes = $("input[type='checkbox']","#patron-list-table");
223
224             $("#CheckAll").click(function(e){
225                 e.preventDefault();
226                 checkBoxes.each(function(){
227                     $(this).prop("checked",1);
228                 });
229             });
230             $("#CheckNone").click(function(e){
231                 e.preventDefault();
232                 checkBoxes.each(function(){
233                     $(this).prop("checked",0);
234                 });
235             });
236
237             $("#remove_patrons").submit(function(){
238                 var checkedItems = $("input:checked");
239                 if ($(checkedItems).size() == 0) {
240                     alert(_("You must select one or more patrons to remove"));
241                     return false;
242                 }
243                 $(checkedItems).parents('tr').addClass("warn");
244                 if( confirm(_("Are you sure you want to remove the selected patrons?")) ) {
245                     return true;
246                 } else {
247                     $(checkedItems).parents('tr').removeClass("warn");
248                     return false;
249                 }
250             });
251
252             $("#add_patrons_by_barcode a").on("click", function(){
253                 $("#add_patrons_by_barcode, #patron_search_line").hide();
254                 $("#add_patrons_by_search, #patron_barcodes_line, #patron_barcodes_submit").show();
255             });
256
257             $("#add_patrons_by_search a").on("click", function(){
258                 $("#add_patrons_by_barcode, #patron_search_line").show();
259                 $("#add_patrons_by_search, #patron_barcodes_line, #patron_barcodes_submit").hide();
260             });
261
262             $('.merge-patrons').on('click', function() {
263                 var checkedItems = $("input:checked");
264                 if ($(checkedItems).length < 2) {
265                     alert(_("You must select two or more patrons to merge"));
266                     return false;
267                 }
268                 $(checkedItems).parents('tr').addClass("warn");
269                 if (confirm(_("Are you sure you want to merge the selected patrons?"))) {
270                     var merge_patrons_url = '/cgi-bin/koha/members/merge-patrons.pl?' +
271                         $('.selection:checked')
272                         .map(function() {
273                             return "id=" + $( '#borrowernumber_' + $(this).val() ).val()
274                         }).get().join('&');
275
276                     window.location.href = merge_patrons_url;
277                     return false;
278                 } else {
279                     $(checkedItems).parents('tr').removeClass("warn");
280                     return false;
281                 }
282             });
283         });
284     </script>
285 [% END %]
286
287 [% INCLUDE 'intranet-bottom.inc' %]