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