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