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