Bug 20168: Update of the OPAC bootstrap template to bootstrap v4
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-suggestions.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% USE AuthorisedValues %]
6 [% USE KohaDates %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;
9 [% IF ( op_add ) %]Enter a new purchase suggestion[% END %]
10 [% IF ( op_else ) %]Purchase Suggestions[% END %]</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% BLOCK cssinclude %][% END %]
13 </head>
14 [% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-usersuggestions' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-suggestions' bodyclass='scrollto' %][% END %]
15 [% INCLUDE 'masthead.inc' %]
16
17     <div class="main">
18         <nav aria-label="breadcrumb">
19             <ul class="breadcrumb">
20                 <li class="breadcrumb-item">
21                     <a href="/cgi-bin/koha/opac-main.pl">Home</a>
22                 </li>
23                 <li class="breadcrumb-item">
24                     <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
25                 </li>
26                 <li class="breadcrumb-item" aria-current="page">
27                     <a href="#">Your purchase suggestions</a>
28                 </li>
29             </ul>
30         </nav>
31
32         <div class="container-fluid">
33             <div class="row">
34                 <div class="col col-lg-2 order-2 order-lg-1">
35                     <div id="navigation">
36                         [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
37                     </div>
38                 </div>
39                 <div class="col-md-12 col-lg-10 order-1">
40
41                     <div id="usersuggestions" class="maincontent">
42                         [% IF ( op_add ) %]
43                             [% IF ( Koha.Preference('MaxTotalSuggestions') != '' && patrons_total_suggestions_count >= Koha.Preference('MaxTotalSuggestions') ) %]
44                                     <h1 class="TooManySuggestions">You cannot place any more suggestions</h1>
45                                     <h2 class="TooManySuggestionsText">You may only add up to [% Koha.Preference('MaxTotalSuggestions') | html %] suggestions in [% Koha.Preference('NumberOfSuggestionDays') | html %] days.</h2>
46                             [% ELSIF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
47                                     <h1 class="TooManySuggestions">You cannot place any more suggestions</h1>
48                                     <h2 class="TooManySuggestionsText">You have reached your limit for suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') | html %]). Once the library has processed those suggestions you will be able to place more.</h2>
49                             [% ELSE %]
50                             <h1>Enter a new purchase suggestion</h1>
51
52                             <p>Please fill out this form to make a purchase suggestion. You will receive an email when the library processes your suggestion.</p>
53                             <p>Only certain fields (marked in red) are required, but the more information you enter the easier it will be for the librarians to find the title you're requesting. The "Notes" field can be used to provide any additional information.</p>
54
55                             [% FOR m IN messages %]
56                                 <div class="alert alert-[% m.type | html %]">
57                                     [% SWITCH m.code %]
58                                     [% CASE 'biblio_exists' %]
59                                         A similar document already exists: <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% m.id | uri %]">[% m.title | html %]</a>. Click on "Confirm your suggestion" to ignore this message.
60                                     [% CASE %]
61                                         [% m.code | html %]
62                                     [% END %]
63                                 </div>
64                             [% END %]
65
66                             <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="add_suggestion_form">
67                                 <fieldset class="rows">
68                                     <ol>
69                                         <li>
70                                             [% IF ( title_required ) %]
71                                                 <label for="title" class="required">Title:</label>
72                                                 <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" required="required" />
73                                                 <span class="required">Required</span>
74                                             [% ELSE %]
75                                                 <label for="title">Title:</label>
76                                                 <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" />
77                                             [% END %]
78                                         </li>
79                                         <li>
80                                             [% IF ( author_required ) %]
81                                                 <label for="author" class="required">Author:</label>
82                                                 <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" required="required" />
83                                                 <span class="required">Required</span>
84                                             [% ELSE %]
85                                                 <label for="author">Author:</label>
86                                                 <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" />
87                                             [% END %]
88                                         </li>
89                                         <li>
90                                             <div title="Copyright or publication year, for example: 2016">
91                                                 [% IF ( copyrightdate_required ) %]
92                                                     <label for="copyrightdate" class="required">Copyright date:</label>
93                                                     <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" required="required" />
94                                                 <span class="required">Required</span>
95                                                 [% ELSE %]
96                                                     <label for="copyrightdate">Copyright date:</label>
97                                                     <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" />
98                                                 [% END %]
99                                             </div>
100                                         </li>
101                                         <li>
102                                             [% IF ( isbn_required ) %]
103                                                 <label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label>
104                                                 <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" required="required" />
105                                                 <span class="required">Required</span>
106                                             [% ELSE %]
107                                                 <label for="isbn">Standard number (ISBN, ISSN or other):</label>
108                                                 <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" />
109                                             [% END %]
110                                         </li>
111                                         <li>
112                                             [% IF ( publishercode_required ) %]
113                                                 <label for="publishercode" class="required">Publisher:</label>
114                                                 <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" required="required" />
115                                                 <span class="required">Required</span>
116                                             [% ELSE %]
117                                                 <label for="publishercode">Publisher:</label>
118                                                 <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" />
119                                             [% END %]
120                                         </li>
121                                         <li>
122                                             [% IF ( collectiontitle_required ) %]
123                                                 <label for="collectiontitle" class="required">Collection title:</label>
124                                                 <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" required="required" />
125                                                 <span class="required">Required</span>
126                                             [% ELSE %]
127                                                 <label for="collectiontitle">Collection title:</label>
128                                                 <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" />
129                                             [% END %]
130                                         </li>
131                                         <li>
132                                             [% IF ( place_required ) %]
133                                                 <label for="place" class="required">Publication place:</label>
134                                                 <input type="text" id="place" name="place" required="required" maxlength="80" value="[% place | html %]" />
135                                                 <span class="required">Required</span>
136                                             [% ELSE %]
137                                                 <label for="place">Publication place:</label>
138                                                 <input type="text" id="place" name="place"  maxlength="80" value="[% place | html %]" />
139                                             [% END %]
140                                         </li>
141                                         <li id="opac-suggestion-quantity">
142                                             [% IF ( quantity_required ) %]
143                                                 <label for="quantity" class="required">Quantity:</label>
144                                                 <input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" />
145                                                 <span class="required">Required</span>
146                                             [% ELSE %]
147                                                 <label for="quantity">Quantity:</label>
148                                                 <input type="text" id="quantity" name="quantity"  maxlength="4" size="4" />
149                                             [% END %]
150                                         </li>
151                                         <li>
152                                             [% IF ( itemtype_required ) %]
153                                                 <label for="itemtype" class="required">Item type:</label>
154                                                 [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
155                                                 <span class="required">Required</span>
156                                             [% ELSE %]
157                                                 <label for="itemtype">Item type:</label>
158                                                 [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
159                                             [% END %]
160                                         </li>
161                                         [% IF branchcode %]
162                                             <li>
163                                                 [% IF ( branchcode_required ) %]
164                                                     <label for="branch" class="required">Library:</label>
165                                                     <select name="branchcode" id="branch" required="required">
166                                                         [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
167                                                     </select>
168                                                     <span class="required">Required</span>
169                                                 [% ELSE %]
170                                                     <label for="branch">Library:</label>
171                                                     <select name="branchcode" id="branch">
172                                                         [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
173                                                     </select>
174                                                 [% END %]
175                                             </li>
176                                         [% END %]
177                                         [% IF ( patron_reason_loop ) %]
178                                             <li>
179                                                 [% IF ( patronreason_required ) %]
180                                                     <label for="patronreason" class="required">Reason for suggestion: </label>
181                                                     <select name="patronreason" id="patronreason" required="required">
182                                                         <option value="">-- Choose --</option>
183                                                         [% FOREACH patron_reason_loo IN patron_reason_loop %]
184                                                             <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
185                                                         [% END %]
186                                                     </select>
187                                                     <span class="required">Required</span>
188                                                 [% ELSE %]
189                                                     <label for="patronreason">Reason for suggestion: </label>
190                                                     <select name="patronreason" id="patronreason">
191                                                         <option value="">-- Choose --</option>
192                                                         [% FOREACH patron_reason_loo IN patron_reason_loop %]
193                                                             <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
194                                                         [% END %]
195                                                     </select>
196                                                 [% END %]
197                                             </li>
198                                         [% END %]
199                                         <li>
200                                             [% IF ( note_required ) %]
201                                                 <label for="note" class="required">Notes:</label>
202                                                 <textarea name="note" id="note" rows="5" cols="40" required="required">[% note | html %]</textarea>
203                                                 <span class="required">Required</span>
204                                             [% ELSE %]
205                                                 <label for="note">Notes:</label>
206                                                 <textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea>
207                                             [% END %]
208                                         </li>
209
210                                         <!--  Add a hidden 'negcap' field -->
211                                         <li id="negcap" style="position: absolute; left: -2000px;">
212                                             negcap <input type="text" name="negcap"/>
213                                         </li>
214
215                                     </ol>
216                                 </fieldset>
217                                 <fieldset class="action">
218                                     <input type="hidden" name="suggested_by_anyone" value="[% suggested_by_anyone | html %]" />
219                                     [% IF need_confirm # Confirm that we want a duplicate %]
220                                         <input type="hidden" name="op" value="add_confirm" />
221                                         <input type="submit" class="btn btn-primary" value="Confirm your suggestion" />
222                                     [% ELSIF biblionumber # Create from an existing title %]
223                                         <input type="hidden" name="op" value="add_confirm" />
224                                         <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
225                                         <input type="submit" class="btn btn-primary" value="Submit your suggestion" />
226                                     [% ELSE # Not created from an existing title, search for possible duplicate %]
227                                         <input type="hidden" name="op" value="add_validate" />
228                                         <input type="submit" class="btn btn-primary" value="Submit your suggestion" />
229                                     [% END %]
230                                     <a class="action" href="/cgi-bin/koha/opac-suggestions.pl">Cancel</a>
231                                 </fieldset>
232                             </form>
233                             [% END %]
234                         [% END #  IF op_add %]
235
236                         [% IF ( op_else ) %]
237                             <h1>
238                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
239                                     Purchase suggestions
240                                 [% ELSE %]
241                                     [% IF ( loggedinusername ) %]
242                                         Your purchase suggestions
243                                     [% ELSE %]
244                                         Purchase suggestions
245                                     [% END %]
246                                 [% END %]
247                             </h1>
248                             [% FOR m IN messages %]
249                                 <div class="alert alert-[% m.type | html %]">
250                                     [% SWITCH m.code %]
251                                     [% CASE 'total_suggestions' %]
252                                         The suggestion has not been added. You have reached your limit for suggestions you can place at this time ([% Koha.Preference('MaxTotalSuggestions') | html %] in [% Koha.Preference('NumberOfSuggestionDays') | html %] days).
253                                     [% CASE 'too_many' %]
254                                         The suggestion has not been added. You have reached your limit for suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') | html %]). Once the library has processed those suggestions you will be able to place more.
255                                     [% CASE 'already_exists' %]
256                                         The suggestion has not been added. A suggestion with this title already exists.
257                                     [% CASE 'success_on_inserted' %]
258                                         Your suggestion has been submitted.
259                                     [% CASE %]
260                                         [% m.code | html %]
261                                     [% END %]
262                                 </div>
263                             [% END %]
264
265                             [% IF ( deleted ) %]<div class="alert alert-info">The selected suggestions have been deleted.</div>[% END %]
266
267                             [% IF ( suggestions_loop ) %]
268                                 [% SET can_delete_suggestion = 0 %]
269                                 <form action="/cgi-bin/koha/opac-suggestions.pl" class="form-inline" id="search_suggestions_form" method="get">
270                                     <div class="form-row">
271                                         <div class="col-auto my-1">
272                                             <label class="sr-only" for="title">Search for:</label>
273                                             <input class="form-control form-control-sm" type="text" name="title" placeholder="Search suggestions" id="title" value="[% title | html %]" />
274                                         </div>
275                                         [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
276                                             [% IF loggedinusername %]
277                                                 <div class="col-auto my-1">
278                                                     <label class="sr-only" for="suggested_by_anyone">Suggested by:</label>
279                                                     <select class="form-control form-control-sm" name="suggested_by_anyone" id="suggested_by_anyone">
280                                                         [% IF suggested_by_anyone %]
281                                                             <option value="0">Suggested by me</option>
282                                                             <option value="1" selected="selected">Suggested by anyone</option>
283                                                         [% ELSE %]
284                                                             <option value="0" selected="selected">Suggested by me</option>
285                                                             <option value="1">Suggested by anyone</option>
286                                                         [% END %]
287                                                     </select>
288                                                 </div>
289                                                 <div class="col-auto my-1">
290                                                     <button type="submit" class="btn btn-sm btn-primary">Go</button>
291                                                 </div>
292                                             [% END %]
293                                         [% END %]
294                                     </div>
295                                 </form>
296                                 <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="delete_suggestions">
297                                     <input type="hidden" name="op" value="delete_confirm" />
298                                     [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
299                                         <div id="toolbar" class="toolbar clearfix">
300                                         [% IF ( Koha.Preference('MaxTotalSuggestions') != '' && patrons_total_suggestions_count >= Koha.Preference('MaxTotalSuggestions') ) %]
301                                                 <p class="TooManySuggestionsText">You may only add up to [% Koha.Preference('MaxTotalSuggestions') | html %] suggestions in [% Koha.Preference('NumberOfSuggestionDays') | html %] days.</p>
302                                         [% ELSIF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
303                                                 <p class="TooManySuggestionsText">You have reached your limit for suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') | html %]).</br>Once the library has processed those suggestions you will be able to place more.</p>
304                                         [% ELSE %]
305                                                 <a class="btn btn-link new" href="/cgi-bin/koha/opac-suggestions.pl?op=add"><i class="fa fa-plus"  aria-hidden="true"></i> New purchase suggestion</a>
306                                         [% END %]
307                                         </div>
308                                     [% END %]
309
310                                     [% IF ( loggedinusername ) %]
311                                         <div id="selections-toolbar" class="toolbar">
312                                             <span class="checkall"></span> <span class="clearall"></span> <span class="sep">|</span>
313                                             <span class="links">
314                                                 <span id="selections">Select suggestions to: </span>
315                                                 <span id="removeitems"></span>
316                                             </span>
317                                         </div>
318                                     [% END %]
319
320                                     <table id="suggestt" class="checkboxed table table-bordered table-striped">
321                                         <thead>
322                                             <tr>
323                                                 [% IF ( loggedinusername ) %]<th>&nbsp;</th>[% END %]
324                                                 <th>Summary</th>
325                                                 <th>Suggested on</th>
326                                                 <th>Note</th>
327                                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]<th>Suggested for</th>[% END %]
328                                                 [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]<th>Managed by</th>[% END %]
329                                                 <th>Status</th>
330                                             </tr>
331                                         </thead>
332                                         <tbody>
333                                             [% FOREACH suggestions_loo IN suggestions_loop %]
334                                                 <tr>
335                                                     [% IF ( loggedinusername ) %]
336                                                         <td>
337                                                             [% IF ( suggestions_loo.showcheckbox ) %]
338                                                                 [% SET can_delete_suggestion = 1 %]
339                                                                 <input type="checkbox" class="cb" id="id[% suggestions_loo.suggestionid | html %]" name="delete_field" data-title="[% suggestions_loo.title | html %]" value="[% suggestions_loo.suggestionid | html %]" />
340                                                             [% END %]
341                                                         </td>
342                                                     [% END %]
343                                                     <td>
344                                                         <p>
345                                                             <label for="id[% suggestions_loo.suggestionid | html %]">
346                                                                 [% IF suggestions_loo.biblionumber %]
347                                                                     <strong><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% suggestions_loo.biblionumber | uri %]">[% suggestions_loo.title | html %]</a></strong>
348                                                                 [% ELSE %]
349                                                                     <strong>[% suggestions_loo.title | html %]</strong>
350                                                                 [% END %]
351                                                             </label>
352                                                         </p>
353                                                             <p>[% IF ( suggestions_loo.author ) %][% suggestions_loo.author | html %],[% END %]
354                                                                 [% IF ( suggestions_loo.copyrightdate ) %] - [% suggestions_loo.copyrightdate | html %],[% END %]
355                                                                 [% IF ( suggestions_loo.publishercode ) %] - [% suggestions_loo.publishercode | html %][% END %]
356                                                                 [% IF ( suggestions_loo.place ) %]([% suggestions_loo.place | html %])[% END %]
357                                                                 [% IF ( suggestions_loo.collectiontitle ) %] , [% suggestions_loo.collectiontitle | html %][% END %]
358                                                                 [% IF ( suggestions_loo.itemtype ) %] - [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 1 ) | html %][% END %]
359                                                         </p>
360                                                     </td>
361                                                     <td>
362                                                         [% IF ( suggestions_loo.suggesteddate ) %][% suggestions_loo.suggesteddate |$KohaDates %][% END %]
363                                                     </td>
364                                                     <td>
365                                                         [% IF ( suggestions_loo.note ) %]
366                                                             <span class="tdlabel">Note: </span>
367                                                             [% suggestions_loo.note | html %]
368                                                         [% END %]
369                                                     </td>
370                                                     [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
371                                                         <td>
372                                                             [% IF ( suggestions_loo.branchcodesuggestedby ) %]
373                                                                 <span class="tdlabel">Suggested for:</span>
374                                                                 [% suggestions_loo.branchcodesuggestedby | html %]
375                                                             [% END %]
376                                                         </td>
377                                                     [% END %]
378                                                     [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]
379                                                     <td>
380                                                         [% IF ( suggestions_loo.surnamemanagedby ) %]
381                                                             <span class="tdlabel">Managed by:</span>
382                                                             [% suggestions_loo.surnamemanagedby | html %]
383                                                             [% IF ( suggestions_loo.firstnamemanagedby ) %]    , [% suggestions_loo.firstnamemanagedby | html %]
384                                                             [% END %]
385                                                         [% END %]
386                                                     </td>
387                                                     [% END %]
388                                                     <td>
389                                                         <span class="tdlabel">Status:</span>
390                                                         [% IF ( suggestions_loo.ASKED ) %]Requested
391                                                         [% ELSIF ( suggestions_loo.CHECKED ) %]Checked by the library
392                                                         [% ELSIF ( suggestions_loo.ACCEPTED ) %]Accepted by the library
393                                                         [% ELSIF ( suggestions_loo.ORDERED ) %]Ordered by the library
394                                                         [% ELSIF ( suggestions_loo.REJECTED ) %]Suggestion declined
395                                                         [% ELSIF ( suggestions_loo.AVAILABLE ) %]Available in the library
396                                                         [% ELSE %] [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS, 1 ) | html %] [% END %]
397                                                         [% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason | html %])[% END %]
398                                                     </td>
399                                                 </tr>
400                                             [% END # / FOREACH suggestions_loo %]
401                                         </tbody>
402                                     </table>
403
404                                     [% IF ( loggedinusername && can_delete_suggestion ) %]
405                                         <fieldset class="action">
406                                             <input type="submit" class="btn btn-danger removeitems" value="Delete selected" />
407                                         </fieldset>
408                                     [% END %]
409                                 </form>
410                             [% ELSE %]
411                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) %]
412                                     [% IF ( loggedinusername ) %]
413                                         [% IF ( suggested_by_anyone ) %]
414                                             <p>There are no pending purchase suggestions.</p>
415                                         [% ELSE %]
416                                             <p>You have no pending purchase suggestions. <a href="/cgi-bin/koha/opac-suggestions.pl?suggested_by_anyone=1">View all suggestions</a></p>
417                                         [% END %]
418                                     [% ELSE %]
419                                         <p>There are no pending purchase suggestions.</p>
420                                     [% END %]
421                                 [% ELSE %]
422                                     [% IF ( loggedinusername ) %]
423                                         <p>You have no pending purchase suggestions.</p>
424                                     [% ELSE %]
425                                         <p>You are not authorized to see pending purchase suggestions.</p>
426                                     [% END %]
427                                 [% END %]
428                                 [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
429                                     [% IF ( Koha.Preference('MaxTotalSuggestions') != ''  && patrons_total_suggestions_count >= Koha.Preference('MaxTotalSuggestions') ) %]
430                                         <p class="TooManySuggestionsText">You may only add up to [% Koha.Preference('MaxTotalSuggestions') | html %] suggestions in [% Koha.Preference('NumberOfSuggestionDays') | html %] days.</p>
431                                     [% ELSIF ( Koha.Preference('MaxOpenSuggestions') != ''  && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
432                                         <p class="TooManySuggestionsText">You have reached your limit for suggestions you can place at this time.</br>Once the library has processed those suggestions you will be able to place more.</p>
433                                     [% ELSE %]
434                                         <p><a class="btn btn-link new" href="/cgi-bin/koha/opac-suggestions.pl?op=add"><i class="fa fa-plus" aria-hidden="true"></i> New purchase suggestion</a></p>
435                                     [% END %]
436                                 [% END %]
437                             [% END # / IF suggestions_loop %]
438
439                         [% END # IF op_else %]
440                     </div> <!-- / #usersuggestions -->
441                 </div> <!-- / .col-lg-10 -->
442             </div> <!-- / .row -->
443         </div> <!-- / .container-fluid -->
444     </div> <!-- / .main -->
445
446 [% INCLUDE 'opac-bottom.inc' %]
447 [% BLOCK jsinclude %]
448 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
449 [% INCLUDE 'datatables.inc' %]
450 <script>
451     [% IF ( loggedinusername ) %]
452         function enableCheckboxActions(){
453             // Enable/disable controls if checkboxes are checked
454             var checkedBoxes = $(".checkboxed input:checkbox:checked");
455             if ($(checkedBoxes).size()) {
456               $("#selections").html(_("With selected suggestions: "));
457               $("#selections-toolbar .links a").removeClass("disabled");
458             } else {
459               $("#selections").html(_("Select suggestions to: "));
460               $("#selections-toolbar .links a").addClass("disabled");
461             }
462         }
463     [% END %]
464
465     $(function() {
466         $("#suggestt").dataTable($.extend(true, {}, dataTablesDefaults, {
467             "order": [[ 1, "asc" ]],
468             "autoWidth": false,
469             "columnDefs": [
470               [% IF ( loggedinusername ) %]{ "targets": [ 0 ], "sortable": false, "searchable": false }[% END %]
471             ],
472             "columns": [
473                 [% IF ( loggedinusername ) %]null,[% END %]
474                 { "type": "anti-the" },
475                 null,
476                 null,
477                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]null,[% END %]
478                 [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]null,[% END %]
479                 null
480             ]
481         }));
482         [% IF ( loggedinusername ) %]$("span.clearall").html("<a id=\"CheckNone\" class=\"btn btn-link btn-sm\" href=\"#\">"+_("Clear all")+"<\/a>");
483         $("span.checkall").html("<a id=\"CheckAll\" class=\"btn btn-link btn-sm\" href=\"#\">"+_("Select all")+"<\/a>");
484         $("#CheckAll").click(function(){
485             $(".checkboxed").checkCheckboxes();
486             enableCheckboxActions();
487             return false;
488         });
489         $("#CheckNone").click(function(){
490             $(".checkboxed").unCheckCheckboxes();
491             enableCheckboxActions();
492             return false;
493         });
494         $(".cb").click(function(){
495           enableCheckboxActions();
496         });
497         $("#removeitems").html("<a href=\"#\" class=\"btn btn-link removeitems tag_hides btn-disabled\"><i class=\"fa fa-trash\" aria-hidden=\"true\"></i> "+_("Delete")+"</a>");
498
499         enableCheckboxActions();
500
501         $(".removeitems").on("click", function(e) {
502             e.preventDefault();
503             var selected_titles = $("input:checked");
504             var title;
505             var yes_label;
506             var no_label;
507             var message = "";
508             if ( selected_titles.size() < 1 ) {
509                 alert(MSG_NO_SUGGESTION_SELECTED);
510                 return false;
511             } else {
512                 if( selected_titles.size() > 1 ){
513                     message = $("<ul></ul>");
514                     title = _("Are you sure you want to delete these suggestions?");
515                     yes_label = _("Yes, delete suggestions");
516                     no_label = _("No, do not delete suggestions");
517                     selected_titles.each(function(){
518                         message.append( "<li>" +  $(this).data("title") + "</li>" );
519                     });
520                 } else {
521                     title = _("Are you sure you want to delete this suggestion?");
522                     yes_label = _("Yes, delete suggestion");
523                     no_label = _("No, do not delete suggestion");
524                     selected_titles.each(function(){
525                         message += $(this).data("title");
526                     });
527                 }
528                 confirmModal( message, title, yes_label, no_label, function( result ){
529                     if( result ){
530                         $("#delete_suggestions").submit();
531                     }
532                 });
533             }
534         });
535         [% END %]
536     });
537 </script>
538 [% END %]