Merge remote-tracking branch 'origin/new/bug_7747'
[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     [% IF ( duplicate_form ) %]&rsaquo; Duplicate budget[% END %]
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 id="admin_aqbudgetperiods" class="admin">
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     <!-- duplicate a budget -->
140     [% IF ( duplicate_form ) %]
141         <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo; Duplicate budget
142     [% END %]
143     <!-- display budget periods list -->
144     <!-- ########################################## -->
145     [% IF ( else ) %]
146         Budgets administration
147     [% END %]
148 </div>
149
150 <div id="doc3" class="yui-t2">
151 <div id="bd">
152 <div id="yui-main">
153 <div class="yui-b">
154
155 [% INCLUDE 'budgets-admin-toolbar.inc' %]
156
157 [% IF ( duplicate_form ) %]
158 <h3>Duplicate budget</h3>
159 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
160     <fieldset class="rows">
161     <input type="hidden" name="op" value="duplicate_budget" />
162     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
163
164     <ol>
165
166     <li>
167     <label class="required" for="budget_period_startdate">Start date</label>
168     <input type="text" size="10" id="budget_period_startdate" name="budget_period_startdate"   value="[% budget_period_startdate %]"  />
169     <img src="/intranet-tmpl/prog/en/lib/calendar/cal.gif" border="0" id="openCalendarFrom" style="cursor: pointer;" alt="Show start date calendar" />
170     <script type="text/javascript">
171         Calendar.setup({
172         inputField     :    "budget_period_startdate",
173         ifFormat         :    "[% DHTMLcalendar_dateformat %]",
174         button         :    "openCalendarFrom",
175         align          :    "Tl",
176         singleClick    :    false
177         });
178     </script>
179                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
180     </li>
181     <li>
182
183     <label class="required" for="budget_period_enddate">End date</label>
184     <input type="text" size="10" id="budget_period_enddate" name="budget_period_enddate" value="[% budget_period_enddate %]" />
185     <img src="/intranet-tmpl/prog/en/lib/calendar/cal.gif" border="0" id="openCalendarTo" style="cursor: pointer;" alt="Show end date calendar" />
186
187     <script type="text/javascript">
188         Calendar.setup({
189         inputField     :    "budget_period_enddate",
190         ifFormat         :    "[% DHTMLcalendar_dateformat %]",
191         button         :    "openCalendarTo",
192         align          :    "Tl"
193         });
194     </script>
195                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
196     </li>
197
198     </ol>
199     </fieldset>
200
201     <fieldset class="action">
202         <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>
203     </fieldset>
204
205 </form>
206
207 [% END %]
208
209 [% IF ( add_form ) %]
210     <!--  add or modify a budget period   -->
211
212     [% IF ( budget_period_id ) %]
213         <h3>Modify budget</h3>
214     [% ELSE %]
215         <h3>Add budget</h3>
216         [% END %]
217 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
218     <fieldset class="rows">
219     <!-- ################################################################################# -->
220     <!-- display information about the budget period that must be added or modified -->
221     <!-- ################################################################################# -->
222     <input type="hidden" name="op" value="add_validate" />
223     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
224     <ol>
225     <li>
226     <label class="required" for="budget_period_startdate">Start date</label>
227     <input type="text" size="10" id="budget_period_startdate" name="budget_period_startdate"   value="[% budget_period_startdate %]"  />
228     <img src="/intranet-tmpl/prog/en/lib/calendar/cal.gif" border="0" id="openCalendarFrom" style="cursor: pointer;" alt="Show start date calendar" />
229     <script type="text/javascript">
230         Calendar.setup({
231         inputField     :    "budget_period_startdate",
232         ifFormat         :    "[% DHTMLcalendar_dateformat %]",
233         button         :    "openCalendarFrom",
234         align          :    "Tl",
235         singleClick    :    false
236         });
237     </script>
238                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
239     </li>
240     <li>
241
242     <label class="required" for="budget_period_enddate">End date</label>
243     <input type="text" size="10" id="budget_period_enddate" name="budget_period_enddate" value="[% budget_period_enddate %]" />
244     <img src="/intranet-tmpl/prog/en/lib/calendar/cal.gif" border="0" id="openCalendarTo" style="cursor: pointer;" alt="Show end date calendar" />
245
246     <script type="text/javascript">
247         Calendar.setup({
248         inputField     :    "budget_period_enddate",
249         ifFormat         :    "[% DHTMLcalendar_dateformat %]",
250         button         :    "openCalendarTo",
251         align          :    "Tl"
252         });
253     </script>
254                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
255     </li>
256
257     <li>
258         <!-- DESCRIPTION -->
259         <!-- ############################## -->
260         <label class="required" for="budget_period_description">Description</label>
261         <input type="text" id="budget_period_description" name="budget_period_description"
262         size="48" maxlength="80" value="[% budget_period_description %]" />
263     </li>
264
265     <li>
266         <!-- TOTAL -->
267         <!-- ############################## -->
268         <label for="budget_period_total">Total amount</label>
269         <input type="text" id="budget_period_total" name="budget_period_total"
270         size="10" maxlength="80" value="[% budget_period_total %]" />
271     </li>
272
273     <li>
274         <!-- ACTIVE -->
275         <!-- ############################## -->
276         <label for="budget_period_active">Make budget active</label>
277         [% 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 %]
278     </li>
279
280     <li>
281         <!-- LOCK  -->
282         <!-- ############################## -->
283         <label for="budget_period_locked">Lock budget</label>
284         [% 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 %]
285     </li>
286     </ol>
287     </fieldset>
288
289     <fieldset class="action">
290         <!-- "save changes" button -->
291         <!-- ###################################### -->
292         <input type="button" value="Save changes"  onclick="Check(this.form)"    />
293         <!--             <input type="submit" value="Save Changes"  />  -->
294         [% IF ( budget_period_id ) %]<a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]" class="cancel">Cancel</a>[% END %]
295     </fieldset>
296
297 </form>
298
299 [% END %]
300
301 <!-- ####################################################################### -->
302 <!-- delete a budget period -->
303 <!-- ####################################################################### -->
304
305 [% IF ( delete_confirm ) %]
306     [% IF ( total ) %]
307         <div class="dialog message">
308         <h3>Cannot delete budget</h3>
309         <p><strong>This record is used [% total %] times</strong>
310         . Deletion is not possible.</p>
311     [% ELSE %]
312         <div class="dialog alert">
313         <h3>Delete budget '[% budget_period_description %]'?</h3>
314     [% END %]
315
316     <!-- ############################################################# -->
317     <!-- "delete" and "cancel" buttons    -->
318     <!-- ############################################################# -->
319
320     <form action="[% script_name %]" method="post">
321         <input type="hidden" name="op" value="delete_confirmed" />
322         <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
323         <input type="submit" class="approve" value="Delete" />
324     </form>
325
326     <form action="[% script_name %]" method="post">
327         <input type="submit" class="deny" value="Cancel" />
328     </form>
329
330     </div>
331 [% END %]
332 <!--  DEFAULT  display budget periods list -->
333 [% IF ( else ) %]
334     <h2>Budgets administration</h2>
335
336     [% INCLUDE 'budgets-active-currency.inc' %]
337
338     <table id="periodsh">
339     <thead>
340             <tr>
341             <th>Budget name</th>
342             <th>Start date</th>
343             <th>End date</th>
344                 <th>Active</th>
345                 <th>Locked</th>
346                 <th>Total</th>
347                 <th>Actions</th>
348             </tr>
349         </thead>
350         <tbody>
351             [% FOREACH period_loo IN period_loop %]
352                 [% IF ( loop.odd ) %]
353                     <tr>
354                 [% ELSE %]
355                     <tr class="highlight">
356                 [% END %]
357                 <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>
358                 <td>[% period_loo.budget_period_startdate %]</td>
359                 <td>[% period_loo.budget_period_enddate %]</td>
360                 <td>[% IF ( period_loo.budget_period_active ) %]<span style="color:green;">Active</span>&nbsp;[% ELSE %][% END %] </td>
361                 <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span>&nbsp;[% ELSE %][% END %] </td>
362                 <td align='right'>[% period_loo.budget_period_total %]</td>
363                 <td>
364                     <a href="[% period_loo.script_name %]?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id |html %]">Edit</a>
365                     <a href="[% period_loo.script_name %]?op=delete_confirm&amp;budget_period_id=[% period_loo.budget_period_id %]">Delete</a>
366             <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id %]">Add fund</a>
367                 </td>
368                 </tr>
369             [% END %]
370             [% UNLESS ( period_loop ) %]
371         <tr><td colspan="7">No budget</td></tr>
372         [% END %]
373     </tbody>
374     </table>
375     <div class="pages">[% pagination_bar %]</div>
376 [% END %]
377
378
379 </div>
380 </div>
381 <div class="yui-b">
382 [% INCLUDE 'acquisitions-menu.inc' %]
383 </div>
384 </div>
385
386 [% INCLUDE 'intranet-bottom.inc' %]