Bug 14973: Add missing filters in templates
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-suggestions.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% USE AuthorisedValues %]
6 [% USE KohaDates %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;
9 [% IF ( op_add ) %]Enter a new purchase suggestion[% END %]
10 [% IF ( op_else ) %]Purchase Suggestions[% END %]</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% BLOCK cssinclude %][% END %]
13 </head>
14 [% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-usersuggestions' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-suggestions' bodyclass='scrollto' %][% END %]
15 [% INCLUDE 'masthead.inc' %]
16
17     <div class="main">
18         <ul class="breadcrumb">
19             <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
20             <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
21             <li><a href="#">Your purchase suggestions</a></li>
22         </ul>
23
24         <div class="container-fluid">
25             <div class="row-fluid">
26                 <div class="span2">
27                     <div id="navigation">
28                         [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
29                     </div>
30                 </div>
31                 <div class="span10">
32                     <div id="usersuggestions" class="maincontent">
33                         [% IF ( op_add ) %]
34                             [% IF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
35                                     <h1 class="TooManySuggestions">You cannot place any more suggestions</h1>
36                                     <h2 class="TooManySuggestionsText">You have reached your limit of suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') | html %]). Once the library has processed those suggestions you will be able to place more.</h2>
37                             [% ELSE %]
38                             <h1>Enter a new purchase suggestion</h1>
39
40                             <p>Please fill out this form to make a purchase suggestion. You will receive an email when the library processes your suggestion.</p>
41                             <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>
42
43                             [% FOR m IN messages %]
44                                 <div class="alert alert-[% m.type | html %]">
45                                     [% SWITCH m.code %]
46                                     [% CASE 'biblio_exists' %]
47                                         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.
48                                     [% CASE %]
49                                         [% m.code | html %]
50                                     [% END %]
51                                 </div>
52                             [% END %]
53
54                             <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="add_suggestion_form">
55                                 <fieldset class="rows">
56                                     <ol>
57                                         <li>
58                                             [% IF ( title_required ) %]
59                                                 <label for="title" class="required">Title:</label>
60                                                 <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" required="required" />
61                                                 <span class="required">Required</span>
62                                             [% ELSE %]
63                                                 <label for="title">Title:</label>
64                                                 <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" />
65                                             [% END %]
66                                         </li>
67                                         <li>
68                                             [% IF ( author_required ) %]
69                                                 <label for="author" class="required">Author:</label>
70                                                 <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" required="required" />
71                                                 <span class="required">Required</span>
72                                             [% ELSE %]
73                                                 <label for="author">Author:</label>
74                                                 <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" />
75                                             [% END %]
76                                         </li>
77                                         <li>
78                                             <div title="Copyright or publication year, for example: 2016">
79                                                 [% IF ( copyrightdate_required ) %]
80                                                     <label for="copyrightdate" class="required">Copyright date:</label>
81                                                     <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" required="required" />
82                                                 <span class="required">Required</span>
83                                                 [% ELSE %]
84                                                     <label for="copyrightdate">Copyright date:</label>
85                                                     <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" />
86                                                 [% END %]
87                                             </div>
88                                         </li>
89                                         <li>
90                                             [% IF ( isbn_required ) %]
91                                                 <label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label>
92                                                 <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" required="required" />
93                                                 <span class="required">Required</span>
94                                             [% ELSE %]
95                                                 <label for="isbn">Standard number (ISBN, ISSN or other):</label>
96                                                 <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" />
97                                             [% END %]
98                                         </li>
99                                         <li>
100                                             [% IF ( publishercode_required ) %]
101                                                 <label for="publishercode" class="required">Publisher:</label>
102                                                 <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" required="required" />
103                                                 <span class="required">Required</span>
104                                             [% ELSE %]
105                                                 <label for="publishercode">Publisher:</label>
106                                                 <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" />
107                                             [% END %]
108                                         </li>
109                                         <li>
110                                             [% IF ( collectiontitle_required ) %]
111                                                 <label for="collectiontitle" class="required">Collection title:</label>
112                                                 <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" required="required" />
113                                                 <span class="required">Required</span>
114                                             [% ELSE %]
115                                                 <label for="collectiontitle">Collection title:</label>
116                                                 <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" />
117                                             [% END %]
118                                         </li>
119                                         <li>
120                                             [% IF ( place_required ) %]
121                                                 <label for="place" class="required">Publication place:</label>
122                                                 <input type="text" id="place" name="place" required="required" maxlength="80" value="[% place | html %]" />
123                                                 <span class="required">Required</span>
124                                             [% ELSE %]
125                                                 <label for="place">Publication place:</label>
126                                                 <input type="text" id="place" name="place"  maxlength="80" value="[% place | html %]" />
127                                             [% END %]
128                                         </li>
129                                         <li id="opac-suggestion-quantity">
130                                             [% IF ( quantity_required ) %]
131                                                 <label for="quantity" class="required">Quantity:</label>
132                                                 <input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" />
133                                                 <span class="required">Required</span>
134                                             [% ELSE %]
135                                                 <label for="quantity">Quantity:</label>
136                                                 <input type="text" id="quantity" name="quantity"  maxlength="4" size="4" />
137                                             [% END %]
138                                         </li>
139                                         <li>
140                                             [% IF ( itemtype_required ) %]
141                                                 <label for="itemtype" class="required">Item type:</label>
142                                                 [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
143                                                 <span class="required">Required</span>
144                                             [% ELSE %]
145                                                 <label for="itemtype">Item type:</label>
146                                                 [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
147                                             [% END %]
148                                         </li>
149                                         [% IF branchcode %]
150                                             <li>
151                                                 [% IF ( branchcode_required ) %]
152                                                     <label for="branch" class="required">Library:</label>
153                                                     <select name="branchcode" id="branch" required="required">
154                                                         [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
155                                                     </select>
156                                                     <span class="required">Required</span>
157                                                 [% ELSE %]
158                                                     <label for="branch">Library:</label>
159                                                     <select name="branchcode" id="branch">
160                                                         [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
161                                                     </select>
162                                                 [% END %]
163                                             </li>
164                                         [% END %]
165                                         [% IF ( patron_reason_loop ) %]
166                                             <li>
167                                                 [% IF ( patronreason_required ) %]
168                                                     <label for="patronreason" class="required">Reason for suggestion: </label>
169                                                     <select name="patronreason" id="patronreason" required="required">
170                                                         <option value="">-- Choose --</option>
171                                                         [% FOREACH patron_reason_loo IN patron_reason_loop %]
172                                                             <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
173                                                         [% END %]
174                                                     </select>
175                                                     <span class="required">Required</span>
176                                                 [% ELSE %]
177                                                     <label for="patronreason">Reason for suggestion: </label>
178                                                     <select name="patronreason" id="patronreason">
179                                                         <option value="">-- Choose --</option>
180                                                         [% FOREACH patron_reason_loo IN patron_reason_loop %]
181                                                             <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
182                                                         [% END %]
183                                                     </select>
184                                                 [% END %]
185                                             </li>
186                                         [% END %]
187                                         <li>
188                                             [% IF ( note_required ) %]
189                                                 <label for="note" class="required">Notes:</label>
190                                                 <textarea name="note" id="note" rows="5" cols="40" required="required">[% note | html %]</textarea>
191                                                 <span class="required">Required</span>
192                                             [% ELSE %]
193                                                 <label for="note">Notes:</label>
194                                                 <textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea>
195                                             [% END %]
196                                         </li>
197
198                                         <!--  Add a hidden 'negcap' field -->
199                                         <li id="negcap" style="position: absolute; left: -2000px;">
200                                             negcap <input type="text" name="negcap"/>
201                                         </li>
202
203                                     </ol>
204                                 </fieldset>
205                                 <fieldset class="action">
206                                     <input type="hidden" name="suggested_by_anyone" value="[% suggested_by_anyone | html %]" />
207                                     <input type="hidden" name="op" value="add_validate" />
208                                     [% IF ( need_confirm ) %]
209                                         <input type="submit" onclick="this.form.op.value = 'add_confirm'; this.form.submit();" class="btn" value="Confirm your suggestion" />
210                                     [% ELSE %]
211                                         <input type="submit" class="btn" value="Submit your suggestion" />
212                                     [% END %]
213                                     <a class="action" href="/cgi-bin/koha/opac-suggestions.pl">Cancel</a>
214                                 </fieldset>
215                             </form>
216                             [% END %]
217                         [% END #  IF op_add %]
218
219                         [% IF ( op_else ) %]
220                             <h1>
221                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
222                                     Purchase suggestions
223                                 [% ELSE %]
224                                     [% IF ( loggedinusername ) %]
225                                         Your purchase suggestions
226                                     [% ELSE %]
227                                         Purchase suggestions
228                                     [% END %]
229                                 [% END %]
230                             </h1>
231                             [% FOR m IN messages %]
232                                 <div class="alert alert-[% m.type | html %]">
233                                     [% SWITCH m.code %]
234                                     [% CASE 'too_many' %]
235                                         The suggestion has not been added. You have reached your limit of 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.
236                                     [% CASE 'already_exists' %]
237                                         The suggestion has not been added. A suggestion with this title already exists.
238                                     [% CASE 'success_on_inserted' %]
239                                         Your suggestion has been submitted.
240                                     [% CASE %]
241                                         [% m.code | html %]
242                                     [% END %]
243                                 </div>
244                             [% END %]
245
246                             [% IF ( deleted ) %]<div class="alert alert-info">The selected suggestions have been deleted.</div>[% END %]
247
248                             [% IF ( suggestions_loop ) %]
249                                 <form action="/cgi-bin/koha/opac-suggestions.pl" class="form-inline" method="get">
250                                     <fieldset>
251                                         <label for="title">Search for:</label>
252                                         <input type="text" name="title" id="title" value="[% title | html %]" />
253                                         [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
254                                             [% IF loggedinusername %]
255                                                 <label for="suggested_by_anyone">Suggested by:</label>
256                                                 <div class="input-append">
257                                                     <select name="suggested_by_anyone" id="suggested_by_anyone">
258                                                         [% IF suggested_by_anyone %]
259                                                             <option value="0">Me</option>
260                                                             <option value="1" selected="selected">Anyone</option>
261                                                         [% ELSE %]
262                                                             <option value="0" selected="selected">Me</option>
263                                                             <option value="1">Anyone</option>
264                                                         [% END %]
265                                                     </select>
266                                                     <button type="submit" class="btn">Go</button>
267                                                 </div>
268                                             [% END %]
269                                         [% END %]
270                                     </fieldset>
271                                 </form>
272                                 <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="myform">
273                                     <input type="hidden" name="op" value="delete_confirm" />
274                                     [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
275                                         <div id="toolbar" class="toolbar clearfix">
276                                         [% IF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
277                                                 <p class="TooManySuggestionsText">You have reached your limit of 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>
278                                         [% ELSE %]
279                                                 <a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a>
280                                         [% END %]
281                                         </div>
282                                     [% END %]
283
284                                     [% IF ( loggedinusername ) %]
285                                         <div id="selections-toolbar" class="toolbar">
286                                             <span class="checkall"></span> <span class="clearall"></span> <span class="sep">|</span>
287                                             <span class="links">
288                                                 <span id="selections">Select suggestions to: </span>
289                                                 <span id="removeitems"></span>
290                                             </span>
291                                         </div>
292                                     [% END %]
293
294                                     <table id="suggestt" class="checkboxed table table-bordered table-striped">
295                                         <thead>
296                                             <tr>
297                                                 [% IF ( loggedinusername ) %]<th>&nbsp;</th>[% END %]
298                                                 <th>Summary</th>
299                                                 <th>Suggested on</th>
300                                                 <th>Note</th>
301                                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]<th>Suggested for</th>[% END %]
302                                                 [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]<th>Managed by</th>[% END %]
303                                                 <th>Status</th>
304                                             </tr>
305                                         </thead>
306                                         <tbody>
307                                             [% FOREACH suggestions_loo IN suggestions_loop %]
308                                                 <tr>
309                                                     [% IF ( loggedinusername ) %]
310                                                         <td>
311                                                             [% IF ( suggestions_loo.showcheckbox ) %]
312                                                                 <input type="checkbox" class="cb" name="delete_field" value="[% suggestions_loo.suggestionid | html %]" />
313                                                             [% END %]
314                                                         </td>
315                                                     [% END %]
316                                                     <td>
317                                                         <p><strong>[% suggestions_loo.title | html %]</strong></p>
318                                                             <p>[% IF ( suggestions_loo.author ) %][% suggestions_loo.author | html %],[% END %]
319                                                                 [% IF ( suggestions_loo.copyrightdate ) %] - [% suggestions_loo.copyrightdate | html %],[% END %]
320                                                                 [% IF ( suggestions_loo.publishercode ) %] - [% suggestions_loo.publishercode | html %][% END %]
321                                                                 [% IF ( suggestions_loo.place ) %]([% suggestions_loo.place | html %])[% END %]
322                                                                 [% IF ( suggestions_loo.collectiontitle ) %] , [% suggestions_loo.collectiontitle | html %][% END %]
323                                                                 [% IF ( suggestions_loo.itemtype ) %] - [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 1 ) | html %][% END %]
324                                                         </p>
325                                                     </td>
326                                                     <td>
327                                                         [% IF ( suggestions_loo.suggesteddate ) %][% suggestions_loo.suggesteddate |$KohaDates %][% END %]
328                                                     </td>
329                                                     <td>
330                                                         [% IF ( suggestions_loo.note ) %]
331                                                             <span class="tdlabel">Note: </span>
332                                                             [% suggestions_loo.note | html %]
333                                                         [% END %]
334                                                     </td>
335                                                     [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
336                                                         <td>
337                                                             [% IF ( suggestions_loo.branchcodesuggestedby ) %]
338                                                                 <span class="tdlabel">Suggested for:</span>
339                                                                 [% suggestions_loo.branchcodesuggestedby | html %]
340                                                             [% END %]
341                                                         </td>
342                                                     [% END %]
343                                                     [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]
344                                                     <td>
345                                                         [% IF ( suggestions_loo.surnamemanagedby ) %]
346                                                             <span class="tdlabel">Managed by:</span>
347                                                             [% suggestions_loo.surnamemanagedby | html %]
348                                                             [% IF ( suggestions_loo.firstnamemanagedby ) %]    , [% suggestions_loo.firstnamemanagedby | html %]
349                                                             [% END %]
350                                                         [% END %]
351                                                     </td>
352                                                     [% END %]
353                                                     <td>
354                                                         <span class="tdlabel">Status:</span>
355                                                         [% IF ( suggestions_loo.ASKED ) %]Requested
356                                                         [% ELSIF ( suggestions_loo.CHECKED ) %]Checked by the library
357                                                         [% ELSIF ( suggestions_loo.ACCEPTED ) %]Accepted by the library
358                                                         [% ELSIF ( suggestions_loo.ORDERED ) %]Ordered by the library
359                                                         [% ELSIF ( suggestions_loo.REJECTED ) %]Suggestion declined
360                                                         [% ELSIF ( suggestions_loo.AVAILABLE ) %]Available in the library
361                                                         [% ELSE %] [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS, 1 ) | html %] [% END %]
362                                                         [% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason | html %])[% END %]
363                                                     </td>
364                                                 </tr>
365                                             [% END # / FOREACH suggestions_loo %]
366                                         </tbody>
367                                     </table>
368
369                                     [% IF ( loggedinusername ) %]
370                                         <fieldset class="action">
371                                             <input type="submit" class="btn btn-danger" value="Delete selected" />
372                                         </fieldset>
373                                     [% END %]
374                                 </form>
375                             [% ELSE %]
376                                 [% UNLESS Koha.Preference( 'OPACViewOthersSuggestions' ) or loggedinusername %]
377                                     <p>You are not authorized to see pending purchase suggestions.</p>
378                                 [% ELSE %]
379                                     <p>There are no pending purchase suggestions.</p>
380                                 [% END %]
381                                 [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
382                                     [% IF ( Koha.Preference('MaxOpenSuggestions') != ''  && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
383                                         <p class="TooManySuggestionsText">You have reached your limit of suggestions you can place at this time.</br>Once the library has processed those suggestions you will be able to place more.</p>
384                                     [% ELSE %]
385                                         <p><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a></p>
386                                     [% END %]
387                                 [% END %]
388                             [% END # / IF suggestions_loop %]
389
390                         [% END # IF op_else %]
391                     </div> <!-- / #usersuggestions -->
392                 </div> <!-- / .span10 -->
393             </div> <!-- / .row-fluid -->
394         </div> <!-- / .container-fluid -->
395     </div> <!-- / .main -->
396
397 [% INCLUDE 'opac-bottom.inc' %]
398 [% BLOCK jsinclude %]
399 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
400 [% INCLUDE 'datatables.inc' %]
401 <script>
402     //<![CDATA[
403     [% IF ( loggedinusername ) %]
404         function enableCheckboxActions(){
405             // Enable/disable controls if checkboxes are checked
406             var checkedBoxes = $(".checkboxed input:checkbox:checked");
407             if ($(checkedBoxes).size()) {
408               $("#selections").html(_("With selected suggestions: "));
409               $("#selections-toolbar .links a").removeClass("disabled");
410             } else {
411               $("#selections").html(_("Select suggestions to: "));
412               $("#selections-toolbar .links a").addClass("disabled");
413             }
414         }
415     [% END %]
416
417     $(function() {
418         $("#suggestt").dataTable($.extend(true, {}, dataTablesDefaults, {
419             "order": [[ 1, "asc" ]],
420             "columnDefs": [
421               [% IF ( loggedinusername ) %]{ "targets": [ 0 ], "sortable": false, "searchable": false }[% END %]
422             ],
423             "columns": [
424                 [% IF ( loggedinusername ) %]null,[% END %]
425                 { "type": "anti-the" },
426                 null,
427                 null,
428                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]null,[% END %]
429                 [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]null,[% END %]
430                 null
431             ]
432         }));
433         [% IF ( loggedinusername ) %]$("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>");
434         $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>");
435         $("#CheckAll").click(function(){
436             $(".checkboxed").checkCheckboxes();
437             enableCheckboxActions();
438             return false;
439         });
440         $("#CheckNone").click(function(){
441             $(".checkboxed").unCheckCheckboxes();
442             enableCheckboxActions();
443             return false;
444         });
445         $(".cb").click(function(){
446           enableCheckboxActions();
447         });
448         $("#removeitems").html("<a href=\"#\" class=\"removeitems tag_hides disabled\">"+_("Delete")+"</a>")
449         .click(function(e){
450           e.preventDefault();
451           $("#myform").submit();
452           return false;
453         });
454         enableCheckboxActions();
455         $("#myform").on('submit', function() {
456           if ( $("input:checked").size() < 1 ) {
457             alert(MSG_NO_SUGGESTION_SELECTED);
458             return false;
459           }
460           return true;
461         });
462         [% END %]
463     });
464 //]]>
465 </script>
466 [% END %]