Bug 19103: Fix Stored XSS in itemtypes.pl
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqbudgets.tt
1 [% USE AuthorisedValues %]
2 [% USE Branches %]
3 [% USE Price %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Administration &rsaquo; Funds[% IF op == 'add_form' %] &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 <script type="text/javascript">
8 //<![CDATA[
9 var MSG_BUDGET_PARENT_ALLOCATION = "- " + _("Fund amount exceeds parent allocation") + "\n";
10 var MSG_BUDGET_PERIOD_ALLOCATION = "- " + _("Fund amount exceeds period allocation") + "\n";
11 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") + "\n";
12 //]]>
13 </script>
14
15 <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
16 [% IF op == 'add_form' %]
17 <script type="text/javascript">
18 //<![CDATA[
19
20     function userPopup() {
21         window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=add",
22             'PatronPopup',
23             'width=740,height=450,location=yes,toolbar=no,'
24             + 'scrollbars=yes,resize=yes'
25         );
26     }
27
28     function ownerPopup() {
29         window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=select",
30             'PatronPopup',
31             'width=740,height=450,location=yes,toolbar=no,'
32             + 'scrollbars=yes,resize=yes'
33         );
34     }
35
36     function select_user(borrowernumber, borrower) {
37         ownerRemove();
38         var borrowername = borrower.firstname + ' ' + borrower.surname
39         if (borrowernumber) {
40             var ownerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
41                 + '?borrowernumber=' + borrowernumber + '">'
42                 + borrowername + '</a>';
43             $('#budget_owner_name').html(ownerlink);
44             $('#budget_owner_id').val(borrowernumber);
45         }
46     }
47
48     function ownerRemove() {
49         $('#budget_owner_name').empty();
50         $('#budget_owner_id').val('');
51     }
52
53     function add_user(borrowernumber, borrowername) {
54         var ids = $("#budget_users_id").val().split(':');
55         if(borrowernumber && ids.indexOf(borrowernumber) == -1) {
56             var li = '<li id="user_' + borrowernumber + '">'
57                 + '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber='
58                 + borrowernumber + '">' + borrowername + '</a> '
59                 + ' &bull; <a data-borrowernumber=" + borrowernumber +" class="del_user" href="#"><i class="fa fa-trash"></i> Remove</a> '
60                 + '</li>';
61             $("#budget_users").prepend(li);
62             ids.push(borrowernumber);
63             $("#budget_users_id").val(ids.join(':'));
64         } else {
65             return -1;
66         }
67         return 0;
68     }
69
70     function del_user(borrowernumber) {
71         var ids = $("#budget_users_id").val().split(':');
72         if (borrowernumber) {
73             var idx = ids.indexOf(borrowernumber+'');
74             if (idx != -1) {
75                 ids.splice(idx, 1);
76                 $("#budget_users_id").val(ids.join(':'));
77                 $("li#user_" + borrowernumber).remove();
78             }
79         }
80     }
81
82     function Check(f) {
83         var ok=1;
84         var _alertString="";
85         var alertString2;
86
87         if (!(isNotNull(f.budget_code,1))) {
88             _alertString += _("- Budget code cannot be blank") + "\n";
89         }
90
91         if (!(isNotNull(f.budget_name,1))) {
92             _alertString += _("- Budget name cannot be blank") + "\n";
93         }
94
95         if (!(isNotNull(f.budget_amount,1))) {
96             _alertString += _("- Budget amount cannot be blank") + "\n";
97         }
98
99         var budgetId;
100         if   (typeof(f.budget_id ) != "undefined")  {
101             budgetId = f.budget_id.value
102         }
103
104         var newBudgetParent;
105
106 //  hack to test if selected parent_id in scrolling-list...
107 //  if value == 'undef' its got a selected_parent :/
108         if(f.budget_parent_id){
109             var chkAdd   =  f.budget_parent_id.value ;
110             if  (     typeof(chkAdd ) != "undefined") {
111                 newBudgetParent  =  f.budget_parent_id.value
112             } else {
113                 newBudgetParent  =  f.budget_parent_id.item(0).value
114             }
115
116             if   (budgetId  > 0)  {  ; //its a mod ...
117                 // if parent == curent-budget, fail...
118                 if ( newBudgetParent  ==  budgetId     ) {
119                         _alertString += _("- Budget parent is current budget") + "\n";
120                 }
121
122                 else if (newBudgetParent) {
123                     var result = checkBudgetParent(  budgetId , newBudgetParent   );
124                     if (result) {
125                         _alertString += result;
126                     }
127                 }
128             }
129         }
130
131          // else do lookup
132         var budgetTotal = Math.abs(f.budget_amount.value);
133         var result =   budgetExceedsParent  (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value)
134         if (result) {
135             _alertString += result;
136         }
137
138         if (_alertString.length==0) {
139             document.Aform.submit();
140         } else {
141             alertString2 = _("Form not submitted because of the following problem(s)");
142             alertString2 += "\n------------------------------------------------------------------------------------\n\n";
143             alertString2 += _alertString;
144             alert(alertString2);
145         }
146     }
147     $(document).ready(function(){
148         $("#remove_owner").on("click",function(e){
149             e.preventDefault();
150             ownerRemove();
151         });
152         $("#edit_owner").on("click",function(e){
153             e.preventDefault();
154             ownerPopup();
155         });
156         $("body").on("click",".del_user",function(e){
157             e.preventDefault();
158             var borrowernumber = $(this).data("borrowernumber");
159             del_user(borrowernumber);
160         });
161         $("#add_user_button").on("click",function(e){
162             e.preventDefault();
163             userPopup();
164         });
165         $("#edit_fund").on("submit",function(e){
166             e.preventDefault();
167             Check(this);
168         });
169     });
170 //]]>
171 </script>
172 [% ELSIF op == 'list' %]
173     <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
174     [% INCLUDE 'datatables.inc' %]
175     <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" />
176     <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script>
177
178 <script type="text/javascript">
179 //<![CDATA[
180     //
181     $(document).ready(function() {
182
183
184         var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
185             "fnDrawCallback": function ( oSettings ) {
186                 if ( oSettings.aiDisplay.length == 0 )
187                 {
188                     return;
189                 }
190
191                 var nTrs = $('#budgeth tbody tr');
192                 var iColspan = nTrs[0].getElementsByTagName('td').length;
193                 var sLastGroup = "";
194                 for ( var i=0 ; i<nTrs.length ; i++ )
195                 {
196                     var iDisplayIndex = oSettings._iDisplayStart + i;
197                     var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1];
198                     if ( sGroup != sLastGroup )
199                     {
200                         var nGroup = document.createElement( 'tr' );
201                         var nCell = document.createElement( 'td' );
202                         nCell.colSpan = iColspan;
203                         nCell.className = "group";
204                         nCell.innerHTML = sGroup;
205                         nGroup.appendChild( nCell );
206                         nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
207                         sLastGroup = sGroup;
208                     }
209                 }
210             },
211             "footerCallback": function ( row, data, start, end, display ) {
212                 var api = this.api(), data;
213                 footer_column_sum( api, [ 4, 6, 8, 10 ], 2 );
214             },
215             "aoColumnDefs": [
216                 { "bVisible": false, "aTargets": [ 0, 1 ] },
217                 { "bSortable": false, "aTargets": ["_all"] }
218             ],
219             'dom': '<"top pager"ilpf>tr<"bottom pager"ip>',
220             'bSort': true,
221             'aaSortingFixed': [[ 1, 'asc' ]],
222             'bPaginate': false,
223             "bAutoWidth": false
224         }));
225
226         $(oTable).treetable({
227             expandable: true
228         });
229         $(oTable).treetable('expandAll');
230         $("#expand_all").click(function(e){
231             e.preventDefault();
232             $(oTable).treetable('expandAll');
233         });
234         $("#collapse_all").click(function(e){
235             e.preventDefault();
236             $(oTable).treetable('collapseAll');
237         });
238
239         [% UNLESS budget_period_id %]
240           $("#hide_inactive").click(function(e){
241             e.preventDefault();
242             oTable.fnFilter( 1, 0 ); // Show only active=1
243           });
244           $("#show_inactive").click(function(e){
245             e.preventDefault();
246             oTable.fnFilter( '', 0 );
247           });
248           $("#hide_inactive").click();
249         [% END %]
250         oTable.fnAddFilters("filter", 750);
251
252         $("#filterbutton").click(function() {
253             $("#fundfilters").slideToggle(0);
254         });
255
256         $(".deletefund-disabled").tooltip().on("click", function(e){
257             e.preventDefault();
258             alert(_("This fund has children. It cannot be deleted."));
259         });
260     });
261 //]]>
262 </script>
263 [% END %]
264
265 </head>
266 <body id="admin_aqbudgets" class="admin">
267 [% INCLUDE 'header.inc' %]
268 [% INCLUDE 'budgets-admin-search.inc' %]
269
270 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
271     <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo; [% IF op == 'list' %][% IF budget_period_id %]Funds for '[% budget_period_description %]'[% ELSE %]All funds[% END %][% END %]
272     [% IF op == 'add_form' %]
273       <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Funds</a> &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund[% END %]
274     [% END %]
275     [% IF op == 'delete_confirm' %]
276       <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> &rsaquo; Delete fund?
277     [% END %]
278 </div>
279
280 <div id="doc3" class="yui-t2">
281 <div id="bd">
282 <div id="yui-main">
283 <div class="yui-b" id="content">
284
285
286 [% UNLESS op == 'delete_confirm' %][% INCLUDE 'budgets-admin-toolbar.inc' %][% END %]
287
288 [% IF (error_not_authorised_to_modify) %]
289     <div class="error">
290         <p>You are not authorized to modify this fund</p>
291     </div>
292 [% END %]
293
294 [% IF op == 'list' %]
295
296 <h1>
297   [% IF budget_period_id %]
298     Funds for '[% budget_period_description %]'
299   [% ELSE %]
300     All funds
301   [% END %]
302 </h1>
303
304 [% INCLUDE 'budgets-active-currency.inc' %]
305
306 [% IF budgets %]
307
308 <table id="budgeth" class="group">
309     [% UNLESS budget_period_id %]
310       <caption>
311         <span class="actions"><a href="#" id="expand_all">Expand all</a>
312         | <a href="#" id="collapse_all">Collapse all</a>
313         | <a href="#" id="hide_inactive">Hide inactive budgets</a>
314         | <a href="#" id="show_inactive">Show inactive budgets</a></span>
315       </caption>
316     [% END %]
317     <thead>
318         <tr>
319             <th>Active</th>
320             <th>Budget period description</th>
321             <th>Fund code</th>
322             <th>Fund name</th>
323             <th>Base-level allocated</th>
324             <th>Base-level ordered</th>
325             <th>Total ordered</th>
326             <th>Base-level spent</th>
327             <th>Total spent</th>
328             <th>Base-level available</th>
329             <th>Total available</th>
330             <th>Actions</th>
331         </tr>
332     </thead>
333     <tfoot>
334     <tr>
335     <th></th>
336     <th></th>
337     <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF budget_period_total %][% budget_period_total | $Price %][% END %]  </th>
338     <th nowrap="nowrap" class="data"> [% period_alloc_total | $Price %]</th>
339     <th></th>
340     <th class="data">[% ordered_total | $Price %]</th>
341     <th></th>
342     <th class="data">[% spent_total | $Price %]</th>
343     <th></th>
344     <th class="data">[% available_total | $Price %]</th>
345     <th></th>
346     </tr>
347     </tfoot>
348     <tbody>
349     [% FOREACH budget IN budgets %]
350     [% IF budget.budget_parent_id %]
351       <tr data-tt-id="[% budget.budget_id %]" data-tt-parent-id="[% budget.budget_parent_id %]">
352     [% ELSE %]
353       <tr data-tt-id="[% budget.budget_id %]">
354     [% END %]
355     <td>[% budget.budget_period_active %]</td>
356     <td>Budget [% budget.budget_period_description %] [id=[% budget.budget_period_id %]][% UNLESS budget.budget_period_active %] (inactive)[% END %]</td>
357     <td>[% budget.budget_code %]</td>
358     <td>[% budget.budget_name %]</td>
359     <td class="data">
360       [% IF budget.budget_parent_id %]
361         <span class="child_fund_amount">[% budget.budget_amount | $Price %]</span>
362       [% ELSE %]
363         <span class="total_amount">[% budget.budget_amount | $Price %]</span>
364       [% END %]
365     </td>
366     <td class="data">
367       [% IF budget.budget_parent_id %]
368         <span class="child_fund_amount">[% budget.budget_ordered | $Price %]</span>
369       [% ELSE %]
370         <span class="total_amount">[% budget.budget_ordered | $Price %]</span>
371       [% END %]
372     </td>
373     <td class="data">
374       [% IF budget.budget_parent_id %]
375         <span class="child_fund_amount">[% budget.total_ordered | $Price %]</span>
376       [% ELSE %]
377         <span class="total_amount">[% budget.total_ordered | $Price %]</span>
378       [% END %]
379     </td>
380     <td class="data">
381       [% IF budget.budget_parent_id %]
382         <span class="child_fund_amount">[% budget.budget_spent | $Price %]</span>
383       [% ELSE %]
384         <span class="total_amount">[% budget.budget_spent | $Price %]</span>
385       [% END %]
386     </td>
387     <td class="data">
388       [% IF budget.budget_parent_id %]
389         <span class="child_fund_amount">[% budget.total_spent | $Price %]</span>
390       [% ELSE %]
391         <span class="total_amount">[% budget.total_spent | $Price %]</span>
392       [% END %]
393     </td>
394
395
396     [% BLOCK colorcellvalue %]
397         [% IF parent %]
398             [% IF (value > 0) %]
399                 <span class="child_fund_amount" style="color: green;">
400             [% ELSIF (value < 0) %]
401                 <span class="child_fund_amount" style="color: red;">
402             [% ELSE %]
403                 <span class="child_fund_amount">
404             [% END %]
405          [% ELSE %]
406             [% IF (value > 0) %]
407                 <span class="total_amount" style="color: green;">
408             [% ELSIF (value < 0) %]
409                 <span class="total_amount" style="color: red;">
410             [% ELSE %]
411                 <span class="totalamount">
412             [% END %]
413         [% END %]
414             [% value | $Price %]
415         </span>
416     [% END %]
417     <td class="data">
418         [% INCLUDE colorcellvalue value=budget.budget_remaining parent=budget.budget_parent_id %]
419     </td>
420     <td class="data">
421         [% INCLUDE colorcellvalue value=budget.total_remaining parent=budget.budget_parent_id %]
422     </td>
423     [% IF ( budget.budget_lock ) %]
424         <td> <span></span> </td>
425     [% ELSE %]
426         <td>
427             <div class="dropdown dropup">
428                 <a class="btn btn-default btn-xs dropdown-toggle" id="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]" role="button" data-toggle="dropdown" href="#">
429                    Actions <b class="caret"></b>
430                 </a>
431                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]">
432                     <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]"><i class="fa fa-pencil"></i> Edit</a></li>
433                     [% IF budget.budget_has_children %]
434                         <li class="disabled"><a href="#" class="deletefund-disabled" data-toggle="tooltip" data-placement="left" title="This fund has children"><i class="fa fa-trash"></i> Delete</a></li>
435                     [% ELSE %]
436                         <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&amp;budget_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]"><i class="fa fa-trash"></i> Delete</a></li>
437                     [% END %]
438                     <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_parent_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]"><i class="fa fa-plus"></i> Add child fund</a></li>
439                 </ul>
440             </div>
441         </td>
442     [% END %]
443     </tr>
444     [% END %]
445     </tbody>
446 </table>
447
448 [% ELSE %]
449     <p>No fund found</p>
450 [% END %]
451
452 [% END %] <!-- list -->
453
454 <!-- ********************************************************************************************** -->
455 <!-- create add/mod entry form -->
456 [% IF op == 'add_form' && !error_not_authorised_to_modify %]
457 <form action="/cgi-bin/koha/admin/aqbudgets.pl" id="edit_fund" name="Aform" method="post">
458     <fieldset class="rows">
459     <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
460     [% IF ( budget_period_description ) %]
461         [% budget_name %] for Budget '[% budget_period_description %]'
462     [% END %]
463     </legend>
464
465     <input type="hidden" name="op" value="add_validate" />
466     <input type="hidden" name="checked" value="0" />
467     <ol>
468     [% IF ( budget_parent_id ) %]
469     <li>
470         <span class="label">Fund parent: </span>
471         [% budget_parent_name %]
472         [% budget_parent_id %] - [% budget_parent_name %]
473         <input type="hidden" name="budget_parent_id" value="[% budget_parent_id %]" />
474     </li>
475     [% END %]
476     <li>
477     <label class="required"  for="budget_code">Fund code: </label>
478     <input type="text" name="budget_code" id="budget_code" value="[% budget_code %]" size="30" />
479     </li>
480
481     <li>
482     <label class="required" for="budget_name">Fund name: </label>
483     <input type="text" name="budget_name" id="budget_name" value="[% budget_name %]" size="60" />
484     </li>
485
486     <li>
487     <label style="white-space: nowrap;" for="budget_amount" class="required">Amount: </label>
488     <input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount | $Price on_editing => 1 %]" size="8" />
489     </li>
490
491     <li>
492       <label for="budget_encumb">Warning at (%): </label>
493       <input type="text" name="budget_encumb" id="budget_encumb" value="[% budget_encumb %]" size="10" />
494       <span class="hint">0 to disable</span>
495     </li>
496
497     <li>
498       <label for="budget_expend">Warning at (amount): </label>
499       <input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend | $Price on_editing => 1 %]" size="10" />
500       <span class="hint">0 to disable</span>
501     </li>
502
503     <li>
504         <span class="label">Owner: </span>
505         [% IF ( budget_owner_name ) %]
506             <span  id="budget_owner_name">
507                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budget_owner_id %]">
508                     [% budget_owner_name %]
509                 </a> |
510             </span>
511         [% END %]
512         <a id="edit_owner" class="new_window" href="#"><i class="fa fa-search"></i> Select owner</a>
513         <a id="remove_owner" href="#"><i class="fa fa-trash"></i> Remove owner</a>
514         <input type="hidden" name="budget_owner_id" id="budget_owner_id"
515             value="[% budget_owner_id %]" />
516     </li>
517
518
519     [% IF budget_has_children %]
520         <li class="radio">
521             <label>
522                 <input type="checkbox" id="set_owner_to_children" name="set_owner_to_children" value="1" />
523                 Update all child funds with this owner
524             </label>
525             <span class="hint">Selecting this option will overwrite existing fund owners, if any</span>
526         </li>
527     [% END %]
528
529     <li>
530         <span class="label">Users:</span>
531         <ul style="float:left;" id="budget_users">
532             [% FOREACH user IN budget_users %]
533                 <li id="user_[% user.borrowernumber %]">
534                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% user.borrowernumber %]">
535                         [% user.firstname %] [% user.surname %]
536                     </a>
537                     &bull; <a href="#" class="del_user" data-borrowernumber="[% user.borrowernumber %]"><i class="fa fa-trash"></i> Remove</a>
538                 </li>
539             [% END %]
540             <li><a href="#" id="add_user_button"><i class="fa fa-plus"></i> Add users</a></li>
541         </ul>
542         <input type="hidden" name="budget_users_ids" id="budget_users_id" value="[% budget_users_ids %]" />
543     </li>
544     <li>
545     <label for="budget_branchcode">Library: </label>
546     <select name="budget_branchcode" id="budget_branchcode">
547         <option value=""></option>
548         [% PROCESS options_for_libraries libraries => Branches.all( selected => budget_branchcode, unfiltered => 1 ) %]
549     </select>
550     </li>
551
552     <li>
553     <label for="budget_permission">Restrict access to: </label>
554     <select name="budget_permission" id="budget_permission">
555         [% IF ( budget_perm_0 ) %]
556             <option value="0" selected="selected">
557         [% ELSE %]
558             <option value="0">
559         [% END %]
560             None
561         </option>
562
563         [% IF ( budget_perm_1 ) %]
564             <option value="1" selected="selected">
565         [% ELSE %]
566             <option value="1">
567         [% END %]
568             Owner
569         </option>
570
571         [% IF ( budget_perm_3) %]
572             <option value="3" selected="selected">
573         [% ELSE %]
574             <option value="3">
575         [% END %]
576             Owner and users
577         </option>
578
579         [% IF ( budget_perm_2 ) %]
580             <option value="2" selected="selected">
581         [% ELSE %]
582             <option value="2">
583         [% END %]
584             Owner, users and library
585         </option>
586     </select>
587     </li>
588
589     <li>
590     <label for="budget_notes">Notes: </label>
591     <textarea name="budget_notes" id="budget_notes"  cols="80" rows="6">[% budget_notes %]</textarea>
592     </li>
593
594     <li>
595     <label  style="white-space: nowrap;" for="authorised_value_category1">Statistic 1 done on: </label>
596         <select name="sort1_authcat" id="authorised_value_category1">
597             <option value=""></option>
598             [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => sort1_authcat ) %]
599         </select>
600     </li>
601     <li>
602     <label  style="white-space: nowrap;" for="authorised_value_category2">Statistic 2 done on: </label>
603         <select name="sort2_authcat" id="authorised_value_category2">
604             <option value=""></option>
605             [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => sort2_authcat ) %]
606         </select>
607     </li>
608     </ol>
609
610     [% IF ( budget_id ) %]
611         <input type="hidden" name="budget_id" value="[% budget_id %]" />
612     [% END %]
613     </fieldset>
614
615     <fieldset class="action">
616         <input type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl">Cancel</a>
617         <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
618     </fieldset>
619 </form>
620
621 [% END %] <!-- add_form -->
622
623 [% IF op == 'delete_confirm' %]
624     <div class="dialog alert">
625         <h3>Delete fund [% budget_name %]?</h3>
626         If you delete this fund, all orders linked to this fund will be deleted!
627         <table>
628             <tr>
629             <th scope="row">Fund amount:</th>
630             <td>[% budget_amount | $Price %]</td>
631             </tr>
632         </table>
633
634         <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="post">
635             <input type="hidden" name="op" value="delete_confirmed" />
636             <input type="hidden" name="budget_id" value="[% budget_id %]" />
637             <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
638             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this fund</button>
639         </form>
640         <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
641             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
642         </form>
643     </div>
644 [% END %]
645
646 </div>
647 </div>
648 <div class="yui-b">
649 [% IF op == 'list' %]
650   <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
651     <a href="#" id="filterbutton">Filters</a>
652     <fieldset class="brief" id="fundfilters">
653     <h4>Fund filters</h4>
654         <ol>
655         <li>
656             <label for="filter_budgetbranch2">Library: </label>
657             <select name="filter_budgetbranch" id="filter_budgetbranch2" style="width:10em;">
658                 <option value=""></option>
659                 [% PROCESS options_for_libraries libraries => Branches.all( selected => budget_branchcode, unfiltered => 1 ) %]
660             </select>
661         </li>
662         <li class="radio">
663
664         <label for="show_mine">Show my funds only:</label>
665             [% IF ( show_mine ) %]
666                 <input type="checkbox" id="show_mine"  name="show_mine" value="1" checked="checked" />
667             [% ELSE %]
668                 <input type="checkbox" id="show_mine"  name="show_mine" value="1" />
669         [% END %]
670         </li>
671
672         [% IF periods %]
673           <li>
674             <label for="periods">Budget:</label>
675             <select id="periods" name="budget_period_id">
676               <option value="">All budgets</option>
677               [% FOR period IN periods %]
678                 [% IF budget_period_id && period.budget_period_id == budget_period_id %]
679                   <option value="[% period.budget_period_id %]" selected="selected">[% period.budget_period_description %]</option>
680                 [% ELSE %]
681                   <option value="[% period.budget_period_id %]">[% period.budget_period_description %]</option>
682                 [% END %]
683               [% END %]
684             </select>
685           </li>
686         [% END %]
687         </ol>
688
689         <input type="hidden" name="op" value="list" />
690         <input type="submit" class="submit" name="filter" value="Go" />
691     </fieldset>
692 </form>[% END %]
693 [% INCLUDE 'acquisitions-menu.inc' %]
694 </div>
695 </div>
696 [% INCLUDE 'intranet-bottom.inc' %]