Bug 34913: DataTables upgrade: Update CSS and option names
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqbudgetperiods.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Price %]
5 [% PROCESS 'i18n.inc' %]
6 [% SET footerjs = 1 %]
7 [%- BLOCK action_menu %]
8     <div class="btn-group dropup">
9         <a class="btn btn-default btn-xs dropdown-toggle" id="budgetmenu_[% block_budget.budget_period_id | html %]" role="button" data-toggle="dropdown" href="#">
10            Actions <b class="caret"></b>
11         </a>
12         <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetmenu_[% block_budget.budget_period_id | html %]">
13               <li>
14                   <a href="[% script_name | url %]?op=add_form&amp;budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
15               </li>
16               [% IF block_budget.count %]
17                   <li class="disabled">
18                       <a data-toggle="tooltip" data-placement="left" title="[% block_budget.count | html %] fund(s) are attached to this budget. You must delete all attached funds before deleting this budget." href="#"><i class="fa fa-trash-can"></i> Delete</a>
19                   </li>
20               [% ELSE %]
21                   <li>
22                       <a href="[% script_name | url %]?op=delete_confirm&amp;budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa fa-trash-can"></i> Delete</a>
23                   </li>
24               [% END %]
25               <li>
26                   <a href="[% script_name | url %]?op=duplicate_form&amp;budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa fa-copy"></i> Duplicate</a>
27               </li>
28               <li>
29                   <a href="[% script_name | url %]?op=close_form&amp;budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa fa-times-circle"></i> Close</a>
30               </li>
31             [% IF ( block_budget.budget_period_locked ) %]
32                 <li class="disabled">
33                     <a data-toggle="tooltip" data-placement="left" title="Budget is locked" href="#"><i class="fa fa-plus"></i> Add fund</a>
34                 </li>
35             [% ELSE %]
36                 <li>
37                     <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa fa-plus"></i> Add fund</a>
38                 </li>
39             [% END %]
40         </ul>
41     </div>
42 [% END -%]
43
44 [% INCLUDE 'doc-head-open.inc' %]
45 [% INCLUDE 'doc-head-close.inc' %]
46 [% IF close_form %]
47     [% Asset.css("lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css") | $raw %]
48 [% END %]
49
50 <title>[% FILTER collapse %]
51     [% IF ( add_form ) %]
52         [% IF ( budget_period_id ) %]
53             [% tx("Modify budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]
54         [% ELSE %]
55             [% t("New budget") | html %]
56         [% END %] &rsaquo;
57     [% END %]
58     [% IF ( duplicate_form ) %]
59         [% t("Duplicate budget") | html %] &rsaquo;
60     [% END %]
61     [% IF ( delete_confirm ) %]
62         [% IF ( total || funds_exist ) %]
63             [% tx("Cannot delete budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %] &rsaquo;
64         [% ELSE %]
65             [% tx("Confirm deletion of budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %] &rsaquo;
66         [% END %]
67     [% END %]
68     [% IF close_form %]
69         [% tx("Close budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %] &rsaquo;
70     [% END %]
71     [% IF closed %]
72         [% tx("Budget '{budget_period_description}' closed", { budget_period_description = budget_period_description }) | html %] &rsaquo;
73     [% END %]
74     [% t("Budgets") | html %] &rsaquo;
75     [% t("Administration") | html %] &rsaquo;
76     [% t("Koha") | html %]
77 [% END %]</title>
78 </head>
79
80 <body id="admin_aqbudgetperiods" class="admin">
81
82 [% WRAPPER 'header.inc' %]
83     [% INCLUDE 'budgets-admin-search.inc' %]
84 [% END %]
85
86 [% WRAPPER 'sub-header.inc' %]
87     [% WRAPPER breadcrumbs %]
88         [% WRAPPER breadcrumb_item %]
89             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
90         [% END %]
91
92         [% IF ( else ) %]
93             [% WRAPPER breadcrumb_item bc_active= 1 %]
94                 <span>Budgets</span>
95             [% END %]
96         [% ELSE %]
97             [% WRAPPER breadcrumb_item %]
98                 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
99             [% END %]
100         [% END %]
101
102         [% IF ( add_form ) %]
103             [% IF ( budget_period_id ) %]
104                 [% WRAPPER breadcrumb_item bc_active= 1 %]
105                     [% tx("Modify budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]
106                 [% END %]
107             [% ELSE %]
108                 [% WRAPPER breadcrumb_item bc_active= 1 %]
109                     <span>New budget</span>
110                 [% END %]
111             [% END %]
112         [% END %]
113
114         [% IF ( delete_confirm ) %]
115             [% IF ( total || funds_exist ) %]
116                 [% WRAPPER breadcrumb_item bc_active= 1 %]
117                     [% tx("Cannot delete budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]
118                 [% END %]
119             [% ELSE %]
120                 [% WRAPPER breadcrumb_item bc_active= 1 %]
121                     [% tx("Confirm deletion of budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]
122                 [% END %]
123             [% END %]
124         [% END %]
125
126             [% IF ( duplicate_form ) %]
127                 [% WRAPPER breadcrumb_item bc_active= 1 %]
128                     <span>Duplicate budget</span>
129                 [% END %]
130             [% END %]
131
132         [% IF close_form %]
133             [% WRAPPER breadcrumb_item bc_active= 1 %]
134                 [% tx("Close budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]
135             [% END %]
136         [% END %]
137
138         [% IF closed %]
139             [% WRAPPER breadcrumb_item bc_active= 1 %]
140                 [% tx("Budget '{budget_period_description}' closed", { budget_period_description = budget_period_description }) | html %]
141             [% END %]
142         [% END %]
143     [% END #/ WRAPPER breadcrumbs %]
144 [% END #/ WRAPPER sub-header.inc %]
145
146 <div class="main container-fluid">
147     <div class="row">
148         <div class="col-sm-10 col-sm-push-2">
149             <main>
150
151 [% UNLESS close_form OR closed OR duplicate_form %]
152   [% INCLUDE 'budgets-admin-toolbar.inc' %]
153 [% END %]
154
155 [% IF ( duplicate_form ) %]
156 <h1>Duplicate budget</h1>
157 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
158     <fieldset class="rows">
159     <input type="hidden" name="op" value="duplicate_budget" />
160     <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
161
162     <ol>
163
164     <li>
165     <label class="required" for="from">Start date: </label>
166     <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | html %]" class="flatpickr" data-date_to="to" />
167         <span class="required">Required</span>
168         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
169     </li>
170     <li>
171
172     <label class="required" for="to">End date: </label>
173     <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | html %]" class="flatpickr" />
174         <span class="required">Required</span>
175         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
176     </li>
177
178     <li>
179     <label class="required" for="budget_period_description">Description</label>
180     <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description | html %]" />
181         <span class="required">Required</span>
182     </li>
183
184     <li>
185       <label for="amount_change_percentage">Change amounts by</label>
186       <input type="text" id="amount_change_percentage" name="amount_change_percentage" /> %
187       <div class="hint">(can be positive or negative)</div>
188     </li>
189
190     <li>
191       <label for="amount_change_round_increment">If amounts changed, round to a multiple of</label>
192       <input type="text" id="amount_change_round_increment" name="amount_change_round_increment" />
193       <div class="hint">(amounts will be rounded down)</div>
194     </li>
195
196     <li>
197       <label for="mark_as_inactive">Mark the original budget as inactive</label>
198       <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
199     </li>
200
201     <li>
202       <label for="reset_all_budgets">Set all funds to zero</label>
203       <input type="checkbox" id="reset_all_budgets" name="reset_all_budgets" />
204     </li>
205
206     </ol>
207     </fieldset>
208
209     <fieldset class="action">
210         <input type="submit" class="btn btn-primary" value="Save" />
211         <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">Cancel</a>
212     </fieldset>
213
214 </form>
215
216 [% END %]
217
218 [% IF ( add_form ) %]
219     <!--  add or modify a budget period   -->
220
221     [% IF ( budget_period_id ) %]
222         <h1>[% tx("Modify budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]</h1>
223     [% ELSE %]
224         <h1>New budget</h1>
225         [% END %]
226 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
227     <fieldset class="rows">
228     <!-- ################################################################################# -->
229     <!-- display information about the budget period that must be added or modified -->
230     <!-- ################################################################################# -->
231     <input type="hidden" name="op" value="add_validate" />
232     <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
233     <ol>
234     <li>
235     <label class="required" for="from">Start date: </label>
236     <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | html %]" class="flatpickr" data-date_to="to" />
237         <span class="required">Required</span>
238         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
239     </li>
240     <li>
241
242     <label class="required" for="to">End date: </label>
243     <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | html %]" class="flatpickr" />
244         <span class="required">Required</span>
245         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
246     </li>
247
248     <li>
249         <!-- DESCRIPTION -->
250         <!-- ############################## -->
251         <label class="required" for="budget_period_description">Description: </label>
252         <input type="text" id="budget_period_description" name="budget_period_description"
253         size="48" maxlength="80" value="[% budget_period_description | html %]" />
254             <span class="required">Required</span>
255     </li>
256
257     <li>
258         <!-- TOTAL -->
259         <!-- ############################## -->
260         <label for="budget_period_total">Total amount: </label>
261         <input type="text" id="budget_period_total" name="budget_period_total"
262         size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" />
263     </li>
264
265     <li>
266         <!-- ACTIVE -->
267         <!-- ############################## -->
268         <label for="budget_period_active">Make budget active: </label>
269         [% IF ( budget_period_active ) %]<input type="checkbox" checked="checked" id="budget_period_active" name="budget_period_active" value="1" />[% ELSE %]  <input type="checkbox" id="budget_period_active" name="budget_period_active" value="1"/> [% END %]
270     </li>
271
272     <li>
273         <!-- LOCK  -->
274         <!-- ############################## -->
275         <label for="budget_period_locked">Lock budget: </label>
276         [% IF ( budget_period_locked ) %]<input type="checkbox" checked="checked" id="budget_period_locked" name="budget_period_locked" value="1" />[% ELSE %]  <input type="checkbox" id="budget_period_locked" name="budget_period_locked" value="1"/> [% END %]
277     </li>
278     </ol>
279     </fieldset>
280
281     <fieldset class="action">
282         <!-- "save changes" button -->
283         <!-- ###################################### -->
284         <input type="submit" class="btn btn-primary" value="Save" />
285         [% IF ( budget_period_id ) %]
286             <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]" class="cancel">Cancel</a>
287         [% ELSE %]
288             <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl" class="cancel">Cancel</a>
289         [% END %]
290     </fieldset>
291
292 </form>
293
294 [% END %]
295
296 <!-- ####################################################################### -->
297 <!-- delete a budget period -->
298 <!-- ####################################################################### -->
299
300 [% IF ( delete_confirm ) %]
301     [% IF ( total ) %]
302         <div class="dialog message">
303         <h1>Cannot delete budget</h1>
304         <p><strong>This record is used [% total | html %] times</strong>.
305         Deletion is not possible.</p>
306     [% ELSIF ( funds_exist ) %]
307         <div class="dialog message">
308         <h1>Cannot delete budget</h1>
309         <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p>
310     [% ELSE %]
311         <div class="dialog alert">
312         <h1>[% tx("Confirm deletion of budget '{budget_period_description}'?", { budget_period_description = budget_period_description }) | html %]</h1>
313
314     <!-- ############################################################# -->
315     <!-- "delete" and "cancel" buttons    -->
316     <!-- ############################################################# -->
317
318     <form action="[% script_name | html %]" method="post">
319         <input type="hidden" name="op" value="delete_confirmed" />
320         <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
321         <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
322     </form>
323     <form action="[% script_name | html %]" method="post">
324         <button type="submit" class="deny"><i class="fa fa-fw fa-times"></i> No, do not delete</button>
325     </form>
326     [% END %]
327
328     </div>
329 [% END %]
330
331 [% IF close_form %]
332 <h1>[% tx("Close budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]</h1>
333     [% IF budget_periods.size == 0 %]
334         <div class="dialog alert">
335             <p>You cannot move funds of this budget, there is no active budget.</p>
336             <p>Please create a new active budget and retry.</p>
337             <a class="btn btn-default" href="/cgi-bin/koha/admin/aqbudgetperiods.pl"><i class="fa fa-fw fa-arrow-left"></i> Return to budgets</a>
338         </div>
339     [% ELSIF number_of_unreceived_orders == 0 %]
340         <div class="dialog message">
341             <h2>Cannot close budget</h2>
342             <p>There are no unreceived orders for this budget.</p>
343             <a class="btn btn-default"  href="/cgi-bin/koha/admin/aqbudgetperiods.pl"><i class="fa fa-fw fa-arrow-left"></i> Return to budgets</a>
344         </div>
345     [% ELSE %]
346     <div class="page-section">
347         <h3>The unreceived orders from the following funds will be moved</h3>
348           Fund list of budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">[% budget_period_description | html %]</a>:
349         <table id="budgeth">
350           <thead>
351             <tr>
352                 <th>Fund ID</th>
353                 <th>Fund code</th>
354                 <th>Fund name</th>
355                 <th>Unreceived orders</th>
356             </tr>
357           </thead>
358           <tbody>
359             [% FOREACH budget IN budgets_to_move %]
360               <tr>
361                 <td>[% budget.budget_id | html %]</td>
362                 <td>[% budget.budget_code | html %]</td>
363                 <td>[% budget.budget_name | html %]</td>
364                 <td>[% budget.unreceived_orders.size | html %]</td>
365               </tr>
366             [% END %]
367           </tbody>
368         </table>
369         <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post" id="move_form">
370           <fieldset class="rows">
371             <ol>
372               <li>
373                 <label class="required" for="to_budget_period_id">Select a budget</label>
374                 <select name="to_budget_period_id" id="to_budget_period_id" required="required">
375                   <option value=""></option>
376                   [% FOR budget_period IN budget_periods %]
377                     <option value="[% budget_period.budget_period_id | html %]">[% budget_period.budget_period_description | html %]</option>
378                   [% END %]
379                 </select>
380               </li>
381               <li>
382               <label for="move_remaining_unspent">Move remaining unspent funds</label>
383                 <input type="checkbox" name="move_remaining_unspent" id="move_remaining_unspent" />
384               </li>
385             </ol>
386           </fieldset>
387           <fieldset class="action">
388               <input type="hidden" name="op" value="close_confirmed" />
389               <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
390               <input type="submit" class="btn btn-primary" value="Move unreceived orders" />
391               <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Cancel</a>
392           </fieldset>
393         </form>
394     </div><!-- /.page-section -->
395   [% END %]
396 [% ELSIF closed %]
397     <h1>[% tx("Budget '{budget_period_description}' closed", { budget_period_description = budget_period_description }) | html %]</h1>
398
399     <div class="page-section">
400         <h3>Report after moving unreceived orders from budget [% from_budget_period.budget_period_description | html %] ([% from_budget_period.budget_period_startdate | $KohaDates %] - [% from_budget_period.budget_period_enddate | $KohaDates %]) to [% to_budget_period.budget_period_description | html %] ([% to_budget_period.budget_period_startdate | $KohaDates %] - [% to_budget_period.budget_period_enddate | $KohaDates%])</h3>
401
402         <table id="closed_report">
403         <thead>
404           <tr>
405             <td>Budget id</td>
406             <td>Basket</td>
407             <td>Ordernumber</td>
408             <td>Details</td>
409           </tr>
410         </thead>
411         <tbody>
412           [% FOR r IN report %]
413               [% IF r.moved %]
414                 [% IF r.orders_moved.size > 0 %]
415                   [% FOR order IN r.orders_moved %]
416                     <tr>
417                       <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %]) Amount=[% r.budget.budget_amount | $Price %][% IF r.unspent_moved %] ([% r.unspent_moved | $Price %] remaining has been moved)[% END %]</td>
418                       <td>[% order.basketname | html %]</td>
419                       <td>[% order.ordernumber | html %]</td>
420                       <td>Moved!</td>
421                     </tr>
422                   [% END %]
423                 [% ELSE %]
424                   <tr>
425                     <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %])</td>
426                     <td></td>
427                     <td></td>
428                     <td>There were no unreceived orders for this fund.</td>
429                   </tr>
430                 [% END %]
431               [% ELSE %]
432                 [% IF r.error == 'budget_code_not_exists' %]
433                   <tr>
434                     <td>[% r.budget.budget_id | html %] [% r.budget.budget_amount | $Price %][% IF r.unspent_moved %] ([% r.unspent_moved | $Price %] remaining has been moved)[% END %]</td>
435                     <td></td>
436                     <td></td>
437                     <td>This fund code does not exist in the destination budget.</td>
438                   </tr>
439                 [% END %]
440               [% END %]
441             </tr>
442           [% END %]
443         </tbody>
444         </table>
445         <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
446     </div>
447 [% END %]
448
449 <!--  DEFAULT  display budget periods list -->
450 [% IF ( else ) %]
451   <h1>Budgets</h1>
452
453     [% IF ( failed_delete_funds_exist ) %]
454         <div class="dialog message">Failed to delete budget because funds exist.</div>
455     [% END %]
456
457     [% INCLUDE 'budgets-active-currency.inc' %]
458
459     [% WRAPPER tabs id= "budgetsTabs" %]
460
461         [% WRAPPER tabs_nav %]
462             [% WRAPPER tab_item tabname= "active" bt_active= 1 %] <span>Active budgets</span> [% END %]
463             [% WRAPPER tab_item tabname= "inactive" %] <span>Inactive budgets</span> [% END %]
464         [% END # /WRAPPER tabs_nav %]
465
466         [% WRAPPER tab_panels %]
467             [% WRAPPER tab_panel tabname="active" bt_active= 1 %]
468                 [% IF ( period_active_loop ) %]
469                     <table id="activeperiodst">
470                         <thead>
471                             <tr>
472                                 <th>Budget name</th>
473                                 <th>Start date</th>
474                                 <th>End date</th>
475                                 <th>Locked</th>
476                                 <th>Total</th>
477                                 <th class="noExport">Actions</th>
478                             </tr>
479                         </thead>
480                         <tbody>
481                             [% FOREACH period_active IN period_active_loop %]
482                                 <tr>
483                                     <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_active.budget_period_id | uri %]" title="View funds for [% period_active.budget_period_description | html %]">[% period_active.budget_period_description | html %]</a></td>
484                                     <td data-order="[% period_active.budget_period_startdate | html %]">[% period_active.budget_period_startdate | $KohaDates %]</td>
485                                     <td data-order="[% period_active.budget_period_enddate | html %]">[% period_active.budget_period_enddate | $KohaDates %]</td>
486                                     <td>
487                                         [% IF ( period_active.budget_period_locked ) %]
488                                             <i class="fa fa-lock"></i> Locked</span>
489                                         [% END %]
490                                     </td>
491                                     <td class="data">[% period_active.budget_period_total | $Price %]</td>
492                                     <td>
493                                         [% PROCESS action_menu block_budget=period_active %]
494                                     </td>
495                                 </tr>
496                             [% END # /FOREACH period_active %]
497                         </tbody>
498                     </table> <!-- /#activeperiodst -->
499                 [% ELSE %]
500                     <span>No active budgets</span>
501                 [% END # /IF period_active_loop %]
502             [% END # /WRAPPER tab_panel#active %]
503
504             [% WRAPPER tab_panel tabname="inactive" %]
505                 [% IF ( period_inactive_loop ) %]
506                     <table id="inactiveperiodst">
507                         <thead>
508                             <tr>
509                                 <th>Budget name</th>
510                                 <th>Start date</th>
511                                 <th>End date</th>
512                                 <th>Locked</th>
513                                 <th>Total</th>
514                                 <th class="noExport">Actions</th>
515                             </tr>
516                         </thead>
517                         <tbody>
518                             [% FOREACH period_loo IN period_inactive_loop %]
519                                 <tr>
520                                     <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_loo.budget_period_id | uri %]" title="View funds for [% period_loo.budget_period_description | html %]">[% period_loo.budget_period_description | html %]</a></td>
521                                     <td data-order="[% period_loo.budget_period_startdate | html %]">[% period_loo.budget_period_startdate | $KohaDates %]</td>
522                                     <td data-order="[% period_loo.budget_period_enddate | html %]">[% period_loo.budget_period_enddate | $KohaDates %]</td>
523                                     <td>[% IF ( period_loo.budget_period_locked ) %]<i class="fa fa-lock"></i> Locked[% END %]</td>
524                                     <td class="data">[% period_loo.budget_period_total | $Price %]</td>
525                                     <td>
526                                             [% PROCESS action_menu block_budget=period_loo %]
527                                     </td>
528                                 </tr>
529                             [% END # /FOREACH period_loo %]
530                         </tbody>
531                     </table> <!-- /#inactiveperiodst -->
532                 [% ELSE %]
533                     <span>No inactive budgets</span>
534                 [% END # /IF inactiveperiodst %]
535             [% END # /WRAPPER tab_panel#inactive %]
536         [% END # /WRAPPER tab_panels %]
537     [% END # /WRAPPER tabs %]
538
539 [% END # /IF else %]
540
541             </main>
542         </div> <!-- /.col-sm-10.col-sm-push-2 -->
543
544         <div class="col-sm-2 col-sm-pull-10">
545             <aside>
546                 [% INCLUDE 'acquisitions-menu.inc' %]
547             </aside>
548         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
549      </div> <!-- /.row -->
550
551 [% MACRO jsinclude BLOCK %]
552     [% INCLUDE 'calendar.inc' %]
553     [% INCLUDE 'datatables.inc' %]
554     [% IF close_form %]
555         [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
556     [% END %]
557     [% Asset.js("js/acq.js") | $raw %]
558     <script>
559         $(document).ready(function() {
560             [% IF ( tab ) %]
561                 $("#budgetsTabs li:eq([% tab | html %]) a").tab("show");
562             [% END %]
563
564             $('[data-toggle="tooltip"]').tooltip();
565
566             $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
567                 "columnDefs": [
568                     { "targets": [ -1 ], "orderable": false, "searchable":  false },
569                 ],
570                 "pagingType": "full",
571                 "autoWidth": false
572             } ) );
573
574             [% IF close_form %]
575               $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
576                 "dom": "t"
577               }));
578               $("#move_form").submit(function(){
579                 var budget_from = "[% budget_period_description | html %]";
580                 var budget_to = $("#to_budget_period_id").find("option:selected").html();
581                 var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
582                 alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
583                 return confirm ( alert_message );
584               });
585             [% END %]
586             [% IF closed %]
587               var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
588                 // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
589                 "drawCallback": function ( oSettings ) {
590                     if ( oSettings.aiDisplay.length == 0 )
591                     {
592                         return;
593                     }
594
595                     var nTrs = $('#closed_report tbody tr');
596                     var iColspan = nTrs[1].getElementsByTagName('td').length;
597                     var sLastGroup = "";
598                     for ( var i=0 ; i<nTrs.length ; i++ )
599                     {
600                         var iDisplayIndex = oSettings._iDisplayStart + i;
601                         var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
602                         if ( sGroup != sLastGroup )
603                         {
604                             var nGroup = document.createElement( 'tr' );
605                             var nCell = document.createElement( 'td' );
606                             nCell.colSpan = iColspan;
607                             nCell.className = "group";
608                             nCell.innerHTML = sGroup;
609                             nGroup.appendChild( nCell );
610                             nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
611                             sLastGroup = sGroup;
612                         }
613                     }
614                 },
615                 "columnDefs": [
616                     { "visible": false, "targets": [ 0, 1 ] },
617                     { "orderable": false, "targets": ["_all"] }
618                 ],
619                 "ordering": true,
620                 "orderFixed": [[ 1, 'asc' ]],
621                 "autoWidth": false,
622                 "pagingType": "full_numbers"
623               }));
624             [% END %]
625             $("#add_modify_budget").validate({
626                 rules: {
627                     budget_period_startdate: "required",
628                     budget_period_enddate: {
629                         required: true,
630                         date_on_or_after: "#from"
631                     },
632                     budget_period_description: "required",
633                     budget_period_total: {
634                         number: true
635                     }
636                 },
637                 messages: {
638                     budget_period_enddate: {
639                         date_on_or_after: _("Budget end date must be on or after budget start date")
640                     }
641                 }
642             });
643         });
644     </script>
645 [% END %]
646 [% INCLUDE 'intranet-bottom.inc' %]