Bug 18399: Add reasons in edit suggestion page
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / suggestion / suggestion.tt
1 [% USE Branches %]
2 [% USE AuthorisedValues %]
3 [% USE KohaDates %]
4 [% USE Price %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Acquisitions  &rsaquo;
7     [% IF ( op_save ) %]
8         [% IF ( suggestionid ) %]
9             Suggestions &rsaquo;  Edit suggestion #[% suggestionid %]
10         [% ELSE %]
11             Suggestions &rsaquo; Add suggestion
12         [% END %]
13     [% ELSIF ( op == 'show' ) %]
14            Suggestions &rsaquo; Show suggestion #[% suggestionid %]
15     [% ELSE %]
16         Suggestions management
17     [% END %]
18 </title>
19 [% INCLUDE 'doc-head-close.inc' %]
20 [% INCLUDE 'calendar.inc' %]
21 [% IF ( op == 'show' || op_else ) %]
22 <script type="text/javascript">
23     // <![CDATA[
24     $(document).ready(function(){
25         $(".deletesuggestion").on("click",function(){
26             return confirm(_("Are you sure you want to delete this suggestion?"));
27         });
28     });
29     // ]]>
30 </script>
31 [% END %]
32 [% IF ( op_else ) %]
33 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
34 [% INCLUDE 'datatables.inc' %]
35 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
36 <script type="text/javascript">
37 // <![CDATA[
38 /**
39 *  displayOther.
40 *  This function display the select or an textaera to write a reason.
41 */
42 function displayOther(id,show,hide){
43         $("#"+hide+id).hide();
44         $("#"+show+id).show();
45 }
46 $(document).ready(function() {
47     $('#suggestiontabs').tabs({
48         // Correct table sizing for tables hidden in tabs
49         // http://www.datatables.net/examples/api/tabs_and_scrolling.html
50         "activate": function(event, ui) {
51             $( $.fn.dataTable.tables( true ) ).DataTable().columns.adjust();
52         }
53     });
54     $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
55         "aoColumnDefs": [
56             { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
57             { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
58         ],
59         "sPaginationType": "four_button"
60     }));
61 [% FOREACH suggestion IN suggestions %]
62 // functions for [% suggestion.suggestiontype %] interactions
63     $("#CheckAll[% suggestion.suggestiontype %]").click(function(e){
64                 $("#[% suggestion.suggestiontype %]t").checkCheckboxes();
65         e.preventDefault();
66     });
67     $("#UncheckAll[% suggestion.suggestiontype %]").click(function(e){
68                 $("#[% suggestion.suggestiontype %]t").unCheckCheckboxes();
69         e.preventDefault();
70         });
71         $("#other_reason[% suggestion.suggestiontype %]").hide();
72     $("#reason[% suggestion.suggestiontype %]").change(function(){
73             if($(this).val() == "other"){
74                         $(this).hide();
75                         $("#other_reason[% suggestion.suggestiontype %]").show();
76     }
77     });
78         $("#[% suggestion.suggestiontype %]delete").change(function(){
79                 if(this.checked){
80                         $("form[name='f[% suggestion.suggestiontype %]'] input[name=op]").attr("value","delete");
81                 } else {
82                         $("form[name='f[% suggestion.suggestiontype %]'] input[name=op]").attr("value","change");
83                 }
84         });
85
86 [% END %]
87     $("a[href*=back]").click(function(){
88     var sid = $(this).attr("href").replace(/#back/,"");
89             $("#reason"+sid).show().find("option[value='']").attr("selected","selected");
90                 $("#other_reason"+sid).hide();
91     });
92     $("h4.local_collapse a").click(function(){
93         $(this).parent().parent().find("ol").toggle();
94         return false;
95     });
96     // http://jqueryui.com/demos/datepicker/#date-range
97     var dates = $( "#suggesteddate_from, #suggesteddate_to" ).datepicker({
98         changeMonth: true,
99         numberOfMonths: 1,
100         onSelect: function( selectedDate ) {
101             var option = this.id == "suggesteddate_from" ? "minDate" : "maxDate",
102                 instance = $( this ).data( "datepicker" );
103                 date = $.datepicker.parseDate(
104                     instance.settings.dateFormat ||
105                     $.datepicker._defaults.dateFormat,
106                     selectedDate, instance.settings );
107             dates.not( this ).datepicker( "option", option, date );
108         }
109     });
110     var datesMD = $( "#manageddate_from, #manageddate_to" ).datepicker({
111         changeMonth: true,
112         numberOfMonths: 1,
113         onSelect: function( selectedDate ) {
114             var option = this.id == "manageddate_from" ? "minDate" : "maxDate",
115                 instance = $( this ).data( "datepicker" );
116                 date = $.datepicker.parseDate(
117                     instance.settings.dateFormat ||
118                     $.datepicker._defaults.dateFormat,
119                     selectedDate, instance.settings );
120             datesMD.not( this ).datepicker( "option", option, date );
121         }
122     });
123     var datesAD = $( "#accepteddate_from, #accepteddate_to" ).datepicker({
124         changeMonth: true,
125         numberOfMonths: 1,
126         onSelect: function( selectedDate ) {
127             var option = this.id == "accepteddate_from" ? "minDate" : "maxDate",
128                 instance = $( this ).data( "datepicker" );
129                 date = $.datepicker.parseDate(
130                     instance.settings.dateFormat ||
131                     $.datepicker._defaults.dateFormat,
132                     selectedDate, instance.settings );
133             datesAD.not( this ).datepicker( "option", option, date );
134         }
135     });
136
137     $("form.update_suggestions").on("submit", function(e){
138         var form = this;
139         var action_delete_selected = $(this).find("input[value='delete']").is(":checked");
140         if ( action_delete_selected ) {
141             var suggestions_to_delete = $(this).find("input[name='edit_field']:checked");
142             if ( suggestions_to_delete.length == 0 ) {
143                 alert(_("Please select at least one suggestion to delete"));
144                 e.preventDefault();
145                 return false;
146             } else if ( suggestions_to_delete.length == 1 ) {
147                 if ( ! confirm(_("Are you sure you want to delete this suggestion?")) ) {
148                     e.preventDefault();
149                     return false;
150                 }
151             } else if ( suggestions_to_delete.length > 1 ) {
152                 if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) {
153                     e.preventDefault();
154                     return false;
155                 }
156             }
157         }
158         return true;
159     });
160 });
161 // ]]>
162 </script>
163 <style type="text/css">
164 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { display : none; }
165 .overlay { top: 180px; left: 50%; position: absolute; margin-left: -100px; width: 200px; text-align: center; display: none; margin-top: -10px; background: #eeffd4; padding: .5em; color: #000; } .note { -moz-border-radius: 3px; border-radius:3px; background: transparent url("[% interface %]/[% theme %]/img/famfamfam/silk/comment.png") top left no-repeat; padding : 1px 3px 1px 18px; font-size : 90%; }
166 </style>[% END %]
167 [% IF ( op_save )  %]
168     <script type="text/javascript">
169         // <![CDATA[
170         $(document).ready(function(){
171             calcNewsuggTotal();
172             $("#quantity,#price,#currency").on("change",function(){
173                 calcNewsuggTotal();
174             });
175
176             [% IF other_reason %]
177                 $(".select-reason").hide();
178                 $(".select-reason").find("option[value='other']").attr("selected","selected");
179                 $("#other_reason").show();
180             [% ELSE %]
181                 $("#other_reason").hide();
182             [% END %]
183             $(".select-reason").change(function(){
184                 if($(this).val() == "other"){
185                     $(this).hide();
186                     $("#other_reason").show();
187                 }
188             });
189             $("a[href*=back]").click(function(){
190                 $(".select-reason").show().find("option[value='']").attr("selected","selected");
191                 $("#other_reason").hide();
192             });
193         });
194         // ]]>
195     </script>
196 [% END %]
197 <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
198 </head>
199 <body id="acq_suggestion" class="acq">
200 [% INCLUDE 'header.inc' %]
201 [% INCLUDE 'cat-search.inc' %]
202 <div id="breadcrumbs">
203     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
204     [% IF ( op_save ) %]
205         [% IF ( suggestionid ) %]
206             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo;  Edit suggestion #[% suggestionid %]
207         [% ELSE %]
208             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Add suggestion
209         [% END %]
210     [% ELSIF ( op == 'show' ) %]
211            <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Show suggestion #[% suggestionid %]
212     [% ELSE %]
213         Suggestions management
214     [% END %]
215 </div>
216
217 [% IF ( op == 'show' ) %]
218 <div id="doc" class="yui-t7"> <!-- <div id="doc3" class="yui-t2"> -->
219 <div id="bd">
220     <div id="yui-main">
221     <div class="yui-b">
222
223     <div id="toolbar" class="btn-toolbar">
224         <a class="btn btn-default btn-sm" id="editsuggestion" href="suggestion.pl?op=edit&amp;suggestionid=[% suggestionid %]"><i class="fa fa-pencil"></i> Edit</a>
225         <a class="btn btn-default btn-sm deletesuggestion" href="suggestion.pl?op=delete&amp;edit_field=[% suggestionid %]"><i class="fa fa-trash"></i> Delete</a>
226     </div>
227
228     <fieldset class="rows">
229       <legend>Bibliographic information</legend>
230       <ol>
231             [% IF ( title ) %]
232                 <li>
233                     <span class="label">Title:</span>
234                     [% title |html %]
235                 </li>
236             [% END %]
237             [% IF ( author ) %]
238                 <li>
239                     <span class="label">Author:</span>
240                     [% author |html %]
241                 </li>
242             [% END %]
243             [% IF ( copyrightdate ) %]
244                 <li>
245                     <span class="label">Copyright date:</span>
246                     [% copyrightdate |html %]
247                 </li>
248             [% END %]
249             [% IF ( isbn ) %]
250                 <li>
251                     <span class="label">ISBN or ISSN or other standard number:</span>
252                     [% isbn |html %]
253                 </li>
254             [% END %]
255             [% IF ( publishercode ) %]
256                 <li>
257                     <span class="label">Publisher:</span>
258                     [% publishercode |html %]
259                 </li>
260             [% END %]
261             [% IF ( place ) %]
262                 <li>
263                     <span class="label">Publication place:</span>
264                     [% place |html %]
265                 </li>
266             [% END %]
267             [% IF ( collectiontitle ) %]
268                 <li>
269                     <span class="label">Collection title:</span>
270                     [% collectiontitle |html %]
271                 </li>
272             [% END %]
273             [% IF ( itemtype ) %]
274                 <li>
275                     <span class="label">Document type:</span>
276                     [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', itemtype, 0 ) %]
277                 </li>
278             [% END %]
279         [% IF ( patron_reason_loop ) %]
280           <li><span class="label">Reason for suggestion: </span>
281             [% FOREACH patron_reason_loo IN patron_reason_loop %]
282               [% IF patron_reason_loo.authorised_value == patronreason %][% patron_reason_loo.lib %][% END %]
283             [% END %]
284           </li>
285         [% END %]
286             [% IF ( note ) %]
287                 <li>
288                     <span class="label">Notes:</span>
289                     [% note |html %]
290                 </li>
291             [% END %]
292       </ol>
293     </fieldset>
294     <fieldset class="rows"> <legend>Suggestion management</legend>
295       <ol>
296         <li>
297           <span class="label">Status:</span>
298           [% SET status_found = 0 %]
299           [% IF ( STATUS == 'ASKED' ) %]
300               Pending
301               [% SET status_found = 1 %]
302           [% ELSIF ( STATUS == 'ACCEPTED' ) %]
303               Accepted
304               [% SET status_found = 1 %]
305           [% ELSIF ( STATUS == 'CHECKED' ) %]
306               Checked
307               [% SET status_found = 1 %]
308           [% ELSIF ( STATUS == 'REJECTED' ) %]
309               Rejected
310               [% SET status_found = 1 %]
311           [% ELSE %]
312               [% FOREACH s IN SuggestionStatuses %]
313                   [% IF STATUS == s.authorised_value %]
314                       [% s.lib %]
315                       [% SET status_found = 1 %]
316                   [% END %]
317               [% END %]
318           [% END %]
319
320         </li>
321         <li>
322           <table>
323             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
324             <tbody>
325             <tr>
326                 <th>Created by:</th>
327                 <td>[% suggesteddate | $KohaDates %]</td>
328                 <td>
329                     [% IF ( suggestedby_borrowernumber ) %]
330                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %] ([% suggestedby_cardnumber %])</a>
331                         [% Branches.GetName( suggestedby_branchcode ) %] ([% suggestedby_description %])
332                     [% END %]
333                 </td>
334             </tr>
335             <tr>
336                 <th>Managed by:</th>
337                 <td>[% manageddate | $KohaDates %]</td>
338                 <td>
339                         [% IF ( managedby_borrowernumber ) %]
340                             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %] ([% suggestedby_cardnumber %])</a>
341                             [% Branches.GetName( managedby_branchcode ) %] ([% managedby_description %])
342                         [% END %]
343                 </td>
344             </tr>
345             <tr>
346                 <th>Accepted on:</th>
347                 <td>[% accepteddate | $KohaDates %]</td>
348                 <td>
349                     [% IF ( acceptedby_borrowernumber ) %]
350                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %] ([% suggestedby_cardnumber %])</a>
351                         [% Branches.GetName( acceptedby_branchcode ) %] ([% acceptedby_description %])
352                     [% END %]
353                 </td>
354             </tr>
355             </tbody>
356         </table></li></ol>
357     </fieldset>
358     <fieldset class="rows"> <legend>Acquisition information</legend>
359       <ol>
360         <li>
361           <span class="label">Library:</span> [% Branches.GetName( branchcode ) %]
362         </li>
363         <li>
364           <span class="label">Fund:</span> [% budgetname %]
365         </li>
366         <li>
367           <span class="label">Copies:</span>[% quantity %]
368         </li>
369         <li>
370           <span class="label">Currency:</span>[% currency %]
371         </li>
372         <li>
373           <span class="label">Price:</span>[% price | $Price %]
374         </li>
375         <li>
376           <span class="label">Total</span>[% total | $Price %]
377         </li>
378       </ol>
379     </fieldset>
380
381     <fieldset class="action">
382         <a href="suggestion.pl">&lt;&lt; Back to suggestions</a>
383     </fieldset>
384
385     </div>
386     </div>
387 </div>
388 [% ELSE %]
389
390 [% IF ( op_save ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
391 <div id="bd">
392     <div id="yui-main">
393     <div class="yui-b">
394 [% IF ( op_save ) %]
395     <form id="add_edit" action="suggestion.pl" method="post" class="validated">
396     <input type="hidden" name="redirect" id="redirect" value="[% redirect %]" />
397     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
398     [% IF ( suggestionid ) %]
399         <h1>Edit purchase suggestion #[% suggestionid %]</h1>
400         <input type="hidden" name="suggestionid" value="[% suggestionid %]"/>
401     [% ELSE %]
402         <h1>Enter a new purchase suggestion</h1>
403     [% END %]
404     <fieldset class="rows"> <legend>Bibliographic information</legend><ol>
405         <li>
406             <label for="title" class="required">Title:</label>
407             <input type="text" id="title" name="title" size="80" maxlength="255" value="[% title |html %]" required="required" class="required" />
408             <span class="required">Required</span>
409         </li>
410         <li><label for="author">Author:</label><input type="text" id="author" name="author" size="50" maxlength="80" value="[% author | html %]"/></li>
411         <li><label for="copyrightdate">Copyright date:</label><input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" value="[% copyrightdate | html %]" /></li>
412         <li><label for="isbn">ISBN or ISSN or other standard number:</label><input type="text" id="isbn" name="isbn" size="50" maxlength="80" value="[% isbn | html %]"/></li>
413         <li><label for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" value="[% publishercode | html %]"/></li>
414         <li><label for="place">Publication place:</label><input type="text" id="place" name="place" size="50" maxlength="80" value="[% place | html %]"/></li>
415         <li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% collectiontitle | html %]"/></li>
416         <li><label for="itemtype">Document type:</label>
417             [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, default=itemtype %]
418         </li>
419         [% IF patron_reason_loop %]
420             <li>
421                 <label for="patronreason">Reason for suggestion: </label>
422                 <select name="patronreason" id="patronreason">
423                     <option value=""> -- Choose -- </option>
424                     [% FOREACH patron_reason_loo IN patron_reason_loop %]
425                         [% IF patron_reason_loo.authorised_value == patronreason %]
426                             <option value="[% patron_reason_loo.authorised_value %]" selected="selected">[% patron_reason_loo.lib %]</option>
427                         [% ELSE %]
428                             <option value="[% patron_reason_loo.authorised_value %]">[% patron_reason_loo.lib %]</option>
429                         [% END %]
430                     [% END %]
431                 </select>
432             </li>
433         [% END %]
434         <li><label for="note">Notes:</label><textarea name="note" id="note" rows="5" cols="40">[% note %]</textarea></li>
435         </ol>
436     </fieldset>
437     <fieldset class="rows"> <legend>Suggestion management</legend>
438        <ol>
439             [% IF ( suggestionid ) %]
440                 <li>
441                     <label for="STATUS">Status:</label>
442                     <select id="STATUS" name="STATUS">
443                         <option value="">No Status</option>
444
445                         [% IF (statusselected_ASKED ) %]
446                             <option value="ASKED" selected="selected">Pending</option>
447                         [% ELSE %]
448                             <option value="ASKED">Pending</option>
449                         [% END %]
450
451                         [% IF (statusselected_ACCEPTED ) %]
452                             <option value="ACCEPTED" selected="selected">Accepted</option>
453                         [% ELSE %]
454                             <option value="ACCEPTED">Accepted</option>
455                         [% END %]
456
457                         [% IF (statusselected_CHECKED ) %]
458                             <option value="CHECKED" selected="selected">Checked</option>
459                         [% ELSE %]
460                             <option value="CHECKED">Checked</option>
461                         [% END %]
462
463                         [% IF ( statusselected_REJECTED ) %]
464                             <option value="REJECTED" selected="selected">Rejected</option>
465                         [% ELSE %]
466                             <option value="REJECTED">Rejected</option>
467                         [% END %]
468
469                         [% FOREACH s IN SuggestionStatuses %]
470                             [% IF s.authorised_value == selected_status %]
471                                 <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
472                             [% ELSE %]
473                                 <option value="[% s.authorised_value %]">[% s.lib %]</option>
474                             [% END %]
475                         [% END %]
476                     </select>
477                 </li>
478                 <li>
479                     <label for="reason">Reason</label>
480                     <select class="select-reason" id="reason" name="reason">
481                         <option value=""> -- Choose a reason -- </option>
482                         [% FOREACH reasonsloo IN suggestion.reasonsloop %]
483                             [% IF (reasonsloo.lib == suggestion.reason) %]
484                                 <option value="[% reasonsloo.lib %]" selected="selected">[% reasonsloo.lib %]</option>
485                             [% ELSE %]
486                                 <option value="[% reasonsloo.lib %]">[% reasonsloo.lib %]</option>
487                             [% END %]
488                         [% END %]
489                         <option value="other">Others...</option>
490                     </select>
491
492                     <span id="other_reason" name="other_reason">
493                         [% IF other_reason %]
494                             <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." value="[% suggestion.reason%]"/>
495                         [% ELSE %]
496                             <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." />
497                         [% END %]
498                         <a href="#back">Cancel</a>
499                     </span>
500                 </li>
501             [% END %]
502         <li><table>
503             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
504             <tbody>
505             <tr>
506                 <th><label for="suggesteddate">Created by:</label> </th>
507                 <td><input type="text" id="suggesteddate" name="suggesteddate" class="datepicker" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/>[% INCLUDE 'date-format.inc' %]</td>
508                 <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %] ([% suggestedby_cardnumber %])</a>  [% Branches.GetName( suggestedby_branchcode ) %] ([% suggestedby_description %])[% END %]
509                 </td>
510             </tr>
511             <tr>
512                 <th><label for="managedon">Managed by:</label> </th>
513                 <td><input type="text" id="managedon" name="manageddate" class="datepicker" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]</td>
514                 <td><input type="hidden" id="managedby" name="managedby" value="[% managedby %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %] ([% suggestedby_cardnumber %])</a> [% Branches.GetName( managedby_branchcode ) %] ([% managedby_description %])[% END %]</td>
515             </tr>
516             <tr>
517                 <th><label for="accepteddate">Accepted on:</label> </th>
518                 <td><input type="text" id="accepteddate" name="accepteddate" class="datepicker" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]</td>
519                 <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %] ([% suggestedby_cardnumber %])</a> [% Branches.GetName( acceptedby_branchcode ) %] ([% acceptedby_description %])[% END %]</td>
520             </tr>
521             </tbody>
522         </table></li></ol>
523     </fieldset>
524     <fieldset class="rows"> <legend>Acquisition information</legend><ol>
525         <li><label for="branchcode">Library:</label>
526             <select name="branchcode" id="branchcode">
527                 <option value="">Any</option>
528                 [% IF branchfilter %]
529                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
530                 [% ELSE %]
531                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
532                 [% END %]
533             </select>
534         </li>
535         <li><label for="budgetid">Fund:</label>
536             <select name="budgetid" id="budgetid">
537                 <option value="">Any</option>[% FOREACH budgetsloo IN budgetsloop %]
538                 [% IF ( budgetsloo.selected ) %]<option value="[% budgetsloo.budget_id %]" selected="selected">[% budgetsloo.budget_name %]</option>[% ELSE %]<option value="[% budgetsloo.budget_id %]">[% budgetsloo.budget_name %]</option>[% END %][% END %]
539             </select>
540                 </li><li><label for="quantity">Copies:</label>
541             <input type="text" size="10" id="quantity" name="quantity" value="[% quantity %]" />
542                 </li>
543                 <li>
544                     <label for="currency">Currency:</label>
545                     [% FOREACH c IN currencies %]
546                         <input type="hidden" value="[% c.rate %]" id="currency_rate_[% c.currency %]" name="currency_rate_[% c.currency %]" />
547                         <input type="hidden" id="[% c.currency %]" name="[% c.currency %]" value="[% c.rate %]" />
548                     [% END %]
549
550                     <select name="currency" id="currency">
551                         [% FOREACH c IN currencies %]
552                             [% IF suggestionid and suggestion.currency == c.currency or not suggestionid and c.active %]
553                                 <option value="[% c.currency %]" selected="selected">[% c.currency %]</option>
554                             [% ELSIF not c.archived %]
555                                 <option value="[% c.currency %]">[% c.currency %]</option>
556                             [% END %]
557                         [% END %]
558                     </select>
559                 </li>
560                 <li><label for="price">Price:</label>
561             <input type="text" size="20" name="price" id="price" value="[% price %]" />
562                 </li><li><label for="total">Total: </label>
563                         <input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total %]"/>
564                 </li></ol>
565     </fieldset><input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby %][% ELSE %]noone[% END %]"/>
566     <fieldset class="action"><input type="hidden" name="op" value="[% op %]" />[% IF ( suggestionid ) %]<input type="submit" value="Save" /> <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby %]#suggestions[% ELSE %]suggestion.pl[% END %]">Cancel</a>[% ELSE %]<input type="submit" value="Submit your suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a>[% END %]
567     </fieldset>
568     </form>
569 [% END %]
570
571 [% IF ( op_else ) %]
572 <div id="toolbar" class="btn-toolbar">
573     <a class="btn btn-default btn-sm" id="newsuggestion" href="suggestion.pl?op=add"><i class="fa fa-plus"></i> New purchase suggestion</a>
574 </div>
575
576 <h1>Suggestions management</h1>
577
578
579 [% FOR m IN messages %]
580     <div class="dialog [% m.type %]">
581         [% SWITCH m.code %]
582         [% CASE 'already_exists' %]
583             The suggestion has not been added. A suggestion with this title already exists (<a href='/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% m.id %]&op=show'>suggestion #[% m.id %]</a>)
584         [% CASE %]
585             [% m.code %]
586         [% END %]
587     </div>
588 [% END %]
589
590 [% UNLESS ( notabs ) %]
591     <div id="suggestiontabs" class="toptabs">
592     <ul class="ui-tabs-nav">
593         [% FOREACH suggestion IN suggestions %]
594                 <li>
595             <a href="#[% suggestion.suggestiontype %]">
596             [% IF ( suggestion.suggestiontypelabel ) %]
597                 [% IF (suggestion.suggestiontypelabel == "Pending") %]Pending
598                 [% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted
599                 [% ELSIF (suggestion.suggestiontypelabel == "Checked") %]Checked
600                 [% ELSIF (suggestion.suggestiontypelabel == "Rejected") %]Rejected
601                 [% ELSIF (suggestion.suggestiontypelabel == "Available") %]Available
602                 [% ELSIF (suggestion.suggestiontypelabel == "Ordered") %]Ordered
603                 [% ELSIF (suggestion.suggestiontypelabel == "Unknown") %]Status unknown
604                 [% ELSE %][% suggestion.suggestiontypelabel %][% END %]
605             [% ELSE %]
606                 [% IF ( suggestion.suggestiontype ) %]
607                     [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %]
608                 [% ELSE %]
609                     No name
610                 [% END %]
611             [% END %]
612             ([% suggestion.suggestions_loop.size %])</a></li>
613
614         [% END %]
615     </ul>
616 [% END %]
617
618 [% FOREACH suggestion IN suggestions %]
619 <div id="[% suggestion.suggestiontype %]">
620 <form class="update_suggestions" name="f[% suggestion.suggestiontype %]" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl#[% suggestion.suggestiontype %]">
621
622 [% IF ( suggestion.suggestions_loop ) %]
623 <p><a id="CheckAll[% suggestion.suggestiontype %]" href="#">Check all</a> | <a id="UncheckAll[% suggestion.suggestiontype %]" href="#">Uncheck all</a></p>
624     <table id="[% suggestion.suggestiontype %]t" class="sorted">
625         <thead>
626             <tr>
627                 <th class="NoSort">&nbsp;</th>
628                 <th class="anti-the">Suggestion</th>
629                 <th>Suggested by - on</th>
630                 <th>Managed by - on</th>
631                 <th>Library</th>
632                 <th>Fund</th>
633                 <th>Status</th>
634                 <th class="NoSort">&nbsp;</th>
635             </tr>
636     </thead>
637         <tbody>
638             [% FOREACH suggestions_loo IN suggestion.suggestions_loop %]
639                 <tr>
640                 <td>
641                     <input type="checkbox" name="edit_field" value="[% suggestions_loo.suggestionid %]" />
642                 </td>
643                 <td>
644                     <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&amp;op=show" title="suggestion" >
645                         [% suggestions_loo.title |html %][% IF ( suggestions_loo.author ) %], by [% suggestions_loo.author %][% END %]</a>
646                     <br />
647                     [% IF ( suggestions_loo.copyrightdate ) %]&copy; [% suggestions_loo.copyrightdate |html %] [% END %]
648                         [% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc |html %]</i> [% END %]
649                         [% IF ( suggestions_loo.isbn ) %]; ISBN:<i>[% suggestions_loo.isbn |html %]</i> [% END %][% IF ( suggestions_loo.publishercode ) %]; Published by [% suggestions_loo.publishercode |html %] [% END %][% IF ( suggestions_loo.publicationyear ) %] in <i>[% suggestions_loo.publicationyear |html %]</i> [% END %][% IF ( suggestions_loo.place ) %] in <i>[% suggestions_loo.place |html %]</i> [% END %][% IF ( suggestions_loo.collectiontitle ) %]; [% suggestions_loo.collectiontitle |html %] [% END %][% IF ( suggestions_loo.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 0 ) %] [% END %]<br />[% IF ( suggestions_loo.note ) %]<span class="note">[% suggestions_loo.note |html%]</span>[% END %]
650                 </td>
651                 <td>
652                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.suggestedby %]">[% suggestions_loo.surnamesuggestedby %][% IF ( suggestions_loo.firstnamesuggestedby ) %], [% suggestions_loo.firstnamesuggestedby %][% END %] [% IF (suggestions_loo.cardnumbersuggestedby ) %]([% suggestions_loo.cardnumbersuggestedby %])[% END %]</a>
653                     [% IF ( suggestions_loo.suggesteddate ) %] - [% suggestions_loo.suggesteddate | $KohaDates %][% END %]
654                 </td>
655                 <td>
656                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.suggestedby %]">[% suggestions_loo.surnamemanagedby %][% IF ( suggestions_loo.firstnamemanagedby ) %], [% suggestions_loo.firstnamemanagedby %][% END %]</a>
657                     [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate | $KohaDates %][% END %]
658                 </td>
659                 <td>
660                     [% Branches.GetName( suggestions_loo.branchcode ) %]
661                 </td>
662                 <td>
663                     [% suggestions_loo.budget_name %]
664                 </td>
665                 <td>
666                     [% IF ( suggestions_loo.ASKED ) %]
667                         Pending
668                     [% ELSIF ( suggestions_loo.ACCEPTED ) %]
669                         Accepted
670                     [% ELSIF ( suggestions_loo.ORDERED ) %]
671                         Ordered
672                     [% ELSIF ( suggestions_loo.REJECTED ) %]
673                         Rejected
674                     [% ELSIF ( suggestions_loo.CHECKED ) %]
675                         Checked
676                     [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
677                         [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
678                     [% ELSE %]
679                         Status unknown
680                     [% END %]
681
682                     [% IF ( suggestions_loo.reason ) %]
683                         <br />([% suggestions_loo.reason %])
684                     [% END %]
685                 </td>
686                 <td class="actions">
687                     <a class="btn btn-xs btn-default" href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&amp;op=edit"><i class="fa fa-pencil"></i> Edit</a>
688                     <a class="btn btn-default btn-xs deletesuggestion" href="suggestion.pl?op=delete&amp;edit_field=[% suggestions_loo.suggestionid %]"><i class="fa fa-trash"></i> Delete</a>
689                 </td>
690         </tr>
691         [% END %]</tbody>
692         </table>  <fieldset>
693     <div id="select-reason[% suggestion.suggestiontype %]">
694         <div id="status[% suggestion.suggestiontype %]">
695             <label for="STATUS[% suggestion.suggestiontype %]">Mark selected as: </label>
696             <select name="STATUS" id="STATUS[% suggestion.suggestiontype %]">
697                 <option value=""> -- Choose a status --</option>
698
699                 [% IF (statusselected_ASKED ) %]
700                     <option value="ASKED" selected="selected">Pending</option>
701                 [% ELSE %]
702                     <option value="ASKED">Pending</option>
703                 [% END %]
704
705                 [% IF (statusselected_ACCEPTED ) %]
706                     <option value="ACCEPTED" selected="selected">Accepted</option>
707                 [% ELSE %]
708                     <option value="ACCEPTED">Accepted</option>
709                 [% END %]
710
711                 [% IF (statusselected_CHECKED ) %]
712                     <option value="CHECKED" selected="selected">Checked</option>
713                 [% ELSE %]
714                     <option value="CHECKED">Checked</option>
715                 [% END %]
716
717                 [% IF ( statusselected_REJECTED ) %]
718                     <option value="REJECTED" selected="selected">Rejected</option>
719                 [% ELSE %]
720                     <option value="REJECTED">Rejected</option>
721                 [% END %]
722
723                 [% FOREACH s IN SuggestionStatuses %]
724                     <option value="[% s.authorised_value %]">[% s.lib %]</option>
725                 [% END %]
726             </select>
727
728             <label for="reason[% suggestion.suggestiontype %]">with this reason:</label>
729             <select id="reason[% suggestion.suggestiontype %]" name="reason[% suggestion.suggestiontype %]">
730                 <option value=""> -- Choose a reason -- </option>
731                 [% FOREACH reasonsloo IN suggestion.reasonsloop %]
732                     <option value="[% reasonsloo.lib %]">[% reasonsloo.lib %]</option>
733                 [% END %]
734                 <option value="other">Others...</option>
735             </select>
736
737             <span id="other_reason[% suggestion.suggestiontype %]">
738                 <input type="text" size="31" id="select-other_reason[% suggestion.suggestiontype %]" name="other_reason[% suggestion.suggestiontype %]" placeholder="please note your reason here..." />
739                 <a href="#back[% suggestion.suggestiontype %]">Cancel</a>
740             </span>
741
742             <strong style="padding: 0 1em;">OR:</strong>
743
744             <label for="[% suggestion.suggestiontype %]delete">Delete selected</label>
745             <input type="checkbox" name="op" id="[% suggestion.suggestiontype %]delete" />
746         </div>
747     </div>
748
749     <input type="hidden" name="branchcode" value="[% branchfilter %]" />
750     <input type="hidden" name="tabcode" value="[% suggestion.suggestiontype %]" />
751     <input type="hidden" name="op" value="change" />
752 </fieldset>
753         <fieldset class="action">
754     <input type="submit" value="Submit" /></fieldset>
755 </form>
756 [% ELSE %]
757     <b>No results.</b>
758 [% END %]
759 </div>
760 [% END %]
761     </div>
762 [% END %]
763 </div>
764 </div>
765
766       [% UNLESS ( op_save ) %] [% UNLESS ( op == 'show' ) %]<div class="yui-b">
767 <form name="suggestionfilter" action="suggestion.pl" method="get">
768 <fieldset class="brief"><ol style="display:block;"><li><label for="displayby">Organize by: </label>
769                 <select name="displayby" id="displayby" style="width:auto;">
770                     [% IF ( displayby == "STATUS" ) %]
771                         <option value="STATUS" selected="selected">Status</option>
772                     [% ELSE %]
773                         <option value="STATUS">Status</option>
774                     [% END %]
775                     [% IF ( displayby == "branchcode" ) %]
776                         <option value="branchcode" selected="selected">Library</option>
777                     [% ELSE %]
778                         <option value="branchcode">Library</option>
779                     [% END %]
780                     [% IF ( displayby == "itemtype" ) %]
781                         <option value="itemtype" selected="selected">Item type</option>
782                     [% ELSE %]
783                         <option value="itemtype">Item type</option>
784                     [% END %]
785                     [% IF ( displayby == "managedby" ) %]
786                         <option value="managedby" selected="selected">Managed by</option>
787                     [% ELSE %]
788                         <option value="managedby">Managed by</option>
789                     [% END %]
790                     [% IF ( displayby == "acceptedby" ) %]
791                         <option value="acceptedby" selected="selected">Accepted by</option>
792                     [% ELSE %]
793                         <option value="acceptedby">Accepted by</option>
794                     [% END %]
795                 </select> <input type="submit" value="Go" /></li></ol></fieldset>
796 <h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4>
797                 <div style="display:block;" id="limits">
798
799                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Bibliographic information</a></h4>
800                    <ol> <li><label for="title"> Title:</label><input type="text" id="title" name="title" value="[% title |html %]" /></li>
801                     <li><label for="author"> Author:</label><input type="text" id="author" name="author" value="[% author | html %]" /></li>
802                     <li><label for="isbn"> ISBN:</label><input type="text" id="isbn"  name="isbn" value="[% isbn | html %]" /></li>
803                     <li><label for="publishercode"> Publisher:</label><input type="text" id="publishercode" name="publishercode" value="[% publishercode | html %]" /></li>
804                     <li><label for="copyrightdate_filter"> Copyright date:</label><input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate | html %]" /></li>
805                     <li><label for="collectiontitle"> Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" value="[% collectiontitle | html %]" /></li><li><input type="submit" value="Go" /></li></ol>
806                 </fieldset>
807                                  <fieldset class="brief"><h4 class="local_collapse"><a href="#">Suggestion information</a></h4>
808                     <ol>
809                       <li>
810                           <label for="STATUS"> Status:</label>
811                           <select name="STATUS" id="STATUS">
812                               <option value="">Any</option>
813
814                               [% IF (statusselected_ASKED ) %]
815                                   <option value="ASKED" selected="selected">Pending</option>
816                               [% ELSE %]
817                                   <option value="ASKED">Pending</option>
818                               [% END %]
819
820                               [% IF (statusselected_ACCEPTED ) %]
821                                   <option value="ACCEPTED" selected="selected">Accepted</option>
822                               [% ELSE %]
823                                   <option value="ACCEPTED">Accepted</option>
824                               [% END %]
825
826                               [% IF (statusselected_CHECKED ) %]
827                                   <option value="CHECKED" selected="selected">Checked</option>
828                               [% ELSE %]
829                                   <option value="CHECKED">Checked</option>
830                               [% END %]
831
832                               [% IF ( statusselected_REJECTED ) %]
833                                   <option value="REJECTED" selected="selected">Rejected</option>
834                               [% ELSE %]
835                                   <option value="REJECTED">Rejected</option>
836                               [% END %]
837
838                               [% FOREACH s IN SuggestionStatuses %]
839                                   [% IF s.authorised_value == selected_status %]
840                                       <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
841                                   [% ELSE %]
842                                       <option value="[% s.authorised_value %]">[% s.lib %]</option>
843                                   [% END %]
844                               [% END %]
845                           </select>
846                       </li>
847
848                     <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
849 [% FOREACH suggestedby_loo IN suggestedby_loop %][% IF ( suggestedby_loo.selected ) %]<option value="[% suggestedby_loo.code %]" selected="selected">[% suggestedby_loo.desc %]</option>[% ELSE %]<option value="[% suggestedby_loo.code %]">[% suggestedby_loo.desc %]</option>[% END %][% END %]
850                                                                      </select></li>
851                     <li>
852                         <label for="suggesteddate_from">Suggested date from:</label>
853                         <input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggesteddate_from %]" />
854                     </li>
855                     <li>
856                         <label for="suggesteddate_to">To:</label>
857                         <input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggesteddate_to %]" />
858                     </li>
859                     <li><label for="managedby"> Managed by:</label><select id="managedby" name="managedby"><option value="">Any</option>
860 [% FOREACH managedby_loo IN managedby_loop %][% IF ( managedby_loo.selected ) %]<option value="[% managedby_loo.code %]" selected="selected">[% managedby_loo.desc %]</option>[% ELSE %]<option value="[% managedby_loo.code %]">[% managedby_loo.desc %]</option>[% END %][% END %]
861                                                                      </select></li>
862                     <li>
863                         <label for="manageddate_from">Management date from:</label>
864                         <input type="text" id="manageddate_from" size="10" name="manageddate_from" value="[% manageddate_from %]" />
865                     </li>
866                     <li>
867                         <label for="manageddate_to">To:</label>
868                         <input type="text" id="manageddate_to" size="10" name="manageddate_to" value="[% manageddate_to %]" />
869                     </li>
870                     <li><label for="acceptedby"> Accepted by:</label><select id="acceptedby" name="acceptedby"><option value="">Any</option>
871 [% FOREACH acceptedby_loo IN acceptedby_loop %][% IF ( acceptedby_loo.selected ) %] <option value="[% acceptedby_loo.code %]" selected="selected">[% acceptedby_loo.desc %]</option>[% ELSE %]<option value="[% acceptedby_loo.code %]">[% acceptedby_loo.desc %]</option>[% END %][% END %]
872                                                       </select></li>
873                     <li>
874                         <label for="accepteddate_from">Accepted date from:</label>
875                         <input type="text" id="accepteddate_from" size="10" name="accepteddate_from" value="[% accepteddate_from %]" />
876                     </li>
877                     <li>
878                         <label for="accepteddate_to">To:</label>
879                         <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to %]" />
880                     </li>
881                     <li><input type="submit" value="Go" /></li></ol>
882                 </fieldset>
883
884                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Acquisition information</a></h4>
885                     <ol><li><label for="budgetid"> Book fund:</label>
886                     <select name="budgetid" id="budgetid">
887                       <option value="__ANY__">Any</option>
888                       [% IF budgetid == '__NONE__' %]
889                           <option value="__NONE__" selected="selected">None</option>
890                       [% ELSE %]
891                           <option value="__NONE__">None</option>
892                       [% END %]
893                     [% FOREACH budgetid_loo IN budgetid_loop %]
894                         [% IF ( budgetid_loo.selected ) %] <option value="[% budgetid_loo.code %]" selected="selected">[% budgetid_loo.desc %]</option>[% ELSE %]<option value="[% budgetid_loo.code %]">[% budgetid_loo.desc %]</option>[% END %]
895                         [% END %]
896                     </select></li>
897                     <li><label for="branchcode">Library:</label>
898                     <select name="branchcode" id="branchcode">
899                         <option value="__ANY__">Any</option>
900                         [% IF branchfilter %]
901                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
902                         [% ELSE %]
903                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
904                         [% END %]
905                     </select></li><li><input type="submit" value="Go" /></li></ol>
906                 </fieldset>
907     </div>
908             </form>
909         [% INCLUDE 'acquisitions-menu.inc' %]
910         </div>
911     [% END %]
912     [% END %]
913 </div>
914 [% END %]
915 [% INCLUDE 'intranet-bottom.inc' %]
916