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