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