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