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