Bug 16242 - Move staff client JavaScript out of language directory
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqplan.tt
1 [% USE Price %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Administration &rsaquo; Budgets &rsaquo; Funds &rsaquo; Planning for [% budget_period_description %] by [% authcat %]</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
6 <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
7 <script type="text/javascript">
8 //<![CDATA[
9     function Check(f) {
10             var ok=1;
11             var _alertString="";
12             var alertString2;
13             var arr = document.getElementsByName('est_total')
14
15             for ( var i=0, len=arr.length; i<len; ++i ){
16                     var tot = arr[i].innerHTML;
17
18                     if (tot == 'NaN') {
19                         _alertString += "\n- " + _("One or more cell values is non-numeric");
20                     }
21             }
22
23             if (_alertString.length==0) {
24
25                 var op  = document.createElement('input');
26                 op.setAttribute("type","hidden");
27                 op.setAttribute("name","op");
28                 op.setAttribute("value","save");   //ohh the pain...
29
30                 document.Aform.appendChild(op);
31                 document.Aform.submit()
32
33             } else {
34                     alertString2  = _("Form not submitted because of the following problem(s)");
35                     alertString2 += "\n------------------------------------------------------------------------------------\n";
36                     alertString2 += _alertString;
37                     alert(alertString2);
38             }
39     }
40     $(document).ready(function() {
41         $("#selections input").on("change",function(e){
42             var num = $(this).attr("id");
43             if(num == 'showall'){
44                 showAllColumns();
45                 e.stopPropagation();
46             } else if(num == 'hideall'){
47                 hideAllColumns();
48                 e.stopPropagation();
49             } else {
50                 if($(this).prop("checked")){
51                     showColumn(num);
52                 } else {
53                     hideColumn(num);
54                 }
55             }
56         });
57     });
58 //]]>
59 </script>
60 <style type="text/css">td.locked { background-image: url('[% interface %]/[% theme %]/img/locked.png'); padding-left : 20px; background-repeat: no-repeat; background-position: 5px 5px; } a.control { font-size:85%;text-decoration:none; }</style>
61 </head>
62 <body id="admin_aqplan" class="admin">
63 [% INCLUDE 'header.inc' %]
64 [% INCLUDE 'budgets-admin-search.inc' %]
65
66 <div id="breadcrumbs">
67     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
68     <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;
69     <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo; 
70     <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Funds</a> &rsaquo;
71     <a href="/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]">Planning</a> &rsaquo;
72 </div>
73
74 <div id="doc3" class="yui-t2">
75 <div id="bd">
76 <div id="yui-main">
77 <div class="yui-b">
78
79 [% INCLUDE 'budgets-admin-toolbar.inc' %]
80
81 <form method="post" id="Aform" name="Aform"  action="/cgi-bin/koha/admin/aqplan.pl">
82 <h3>Planning for [% budget_period_description %] by [% authcat %]</h3>
83 <input type="hidden" name="authcat" value="[% authcat %]" />
84 <!-- Budget Lines -->
85
86     [% IF ( budget_lines ) %]
87
88         [% INCLUDE 'budgets-active-currency.inc' %]
89         [% IF ( show_actual ) %]
90             <p><b>Each cell contain both actual and estimated values.</b></p>
91         [% ELSE %]
92             <p><b>Cells contain estimated values only.</b></p>
93         [% END %]
94
95     <p id="selections">
96         <strong>Show/hide columns:</strong> <span class="selected"><input type="checkbox" checked="checked" id="showall"/><label for="showall">Show all columns</label></span> <span><input type="checkbox" id="hideall"/><label for="hideall">Hide all columns</label></span>
97         [% FOREACH authvals_ro IN authvals_row %]
98             <span class="selected"><label><input type="checkbox" checked="checked" id="col[% authvals_ro.colnum %]">[% authvals_ro.code %]</label></span>
99         [% END %]
100     </p>
101     <table id="plan">
102     <thead>
103     <tr>
104     <th>Fund name</th>
105     <th>Fund total</th>
106
107     [% FOREACH authvals_ro IN authvals_row %]
108          [% IF ( authvals_ro.display ) %]
109             <th id="col[% authvals_ro.code %]" class="[% authvals_ro.colnum %]">
110         [% ELSE %]
111             <th id="col[% authvals_ro.code %]" style="display:none;" class="[% authvals_ro.colnum %]">
112         [% END %]
113
114     [% authvals_ro.code %]</th>
115     [% END %]
116
117     <th class="remaining">Fund remaining</th><th>&nbsp;</th>
118     </tr>
119     </thead>
120
121     <tbody>
122     [% FOREACH budget_line IN budget_lines %]
123     <tr>
124         [% IF ( budget_line.budget_lock ) %]
125             <td class="locked" title="Fund locked">
126         [% ELSE %]
127             <td>
128         [% END %]
129         <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=[% budget_line.budget_id %]&amp;budget_period_id=[% budget_period_id %]">[% budget_line.budget_name %]</a></td>
130         <td><span id="[% budget_line.budget_amount %]">[% budget_line.budget_amount | $Price %]&nbsp;</span>
131
132
133         <!-- NEXT DIV ELEMENT IS USED BY JS FOR CALC-ING AUTO-FILL AND ESTIMATED AMOUNTS -->
134         <div style="display:none;" id="budget_tot_[% budget_line.budget_id %]">[% budget_line.budget_amount %]</div></td>
135
136         [% FOREACH line IN budget_line.lines %]
137             [% IF ( line.display ) %]
138                 <td class="[% line.colnum %]">
139             [% ELSE %]
140                 <td style="display:none;" class="[% line.colnum %]">
141             [% END %]
142             <table class="invis">
143                 <tr>
144                     [% IF show_actual %]
145                         <td    >[% line.actual_amount %]</td>
146                     [% END %]
147                 <td>
148
149                 [% IF ( line.budget_lock ) %]
150                     [% line.estimated_amount %]&nbsp;
151                     <input type="hidden" style="text-align: right;"  name="[% line.cell_name %]" value="[% line.estimated_amount %]"   />
152                 [% ELSE %]
153                     <input type="text" style="text-align: right;  width:90%; " size="6" name="[% line.cell_name %]"  value="[% line.estimated_amount %]"  id="budget_[% line.budget_id %][% line.colnum %]" class="plan_entry_[% line.budget_id %]" onchange="calcTotalRow(this);" />
154                 [% END %]
155
156                 </td></tr>
157             </table>
158             </td>
159         [% END %]
160
161         <td>
162         <table class="invis">
163             <tr>
164        [% IF show_actual %]
165             [% IF ( budget_line.act_negative ) %]
166                 <td style="color: red;">
167             [% ELSIF ( budget_line.act_positive ) %]
168                 <td style="color: green;">
169             [% ELSE %]
170                 <td>
171             [% END %]
172                     [% budget_line.budget_act_remain %]
173             </td>
174         [% END %]
175
176         [% IF ( budget_line.est_negative ) %]
177             <td style="color: red;" id="budget_est_[% budget_line.budget_id %]">
178         [% ELSIF ( budget_line.est_positive ) %]
179             <td style="color: green;" id="budget_est_[% budget_line.budget_id %]">
180         [% ELSE %]
181             <td id="budget_est_[% budget_line.budget_id %]">
182         [% END %] 
183                 [% budget_line.budget_est_remain | $Price %]&nbsp;
184             </td>
185             </tr>
186         </table>
187         </td>
188
189         <td>
190              [% UNLESS ( budget_line.budget_lock ) %]
191                     <input type="button"  onclick="autoFillRow('[% budget_line.budget_id %]')" value="Auto-fill row"/>
192             [% ELSE %]
193              <div style="color:red;">not owned</div>
194             [% END %]
195         </td>
196         </tr>
197     [% END %]
198     </tbody>
199     </table>
200
201     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
202     [% IF ( budget_period_locked ) %]
203         <!-- <input STYLE="background: gray;"   type="submit" value="Save" disabled="disabled"/> -->
204     [% ELSE %]
205         <fieldset class="action"><input type="button"  onclick="Check(this.form)" value="Save"/></fieldset>
206     [% END %]
207
208
209 <div id="hide_div">
210     [% FOREACH authvals_ro IN authvals_row %]
211
212      [% UNLESS ( authvals_ro.display ) %]
213         <input type="hidden" value="[% authvals_ro.code %]"  name="hide_cols"/>
214      [% END %]
215     [% END %]
216
217  </div>
218
219
220 </form>
221
222         [% ELSIF not budget_period_id %]
223 <div class="dialog alert">That budget does not exist! Please select a budget to continue.</div>
224         [% ELSE %]
225 <div class="dialog message">No funds to display for this search criteria</div>
226         [% END %]
227
228
229 </div>
230 </div>
231 <div class="yui-b">
232
233 <form method="post" action="/cgi-bin/koha/admin/aqplan.pl">
234     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
235 <fieldset class="brief">
236 <h4>Filter</h4>
237 [% BLOCK planning_types %]
238 [%   SWITCH type %]
239 [%     CASE 'MONTHS'    %]<span>by months</span>
240 [%     CASE 'ITEMTYPES' %]<span>by item types</span>
241 [%     CASE 'BRANCHES'  %]<span>by libraries</span>
242 [%     CASE             %]<span>by [% type %]</span>
243 [%   END %]
244 [% END %]
245 <ol>
246     <li>
247         <label for="authcat"> Select planning type:</label>
248         <select name="authcat" id="authcat" size="1">
249         [% FOREACH value IN authcat_dropbox.values %]
250             [% IF ( value == authcat_dropbox.default ) %]
251             <option value="[% value %]" selected="selected">[% PROCESS planning_types type=value %]</option>
252             [% ELSE %]
253             <option value="[% value %]">[% PROCESS planning_types type=value %]</option>
254             [% END %]
255         [% END %]
256         </select>
257     </li>
258     <li class="radio">
259     [% IF ( show_mine ) %]
260         <input type="checkbox" id="show_mine"  name="show_mine" value="1" checked="checked" />
261     [% ELSE %]
262         <input type="checkbox" id="show_mine"  name="show_mine" value="1"  />
263     [% END %]
264     <label for="show_mine">Show my funds only</label>
265     </li>
266
267     <li class="radio">
268     [% IF ( show_active ) %]
269         <input type="checkbox" id="show_active" name="show_active" value="1" checked="checked" />
270     [% ELSE %]
271         <input type="checkbox" id="show_active" name="show_active" value="1" />
272         [% END %]
273     <label for="show_active">Show active funds only</label>
274     </li>
275
276
277     <li class="radio">
278         [% IF ( show_actual ) %]
279             <input type="checkbox" id="show_actual" name="show_actual" value="1" checked="checked" />
280         [% ELSE %]
281             <input type="checkbox" id="show_actual" name="show_actual" value="1"  />
282         [% END %]
283         <label for="show_actual">Show actual/estimated values</label>
284     </li>
285     </ol>
286     <fieldset class="action">
287         <input type="submit" name="option_submit" value="Submit" />
288         <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
289     </fieldset>
290 </fieldset>
291 </form>
292 [% IF ( budget_lines ) %]
293 <form method="post" action="/cgi-bin/koha/admin/aqplan.pl">
294 <fieldset class="brief">
295 <h4>Export</h4>
296     <ol>
297         <li><label for="basename">Output to a file named: </label><input type="text" name="basename" id="basename" value="Export" /></li>
298         <li><label class="inline" for="MIME">Into an application</label>
299             <select name="MIME" id="MIME" size="1">
300             [% FOREACH value IN CGIextChoice %]
301                 <option value="[% value %]">[% value %]</option>
302             [% END %]
303             </select>
304             <select name="sep" id="sep" size="1">
305             [% FOREACH value IN CGIsepChoice %]
306                 <option value="[% value %]">[% value %]</option>
307             [% END %]
308             </select>
309         </li>
310     </ol>
311     <fieldset class="action">    <input type="submit" value="Submit"/>
312     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
313     <input type="hidden" name="report_name" value="[% report_name %]" />
314     <input type="hidden" name="output" value="file" /></fieldset>
315     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
316     <input type="hidden" name="authcat" value="[% authcat %]" />
317     </fieldset>
318 </form>
319 [% END %]
320
321 [% INCLUDE 'acquisitions-menu.inc' %]
322 </div>
323 </div>
324 [% INCLUDE 'intranet-bottom.inc' %]