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