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