Bug 14783: Change pickup location from 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>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                                 [% IF ( HOLD.can_change_branch_opac ) %]
86                                     <form class="change_branch" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
87                                         <select name="new_branch" >
88                                             [% PROCESS options_for_libraries libraries = Branches.pickup_locations({    search_params => { biblio => HOLD.biblionumber, patron => HOLD.borrower }, selected => HOLD.branchcode }) %]
89                                        </select>
90                                        <input type="hidden" name="new_branch_reserveid" value="[% HOLD.reserve_id | html %]" />
91                                        <button class="btn btn-primary" type="submit" name="change_branch" value="1">Change</button>
92                                     </form>
93                                 [% ELSE %]
94                                     [% HOLD.branch.branchname | html %]
95                                 [% END  %]
96                             </td>
97                         [% END %]
98                         [% IF ( showpriority ) %]
99                                 <td data-order="[% HOLD.priority | html %]" class="priority">
100                                 <span class="tdlabel">Priority:</span>
101                                 [% HOLD.priority | html %]
102                             </td>
103                         [% END %]
104                         <td class="status">
105                             <span class="tdlabel">Status:</span>
106                             [% IF ( HOLD.is_waiting ) %]
107                                 <i class="fa fa-exclamation-circle text-warning" aria-hidden="true"></i>
108                                 [% IF ( HOLD.is_at_destination ) %]
109                                     Item waiting at <strong> [% HOLD.branch.branchname | html %]</strong>
110                                     [% IF ( HOLD.desk_id ) %], [% HOLD.desk.desk_name | html %],[% END %]
111                                     [% IF ( HOLD.waitingdate ) %]
112                                         since [% HOLD.waitingdate | $KohaDates %]
113                                         [% IF HOLD.expirationdate %]
114                                             until [% HOLD.expirationdate | $KohaDates %]
115                                         [% END %]
116                                     [% END %]
117                                     <input type="hidden" name="pickup" value="[% HOLD.branchcode | html %]" />
118                                 [% ELSE %]
119                                     Item in transit to <strong> [% Branches.GetName( HOLD.branchcode ) | html %]</strong> <input type="hidden" name="pickup" value="[% HOLD.branchcode | html %]" />
120                                 [% END %]
121                             [% ELSE %]
122                                 [% IF ( HOLD.is_in_transit ) %]
123                                     [% SET transfer = HOLD.item.get_transfer %]
124                                     [% branch_name = BLOCK %]<strong>[% Branches.GetName( transfer.frombranch ) | html %]</strong>[% END %]
125                                     <span>Item in transit from [% branch_name| $raw %] since</span>
126                                     [% transfer.datesent | $KohaDates %]
127                                 [% ELSIF ( HOLD.is_in_processing ) %]
128                                     <span>Item in processing</span>
129                                 [% ELSIF ( HOLD.suspend ) %]
130                                     <span>Suspended</span>[% IF ( HOLD.suspend_until ) %] <span>until</span> [% HOLD.suspend_until | $KohaDates %][% END %]
131                                 [% ELSE %]
132                                     [% IF HOLD.itemtype %]
133                                         <span>Pending for next available item of item type '[% ItemTypes.GetDescription( HOLD.itemtype ) | html %]'</span>
134                                     [% ELSE %]
135                                         <span>Pending</span>
136                                     [% END %]
137                                 [% END %]
138                             [% END %]
139                         </td>
140                         [% IF SuspendHoldsOpac and ! onlyinfo %]
141                             <td>
142                                 [% IF ( HOLD.is_cancelable_from_opac ) %]
143                                     [% IF HOLD.suspend %]
144                                         <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
145                                             <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
146                                             <button class="btn btn-link" type="submit" name="submit"><i class="fa fa-play" aria-hidden="true"></i> Resume</button>
147                                         </form>
148                                     [% ELSE %]
149                                         [% IF AutoResumeSuspendedHolds %]
150                                             <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>
151                                         [% ELSE %]
152                                             <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
153                                                 <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
154                                                 <button class="btn btn-link" type="submit" name="submit"><i class="fa fa-pause" aria-hidden="true"></i> Suspend</button>
155                                             </form>
156                                         [% END # / IF AutoResumeSuspendedHolds %]
157                                     [% END # / IF HOLD.suspend %]
158                                 [% END # / IF ( HOLD.is_cancelable_from_opac )%]
159                             </td>
160                         [% END # / IF SuspendHoldsOpac %]
161                         [% IF ! onlyinfo %]
162                             <td class="modify">
163                                 [% IF ( HOLD.is_cancelable_from_opac ) %]
164                                     <form id="delete_hold_[% HOLD.reserve_id | html %]" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
165                                         <input type="hidden" name="biblionumber" value="[% HOLD.biblionumber | html %]" />
166                                         <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
167                                         <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>
168                                     </form>
169                                 [% ELSIF HOLD.is_waiting && HOLD.cancellation_requestable_from_opac %]
170                                     <form id="req_cancel_hold_[% HOLD.reserve_id | html %]" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
171                                         <input type="hidden" name="biblionumber" value="[% HOLD.biblionumber | html %]" />
172                                         <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
173                                         <input type="hidden" name="cancellation_request" value="1" />
174                                         <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>
175                                     </form>
176                                 [% END %]
177                             </td>
178                         [% END # / IF onlyinfo %]
179                     </tr>
180                 [% END # /FOREACH HOLDS %]
181             </tbody>
182         </table>
183
184         [% IF SuspendHoldsOpac and ! onlyinfo %]
185             [% UNLESS ( all_holds_waiting ) %]
186                 <div>
187                     <form class="form-inline" id="suspend_all_holds" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
188                         <button type="submit" id="suspend_all_submit" class="btn btn-primary"><i class="fa fa-pause" aria-hidden="true"></i> Suspend all holds</button>
189                         <input type="hidden" name="suspend" value="1" />
190
191                         [% IF AutoResumeSuspendedHolds %]
192                             <label for="suspend_until"> until </label>
193                             <input type="text" name="suspend_until" id="suspend_until" class="flatpickr futuredate" size="10" />
194                             <p><a href="#" class="clear-flatpickr" data-fp="suspend_until">Clear date to suspend indefinitely</a></p>
195                         [% END %]
196                     </form>
197                 </div>
198                 <br/>
199                 <div>
200                     <form id="resume_all_holds" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
201                         <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>
202                         <input type="hidden" name="suspend" value="0" />
203                     </form>
204                 </div>
205             [% END %]
206         [% END %]
207     </div> <!-- / #opac-user-holds -->
208 [% END # / #HOLDS.count %]