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