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