Bug 24412: Attach waiting reserve to desk
[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">
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 class="title-string">Placed on</th>
16                     [% ELSE %]
17                         <th class="psort title-string">Placed on</th>
18                     [% END %]
19                     <th class="title-string">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                                 <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% HOLD.biblionumber | html %]">
51                                     [% INCLUDE 'biblio-title.inc' biblio=HOLD.biblio %]
52                                     [% HOLD.item.enumchron | html %]
53                                 </a>
54                             [% ELSE %]
55                                 <strong>
56                                     [% INCLUDE 'biblio-title.inc' biblio=HOLD.biblio %]
57                                     [% HOLD.item.enumchron | html %]
58                                 </strong>
59                             [% END %]
60                             [% HOLD.biblio.author | html %]
61                         </td>
62                         <td class="reservedate">
63                             <span title="[% HOLD.reservedate | html %]">
64                                 <span class="tdlabel">Hold date:</span>
65                                 [% HOLD.reservedate | $KohaDates %]
66                             </span>
67                         </td>
68                         <td class="expirationdate">
69                             [% IF ! HOLD.found %]
70                                 [% IF ( HOLD.expirationdate ) %]
71                                     <span title="[% HOLD.expirationdate | html %]">
72                                         <span class="tdlabel">Expiration:</span>
73                                             [% HOLD.expirationdate | $KohaDates %]
74                                     </span>
75                                 [% ELSE %]
76                                     <span title="0000-00-00">
77                                         <span class="tdlabel">Expiration:</span>
78                                         Never expires
79                                     </span>
80                                 [% END %]
81                             [% ELSE %]
82                                 <span title="0000-00-00">-</span>
83                             [% END %]
84                         </td>
85                         [% UNLESS( singleBranchMode) %]
86                             <td class="branch">
87                                 <span class="tdlabel">Pick up location:</span>
88                                 [% HOLD.branch.branchname | html %]
89                             </td>
90                         [% END %]
91                         [% IF ( showpriority ) %]
92                                 <td data-order="[% HOLD.priority | html %]" class="priority">
93                                 <span class="tdlabel">Priority:</span>
94                                 [% HOLD.priority | html %]
95                             </td>
96                         [% END %]
97                         <td class="status">
98                             <span class="tdlabel">Status:</span>
99                             [% IF ( HOLD.is_waiting ) %]
100                                 <i class="fa fa-exclamation-circle text-warning" aria-hidden="true"></i>
101                                 [% IF ( HOLD.is_at_destination ) %]
102                                     Item waiting at <strong> [% HOLD.branch.branchname | html %]</strong>
103                                     [% IF ( HOLD.desk_id ) %], [% Desks.GetName ( HOLD.desk_id ) | html %],[% END %]
104                                     [% IF ( HOLD.waitingdate ) %]
105                                         since [% HOLD.waitingdate | $KohaDates %]
106                                         [% IF HOLD.expirationdate %]
107                                             until [% HOLD.expirationdate | $KohaDates %]
108                                         [% END %]
109                                     [% END %]
110                                     <input type="hidden" name="pickup" value="[% HOLD.branchcode | html %]" />
111                                 [% ELSE %]
112                                     Item in transit to <strong> [% Branches.GetName( HOLD.branchcode ) | html %]</strong> <input type="hidden" name="pickup" value="[% HOLD.branchcode | html %]" />
113                                 [% END %]
114                             [% ELSE %]
115                                 [% IF ( HOLD.is_in_transit ) %]
116                                     [% SET transfer = HOLD.item.get_transfer %]
117                                     Item in transit from <strong> [% Branches.GetName( transfer.frombranch ) | html %]</strong> since
118                                     [% transfer.datesent | $KohaDates %]
119                                 [% ELSIF ( HOLD.is_in_processing ) %]
120                                     Item in processing
121                                 [% ELSIF ( HOLD.suspend ) %]
122                                     Suspended [% IF ( HOLD.suspend_until ) %] until [% HOLD.suspend_until | $KohaDates %] [% END %]
123                                 [% ELSE %]
124                                     [% IF HOLD.itemtype %]
125                                         Pending for next available item of item type '[% ItemTypes.GetDescription( HOLD.itemtype ) | html %]'
126                                     [% ELSE %]
127                                         Pending
128                                     [% END %]
129                                 [% END %]
130                             [% END %]
131                         </td>
132                         [% IF SuspendHoldsOpac and ! onlyinfo %]
133                             <td>
134                                 [% IF ( HOLD.is_cancelable_from_opac ) %]
135                                     [% IF HOLD.suspend %]
136                                         <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
137                                             <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
138                                             <button class="btn btn-link" type="submit" name="submit"><i class="fa fa-play" aria-hidden="true"></i> Resume</button>
139                                         </form>
140                                     [% ELSE %]
141                                         [% IF AutoResumeSuspendedHolds %]
142                                             <a class="btn btn-link js-show" href="#suspendModal[% HOLD.reserve_id | html %]" role="button" data-toggle="modal"><i class="fa fa-pause" aria-hidden="true"></i> Suspend</a>
143                                             [% # hold suspend modal form %]
144                                             <div id="suspendModal[% HOLD.reserve_id | html %]" class="modal-nojs" tabindex="-1" role="dialog" aria-labelledby="suspendModal[% HOLD.reserve_id | html %]Label" aria-hidden="true">
145                                                 <div class="modal-dialog">
146                                                     <div class="modal-content">
147                                                         <form action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
148                                                             <div class="modal-header">
149                                                                 [% IF HOLD.suspend %]
150                                                                     <h3 class="modal-title" id="suspendModal[% HOLD.reserve_id | html %]Label">Resume your hold on <em>[% HOLD.biblio.title | html %]</em></h3>
151                                                                 [% ELSE %]
152                                                                     <h3 class="modal-title" id="suspendModal[% HOLD.reserve_id | html %]Label">Suspend your hold on <em>[% HOLD.biblio.title | html %]</em></h3>
153                                                                 [% END %]
154                                                                 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
155                                                                     <span aria-hidden="true">x</span>
156                                                                 </button>
157                                                             </div>
158                                                             <div class="modal-body">
159                                                                 <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
160                                                                 <label for="suspend_until_[% HOLD.reserve_id | html %]">Suspend until:</label>
161                                                                 <input type="text" name="suspend_until" id="suspend_until_[% HOLD.reserve_id | html %]" class="suspend-until" size="10" />
162                                                                 [% INCLUDE 'date-format.inc' %]
163                                                                 <p class="js-show"><a href="#" onclick="document.getElementById('suspend_until_[% HOLD.reserve_id | html %]').value='';return false;">Clear date to suspend indefinitely</a></p>
164                                                                 <button class="btn btn-primary btn-sm js-hide" type="submit" name="submit">Suspend</button>
165                                                             </div>
166                                                             <div class="modal-footer">
167                                                                 <button class="btn btn-primary"><i class="fa fa-check" aria-hidden="true"></i> Suspend</button>
168                                                                 <button data-dismiss="modal" class="btn btn-secondary"><i class="fa fa-remove" aria-hidden="true"></i> Do not suspend</button>
169                                                             </div>
170                                                         </form>
171                                                     </div> <!-- /.modal-content -->
172                                                 </div> <!-- /.modal-dialog -->
173                                             </div>  <!-- /#suspendModal[% HOLD.reserve_id | html %] -->
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                                 [% END %]
193                             </td>
194                         [% END # / IF onlyinfo %]
195                     </tr>
196                 [% END # /FOREACH HOLDS %]
197             </tbody>
198         </table>
199
200         [% IF SuspendHoldsOpac and ! onlyinfo %]
201             [% UNLESS ( all_holds_waiting ) %]
202                 <div>
203                     <form class="form-inline" id="suspend_all_holds" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
204                         <button type="submit" id="suspend_all_submit" class="btn btn-primary"><i class="fa fa-pause" aria-hidden="true"></i> Suspend all holds</button>
205                         <input type="hidden" name="suspend" value="1" />
206
207                         [% IF AutoResumeSuspendedHolds %]
208                             <label for="suspend_until"> until </label>
209                             <input type="text" name="suspend_until" id="suspend_until" class="suspend-until" readonly="readonly" size="10" />
210                             <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('suspend_until').value='';return false;">Clear date to suspend indefinitely</a>
211                         [% END %]
212                     </form>
213                 </div>
214                 <br/>
215                 <div>
216                     <form id="resume_all_holds" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
217                         <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>
218                         <input type="hidden" name="suspend" value="0" />
219                     </form>
220                 </div>
221             [% END %]
222         [% END %]
223     </div> <!-- / #opac-user-holds -->
224 [% END # / #HOLDS.count %]