Bug 28937: Use Flatpickr on circulation and patron pages
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / circulation_batch_checkouts.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% USE Koha %]
5 [% USE KohaDates %]
6 [% USE Price %]
7 [% USE AuthorisedValues %]
8 [% SET footerjs = 1 %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 [% SET destination = "circ" %]
11 <title>
12     [% IF patron %]
13         Batch check out to [% INCLUDE 'patron-title.inc' invert_name = 1 no_html = 1 %] &rsaquo;
14     [% END %]
15
16     Circulation &rsaquo; Koha
17 </title>
18 [% INCLUDE 'doc-head-close.inc' %]
19 </head>
20
21 <body id="circ_circulation_batch_checkouts" class="circ">
22
23 [% INCLUDE 'header.inc' %]
24 [% INCLUDE 'circ-search.inc' %]
25
26 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
27     <ol>
28         <li>
29             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
30         </li>
31         <li>
32             <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
33         </li>
34
35         [% IF patron %]
36             <li>
37                 <a href="/cgi-bin/koha/circ/circulation.pl">Batch check out</a>
38             </li>
39             <li>
40                 <a href="#" aria-current="page">
41                     [% INCLUDE 'patron-title.inc' %]
42                 </a>
43             </li>
44         [% ELSE %]
45             <li>
46                 <a href="#" aria-current="page">
47                     Batch check out
48                 </a>
49             </li>
50         [% END %]
51     </ol>
52 </nav>
53
54 <div class="main container-fluid">
55     <div class="row">
56         [% IF patron %]
57             <div class="col-sm-10 col-sm-push-2">
58         [% ELSE %]
59             <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
60         [% END %]
61             <main>
62
63 [% IF patron %]
64 [% INCLUDE 'members-toolbar.inc' %]
65 [% END %]
66
67 [% IF patron and not batch_allowed %]
68   <div class="dialog alert">You are not allowed to use batch checkout for this patron</div>
69 [% ELSIF patron and noissues and not checkout_infos %]
70   <div class="dialog alert">
71       Cannot check out!
72       [% IF ( charges ) %]
73           [% INCLUDE 'blocked-fines.inc' fines = chargesamount %]
74       [% END %]
75       [% IF ( charges_guarantors_guarantees ) %]
76           <li>
77               <span class="circ-hlt">Charges:</span> Patron's guarantors and their other guarantees collectively owe [% charges_guarantors_guarantees | $Price %].
78               [% IF noissues %]
79                   <span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
80               [% END %]
81           </li>
82       [% END %]
83       [% IF ( charges_guarantees ) %]
84           <li>
85               <span class="circ-hlt">Charges:</span> Patron's guarantees collectively owe [% chargesamount_guarantees | $Price %].
86               [% IF noissues %]
87                   <span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
88               [% END %]
89           </li>
90       [% END %]
91   </div>
92 [% ELSIF patron and not checkout_infos %]
93   <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/circ/circulation.pl">
94     <fieldset id="circ_circulation_issue">
95       <label for="barcode">Checking out to [% INCLUDE 'patron-title.inc' %]</label>
96       <fieldset class="rows">
97         <legend>Use a file</legend>
98         <ol>
99           <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
100         </ol>
101       </fieldset>
102       <fieldset class="rows">
103         <legend>Or list barcodes one by one</legend>
104         <ol>
105           <li>
106             <label for="barcodelist">Barcode list (one barcode per line): </label>
107             <textarea rows="10" cols="30" id="barcodelist" name="barcodelist"></textarea>
108           </li>
109         </ol>
110       </fieldset>
111       [% IF Koha.Preference('SpecifyDueDate') %]
112           <fieldset class="rows">
113               <legend>Due date: </legend>
114               <label for="duedatespec">Hard due date [% INCLUDE 'date-format.inc' %]:</label>
115               <input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | $KohaDates with_hours => 1 %]" />
116           </fieldset>
117       [% END %]
118       <input type="hidden" name="op" value="show" />
119       <fieldset class="action">
120         <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
121         <input type="hidden" name="branch" value="[% branch | html %]" />
122         <input type="hidden" name="batch" value="1" />
123         <input type="submit" value="Check out" class="button" />
124       </fieldset>
125     </fieldset>
126   </form>
127
128 [% ELSIF patron %]
129   [% IF confirmation_needed && CAN_user_circulate_force_checkout %]
130     <h3>Batch checkout confirmation [% IF patron %] for [% INCLUDE 'patron-title.inc' invert_name = 1 %] [% END %]</h3>
131     <form method="post" action="/cgi-bin/koha/circ/circulation.pl" id="mainform" name="mainform" autocomplete="off">
132   [% ELSE %]
133     <h3>Batch checkout information [% IF patron.borrowernumber %] for [% INCLUDE 'patron-title.inc' invert_name = 1 %] |[% batch | html %]|[% END %]</h3>
134   [% END %]
135     <table id="checkout_infos">
136       <thead>
137         <tr>
138           [% IF confirmation_needed && CAN_user_circulate_force_checkout %]
139             <th class="NoSort"></th>
140           [% END %]
141           <th>Barcode</th>
142           <th class="anti-the">Title</th>
143           <th>Information</th>
144         </tr>
145       </thead>
146       <tbody>
147         [% FOR checkout_info IN checkout_infos %]
148           <tr>
149             [% IF confirmation_needed && CAN_user_circulate_force_checkout %]
150               <td>
151                 [% IF checkout_info.NEEDSCONFIRMATION %]
152                   <input type="checkbox" name="barcodes" value="[% checkout_info.barcode | html %]" checked="checked" />
153                 [% END %]
154               </td>
155             [% END %]
156             <td>[% checkout_info.barcode | html %]</td>
157             <td>
158                 [% INCLUDE 'biblio-title.inc' biblio=checkout_info.biblio link = 1 %] [% IF checkout_info.biblio.author %], by [% checkout_info.biblio.author | html %][% END %][% IF ( checkout_info.item.itemnotes ) %]- <span class="circ-hlt">[% checkout_info.item.itemnotes | $raw %]</span>[% END %] <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% checkout_info.biblio.biblionumber | uri %]&amp;itemnumber=[% checkout_info.item.itemnumber | uri %]#item[% checkout_info.item.itemnumber | uri %]">[% checkout_info.item.barcode | html %]</a>
159             </td>
160             <td>
161               [% IF checkout_info.NEEDSCONFIRMATION %]
162                 <ul class="fa-ul warn">
163                   [% IF checkout_info.AGE_RESTRICTION %]
164                       <li><i class="fa fa-li fa-warning"></i>Age restriction [% checkout_info.AGE_RESTRICTION | html %].</li>
165                   [% END %]
166                   [% IF checkout_info.RENEW_ISSUE %]
167                       <li><i class="fa fa-li fa-warning"></i>This item is currently checked out to this patron. Renew?</li>
168                   [% END %]
169                   [% IF checkout_info.RESERVE_WAITING %]
170                       <li><i class="fa fa-li fa-warning"></i>This item is waiting for another patron.</li>
171                   [% END %]
172                   [% IF checkout_info.TRANSFERRED %]
173                       <li><i class="fa fa-li fa-warning"></i>This item is on hold and being transferred for another patron.</li>
174                   [% END %]
175                   [% IF checkout_info.PROCESSING %]
176                       <li><i class="fa fa-li fa-warning"></i>This item is on hold and being processed for another patron.</li>
177                   [% END %]
178                   [% IF checkout_info.ISSUED_TO_ANOTHER %]
179                       <li><i class="fa fa-li fa-warning"></i>This item is checked out to another patron.
180                     [% IF CAN_user_circulate_force_checkout %]
181                       Check in and check out?
182                       [% END %]</li>
183                   [% END %]
184                   [% IF checkout_info.TOO_MANY %]
185                       <li><i class="fa fa-li fa-warning"></i>Too many checked out.</li>
186                   [% END %]
187                   [% IF checkout_info.BORRNOTSAMEBRANCH %]
188                       <li><i class="fa fa-li fa-warning"></i>This patron is from a different library ([% Branches.GetName( checkout_info.BORRNOTSAMEBRANCH ) | html %]).</li>
189                   [% END %]
190                   [% IF checkout_info.PATRON_CANT %]
191                       <li><i class="fa fa-li fa-warning"></i>This patron can't check out this item per library circulation policy.</li>
192                   [% END %]
193                   [% IF checkout_info.NOT_FOR_LOAN_FORCING %]
194                     [% IF checkout_info.itemtype_notforloan %]
195                         <li><i class="fa fa-li fa-warning"></i>Item type is normally not for loan.</li>
196                     [% ELSIF checkout_info.item_notforloan %]
197                       [% item_notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => checkout_info.item_notforloan ) %]
198                         <li><i class="fa fa-li fa-warning"></i>Item is normally not for loan [% IF item_notforloan_lib %]([% item_notforloan_lib | html %])[% END %].</li>
199                     [% END %]
200                   [% END %]
201                   [% IF checkout_info.USERBLOCKEDOVERDUE %]
202                       <li><i class="fa fa-li fa-warning"></i>Patron has [% checkout_info.USERBLOCKEDOVERDUE | html %] overdue item(s).</li>
203                   [% END %]
204                   [% IF checkout_info.ITEM_LOST %]
205                       <li><i class="fa fa-li fa-warning"></i>This item has been lost with a status of "[% checkout_info.ITEM_LOST | html %]."</li>
206                   [% END %]
207                   [% IF checkout_info.HIGHHOLDS %]
208                       <li><i class="fa fa-li fa-warning"></i>High demand item. Loan period shortened to [% checkout_info.HIGHHOLDS.duration | html %] days (due [% checkout_info.HIGHHOLDS.returndate | html %]).</li>
209                   [% END %]
210                   [% IF checkout_info.HIGHHOLDS %] <!-- FIXME -->
211                       <script>
212                           $(document).ready(function() {
213                               $("input[name=duedatespec]:hidden").val('[% checkout_info.HIGHHOLDS.returndate | html %]');
214                           });
215                       </script>
216                   [% END %]
217
218                   [% IF NOT checkout_info.IMPOSSIBLE && ( CAN_user_circulate_force_checkout || checkout_info.HIGHHOLDS ) && ( checkout_info.RESERVED || checkout_info.RESERVE_WAITING || checkout_info.TRANSFERRED || checkout_info.PROCESSING ) %] <!-- arbitrary choice, revert the reserve is not possible-->
219                       <li><i class="fa fa-li fa-warning"></i>This item is on hold for another patron. The hold will be overridden, but not cancelled.</li>
220                   [% ELSIF checkout_info.RESERVED %]
221                       <li><i class="fa fa-li fa-warning"></i>This item is on hold for another patron.</li>
222                   [% END %]
223
224                   [% IF checkout_info.PREVISSUE %]
225                       <li>This item has previously been checked out to this patron.</li>
226                   [% END %]
227                 </ul>
228               [% END %]
229
230
231               [% IF checkout_info.alert.ITEM_LOST || checkout_info.alert.OTHER_CHARGES %]
232                 <ul class="info">
233                   [% IF checkout_info.alert.ITEM_LOST %]
234                       <li>This item has been lost with a status of "[% checkout_info.alert.ITEM_LOST | html %]."</li>
235                   [% END %]
236                   [% IF checkout_info.alert.OTHER_CHARGES %]
237                       <li>The patron has unpaid charges for holds, rentals etc of [% checkout_info.alert.OTHER_CHARGES | $Price %].</li>
238                   [% END %]
239                 </ul>
240               [% END %]
241
242               [% IF checkout_info.alert.RETURNED_FROM_ANOTHER %]
243                   <div class="dialog alert">Item was checked out to [% INCLUDE 'patron-title.inc' patron = checkout_info.alert.RETURNED_FROM_ANOTHER.patron %] and was returned automatically.</div>
244               [% END %]
245
246               [% IF checkout_info.IMPOSSIBLE %]
247                 <ul class="fa-ul error">
248                   [% IF checkout_info.STATS  %]
249                       <li><i class="fa fa-li fa-exclamation"></i>Local use recorded.</li>
250                   [% END %]
251
252                   [% IF checkout_info.NOT_FOR_LOAN %]
253                     [% IF checkout_info.itemtype_notforloan %]
254                        <li><i class="fa fa-li fa-exclamation"></i>Item type not for loan.</li>
255                     [% ELSIF checkout_info.item_notforloan %]
256                       [% item_notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => checkout_info.item_notforloan ) %]
257                         <li><i class="fa fa-li fa-exclamation"></i>Item not for loan [% IF item_notforloan_lib %]([% item_notforloan_lib | html %])[% END %].</li>
258                     [% END %]
259                   [% END %]
260                   [% IF checkout_info.WTHDRAWN %]
261                       <li><i class="fa fa-li fa-exclamation"></i>Item has been withdrawn.</li>
262                   [% END %]
263                   [% IF checkout_info.RESTRICTED %]
264                       <li><i class="fa fa-li fa-exclamation"></i>Item is restricted.</li>
265                   [% END %]
266                   [% IF checkout_info.GNA %]
267                       <li><i class="fa fa-li fa-exclamation"></i>Patron's address is in doubt.</li>
268                   [% END %]
269                   [% IF checkout_info.CARD_LOST %]
270                       <li><i class="fa fa-li fa-exclamation"></i>Patron's card is lost.</li>
271                   [% END %]
272                   [% IF checkout_info.DEBARRED %]
273                       <li><i class="fa fa-li fa-exclamation"></i>Patron is restricted.</li>
274                   [% END %]
275                   [% IF checkout_info.NO_MORE_RENEWALS %]
276                       <li><i class="fa fa-li fa-exclamation"></i>No more renewals possible.</li>
277                   [% END %]
278                   [% IF checkout_info.EXPIRED %]
279                       <li><i class="fa fa-li fa-exclamation"></i>Patron's card is expired.</li>
280                   [% END %]
281                   [% IF checkout_info.ITEMNOTSAMEBRANCH %]
282                       <li><i class="fa fa-li fa-exclamation"></i>This item belongs to [% Branches.GetName( checkout_info.itemhomebranch ) | html %] and cannot be checked out from this location.</li>
283                   [% END %]
284                   [% IF checkout_info.USERBLOCKEDREMAINING %]
285                       <li><i class="fa fa-li fa-exclamation"></i>Patron has had overdue items and is blocked for [% checkout_info.USERBLOCKEDREMAINING | html %] day(s).</li>
286                   [% END %]
287                   [% IF checkout_info.USERBLOCKEDOVERDUE %]
288                       <li><i class="fa fa-li fa-exclamation"></i>Checkouts are BLOCKED because patron has overdue items.</li>
289                   [% END %]
290                   [% IF checkout_info.TOO_MANY %]
291                       <li><i class="fa fa-li fa-exclamation"></i>Too many checked out.</li>
292                   [% END %]
293                   [% IF checkout_info.UNKNOWN_BARCODE %]
294                       <li><i class="fa fa-li fa-exclamation"></i>The barcode was not found [% checkout_info.barcode | html %].</li>
295                   [% END %]
296                   [% IF checkout_info.DEBT %]
297                       <li><i class="fa fa-li fa-exclamation"></i>The patron has a debt of [% checkout_info.DEBT | $Price %].</li> <!-- Need debt_confirmed -->
298                   [% END %]
299                 </p>
300               [% END %]
301
302               [% IF checkout_info.issue.date_due %]
303                 <li>Due on [% checkout_info.issue.date_due | $KohaDates as_due_date => 1 %]</li>
304               [% END %]
305             </td>
306           </tr>
307         [% END %]
308       </tbody>
309     </table>
310
311     [% IF confirmation_needed && CAN_user_circulate_force_checkout %]
312         <fieldset>
313             <legend>Please confirm checkout</legend>
314       <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
315       <input type="hidden" name="issueconfirmed" value="1" />
316       <input type="hidden" name="debt_confirmed" value="1" />
317       <input type="hidden" name="branch" value="[% branch | html %]" />
318       <input type="hidden" name="duedatespec" value="[% duedatespec | html %]" />
319       <input type="hidden" name="batch" value="1" />
320       <input type="submit" id="checkoutrenew" class="approve" value="Checkout or renew" />
321         </fieldset>
322     </form>
323     [% END %]
324
325 [% ELSE %]
326     <div class="dialog message">This patron does not exist. <a href="/cgi-bin/koha/members/members-home.pl">Find another patron?</a></div>
327 [% END %]
328
329                   </main>
330                       </div> <!-- /.col-sm-10.col-sm-push-2 -->
331                       [% IF patron %]
332                           <div class="col-sm-2 col-sm-pull-10">
333                               <aside>
334                                   [% INCLUDE 'circ-menu.inc' %]
335                               </aside>
336                           </div> <!-- /.col-sm-2.col-sm-pull-10 -->
337                       [% END %]
338                   </div> <!-- /.row -->
339
340 [% MACRO jsinclude BLOCK %]
341     [% INCLUDE 'calendar.inc' %]
342     [% INCLUDE 'datatables.inc' %]
343     [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
344     <script>
345         $(document).ready(function() {
346             if($('#barcodelist').length) {
347                 $('#barcodelist').focus();
348             } else if ($('#checkoutrenew').length) {
349                 $('#checkoutrenew').focus();
350             }
351             $("#checkout_infos").dataTable($.extend(true, {}, dataTablesDefaults, {
352                 "sDom": 't',
353                 "aaSorting": [],
354                 "aoColumnDefs": [
355                     { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
356                     { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
357                 ],
358                 "bPaginate": false
359             }));
360
361             [% IF Koha.Preference('SpecifyDueDate') %]
362                $("#duedatespec").flatpickr({
363                     enableTime: true,
364                     dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string,
365                     defaultDate: new Date().setHours(23, 59, 0, 0) /* Today a 11:59PM */
366                 });
367             [% END %]
368         });
369
370     </script>
371     [% INCLUDE 'str/members-menu.inc' %]
372     [% Asset.js("js/members-menu.js") | $raw %]
373 [% END %]
374
375 [% INCLUDE 'intranet-bottom.inc' %]