Bug 24860: Add ability to select an item group when placing a hold - OPAC
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / includes / holds-table.inc
1 [% USE Branches %]
2 [% USE ItemTypes %]
3 [% USE KohaDates %]
4 [% PROCESS 'i18n.inc' %]
5
6 [% IF ( HOLDS.count ) %]
7     <div id="opac-user-holds" class="tab-pane" role="tabpanel" aria-labelledby="opac-user-holds-tab">
8         <table id="holdst" class="table table-bordered table-striped">
9             <caption>Holds <span class="count">([% HOLDS.count | html %] total)</span></caption>
10             <!-- HOLDS TABLE ROWS -->
11             <thead>
12                 <tr>
13                     <th class="anti-the">Title</th>
14                     [% IF ( showpriority ) %]
15                         <th>Placed on</th>
16                     [% ELSE %]
17                         <th class="psort">Placed on</th>
18                     [% END %]
19                     <th>Expires on</th>
20                     [% UNLESS( singleBranchMode) %]
21                         <th>Pickup location</th>
22                     [% END %]
23                     [% IF ( showpriority ) %]
24                         <th class="psort">Priority</th>
25                     [% END %]
26                     <th>Status</th>
27                     [% IF SuspendHoldsOpac and ! onlyinfo %]
28                             <th class="nosort" >Suspend</th>
29                     [% END %]
30                     [% IF ! onlyinfo %]
31                         <th class="nosort">Modify</th>
32                     [% END %]
33                 </tr>
34             </thead>
35             <tbody>
36                 [% SET all_holds_waiting = 1 %]
37                 [% FOREACH HOLD IN HOLDS %]
38                     [% UNLESS ( HOLD.is_waiting || HOLD.is_in_transit || HOLD.is_in_processing) %]
39                         [% SET all_holds_waiting = 0 %]
40                     [% END %]
41                     [% IF ( HOLD.is_at_destination ) %]
42                         <tr class="reserved">
43                     [% ELSIF HOLD.is_in_transit %]
44                         <tr class="transfered">
45                     [% ELSE %]
46                         <tr>
47                     [% END %]
48                         <td class="title">
49                             [% IF ! onlyinfo %]
50                                 [% INCLUDE 'biblio-title.inc' biblio=HOLD.biblio link=> 1 %]
51                                 [% HOLD.item.enumchron | html %]
52                             [% ELSE %]
53                                 <strong>
54                                     [% INCLUDE 'biblio-title.inc' biblio=HOLD.biblio %]
55                                     [% HOLD.item.enumchron | html %]
56                                 </strong>
57                             [% END %]
58                             [% HOLD.biblio.author | html %]
59                             [% IF HOLD.item_group_id %]
60                                <p>Next available item from item group: <strong>[% HOLD.item_group.description | html %]</strong></p>
61                             [% END %]
62                             [% IF HOLD.item_level_hold %]
63                                 <p class="hint">Item on hold: [% HOLD.item.barcode | html %]</p>
64                             [% END %]
65                         </td>
66                         <td class="reservedate" data-order="[% HOLD.reservedate | html %]">
67                             <span class="tdlabel">Hold date:</span>
68                                 [% HOLD.reservedate | $KohaDates %]
69                             </span>
70                         </td>
71                         [% IF ! HOLD.found %]
72                             <td class="expirationdate" data-order="[% HOLD.expirationdate | html %]">
73                                 [% IF ( HOLD.expirationdate ) %]
74                                     <span class="tdlabel">Expiration:</span>
75                                     [% HOLD.expirationdate | $KohaDates %]
76                                 [% ELSE %]
77                                     <span class="tdlabel">Expiration:</span>
78                                     Never expires
79                                 [% END %]
80                         [% ELSE %]
81                             <td class="expirationdate" data-order="0000-00-00">
82                                 -
83                         [% END %]
84                         </td>
85                         [% UNLESS( singleBranchMode) %]
86                             <td class="branch">
87                                 <span class="tdlabel">Pickup location:</span>
88                                 [% HOLD.branch.branchname | html %]
89                                 [% IF ( HOLD.can_update_pickup_location_opac ) %]
90                                     <button type="button" class="btn btn-sm btn-link" data-toggle="modal" data-target="#changePickup[% HOLD.reserve_id | html %]">
91                                         <i class="fa fa-pencil" aria-hidden="true"></i> Change
92                                     </button>
93                                     <!-- Change pickup location modal -->
94                                     <div class="modal" id="changePickup[% HOLD.reserve_id | html %]" tabindex="-1" aria-labelledby="changePickup[% HOLD.reserve_id | html %]Label" aria-hidden="true">
95                                         <div class="modal-dialog">
96                                             <form id="change_branch_form[% HOLD.reserve_id | html %]" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
97                                                 <div class="modal-content">
98                                                     <div class="modal-header">
99                                                         <h5 class="modal-title" id="changePickup[% HOLD.reserve_id | html %]Label">Change pickup location for <em>[% INCLUDE 'biblio-title.inc' biblio=HOLD.biblio %]</em></h5>
100                                                         <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
101                                                             <span aria-hidden="true">&times;</span>
102                                                         </button>
103                                                     </div>
104                                                     <div class="modal-body">
105                                                         <div class="form-group">
106                                                         <label for="new_branch[% HOLD.reserve_id | html %]">New pickup location:</label>
107                                                         <select name="new_pickup_location" id="new_branch[% HOLD.reserve_id | html %]" class="form-control">
108                                                             [% PROCESS options_for_libraries libraries = Branches.pickup_locations({ search_params => { biblio => HOLD.biblionumber, patron => HOLD.borrower }, selected => HOLD.branchcode }) %]
109                                                         </select>
110                                                         </div>
111                                                         <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
112                                                     </div>
113                                                     <div class="modal-footer">
114                                                         <button type="submit" name="change_branch" value="1" class="btn btn-primary"><i class="fa fa-check" aria-hidden="true"></i> Save</button>
115                                                         <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-remove" aria-hidden="true"></i> Cancel</button>
116                                                     </div>
117                                                 </div> <!-- /.modal-content -->
118                                             </form>
119                                         </div> <!-- /.modal-dialog -->
120                                     </div> <!-- /.modal -->
121                                 [% END  %]
122                             </td>
123                         [% END %]
124                         [% IF ( showpriority ) %]
125                                 <td data-order="[% HOLD.priority | html %]" class="priority">
126                                 <span class="tdlabel">Priority:</span>
127                                 [% HOLD.priority | html %]
128                             </td>
129                         [% END %]
130                         <td class="status">
131                             <span class="tdlabel">Status:</span>
132                             [% IF ( HOLD.is_waiting ) %]
133                                 <i class="fa fa-exclamation-circle text-warning" aria-hidden="true"></i>
134                                 [% IF ( HOLD.is_at_destination ) %]
135                                     Item waiting at <strong> [% HOLD.branch.branchname | html %]</strong>
136                                     [% IF ( HOLD.desk_id ) %], [% HOLD.desk.desk_name | html %],[% END %]
137                                     [% IF ( HOLD.waitingdate ) %]
138                                         since [% HOLD.waitingdate | $KohaDates %]
139                                         [% IF HOLD.expirationdate %]
140                                             until [% HOLD.expirationdate | $KohaDates %]
141                                         [% END %]
142                                     [% END %]
143                                     <input type="hidden" name="pickup" value="[% HOLD.branchcode | html %]" />
144                                 [% ELSE %]
145                                     Item in transit to <strong> [% Branches.GetName( HOLD.branchcode ) | html %]</strong> <input type="hidden" name="pickup" value="[% HOLD.branchcode | html %]" />
146                                 [% END %]
147                             [% ELSE %]
148                                 [% IF ( HOLD.is_in_transit ) %]
149                                     [% SET transfer = HOLD.item.get_transfer %]
150                                     [% branch_name = BLOCK %]<strong>[% Branches.GetName( transfer.frombranch ) | html %]</strong>[% END %]
151                                     <span>Item in transit from [% branch_name| $raw %] since</span>
152                                     [% transfer.datesent | $KohaDates %]
153                                 [% ELSIF ( HOLD.is_in_processing ) %]
154                                     <span>Item in processing</span>
155                                 [% ELSIF ( HOLD.suspend ) %]
156                                     <span>Suspended</span>[% IF ( HOLD.suspend_until ) %] <span>until</span> [% HOLD.suspend_until | $KohaDates %][% END %]
157                                 [% ELSE %]
158                                     [% IF HOLD.itemtype %]
159                                         <span>Pending for next available item of item type '[% ItemTypes.GetDescription( HOLD.itemtype ) | html %]'</span>
160                                     [% ELSE %]
161                                         <span>Pending</span>
162                                     [% END %]
163                                 [% END %]
164                             [% END %]
165                         </td>
166                         [% IF SuspendHoldsOpac and ! onlyinfo %]
167                             <td>
168                                 [% IF ( HOLD.is_cancelable_from_opac ) %]
169                                     [% IF HOLD.suspend %]
170                                         <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
171                                             <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
172                                             <button class="btn btn-link" type="submit" name="submit"><i class="fa fa-play" aria-hidden="true"></i> Resume</button>
173                                         </form>
174                                     [% ELSE %]
175                                         [% IF AutoResumeSuspendedHolds %]
176                                             <a class="btn btn-link suspend_hold js-show" href="#" role="button" data-title="[% HOLD.biblio.title | html %] [% FOREACH subtitle IN HOLD.biblio.subtitle.split(' \| ') %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %][% subtitle | html %][% END %]" data-reserve_id="[% HOLD.reserve_id | html %]"><i class="fa fa-pause" aria-hidden="true"></i> Suspend</a>
177                                         [% ELSE %]
178                                             <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
179                                                 <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
180                                                 <button class="btn btn-link" type="submit" name="submit"><i class="fa fa-pause" aria-hidden="true"></i> Suspend</button>
181                                             </form>
182                                         [% END # / IF AutoResumeSuspendedHolds %]
183                                     [% END # / IF HOLD.suspend %]
184                                 [% END # / IF ( HOLD.is_cancelable_from_opac )%]
185                             </td>
186                         [% END # / IF SuspendHoldsOpac %]
187                         [% IF ! onlyinfo %]
188                             <td class="modify">
189                                 [% IF ( HOLD.is_cancelable_from_opac ) %]
190                                     <form id="delete_hold_[% HOLD.reserve_id | html %]" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
191                                         <input type="hidden" name="biblionumber" value="[% HOLD.biblionumber | html %]" />
192                                         <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
193                                         <button data-title="[% INCLUDE 'biblio-title-head.inc' biblio=HOLD.biblio %]" data-reserve_id="[% HOLD.reserve_id | html %]" type="submit" class="btn btn-sm btn-danger btn-delete-hold"><i class="fa fa-remove" aria-hidden="true"></i> [% tp('Cancel hold button', 'Cancel') | html %]</button>
194                                     </form>
195                                 [% ELSIF HOLD.is_waiting && HOLD.cancellation_requestable_from_opac %]
196                                     <form id="req_cancel_hold_[% HOLD.reserve_id | html %]" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
197                                         <input type="hidden" name="biblionumber" value="[% HOLD.biblionumber | html %]" />
198                                         <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
199                                         <input type="hidden" name="cancellation_request" value="1" />
200                                         <button data-title="[% INCLUDE 'biblio-title-head.inc' biblio=HOLD.biblio %]" data-reserve_id="[% HOLD.reserve_id | html %]" type="submit" class="btn btn-sm btn-danger btn-req-delete-hold"><i class="fa fa-remove" aria-hidden="true"></i> [% tp('Cancel hold button', 'Cancel') | html %]</button>
201                                     </form>
202                                 [% END %]
203                             </td>
204                         [% END # / IF onlyinfo %]
205                     </tr>
206                 [% END # /FOREACH HOLDS %]
207             </tbody>
208         </table>
209
210         [% IF SuspendHoldsOpac and ! onlyinfo %]
211             [% UNLESS ( all_holds_waiting ) %]
212                 <div>
213                     <form class="form-inline" id="suspend_all_holds" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
214                         <button type="submit" id="suspend_all_submit" class="btn btn-primary"><i class="fa fa-pause" aria-hidden="true"></i> Suspend all holds</button>
215                         <input type="hidden" name="suspend" value="1" />
216
217                         [% IF AutoResumeSuspendedHolds %]
218                             <label for="suspend_until"> until </label>
219                             <input type="text" name="suspend_until" id="suspend_until" class="flatpickr futuredate" size="10" />
220                             <p><a href="#" class="clear-flatpickr" data-fp="suspend_until">Clear date to suspend indefinitely</a></p>
221                         [% END %]
222                     </form>
223                 </div>
224                 <br/>
225                 <div>
226                     <form id="resume_all_holds" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
227                         <button type="submit" id="resume_all_submit" class="btn btn-primary"><i class="fa fa-play" aria-hidden="true"></i> Resume all suspended holds</button>
228                         <input type="hidden" name="suspend" value="0" />
229                     </form>
230                 </div>
231             [% END %]
232         [% END %]
233     </div> <!-- / #opac-user-holds -->
234 [% END # / #HOLDS.count %]