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