Bug 12280 - "Others..." reason for suggestions not showing in Bootstrap OPAC
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-suggestions.tt
1 [% USE Koha %]
2 [% USE AuthorisedValues %]
3 [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog ›
4 [% IF ( op_add ) %]Enter a new purchase suggestion[% END %]
5 [% IF ( op_else ) %]Purchase Suggestions[% END %]
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% BLOCK cssinclude %][% END %]
8 </head>
9 [% IF ( loggedinusername ) %]<body id="opac-usersuggestions" class="scrollto">[% ELSE %]<body id="opac-suggestions" class="scrollto">[% END %]
10 [% INCLUDE 'masthead.inc' %]
11
12     <div class="main">
13         <ul class="breadcrumb">
14             <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
15             <li><a href="/cgi-bin/koha/opac-user.pl">[% FOREACH USER_INF IN USER_INFO %][% USER_INF.title %] [% USER_INF.firstname %] [% USER_INF.surname %][% END %]</a> <span class="divider">&rsaquo;</span></li>
16             <li><a href="#">Your purchase suggestions</a></li>
17         </ul>
18
19         <div class="container-fluid">
20             <div class="row-fluid">
21                 <div class="span2">
22                     <div id="navigation">
23                         [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
24                     </div>
25                 </div>
26                 <div class="span10">
27                     <div id="usersuggestions" class="maincontent">
28                         [% IF ( op_add ) %]
29                             <h1>Enter a new purchase suggestion</h1>
30
31                             <p>Please fill out this form to make a purchase suggestion. You will receive an email when the library processes your suggestion</p>
32                             <p>Only the title is 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>
33
34                             <form action="/cgi-bin/koha/opac-suggestions.pl" method="post">
35                                 <fieldset class="rows">
36                                     <ol>
37                                         <li><label class="required" for="title">Title:</label><input type="text" id="title" name="title"  maxlength="255" /></li>
38                                         <li><label for="author">Author:</label><input type="text" id="author" name="author"  maxlength="80" /></li>
39                                         <li><label for="copyrightdate">Copyright date:</label><input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" /></li>
40                                         <li><label for="isbn">Standard number (ISBN, ISSN or other):</label><input type="text" id="isbn" name="isbn"  maxlength="80" /></li>
41                                         <li><label for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode"  maxlength="80" /></li>
42                                         <li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle"  maxlength="80" /></li>
43                                         <li><label for="place">Publication place:</label><input type="text" id="place" name="place"  maxlength="80" /></li>
44                                         <li><label for="itemtype">Item type:</label>
45                                             <select name="itemtype" id="itemtype">
46                                                 <option value="">Default</option>
47                                                 [% FOREACH itemtypeloo IN itemtypeloop %]
48                                                     [% IF ( itemtypeloo.selected ) %]
49                                                         <option value="[% itemtypeloo.itemtype %]" selected="selected">
50                                                     [% ELSE %]
51                                                         <option value="[% itemtypeloo.itemtype %]">
52                                                     [% END %]
53                                                             [% itemtypeloo.description %]
54                                                         </option>
55                                                 [% END %]
56                                             </select>
57                                         </li>
58                                         [% IF ( branchloop ) %]
59                                             <li><label for="branch">Library:</label>
60                                                 <select name="branch" id="branch">
61                                                     [% FOREACH branchloo IN branchloop %]
62                                                         [% IF ( branchloo.selected ) %]
63                                                             <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
64                                                         [% ELSE %]
65                                                             <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
66                                                         [% END %]
67                                                     [% END %]
68                                                 </select>
69                                             </li>
70                                         [% END %]
71                                         [% IF ( patron_reason_loop ) %]
72                                             <li>
73                                                 <label for="patronreason">Reason for suggestion: </label>
74                                                 <select name="patronreason" id="patronreason">
75                                                     <option value="">-- Choose --</option>
76                                                     [% FOREACH patron_reason_loo IN patron_reason_loop %]
77                                                         <option value="[% patron_reason_loo.authorised_value %]">[% patron_reason_loo.lib %]</option>
78                                                     [% END %]
79                                                 </select>
80                                             </li>
81                                         [% END %]
82                                         <li>
83                                             <label for="note">Notes:</label>
84                                             <textarea name="note" id="note" rows="5" cols="40"></textarea>
85                                         </li>
86                                     </ol>
87                                 </fieldset>
88                                 <fieldset class="action">
89                                     <input type="hidden" name="suggestedby" value="[% suggestedbyme %]" />
90                                     <input type="hidden" name="op" value="add_confirm" />
91                                     <input type="submit" onclick="Check(this.form); return false;" class="btn" value="Submit your suggestion" /> <a class="action" href="/cgi-bin/koha/opac-suggestions.pl">Cancel</a>
92                                 </fieldset>
93                             </form>
94                         [% END #  IF op_add %]
95
96                         [% IF ( op_else ) %]
97                             <h1>
98                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
99                                     Purchase suggestions
100                                 [% ELSE %]
101                                     [% IF ( loggedinusername ) %]
102                                         Your purchase suggestions
103                                     [% ELSE %]
104                                         Purchase suggestions
105                                     [% END %]
106                                 [% END %]
107                             </h1>
108
109                             [% IF ( deleted ) %]<div class="alert alert-info">The selected suggestions have been deleted.</div>[% END %]
110                             [% IF ( submitted ) %]<div class="alert alert-info">Your suggestion has been submitted.</div>[% END %]
111
112                             [% IF ( suggestions_loop ) %]
113                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
114                                     <form action="/cgi-bin/koha/opac-suggestions.pl" class="form-inline" method="get">
115                                         <fieldset>
116                                             <label for="title">Search for:</label>
117                                             <input type="text" name="title" id="title" value="[% title |html %]" />
118                                             <label for="suggestedby">Suggested by:</label>
119                                             <div class="input-append">
120                                                 <select name="suggestedby" id="suggestedby">
121                                                     <option value="0">Anyone</option>
122                                                     <option value="1">Me</option>
123                                                 </select>
124                                                 <button type="submit" class="btn">Go</button>
125                                             </div>
126                                         </fieldset>
127                                     </form>
128                                 [% END %]
129                                 <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="myform">
130                                     <input type="hidden" name="op" value="delete_confirm" />
131                                     <div id="toolbar" class="toolbar clearfix">
132                                         [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
133                                             <a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a>
134                                         [% END %]
135                                     </div>
136
137                                     [% IF ( loggedinusername ) %]
138                                         <div id="selections-toolbar" class="toolbar">
139                                               <span class="checkall"></span> <span class="clearall"></span> <span class="sep">|</span>
140                                               <span class="links"><span id="selections">Select suggestions to: </span>
141                                               <span id="removeitems"></span>
142                                         </div>
143                                     [% END %]
144
145                                     <table id="suggestt" class="checkboxed table table-bordered table-striped">
146                                         <thead>
147                                             <tr>
148                                                 [% IF ( loggedinusername ) %]<th>&nbsp;</th>[% END %]
149                                                 <th>Summary</th>
150                                                 <th>Note</th>
151                                                 [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]<th>Suggested for</th>[% END %]
152                                                 [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]<th>Managed by</th>[% END %]
153                                                 <th>Status</th>
154                                             </tr>
155                                         </thead>
156                                         <tbody>
157                                             [% FOREACH suggestions_loo IN suggestions_loop %]
158                                                 <tr>
159                                                     [% IF ( loggedinusername ) %]
160                                                         <td>
161                                                             [% IF ( suggestions_loo.showcheckbox ) %]
162                                                                 <input type="checkbox" class="cb" name="delete_field" value="[% suggestions_loo.suggestionid %]" />
163                                                             [% END %]
164                                                         </td>
165                                                     [% END %]
166                                                     <td>
167                                                         <p><strong>[% suggestions_loo.title |html %]</strong></p>
168                                                             <p>[% IF ( suggestions_loo.author ) %][% suggestions_loo.author |html %],[% END %]
169                                                                 [% IF ( suggestions_loo.copyrightdate ) %] - [% suggestions_loo.copyrightdate |html %],[% END %]
170                                                                 [% IF ( suggestions_loo.publishercode ) %] - [% suggestions_loo.publishercode |html %][% END %]
171                                                                 [% IF ( suggestions_loo.place ) %]([% suggestions_loo.place |html %])[% END %]
172                                                                 [% IF ( suggestions_loo.collectiontitle ) %] , [% suggestions_loo.collectiontitle |html %][% END %]
173                                                                 [% IF ( suggestions_loo.itemtype ) %] - [% suggestions_loo.itemtype %][% END %]
174                                                         </p>
175                                                     </td>
176                                                     <td>
177                                                         [% IF ( suggestions_loo.note ) %]
178                                                             <span class="tdlabel">Note: </span>
179                                                             [% suggestions_loo.note |html %]
180                                                         [% END %]
181                                                     </td>
182                                                     [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
183                                                         <td>
184                                                             [% IF ( suggestions_loo.branchcodesuggestedby ) %]
185                                                                 <span class="tdlabel">Suggested for:</span>
186                                                                 [% suggestions_loo.branchcodesuggestedby %]
187                                                             [% END %]
188                                                         </td>
189                                                     [% END %]
190                                                     [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]
191                                                     <td>
192                                                         [% IF ( suggestions_loo.surnamemanagedby ) %]
193                                                             <span class="tdlabel">Managed by:</span>
194                                                             [% suggestions_loo.surnamemanagedby %]
195                                                             [% IF ( suggestions_loo.firstnamemanagedby ) %]    , [% suggestions_loo.firstnamemanagedby %]
196                                                             [% END %]
197                                                         [% END %]
198                                                     </td>
199                                                     [% END %]
200                                                     <td>
201                                                         <span class="tdlabel">Status:</span>
202                                                         [% IF ( suggestions_loo.ASKED ) %]Requested
203                                                         [% ELSIF ( suggestions_loo.CHECKED ) %]Checked by the library
204                                                         [% ELSIF ( suggestions_loo.ACCEPTED ) %]Accepted by the library
205                                                         [% ELSIF ( suggestions_loo.ORDERED ) %]Ordered by the library
206                                                         [% ELSIF ( suggestions_loo.REJECTED ) %]Suggestion declined
207                                                         [% ELSIF ( suggestions_loo.AVAILABLE ) %]Available in the library
208                                                         [% ELSE %] [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS, 1 ) %] [% END %]
209                                                         [% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason |html %])[% END %]
210                                                     </td>
211                                                 </tr>
212                                             [% END # / FOREACH suggestions_loo %]
213                                         </tbody>
214                                     </table>
215
216                                     [% IF ( loggedinusername ) %]
217                                         <fieldset class="action">
218                                             <input type="submit" class="btn btn-danger" value="Delete selected" />
219                                         </fieldset>
220                                     [% END %]
221                                 </form>
222                             [% ELSE %]
223                                 <p>There are no pending purchase suggestions.</p>
224                                 [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
225                                     <p><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a></p>
226                                 [% END %]
227                             [% END # / IF suggestions_loop %]
228
229                         [% END # IF op_else %]
230                     </div> <!-- / #usersuggestions -->
231                 </div> <!-- / .span10 -->
232             </div> <!-- / .row-fluid -->
233         </div> <!-- / .container-fluid -->
234     </div> <!-- / .main -->
235
236 [% INCLUDE 'opac-bottom.inc' %]
237 [% BLOCK jsinclude %]
238 <script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
239 [% INCLUDE 'datatables.inc' %]
240 <script type="text/javascript">
241     //<![CDATA[
242     [% IF ( loggedinusername ) %]
243         function enableCheckboxActions(){
244             // Enable/disable controls if checkboxes are checked
245             var checkedBoxes = $(".checkboxed input:checkbox:checked");
246             if ($(checkedBoxes).size()) {
247               $("#selections").html(_("With selected suggestions: "));
248               $("#selections-toolbar .links a").removeClass("disabled");
249             } else {
250               $("#selections").html(_("Select suggestions to: "));
251               $("#selections-toolbar .links a").addClass("disabled");
252             }
253         }
254     [% END %]
255
256     $(function() {
257         $("#suggestt").dataTable($.extend(true, {}, dataTablesDefaults, {
258             "aaSorting": [[ 1, "asc" ]],
259             "aoColumnDefs": [
260               [% IF ( loggedinusername ) %]{ "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }[% END %]
261             ],
262             "aoColumns": [
263                 [% IF ( loggedinusername ) %]null,[% END %]
264                 { "sType": "anti-the" },
265                 null,
266                 [% IF ( OPACViewOthersSuggestions ) %]null,[% END %]
267                 [% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]null,[% END %]
268                 null
269             ]
270         }));
271         [% IF ( loggedinusername ) %]$("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>");
272         $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>");
273         $("#CheckAll").click(function(){
274             $(".checkboxed").checkCheckboxes();
275             enableCheckboxActions();
276             return false;
277         });
278         $("#CheckNone").click(function(){
279             $(".checkboxed").unCheckCheckboxes();
280             enableCheckboxActions();
281             return false;
282         });
283         $(".cb").click(function(){
284           enableCheckboxActions();
285         });
286         $("#removeitems").html("<a href=\"#\" class=\"removeitems tag_hides disabled\">"+_("Delete")+"</a>")
287         .click(function(e){
288           e.preventDefault();
289           $("#myform").submit();
290           return false;
291         });
292         enableCheckboxActions();
293         $("#myform").on('submit', function() {
294           if ( $("input:checked").size() < 1 ) {
295             alert(MSG_NO_SUGGESTION_SELECTED);
296             return false;
297           }
298           return true;
299         });
300         [% END %]
301     });
302
303     function Check(f) {
304         var _alertString="";
305         var alertString2;
306
307         if(f.title.value.length ==0){
308             _alertString += _("- You must enter a Title") + "\n";
309         }
310
311         if (_alertString.length==0) {
312             f.submit();
313         } else {
314             alertString2 = _("Form not submitted because of the following problem(s)");
315             alertString2 += "\n------------------------------------------------------------------------------------\n\n";
316             alertString2 += _alertString;
317             alert(alertString2);
318         }
319     }
320 //]]>
321 </script>
322 [% END %]