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