Bug 29737: Fix suspend from hold list
[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     <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     </tr>
25     [%- SET first_priority = 0 -%]
26     [%- SET found_holds = 0 -%]
27     [%- SET last_priority  = holds.last.priority -%]
28
29     [% BLOCK priority_dropdown %]
30         [%- SET loop_priority = 1 -%]
31         [%- WHILE loop_priority <= last_priority -%]
32             [%- IF this_priority == loop_priority -%]
33                 <option value="[% loop_priority | html %]" selected="selected">[% loop_priority | html %]</option>
34             [%- ELSE -%]
35                 <option value="[% loop_priority | html %]">[% loop_priority | html %]</option>
36             [%- END -%]
37             [%- loop_priority = loop_priority + 1- %]
38         [%- END -%]
39     [% END %]
40
41     [% FOREACH hold IN holds %]
42     [%- IF !hold.found && first_priority == 0 -%]
43         [%- first_priority = hold.priority -%]
44         [%- found_holds = loop.index() -%]
45     [%- END -%]
46     [%- IF Koha.Preference('HoldsSplitQueueNumbering') == 'actual' -%]
47         [%- this_priority = hold.priority -%]
48     [%- ELSE -%]
49         [%- this_priority = loop.count() - found_holds -%]
50     [%- END -%]
51         <tr>
52             <th><input type="checkbox" class="select_hold" data-id="[% hold.reserve_id | html %]"/></th>
53             <td>
54                 <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
55                 <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" />
56                 <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" />
57                 [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %]
58                     <select name="rank-request" class="rank-request" data-hold-id="[% hold.reserve_id | html %]">
59                     [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
60                         [% PROCESS priority_dropdown %]
61                     [% ELSE %]
62                         <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option>
63                     [% END %]
64                         <option value="del">del</option>
65                     </select>
66                 [% ELSE %]
67                     <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]">
68                     <select name="rank-request" class="rank-request" disabled="disabled" data-hold-id="[% hold.reserve_id | html %]">
69                     [% IF ( hold.found ) %]
70                         [% IF ( hold.intransit ) %]
71                             <option value="T" selected="selected">In transit</option>
72                         [% ELSIF (hold.inprocessing) %]
73                             <option value="P" selected="selected">In processing</option>
74                         [% ELSE %]
75                             <option value="W" selected="selected">Waiting</option>
76                         [% END %]
77                     [% ELSE %]
78                         <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option>
79                     [% END %]
80                     </select>
81                 [% END %]
82             </td>
83             [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%]
84             [%- UNLESS hold.found -%]
85                     [%- SET prev_priority  = loop.prev.priority -%]
86                     [%- SET next_priority  = loop.next.priority -%]
87                     <td style="white-space:nowrap;">
88                         <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 %]">
89                             <img src="[% interface | html %]/[% theme | html %]/img/go-up.png" alt="Go up" />
90                         </a>
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                         <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 %]">
95                             <img src="[% interface | html %]/[% theme | html %]/img/go-bottom.png" alt="Go bottom" />
96                         </a>
97                         <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 %]">
98                             <img src="[% interface | html %]/[% theme | html %]/img/go-down.png" alt="Go down" />
99                         </a>
100                     </td>
101         [%- ELSE -%]
102             <td></td>
103         [%- END -%]
104             [%- END -%]
105             <td>
106                 [% INCLUDE 'patron-title.inc' patron=hold.patron hide_patron_infos_if_needed=1 %]
107             </td>
108             <td>[% hold.notes | html | html_line_break %]</td>
109             <td>
110                 [% IF Koha.Preference('AllowHoldDateInFuture') %]
111                     <input type="text" class="flatpickr" value="[% hold.date | $KohaDates %]" required="required" size="10" name="reservedate" />
112                 [% ELSE %]
113                     [% hold.date | $KohaDates %]
114                 [% END %]
115             </td>
116             <td>
117                 <input type="text" class="flatpickr" data-flatpickr-futuredate="true" value="[% hold.expirationdate | $KohaDates %]" size="10" name="expirationdate" />
118             </td>
119             <td>
120                 [%- IF ( hold.found ) -%]
121                     [%- IF ( hold.atdestination ) -%]
122                             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 %]
123                     [%- ELSIF (hold.intransit) -%]
124                         Item being transferred to <strong> [% hold.wbrname | html %]</strong> <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" />
125                     [%- ELSIF (hold.inprocessing) -%]
126                         Item being processed at <strong> [% hold.wbrname | html %]</strong> <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" />
127                     [%- END -%]
128                 [%- ELSE -%]
129                     [%- IF Koha.Preference('IndependentBranches') && Branches.all().size == 1 -%]
130                         [% Branches.GetName(hold.branchcode) | html %] <input type="hidden" name="pickup" value="[% hold.branchcode | html %]" />
131                     [%- ELSE -%]
132                         <select class="pickup_location_dropdown"
133                                 data-selected="[% hold.branchcode | html %]"
134                                 data-hold-id="[% hold.reserve_id | html %]"
135                                 data-pickup-location-source="hold"
136                                 name="pickup">
137                             <option selected="selected" value="[% hold.branchcode | html %]">[% Branches.GetName(hold.branchcode) | html %]</option>
138                             <option value="" disabled="disabled" class="loading">Loading...</option>
139                         </select>
140                         <img class="loading_[% hold.reserve_id | html %]" src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" style="display:none;"/>
141                     [%- END -%]
142                 [%- END -%]
143             </td>
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             [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%]
182             [%- UNLESS hold.found -%]
183                     <td>
184                         <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 %]">
185                             [%- IF ( hold.lowestPriority ) -%]
186                                 <img src="[% interface | html %]/[% theme | html %]/img/go-bottom.png" alt="Unset lowest priority" />
187                             [%- ELSE -%]
188                                 <img src="[% interface | html %]/[% theme | html %]/img/go-down.png" alt="Set to lowest priority" />
189                             [%- END -%]
190                         </a>
191                     </td>
192         [%- ELSE -%]
193             <td></td>
194         [%- END -%]
195             [%- END -%]
196             <td>
197                 <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 %]">
198                     <i class="fa fa-trash" aria-hidden="true"></i> Cancel
199                 </a>
200             </td>
201             <td>
202                 [% IF Koha.Preference('SuspendHoldsIntranet') %]
203                     [% UNLESS ( hold.found ) %]
204                         <button class="btn btn-default btn-xs toggle-suspend" data-reserve-id="[% hold.reserve_id | html %]" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-date="[% hold.date | html %]">
205                             [% IF ( hold.suspend ) %]
206                                 <i class="fa fa-play" aria-hidden="true"></i> Unsuspend
207                             [% ELSE %]
208                                 <i class="fa fa-pause" aria-hidden="true"></i> Suspend
209                             [% END %]
210                         </button>
211
212                         [% IF Koha.Preference('AutoResumeSuspendedHolds') %]
213                             <label for="suspend_until_[% hold.reserve_id | html %]">[% IF ( hold.suspend ) %] on [% ELSE %] until [% END %]</label>
214                             <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" />
215                         [%- ELSE -%]
216                             <input type="hidden" name="suspend_until_[% hold.reserve_id | html %]" id="suspend_until_[% hold.reserve_id | html %]" value=""/>
217                         [%- END -%]
218                     [%- END -%]
219                 [%- END # IF SuspendHoldsIntranet -%]
220                 [%- IF ( hold.found ) -%]
221                     <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 %]'">
222                 [%- END -%]
223             </td>
224         </tr>
225     [% END %]
226 </table>