Bug 18582 - Hide empty rows in detailed suggestion view
[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' ) %]
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             { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
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         // ]]>
177     </script>
178 [% END %]
179 <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
180 </head>
181 <body id="acq_suggestion" class="acq">
182 [% INCLUDE 'header.inc' %]
183 [% INCLUDE 'cat-search.inc' %]
184 <div id="breadcrumbs">
185     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
186     [% IF ( op_save ) %]
187         [% IF ( suggestionid ) %]
188             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo;  Edit suggestion #[% suggestionid %]
189         [% ELSE %]
190             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Add suggestion
191         [% END %]
192     [% ELSIF ( op == 'show' ) %]
193            <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Show suggestion #[% suggestionid %]
194     [% ELSE %]
195         Suggestions management
196     [% END %]
197 </div>
198
199 [% IF ( op == 'show' ) %]
200 <div id="doc" class="yui-t7"> <!-- <div id="doc3" class="yui-t2"> -->
201 <div id="bd">
202     <div id="yui-main">
203     <div class="yui-b">
204
205     <div id="toolbar" class="btn-toolbar">
206         <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>
207         <a class="btn btn-default btn-sm" id="deletesuggestion" href="suggestion.pl?op=delete&amp;edit_field=[% suggestionid %]"><i class="fa fa-trash"></i> Delete</a>
208     </div>
209
210     <fieldset class="rows">
211       <legend>Bibliographic information</legend>
212       <ol>
213             [% IF ( title ) %]
214                 <li>
215                     <span class="label">Title:</span>
216                     [% title |html %]
217                 </li>
218             [% END %]
219             [% IF ( author ) %]
220                 <li>
221                     <span class="label">Author:</span>
222                     [% author |html %]
223                 </li>
224             [% END %]
225             [% IF ( copyrightdate ) %]
226                 <li>
227                     <span class="label">Copyright date:</span>
228                     [% copyrightdate |html %]
229                 </li>
230             [% END %]
231             [% IF ( isbn ) %]
232                 <li>
233                     <span class="label">ISBN or ISSN or other standard number:</span>
234                     [% isbn |html %]
235                 </li>
236             [% END %]
237             [% IF ( publishercode ) %]
238                 <li>
239                     <span class="label">Publisher:</span>
240                     [% publishercode |html %]
241                 </li>
242             [% END %]
243             [% IF ( place ) %]
244                 <li>
245                     <span class="label">Publication place:</span>
246                     [% place |html %]
247                 </li>
248             [% END %]
249             [% IF ( collectiontitle ) %]
250                 <li>
251                     <span class="label">Collection title:</span>
252                     [% collectiontitle |html %]
253                 </li>
254             [% END %]
255             [% IF ( itemtype ) %]
256                 <li>
257                     <span class="label">Document type:</span>
258                     [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', itemtype, 0 ) %]
259                 </li>
260             [% END %]
261         [% IF ( patron_reason_loop ) %]
262           <li><span class="label">Reason for suggestion: </span>
263             [% FOREACH patron_reason_loo IN patron_reason_loop %]
264               [% IF patron_reason_loo.authorised_value == patronreason %][% patron_reason_loo.lib %][% END %]
265             [% END %]
266           </li>
267         [% END %]
268             [% IF ( note ) %]
269                 <li>
270                     <span class="label">Notes:</span>
271                     [% note |html %]
272                 </li>
273             [% END %]
274       </ol>
275     </fieldset>
276     <fieldset class="rows"> <legend>Suggestion management</legend>
277       <ol>
278         <li>
279           <span class="label">Status:</span>
280           [% SET status_found = 0 %]
281           [% IF ( STATUS == 'ASKED' ) %]
282               Pending
283               [% SET status_found = 1 %]
284           [% ELSIF ( STATUS == 'ACCEPTED' ) %]
285               Accepted
286               [% SET status_found = 1 %]
287           [% ELSIF ( STATUS == 'CHECKED' ) %]
288               Checked
289               [% SET status_found = 1 %]
290           [% ELSIF ( STATUS == 'REJECTED' ) %]
291               Rejected
292               [% SET status_found = 1 %]
293           [% ELSE %]
294               [% FOREACH s IN SuggestionStatuses %]
295                   [% IF STATUS == s.authorised_value %]
296                       [% s.lib %]
297                       [% SET status_found = 1 %]
298                   [% END %]
299               [% END %]
300           [% END %]
301
302         </li>
303         <li>
304           <table>
305             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
306             <tbody>
307             <tr>
308                 <th><span class="label">Suggestion creation</span> </th>
309                 <td>[% suggesteddate | $KohaDates %]</td>
310                 <td>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a>  [% Branches.GetName( suggestedby_branchcode ) %] ([% suggestedby_description %])[% END %]
311                 </td>
312             </tr>
313             <tr>
314                 <th><span class="label">Suggestion management</span> </th>
315                 <td>[% manageddate | $KohaDates %]</td>
316                 <td>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% Branches.GetName( managedby_branchcode ) %] ([% managedby_description %])[% END %]</td>
317             </tr>
318             <tr>
319                 <th><span class="label">Suggestion accepted</span> </th>
320                 <td>[% accepteddate | $KohaDates %]</td>
321                 <td>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% Branches.GetName( acceptedby_branchcode ) %] ([% acceptedby_description %])[% END %]</td>
322             </tr>
323             </tbody>
324         </table></li></ol>
325     </fieldset>
326     <fieldset class="rows"> <legend>Acquisition information</legend>
327       <ol>
328         <li>
329           <span class="label">Library:</span> [% Branches.GetName( branchcode ) %]
330         </li>
331         <li>
332           <span class="label">Fund:</span> [% budgetname %]
333         </li>
334         <li>
335           <span class="label">Copies:</span>[% quantity %]
336         </li>
337         <li>
338           <span class="label">Currency:</span>[% currency %]
339         </li>
340         <li>
341           <span class="label">Price:</span>[% price | $Price %]
342         </li>
343         <li>
344           <span class="label">Total</span>[% total | $Price %]
345         </li>
346       </ol>
347     </fieldset>
348
349     <fieldset class="action">
350         <a href="suggestion.pl">&lt;&lt; Back to suggestions</a>
351     </fieldset>
352
353     </div>
354     </div>
355 </div>
356 [% ELSE %]
357
358 [% IF ( op_save ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
359 <div id="bd">
360     <div id="yui-main">
361     <div class="yui-b">
362 [% IF ( op_save ) %]
363     <form id="add_edit" action="suggestion.pl" method="post" class="validated">
364     <input type="hidden" name="redirect" id="redirect" value="[% redirect %]" />
365     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
366     [% IF ( suggestionid ) %]
367         <h1>Edit purchase suggestion #[% suggestionid %]</h1>
368         <input type="hidden" name="suggestionid" value="[% suggestionid %]"/>
369     [% ELSE %]
370         <h1>Enter a new purchase suggestion</h1>
371     [% END %]
372     <fieldset class="rows"> <legend>Bibliographic information</legend><ol>
373         <li>
374             <label for="title" class="required">Title:</label>
375             <input type="text" id="title" name="title" size="80" maxlength="255" value="[% title |html %]" required="required" class="required" />
376             <span class="required">Required</span>
377         </li>
378         <li><label for="author">Author:</label><input type="text" id="author" name="author" size="50" maxlength="80" value="[% author | html %]"/></li>
379         <li><label for="copyrightdate">Copyright date:</label><input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" value="[% copyrightdate | html %]" /></li>
380         <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>
381         <li><label for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" value="[% publishercode | html %]"/></li>
382         <li><label for="place">Publication place:</label><input type="text" id="place" name="place" size="50" maxlength="80" value="[% place | html %]"/></li>
383         <li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% collectiontitle | html %]"/></li>
384         <li><label for="itemtype">Document type:</label>
385             [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, default=itemtype %]
386         </li>
387         [% IF patron_reason_loop %]
388             <li>
389                 <label for="patronreason">Reason for suggestion: </label>
390                 <select name="patronreason" id="patronreason">
391                     <option value=""> -- Choose -- </option>
392                     [% FOREACH patron_reason_loo IN patron_reason_loop %]
393                         [% IF patron_reason_loo.authorised_value == patronreason %]
394                             <option value="[% patron_reason_loo.authorised_value %]" selected="selected">[% patron_reason_loo.lib %]</option>
395                         [% ELSE %]
396                             <option value="[% patron_reason_loo.authorised_value %]">[% patron_reason_loo.lib %]</option>
397                         [% END %]
398                     [% END %]
399                 </select>
400             </li>
401         [% END %]
402         <li><label for="note">Notes:</label><textarea name="note" id="note" rows="5" cols="40">[% note %]</textarea></li>
403         </ol>
404     </fieldset>
405     <fieldset class="rows"> <legend>Suggestion management</legend>
406        <ol>
407             [% IF ( suggestionid ) %]
408                 <li>
409                     <label for="STATUS">Status:</label>
410                     <select id="STATUS" name="STATUS">
411                         <option value="">No Status</option>
412
413                         [% IF (statusselected_ASKED ) %]
414                             <option value="ASKED" selected="selected">Pending</option>
415                         [% ELSE %]
416                             <option value="ASKED">Pending</option>
417                         [% END %]
418
419                         [% IF (statusselected_ACCEPTED ) %]
420                             <option value="ACCEPTED" selected="selected">Accepted</option>
421                         [% ELSE %]
422                             <option value="ACCEPTED">Accepted</option>
423                         [% END %]
424
425                         [% IF (statusselected_CHECKED ) %]
426                             <option value="CHECKED" selected="selected">Checked</option>
427                         [% ELSE %]
428                             <option value="CHECKED">Checked</option>
429                         [% END %]
430
431                         [% IF ( statusselected_REJECTED ) %]
432                             <option value="REJECTED" selected="selected">Rejected</option>
433                         [% ELSE %]
434                             <option value="REJECTED">Rejected</option>
435                         [% END %]
436
437                         [% FOREACH s IN SuggestionStatuses %]
438                             [% IF s.authorised_value == selected_status %]
439                                 <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
440                             [% ELSE %]
441                                 <option value="[% s.authorised_value %]">[% s.lib %]</option>
442                             [% END %]
443                         [% END %]
444                     </select>
445                 </li>
446             [% END %]
447         <li><table>
448             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
449             <tbody>
450             <tr>
451                 <th><label for="suggesteddate">Suggestion creation</label> </th>
452                 <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/></td>
453                 <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 %]</a>  [% Branches.GetName( suggestedby_branchcode ) %] ([% suggestedby_description %])[% END %]
454                 </td>
455             </tr>
456             <tr>
457                 <th><label for="managedon">Suggestion management</label> </th>
458                 <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" /></td>
459                 <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 %]</a> [% Branches.GetName( managedby_branchcode ) %] ([% managedby_description %])[% END %]</td>
460             </tr>
461             <tr>
462                 <th><label for="accepteddate">Suggestion accepted</label> </th>
463                 <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" /></td>
464                 <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 %]</a> [% Branches.GetName( acceptedby_branchcode ) %] ([% acceptedby_description %])[% END %]</td>
465             </tr>
466             </tbody>
467         </table></li></ol>
468     </fieldset>
469     <fieldset class="rows"> <legend>Acquisition information</legend><ol>
470         <li><label for="branchcode">Library:</label>
471             <select name="branchcode" id="branchcode">
472                 <option value="">Any</option>
473                 [% IF branchfilter %]
474                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
475                 [% ELSE %]
476                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
477                 [% END %]
478             </select>
479         </li>
480         <li><label for="budgetid">Fund:</label>
481             <select name="budgetid" id="budgetid">
482                 <option value="">Any</option>[% FOREACH budgetsloo IN budgetsloop %]
483                 [% 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 %]
484             </select>
485                 </li><li><label for="quantity">Copies:</label>
486             <input type="text" size="10" id="quantity" name="quantity" value="[% quantity %]" />
487                 </li>
488                 <li>
489                     <label for="currency">Currency:</label>
490                     [% FOREACH c IN currencies %]
491                         <input type="hidden" value="[% c.rate %]" id="currency_rate_[% c.currency %]" name="currency_rate_[% c.currency %]" />
492                         <input type="hidden" id="[% c.currency %]" name="[% c.currency %]" value="[% c.rate %]" />
493                     [% END %]
494
495                     <select name="currency" id="currency">
496                         [% FOREACH c IN currencies %]
497                             [% IF suggestionid and suggestion.currency == c.currency or not suggestionid and c.active %]
498                                 <option value="[% c.currency %]" selected="selected">[% c.currency %]</option>
499                             [% ELSIF not c.archived %]
500                                 <option value="[% c.currency %]">[% c.currency %]</option>
501                             [% END %]
502                         [% END %]
503                     </select>
504                 </li>
505                 <li><label for="price">Price:</label>
506             <input type="text" size="20" name="price" id="price" value="[% price %]" />
507                 </li><li><label for="total">Total: </label>
508                         <input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total %]"/>
509                 </li></ol>
510     </fieldset><input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby %][% ELSE %]noone[% END %]"/>
511     <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 %]
512     </fieldset>
513     </form>
514 [% END %]
515
516 [% IF ( op_else ) %]
517 <div id="toolbar" class="btn-toolbar">
518     <a class="btn btn-default btn-sm" id="newsuggestion" href="suggestion.pl?op=add"><i class="fa fa-plus"></i> New purchase suggestion</a>
519 </div>
520
521 <h1>Suggestions management</h1>
522
523
524 [% FOR m IN messages %]
525     <div class="dialog [% m.type %]">
526         [% SWITCH m.code %]
527         [% CASE 'already_exists' %]
528             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>)
529         [% CASE %]
530             [% m.code %]
531         [% END %]
532     </div>
533 [% END %]
534
535 [% UNLESS ( notabs ) %]
536     <div id="suggestiontabs" class="toptabs">
537     <ul class="ui-tabs-nav">
538         [% FOREACH suggestion IN suggestions %]
539                 <li>
540             <a href="#[% suggestion.suggestiontype %]">
541             [% IF ( suggestion.suggestiontypelabel ) %]
542                 [% IF (suggestion.suggestiontypelabel == "Pending") %]Pending
543                 [% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted
544                 [% ELSIF (suggestion.suggestiontypelabel == "Checked") %]Checked
545                 [% ELSIF (suggestion.suggestiontypelabel == "Rejected") %]Rejected
546                 [% ELSIF (suggestion.suggestiontypelabel == "Available") %]Available
547                 [% ELSIF (suggestion.suggestiontypelabel == "Ordered") %]Ordered
548                 [% ELSIF (suggestion.suggestiontypelabel == "Unknown") %]Status unknown
549                 [% ELSE %][% suggestion.suggestiontypelabel %][% END %]
550             [% ELSE %]
551                 [% IF ( suggestion.suggestiontype ) %]
552                     [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %]
553                 [% ELSE %]
554                     No name
555                 [% END %]
556             [% END %]
557             ([% suggestion.suggestions_loop.size %])</a></li>
558
559         [% END %]
560     </ul>
561 [% END %]
562
563 [% FOREACH suggestion IN suggestions %]
564 <div id="[% suggestion.suggestiontype %]">
565 <form class="update_suggestions" name="f[% suggestion.suggestiontype %]" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl#[% suggestion.suggestiontype %]">
566
567 [% IF ( suggestion.suggestions_loop ) %]
568 <p><a id="CheckAll[% suggestion.suggestiontype %]" href="#">Check all</a> | <a id="UncheckAll[% suggestion.suggestiontype %]" href="#">Uncheck all</a></p>
569     <table id="[% suggestion.suggestiontype %]t" class="sorted">
570         <thead>
571             <tr><th>&nbsp;</th>
572             <th>No.</th>
573             <th class="anti-the">Suggestion</th>
574             <th>Suggested by - on</th>
575             <th>Managed by - on</th>
576             <th>Library</th>
577             <th>Fund</th>
578             <th>Status</th></tr>
579     </thead>
580         <tbody>
581             [% FOREACH suggestions_loo IN suggestion.suggestions_loop %]
582                 <tr>
583                 <td>
584                     <input type="checkbox" name="edit_field" value="[% suggestions_loo.suggestionid %]" />
585                 </td>
586                 <td>
587                     [% suggestions_loo.suggestionid %]
588                 </td>
589                 <td>
590                     <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&amp;op=show" title="suggestion" >
591                         [% suggestions_loo.title |html %][% IF ( suggestions_loo.author ) %], by [% suggestions_loo.author %][% END %]</a>
592                     [<a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&amp;op=edit" title="suggestion" >edit</a>]
593                     <br />
594                     [% IF ( suggestions_loo.copyrightdate ) %]&copy; [% suggestions_loo.copyrightdate |html %] [% END %]
595                         [% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc |html %]</i> [% END %]
596                         [% 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 %]
597                 </td>
598                 <td>
599                     [% IF ( suggestions_loo.emailsuggestedby ) %]<a href="mailto:[% suggestions_loo.emailsuggestedby %]">[% END %][% suggestions_loo.surnamesuggestedby %][% IF ( suggestions_loo.firstnamesuggestedby ) %], [% suggestions_loo.firstnamesuggestedby %][% END %] [% IF (suggestions_loo.cardnumbersuggestedby ) %]([% suggestions_loo.cardnumbersuggestedby %])[% END %] [% IF ( suggestions_loo.emailsuggestedby ) %]</a>[% END %]
600                     [% IF ( suggestions_loo.suggesteddate ) %] - [% suggestions_loo.suggesteddate | $KohaDates %][% END %]
601                 </td>
602                 <td>
603                     [% IF ( suggestions_loo.emailmanagedby ) %]<a href="mailto:[% suggestions_loo.emailmanagedby %]">[% END %][% suggestions_loo.surnamemanagedby %][% IF ( suggestions_loo.firstnamemanagedby ) %], [% suggestions_loo.firstnamemanagedby %][% END %] [% IF ( suggestions_loo.emailmanagedby ) %]</a>[% END %]
604                     [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate | $KohaDates %][% END %]
605                 </td>
606                 <td>
607                     [% Branches.GetName( suggestions_loo.branchcode ) %]
608                 </td>
609                 <td>
610                     [% suggestions_loo.budget_name %]
611                 </td>
612                 <td>
613                     [% IF ( suggestions_loo.ASKED ) %]
614                         Pending
615                     [% ELSIF ( suggestions_loo.ACCEPTED ) %]
616                         Accepted
617                     [% ELSIF ( suggestions_loo.ORDERED ) %]
618                         Ordered
619                     [% ELSIF ( suggestions_loo.REJECTED ) %]
620                         Rejected
621                     [% ELSIF ( suggestions_loo.CHECKED ) %]
622                         Checked
623                     [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
624                         [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
625                     [% ELSE %]
626                         Status unknown
627                     [% END %]
628
629                     [% IF ( suggestions_loo.reason ) %]
630                         <br />([% suggestions_loo.reason %])
631                     [% END %]
632                 </td>
633         </tr>
634         [% END %]</tbody>
635         </table>  <fieldset>
636     <div id="select-reason[% suggestion.suggestiontype %]">
637         <div id="status[% suggestion.suggestiontype %]">
638             <label for="STATUS[% suggestion.suggestiontype %]">Mark selected as: </label>
639             <select name="STATUS" id="STATUS[% suggestion.suggestiontype %]">
640                 <option value=""> -- Choose a status --</option>
641
642                 [% IF (statusselected_ASKED ) %]
643                     <option value="ASKED" selected="selected">Pending</option>
644                 [% ELSE %]
645                     <option value="ASKED">Pending</option>
646                 [% END %]
647
648                 [% IF (statusselected_ACCEPTED ) %]
649                     <option value="ACCEPTED" selected="selected">Accepted</option>
650                 [% ELSE %]
651                     <option value="ACCEPTED">Accepted</option>
652                 [% END %]
653
654                 [% IF (statusselected_CHECKED ) %]
655                     <option value="CHECKED" selected="selected">Checked</option>
656                 [% ELSE %]
657                     <option value="CHECKED">Checked</option>
658                 [% END %]
659
660                 [% IF ( statusselected_REJECTED ) %]
661                     <option value="REJECTED" selected="selected">Rejected</option>
662                 [% ELSE %]
663                     <option value="REJECTED">Rejected</option>
664                 [% END %]
665
666                 [% FOREACH s IN SuggestionStatuses %]
667                     <option value="[% s.authorised_value %]">[% s.lib %]</option>
668                 [% END %]
669             </select>
670
671             <label for="reason[% suggestion.suggestiontype %]">with this reason:</label>
672             <select id="reason[% suggestion.suggestiontype %]" name="reason[% suggestion.suggestiontype %]">
673                 <option value=""> -- Choose a reason -- </option>
674                 [% FOREACH reasonsloo IN suggestion.reasonsloop %]
675                     <option value="[% reasonsloo.lib %]">[% reasonsloo.lib %]</option>
676                 [% END %]
677                 <option value="other">Others...</option>
678             </select>
679
680             <span id="other_reason[% suggestion.suggestiontype %]">
681                 <input type="text" size="31" id="select-other_reason[% suggestion.suggestiontype %]" name="other_reason[% suggestion.suggestiontype %]" placeholder="please note your reason here..." />
682                 <a href="#back[% suggestion.suggestiontype %]">Cancel</a>
683             </span>
684
685             <strong style="padding: 0 1em;">OR:</strong>
686
687             <label for="[% suggestion.suggestiontype %]delete">Delete selected</label>
688             <input type="checkbox" name="op" id="[% suggestion.suggestiontype %]delete" />
689         </div>
690     </div>
691
692     <input type="hidden" name="branchcode" value="[% branchfilter %]" />
693     <input type="hidden" name="tabcode" value="[% suggestion.suggestiontype %]" />
694     <input type="hidden" name="op" value="change" />
695 </fieldset>
696         <fieldset class="action">
697     <input type="submit" value="Submit" /></fieldset>
698 </form>
699 [% ELSE %]
700     <b>No results.</b>
701 [% END %]
702 </div>
703 [% END %]
704     </div>
705 [% END %]
706 </div>
707 </div>
708
709       [% UNLESS ( op_save ) %] [% UNLESS ( op == 'show' ) %]<div class="yui-b">
710 <form name="suggestionfilter" action="suggestion.pl" method="get">
711 <fieldset class="brief"><ol style="display:block;"><li><label for="displayby">Organize by: </label>
712                 <select name="displayby" id="displayby" style="width:auto;">
713                     [% IF ( displayby == "STATUS" ) %]
714                         <option value="STATUS" selected="selected">Status</option>
715                     [% ELSE %]
716                         <option value="STATUS">Status</option>
717                     [% END %]
718                     [% IF ( displayby == "branchcode" ) %]
719                         <option value="branchcode" selected="selected">Library</option>
720                     [% ELSE %]
721                         <option value="branchcode">Library</option>
722                     [% END %]
723                     [% IF ( displayby == "itemtype" ) %]
724                         <option value="itemtype" selected="selected">Item type</option>
725                     [% ELSE %]
726                         <option value="itemtype">Item type</option>
727                     [% END %]
728                     [% IF ( displayby == "managedby" ) %]
729                         <option value="managedby" selected="selected">Managed by</option>
730                     [% ELSE %]
731                         <option value="managedby">Managed by</option>
732                     [% END %]
733                     [% IF ( displayby == "acceptedby" ) %]
734                         <option value="acceptedby" selected="selected">Accepted by</option>
735                     [% ELSE %]
736                         <option value="acceptedby">Accepted by</option>
737                     [% END %]
738                 </select> <input type="submit" value="Go" /></li></ol></fieldset>
739 <h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4>
740                 <div style="display:block;" id="limits">
741
742                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Bibliographic information</a></h4>
743                    <ol> <li><label for="title"> Title:</label><input type="text" id="title" name="title" value="[% title |html %]" /></li>
744                     <li><label for="author"> Author:</label><input type="text" id="author" name="author" value="[% author | html %]" /></li>
745                     <li><label for="isbn"> ISBN:</label><input type="text" id="isbn"  name="isbn" value="[% isbn | html %]" /></li>
746                     <li><label for="publishercode"> Publisher:</label><input type="text" id="publishercode" name="publishercode" value="[% publishercode | html %]" /></li>
747                     <li><label for="copyrightdate_filter"> Copyright date:</label><input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate | html %]" /></li>
748                     <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>
749                 </fieldset>
750                                  <fieldset class="brief"><h4 class="local_collapse"><a href="#">Suggestion information</a></h4>
751                     <ol>
752                       <li>
753                           <label for="STATUS"> Status:</label>
754                           <select name="STATUS" id="STATUS">
755                               <option value="">Any</option>
756
757                               [% IF (statusselected_ASKED ) %]
758                                   <option value="ASKED" selected="selected">Pending</option>
759                               [% ELSE %]
760                                   <option value="ASKED">Pending</option>
761                               [% END %]
762
763                               [% IF (statusselected_ACCEPTED ) %]
764                                   <option value="ACCEPTED" selected="selected">Accepted</option>
765                               [% ELSE %]
766                                   <option value="ACCEPTED">Accepted</option>
767                               [% END %]
768
769                               [% IF (statusselected_CHECKED ) %]
770                                   <option value="CHECKED" selected="selected">Checked</option>
771                               [% ELSE %]
772                                   <option value="CHECKED">Checked</option>
773                               [% END %]
774
775                               [% IF ( statusselected_REJECTED ) %]
776                                   <option value="REJECTED" selected="selected">Rejected</option>
777                               [% ELSE %]
778                                   <option value="REJECTED">Rejected</option>
779                               [% END %]
780
781                               [% FOREACH s IN SuggestionStatuses %]
782                                   [% IF s.authorised_value == selected_status %]
783                                       <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
784                                   [% ELSE %]
785                                       <option value="[% s.authorised_value %]">[% s.lib %]</option>
786                                   [% END %]
787                               [% END %]
788                           </select>
789                       </li>
790
791                     <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
792 [% 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 %]
793                                                                      </select></li>
794                     <li>
795                         <label for="suggesteddate_from">Suggested date from:</label>
796                         <input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggesteddate_from %]" />
797                     </li>
798                     <li>
799                         <label for="suggesteddate_to">To:</label>
800                         <input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggesteddate_to %]" />
801                     </li>
802                     <li><label for="managedby"> Managed by:</label><select id="managedby" name="managedby"><option value="">Any</option>
803 [% 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 %]
804                                                                      </select></li>
805                     <li>
806                         <label for="manageddate_from">Management date from:</label>
807                         <input type="text" id="manageddate_from" size="10" name="manageddate_from" value="[% manageddate_from %]" />
808                     </li>
809                     <li>
810                         <label for="manageddate_to">To:</label>
811                         <input type="text" id="manageddate_to" size="10" name="manageddate_to" value="[% manageddate_to %]" />
812                     </li>
813                     <li><label for="acceptedby"> Accepted by:</label><select id="acceptedby" name="acceptedby"><option value="">Any</option>
814 [% 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 %]
815                                                       </select></li>
816                     <li>
817                         <label for="accepteddate_from">Accepted date from:</label>
818                         <input type="text" id="accepteddate_from" size="10" name="accepteddate_from" value="[% accepteddate_from %]" />
819                     </li>
820                     <li>
821                         <label for="accepteddate_to">To:</label>
822                         <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to %]" />
823                     </li>
824                     <li><input type="submit" value="Go" /></li></ol>
825                 </fieldset>
826
827                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Acquisition information</a></h4>
828                     <ol><li><label for="budgetid"> Book fund:</label>
829                     <select name="budgetid" id="budgetid">
830                       <option value="__ANY__">Any</option>
831                       [% IF budgetid == '__NONE__' %]
832                           <option value="__NONE__" selected="selected">None</option>
833                       [% ELSE %]
834                           <option value="__NONE__">None</option>
835                       [% END %]
836                     [% FOREACH budgetid_loo IN budgetid_loop %]
837                         [% 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 %]
838                         [% END %]
839                     </select></li>
840                     <li><label for="branchcode">Library:</label>
841                     <select name="branchcode" id="branchcode">
842                         <option value="__ANY__">Any</option>
843                         [% IF branchfilter %]
844                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
845                         [% ELSE %]
846                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
847                         [% END %]
848                     </select></li><li><input type="submit" value="Go" /></li></ol>
849                 </fieldset>
850     </div>
851             </form>
852         [% INCLUDE 'acquisitions-menu.inc' %]
853         </div>
854     [% END %]
855     [% END %]
856 </div>
857 [% END %]
858 [% INCLUDE 'intranet-bottom.inc' %]
859