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