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