Bug 10287: Remove 1px artifacts from budget admin page
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqbudgetperiods.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
4 [% INCLUDE 'doc-head-close.inc' %]
5 [% INCLUDE 'calendar.inc' %]
6 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
7 [% INCLUDE 'datatables-strings.inc' %]
8 <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
9 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
10 <script type="text/javascript">
11 // #################################################################################
12 // Javascript
13 // #################################################################################
14     function CheckDuplicateForm(f){
15             var ok=1;
16             var _alertString="";
17             var alertString="";
18             if(!(isNotNull(f.budget_period_startdate,1))){
19               _alertString += "\n- " + _("Start date missing");
20             }
21             if (!(isNotNull(f.budget_period_enddate,1))){
22               _alertString += "\n- " + _("End date missing");
23             }
24             if( f.budget_period_startdate > f.budget_period_enddate ) {
25               _alertString += "\n- " + _("Start date must be before end date");
26             }
27
28             if(_alertString.length==0){
29               f.submit();
30             } else {
31               alertString += _("Form not submitted because of the following problem(s)");
32               alertString += "\n-----------------------------------------\n";
33               alertString += _alertString;
34               alert(alertString);
35             }
36     }
37     function Check(f) {
38             var ok=1;
39             var _alertString="";
40             var alertString2;
41
42             if (!(isNotNull(f.budget_period_startdate,1))) {
43                     _alertString += "\n- " + _("Start date missing");
44             }
45
46             if (!(isNotNull(f.budget_period_enddate,1))) {
47                     _alertString += "\n- " + _("End date missing");
48             }
49
50             if ( f.budget_period_startdate >   f.budget_period_enddate )  {
51                     _alertString += "\n- " + _("Start date must be before end date");
52             }
53
54             if (!(isNotNull(f.budget_period_description,1))) {
55                     _alertString += "\n- " + _("Description missing");
56             }
57
58             if (!(isNum(f.budget_period_total))) {
59                     _alertString += "\n- " + _("Amount must be a valid number, or empty");
60             }
61
62 /*
63                         checkBudgetTotal(f) {
64                         }
65 */
66
67             if (_alertString.length==0) {
68                     f.submit();
69             } else {
70                     alertString2  = _("Form not submitted because of the following problem(s)");
71                     alertString2 += "\n------------------------------------------------------------------------------------\n";
72                     alertString2 += _alertString;
73                     alert(alertString2);
74             }
75     }
76
77
78
79     [% IF ( dateformat == 'metric' ) %]
80         dt_add_type_uk_date();
81     [% END %]
82     $(document).ready(function() {
83         var tabs = $('#budgetsTabs').tabs();
84         [% IF ( tab ) %]
85             tabs.tabs('select', [% tab %]);
86         [% END %]
87         $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
88             "aoColumnDefs": [
89                 {
90                     [% IF ( dateformat == 'metric' ) %]
91                         "aTargets": [ 1, 2 ], "sType": "uk_date",
92                     [% END %]
93                     "bSortable": false, 'aTargets':['_all'],
94                 },
95             ],
96             "sPaginationType": "four_button",
97             "sDom": 't',
98             "bAutoWidth": false,
99             "bPaginate": false,
100             "bInfo": false,
101             "bFilter": false,
102         } ) );
103     });
104 </script>
105
106 <title>
107     Koha &rsaquo; Administration &rsaquo; Budgets
108
109     [% IF ( add_form ) %]&rsaquo;
110         [% IF ( budget_period_id ) %]
111             Modify budget'[% budget_period_id %]'
112         [% ELSE %]
113             Add budget
114         [% END %]
115     [% END %]
116     [% IF ( duplicate_form ) %]&rsaquo; Duplicate budget[% END %]
117     [% IF ( delete_confirm ) %]&rsaquo;
118             Delete budget '[% budget_period_description %]'?
119     [% END %]
120     [% IF ( delete_confirmed ) %]&rsaquo;
121         Data deleted
122     [% END %]
123 </title>
124
125
126 </head>
127
128 <body id="admin_aqbudgetperiods" class="admin">
129
130 [% INCLUDE 'header.inc' %]
131 [% INCLUDE 'budgets-admin-search.inc' %]
132
133 <!-- ################################################################################# -->
134 <!-- BREADCRUMBS -->
135 <!-- ################################################################################# -->
136
137 <div id="breadcrumbs">
138     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
139     <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;
140
141     <!-- add or modify a budget period -->
142     <!-- ####################################### -->
143     [% IF ( add_form ) %]
144         <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budget</a> &rsaquo;
145         [% IF ( budget_period_id ) %]
146             Modify budget [% budget_period_description %]
147
148         [% ELSE %]
149             Add budget
150         [% END %]
151     [% END %]
152
153     <!-- delete a budget period -->
154     <!-- ################################ -->
155     [% IF ( delete_confirm ) %]
156         <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo;
157         [% IF ( total ) %]
158             Cannot delete budget '[% budget_period_description %]'
159         [% ELSE %]
160             Delete budget '[% budget_period_description %]'?
161         [% END %]
162     [% END %]
163     <!-- duplicate a budget -->
164     [% IF ( duplicate_form ) %]
165         <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo; Duplicate budget
166     [% END %]
167     <!-- display budget periods list -->
168     <!-- ########################################## -->
169     [% IF ( else ) %]
170         Budgets administration
171     [% END %]
172 </div>
173
174 <div id="doc3" class="yui-t2">
175 <div id="bd">
176 <div id="yui-main">
177 <div class="yui-b">
178
179 [% INCLUDE 'budgets-admin-toolbar.inc' %]
180
181 [% IF ( duplicate_form ) %]
182 <h3>Duplicate budget</h3>
183 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
184     <fieldset class="rows">
185     <input type="hidden" name="op" value="duplicate_budget" />
186     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
187
188     <ol>
189
190     <li>
191     <label class="required" for="from">Start date: </label>
192     <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
193                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
194     </li>
195     <li>
196
197     <label class="required" for="to">End date: </label>
198     <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
199                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
200     </li>
201
202     </ol>
203     </fieldset>
204
205     <fieldset class="action">
206         <input type="button" value="Save Changes"  onclick="CheckDuplicateForm(this.form)" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Cancel</a>
207     </fieldset>
208
209 </form>
210
211 [% END %]
212
213 [% IF ( add_form ) %]
214     <!--  add or modify a budget period   -->
215
216     [% IF ( budget_period_id ) %]
217         <h3>Modify budget</h3>
218     [% ELSE %]
219         <h3>Add budget</h3>
220         [% END %]
221 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
222     <fieldset class="rows">
223     <!-- ################################################################################# -->
224     <!-- display information about the budget period that must be added or modified -->
225     <!-- ################################################################################# -->
226     <input type="hidden" name="op" value="add_validate" />
227     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
228     <ol>
229     <li>
230     <label class="required" for="from">Start date: </label>
231     <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
232                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
233     </li>
234     <li>
235
236     <label class="required" for="to">End date: </label>
237     <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
238                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
239     </li>
240
241     <li>
242         <!-- DESCRIPTION -->
243         <!-- ############################## -->
244         <label class="required" for="budget_period_description">Description: </label>
245         <input type="text" id="budget_period_description" name="budget_period_description"
246         size="48" maxlength="80" value="[% budget_period_description %]" />
247     </li>
248
249     <li>
250         <!-- TOTAL -->
251         <!-- ############################## -->
252         <label for="budget_period_total">Total amount: </label>
253         <input type="text" id="budget_period_total" name="budget_period_total"
254         size="10" maxlength="80" value="[% budget_period_total %]" />
255     </li>
256
257     <li>
258         <!-- ACTIVE -->
259         <!-- ############################## -->
260         <label for="budget_period_active">Make budget active: </label>
261         [% 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 %]
262     </li>
263
264     <li>
265         <!-- LOCK  -->
266         <!-- ############################## -->
267         <label for="budget_period_locked">Lock budget: </label>
268         [% 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 %]
269     </li>
270     </ol>
271     </fieldset>
272
273     <fieldset class="action">
274         <!-- "save changes" button -->
275         <!-- ###################################### -->
276         <input type="button" value="Save changes"  onclick="Check(this.form)"    />
277         <!--             <input type="submit" value="Save Changes"  />  -->
278         [% IF ( budget_period_id ) %]<a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]" class="cancel">Cancel</a>[% END %]
279     </fieldset>
280
281 </form>
282
283 [% END %]
284
285 <!-- ####################################################################### -->
286 <!-- delete a budget period -->
287 <!-- ####################################################################### -->
288
289 [% IF ( delete_confirm ) %]
290     [% IF ( total ) %]
291         <div class="dialog message">
292         <h3>Cannot delete budget</h3>
293         <p><strong>This record is used [% total %] times</strong>
294         . Deletion is not possible.</p>
295     [% ELSE %]
296         <div class="dialog alert">
297         <h3>Delete budget '[% budget_period_description %]'?</h3>
298     [% END %]
299
300     <!-- ############################################################# -->
301     <!-- "delete" and "cancel" buttons    -->
302     <!-- ############################################################# -->
303
304     <form action="[% script_name %]" method="post">
305         <input type="hidden" name="op" value="delete_confirmed" />
306         <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
307         <input type="submit" class="approve" value="Delete" />
308     </form>
309
310     <form action="[% script_name %]" method="post">
311         <input type="submit" class="deny" value="Cancel" />
312     </form>
313
314     </div>
315 [% END %]
316 <!--  DEFAULT  display budget periods list -->
317 [% IF ( else ) %]
318   <h2>Budgets administration</h2>
319
320   [% INCLUDE 'budgets-active-currency.inc' %]
321
322   <div id="budgetsTabs" class="toptabs">
323     <ul>
324         <li><a href="#active">Active budgets</a></li>
325         <li><a href="#inactive">Inactive budgets</a></li>
326     </ul>
327
328     <div id="active">
329       [% IF ( period_active_loop ) %]
330         <table id="activeperiodst">
331           <thead>
332             <tr>
333               <th>Budget name</th>
334               <th>Start date</th>
335               <th>End date</th>
336               <th>Locked</th>
337               <th>Total</th>
338               <th>Actions</th>
339             </tr>
340           </thead>
341           <tbody>
342               [% FOREACH period_active IN period_active_loop %]
343                 <tr>
344                 <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_active.budget_period_id %]" title="View funds for [% period_active.budget_period_description %]">[% period_active.budget_period_description %]</a></td>
345                 <td>[% period_active.budget_period_startdate | $KohaDates %]</td>
346                 <td>[% period_active.budget_period_enddate | $KohaDates %]</td>
347                 <td>
348                   [% IF ( period_active.budget_period_locked ) %]
349                     <span style="color:green;">Locked</span>&nbsp;
350                   [% END %]
351                 </td>
352                 <td align='right'>[% period_active.budget_period_total %]</td>
353                 <td>
354                   <a href="[% script_name %]?op=add_form&amp;budget_period_id=[% period_active.budget_period_id |html %]">Edit</a>
355                   <a href="[% script_name %]?op=delete_confirm&amp;budget_period_id=[% period_active.budget_period_id %]">Delete</a>
356                   <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% period_active.budget_period_id %]">Add fund</a>
357                 </td>
358                 </tr>
359               [% END %]
360           </tbody>
361         </table>
362       [% ELSE %]
363         No active budgets
364       [% END %]
365       <div class="paginationBar">[% active_pagination_bar %]</div>
366     </div>
367     <div id="inactive">
368       [% IF ( period_inactive_loop ) %]
369         <table id="inactiveperiodst">
370           <thead>
371               <tr>
372                   <th>Budget name</th>
373                   <th>Start date</th>
374                   <th>End date</th>
375                   <th>Locked</th>
376                   <th>Total</th>
377                   <th>Actions</th>
378               </tr>
379           </thead>
380           <tbody>
381               [% FOREACH period_loo IN period_inactive_loop %]
382                   [% IF ( loop.odd ) %]
383                       <tr>
384                   [% ELSE %]
385                       <tr class="highlight">
386                   [% END %]
387                   <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_loo.budget_period_id %]" title="View funds for [% period_loo.budget_period_description %]">[% period_loo.budget_period_description %]</a></td>
388                   <td>[% period_loo.budget_period_startdate | $KohaDates %]</td>
389                   <td>[% period_loo.budget_period_enddate | $KohaDates %]</td>
390                   <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span>&nbsp;[% ELSE %][% END %] </td>
391                   <td align='right'>[% period_loo.budget_period_total %]</td>
392                   <td>
393                       <a href="[% period_loo.script_name %]?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id |html %]">Edit</a>
394                       <a href="[% period_loo.script_name %]?op=delete_confirm&amp;budget_period_id=[% period_loo.budget_period_id %]">Delete</a>
395                   <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id %]">Add fund</a>
396                   </td>
397                   </tr>
398               [% END %]
399           </tbody>
400         </table>
401       [% ELSE %]
402         No inactive budgets
403       [% END %]
404       <div class="pages">[% inactive_pagination_bar %]</div>
405     </div>
406   </div>
407 [% END %]
408
409
410 </div>
411 </div>
412 <div class="yui-b">
413 [% INCLUDE 'acquisitions-menu.inc' %]
414 </div>
415 </div>
416
417 [% INCLUDE 'intranet-bottom.inc' %]