Bug 31902: Next header row inside a thead
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / holds_table.inc
1 [% USE Koha %]
2 [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
3 [% USE AuthorisedValues %]
4 <table class="holds_table">
5     <thead>
6         <tr>
7             <th><input type="checkbox" class="select_hold_all"/></th>
8             <th>Priority</th>
9             [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
10                 <th>&nbsp;</th>
11             [% END %]
12             <th>Patron</th>
13             <th>Notes</th>
14             <th>Date</th>
15             <th>Expiration</th>
16             <th>Pickup library</th>
17             <th>Details</th>
18             [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
19                 <th>
20                     <i class="fa fa-lg fa-rotate-90 fa-fast-forward" title="Toggle set to lowest priority"></i>
21                 </th>
22             [% END %]
23             <th>&nbsp;</th>
24             <th>&nbsp;</th>
25             <th>Print hold/transfer slip</th>
26         </tr>
27     </thead>
28     [%- SET first_priority = 0 -%]
29     [%- SET found_holds = 0 -%]
30     [%- SET last_priority  = holds.last.priority -%]
31
32     [% BLOCK priority_dropdown %]
33         [%- SET loop_priority = 1 -%]
34         [%- WHILE loop_priority <= last_priority -%]
35             [%- IF this_priority == loop_priority -%]
36                 <option value="[% loop_priority | html %]" selected="selected">[% loop_priority | html %]</option>
37             [%- ELSE -%]
38                 <option value="[% loop_priority | html %]">[% loop_priority | html %]</option>
39             [%- END -%]
40             [%- loop_priority = loop_priority + 1- %]
41         [%- END -%]
42     [% END %]
43
44     [% FOREACH hold IN holds %]
45     [%- IF !hold.found && first_priority == 0 -%]
46         [%- first_priority = hold.priority -%]
47         [%- found_holds = loop.index() -%]
48     [%- END -%]
49     [%- IF Koha.Preference('HoldsSplitQueueNumbering') == 'actual' -%]
50         [%- this_priority = hold.priority -%]
51     [%- ELSE -%]
52         [%- this_priority = loop.count() - found_holds -%]
53     [%- END -%]
54         <tr>
55             <th><input type="checkbox" class="select_hold" data-id="[% hold.reserve_id | html %]"/></th>
56             <td>
57                 <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
58                 <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" />
59                 <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" />
60                 [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
61                     [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %]
62                         <select name="rank-request" class="rank-request" data-hold-id="[% hold.reserve_id | html %]">
63                         [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
64                             [% PROCESS priority_dropdown %]
65                         [% ELSE %]
66                             <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option>
67                         [% END %]
68                             <option value="del">del</option>
69                         </select>
70                     [% ELSE %]
71                         <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]">
72                         <select name="rank-request" class="rank-request" disabled="disabled" data-hold-id="[% hold.reserve_id | html %]">
73                         [% IF ( hold.found ) %]
74                             [% IF ( hold.intransit ) %]
75                                 <option value="T" selected="selected">In transit</option>
76                             [% ELSIF (hold.inprocessing) %]
77                                 <option value="P" selected="selected">In processing</option>
78                             [% ELSE %]
79                                 <option value="W" selected="selected">Waiting</option>
80                             [% END %]
81                         [% ELSE %]
82                             <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option>
83                         [% END %]
84                         </select>
85                     [% END %]
86                 [% ELSE %]
87                     <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]">
88                     [% hold.priority | html %]
89                 [% END %]
90             </td>
91             [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%]
92             [%- UNLESS hold.found -%]
93                     [%- SET prev_priority  = loop.prev.priority -%]
94                     [%- SET next_priority  = loop.next.priority -%]
95                     <td style="white-space:nowrap;">
96                         <a class="hold-arrow" title="Move hold up" href="request.pl?action=move&amp;where=up&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=[% prev_priority | html %]&amp;next_priority=[% next_priority | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
97                             <i class="fa fa-lg icon-move-hold-up" aria-hidden="true"></i>
98                         </a>
99
100                         <a class="hold-arrow" title="Move hold to top" href="request.pl?action=move&amp;where=top&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=[% prev_priority | html %]&amp;next_priority=[% next_priority | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
101                             <i class="fa fa-lg icon-move-hold-top" aria-hidden="true"></i>
102                         </a>
103
104                         <a class="hold-arrow" title="Move hold to bottom" href="request.pl?action=move&amp;where=bottom&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=[% prev_priority | html %]&amp;next_priority=[% next_priority | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
105                             <i class="fa fa-lg icon-move-hold-bottom" aria-hidden="true"></i>
106                         </a>
107
108                         <a class="hold-arrow" title="Move hold down" href="request.pl?action=move&amp;where=down&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=[% prev_priority | html %]&amp;next_priority=[% next_priority | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
109                             <i class="fa fa-lg icon-move-hold-down" aria-hidden="true"></i>
110                         </a>
111                     </td>
112         [%- ELSE -%]
113             <td></td>
114         [%- END -%]
115             [%- END -%]
116             <td>
117                 [% INCLUDE 'patron-title.inc' patron=hold.patron hide_patron_infos_if_needed=1 %]
118             </td>
119             <td>[% hold.notes | html | html_line_break %]</td>
120             <td>
121                 [% IF Koha.Preference('AllowHoldDateInFuture') %]
122                     <input type="text" class="flatpickr" value="[% hold.date | html %]" required="required" size="10" name="reservedate" />
123                 [% ELSE %]
124                     [% hold.date | $KohaDates %]
125                 [% END %]
126             </td>
127             <td>
128                 <input type="text" class="flatpickr" data-flatpickr-futuredate="true" value="[% hold.expirationdate | html %]" size="10" name="expirationdate" />
129             </td>
130             <td>
131                 [%- IF ( hold.found ) -%]
132                     <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" />
133                     [%- IF ( hold.atdestination ) -%]
134                             Item waiting at <strong> [% hold.wbrname | html %]</strong>[% IF hold.desk_name %], [% hold.desk_name | html %],[% END %] since [% hold.waiting_date | $KohaDates %]
135                     [%- ELSIF (hold.intransit) -%]
136                         Item being transferred to <strong> [% hold.wbrname | html %]</strong>
137                     [%- ELSIF (hold.inprocessing) -%]
138                         Item being processed at <strong> [% hold.wbrname | html %]</strong>
139                     [%- ELSE -%]
140                         Hold expected at <strong>[% hold.wbrname | html %]</strong>, please checkin to verify status
141                     [%- END -%]
142                 [%- ELSE -%]
143                     [%- IF Koha.Preference('IndependentBranches') && Branches.all().size == 1 -%]
144                         [% Branches.GetName(hold.branchcode) | html %] <input type="hidden" name="pickup" value="[% hold.branchcode | html %]" />
145                     [%- ELSE -%]
146                         <select class="pickup_location_dropdown"
147                                 data-selected="[% hold.branchcode | html %]"
148                                 data-hold-id="[% hold.reserve_id | html %]"
149                                 data-pickup-location-source="hold"
150                                 name="pickup">
151                             <option selected="selected" value="[% hold.branchcode | html %]">[% Branches.GetName(hold.branchcode) | html %]</option>
152                             <option value="" disabled="disabled" class="loading">Loading...</option>
153                         </select>
154                         <img class="loading_[% hold.reserve_id | html %]" src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" style="display:none;"/>
155                     [%- END -%]
156                 [%- END -%]
157             </td>
158             <td>
159                 [%- IF ( hold.found ) -%]
160                     <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
161                         [%- IF ( hold.barcodenumber ) -%]
162                             [%- hold.barcodenumber | html -%]
163                             <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
164                         [%- ELSE -%]
165                             <span>No barcode</span>
166                         [%- END -%]
167                     </a>
168                 [%- ELSE -%]
169                     [%- IF ( hold.item_level_hold ) -%]
170                         <em>
171                             <span>Only item</span>
172                             <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
173                                 [%- IF ( hold.barcodenumber ) -%]
174                                     [%- hold.barcodenumber | html -%]
175                                     <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
176                                 [%- ELSE -%]
177                                     <span>No barcode</span>
178                                 [%- END -%]
179                             </a>
180                         </em>
181                     [%- ELSE -%]
182                         [%- IF hold.itemtype -%]
183                             <em>Next available [% ItemTypes.GetDescription( hold.itemtype ) | html %] item</em>
184                         [%- ELSIF hold.object.item_group -%]
185                             <em>Next available item from group <strong>[% hold.object.item_group.description | html %]</strong></em>
186                         [%- ELSE -%]
187                             <em>Next available</em>
188                         [%- END -%]
189
190                         <input type="hidden" name="itemnumber" value="" />
191                     [%- END -%]
192                 [%- END -%]
193                 [%- IF hold.non_priority -%]
194                     <br><i>Non priority hold</i>
195                 [%- END -%]
196             </td>
197             [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%]
198             [%- UNLESS hold.found -%]
199                     <td>
200                             [% IF ( hold.lowestPriority ) %]
201                                 <a class="hold-arrow" title="Remove lowest priority" href="request.pl?action=setLowestPriority&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
202                                     <i class="fa fa-lg fa-rotate-90 icon-unset-lowest" aria-hidden="true"></i>
203                             [% ELSE %]
204                                 <a class="hold-arrow" title="Set lowest priority" href="request.pl?action=setLowestPriority&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
205                                     <i class="fa fa-lg fa-rotate-90 icon-set-lowest" aria-hidden="true"></i>
206                             [% END %]
207                         </a>
208                     </td>
209         [%- ELSE -%]
210             <td></td>
211         [%- END -%]
212             [%- END -%]
213             <td>
214                 <a class="cancel-hold" title="Cancel hold" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-id="[% hold.reserve_id | html %]" href="request.pl?action=cancel&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
215                     <i class="fa fa-trash" aria-label="Cancel hold"></i>
216                 </a>
217             </td>
218             <td>
219                 [% IF Koha.Preference('SuspendHoldsIntranet') %]
220                     [% UNLESS ( hold.found ) %]
221                         <button class="btn btn-default btn-xs toggle-suspend" data-reserve-id="[% hold.reserve_id | html %]" data-biblionumber="[% hold.biblionumber | html %]">
222                             [% IF ( hold.suspend ) %]
223                                 <i class="fa fa-play" aria-hidden="true"></i> Unsuspend
224                             [% ELSE %]
225                                 <i class="fa fa-pause" aria-hidden="true"></i> Suspend
226                             [% END %]
227                         </button>
228
229                         [% IF Koha.Preference('AutoResumeSuspendedHolds') %]
230                             <label for="suspend_until_[% hold.reserve_id | html %]">[% IF ( hold.suspend ) %] on [% ELSE %] until [% END %]</label>
231                             <input type="text" name="suspend_until_[% hold.reserve_id | html %]" id="suspend_until_[% hold.reserve_id | html %]" size="10" value="[% hold.suspend_until | html %]" class="flatpickr" data-flatpickr-futuredate="true" />
232                         [%- ELSE -%]
233                             <input type="hidden" name="suspend_until_[% hold.reserve_id | html %]" id="suspend_until_[% hold.reserve_id | html %]" value=""/>
234                         [%- END -%]
235                     [%- END -%]
236                 [%- END # IF SuspendHoldsIntranet -%]
237                 [%- IF ( hold.found ) -%]
238                     <input type="button" id="revert_hold_[% hold.reserve_id | html %]" value="[% IF hold.intransit %]Revert transit status[% ELSE %]Revert waiting status[% END %]" onclick="window.location.href='request.pl?action=move&amp;where=down&amp;first_priority=[% first_priority | uri %]&amp;last_priority=[% last_priority | uri %]&amp;prev_priority=0&amp;next_priority=1&amp;borrowernumber=[% hold.borrowernumber | uri %]&amp;biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]&amp;reserve_id=[% hold.reserve_id | uri %]&amp;date=[% hold.date | uri %]'">
239                 [%- END -%]
240             </td>
241             [% IF ( hold.intransit || hold.atdestination ) %]
242                 <td><input class="printholdslip" type="button" name="printholdslip" value="Print slip" data-reserve_id="[% hold.reserve_id | html %]"></td>
243             [% ELSE %]
244                 <td></td>
245             [% END %]
246         </tr>
247     [% END %]
248 </table>