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