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