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