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