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