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