[MT2343] Select in budget add forum
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqbudgets.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title><!--TMPL_IF NAME="budget_id" -->Modify<!-- TMPL_ELSE -->Add<!-- /TMPL_IF --> Budget</title>
3 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
5 <script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/acq.js"></script>
6
7 <!-- TMPL_IF name="add_form" -->
8 <script type="text/javascript">
9 //<![CDATA[
10         //
11         
12         var actTotal ="";
13
14         function ownerRemove(f) {
15         document.getElementById('budget_owner_name').innerHTML = '';
16     }
17
18         function Check(f) {
19                 var ok=1;
20                 var _alertString="";
21                 var alertString2;
22
23         // var actTotal ="";
24
25             if (!(isNotNull(f.budget_code,1))) {
26                         _alertString += _("- Budget code missing\n");
27                 }
28
29             if (!(isNotNull(f.budget_name,1))) {
30                         _alertString += _("- Budget name missing\n");
31                 }
32
33         var budgetId;
34         if   (typeof(f.budget_id ) != "undefined")  {
35             budgetId = f.budget_id.value
36         }
37
38         var newBudgetParent;
39
40 //  hack to test if selected parent_id in scrolling-list...
41 //  if value == 'undef' its got a selected_parent :/
42                 if(f.budget_parent_id){
43                 var chkAdd   =  f.budget_parent_id.value ;
44                 if  (     typeof(chkAdd ) != "undefined") {
45                     newBudgetParent  =  f.budget_parent_id.value
46                 } else {
47                     newBudgetParent  =  f.budget_parent_id.item(0).value
48                 }
49
50                 if   (budgetId  > 0)  {  ; //its a mod ...
51                     // if parent eq curent-budget, fail...
52                     if ( newBudgetParent  ==  budgetId     ) {
53                                     _alertString += _("- Budget parent is current budget\n");
54                     }
55         
56                     else if (newBudgetParent) {
57                         var result = checkBudgetParent(  budgetId , newBudgetParent   );
58                         if (result) {
59                                     _alertString += result;
60                         }
61                     }
62                 }
63                 }
64
65          // else do lookup
66         var budgetTotal = Math.abs(f.budget_amount.value);
67         var result =   budgetExceedsParent  (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value)
68         if (result) {
69             _alertString += result;
70         }
71
72                 if (_alertString.length==0) {
73                         document.Aform.submit();
74                 } else {
75                         alertString2 = _("Form not submitted because of the following problem(s)\n");
76                         alertString2 += "------------------------------------------------------------------------------------\n\n";
77                         alertString2 += _alertString;
78                         alert(alertString2);
79                 }
80         }
81 //]]>
82 </script>
83 <!-- TMPL_ELSE -->
84 <link href="<!-- TMPL_VAR NAME='themelang' -->/lib/jquery/plugins/treetable/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
85
86 <script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
87 <script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/lib/jquery/plugins/treetable/jquery.treeTable.min.js"></script>
88 <script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/lib/jquery/plugins/jquery.qtip.js"></script>
89
90 <script type="text/javascript">
91 //<![CDATA[
92         //
93         $(document).ready(function() {
94                 
95                 $('.tooltiped').each(function (){
96                     contentelem = $(this).children().filter('.tooltipcontent');
97                     $(this).qtip({
98                         content: contentelem.html(),
99                         show: 'mouseover',
100                         hide: 'mouseout',
101                         style: { 
102                             name: 'light',
103                             tip: 'bottomLeft',
104                             border: {
105                                 radius: 8,
106                                 color: '#6699CC'
107                             }
108                         },
109                         position: {
110                             corner: {
111                                 target: 'topRight',
112                                 tooltip: 'bottomRight'
113                             }
114                         }
115                     });
116                 });
117                 $('.tooltipcontent').each(function (){
118                     $(this).hide();
119                 });
120                 <!-- TMPL_IF NAME="notree" -->
121                 $("#budgeth").tablesorter({
122                 widgets : ['zebra'],
123                 sortList: [[0,0]]
124             });
125             <!-- TMPL_ELSE -->
126                 $("#budgeth").treeTable();
127                 <!-- /TMPL_IF -->
128         });
129 //]]>
130 </script>
131 <!-- /TMPL_IF -->
132
133 </head>
134 <body>
135 <!-- TMPL_INCLUDE NAME="header.inc" -->
136 <!-- TMPL_INCLUDE NAME="budgets-admin-search.inc" -->
137
138 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; 
139     <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; <!-- TMPL_IF NAME="else" -->Budgets<!-- /TMPL_IF --><!-- TMPL_IF name="add_form" -->
140     <a href="/cgi-bin/koha/admin/aqbudgets.pl">Budgets</a> &rsaquo; <!-- TMPL_IF NAME="budget_id" -->Modify<!-- TMPL_ELSE -->Add<!-- /TMPL_IF --> Budget<!-- /TMPL_IF -->  <!-- TMPL_IF name="delete_confirm" -->
141     <a href="/cgi-bin/koha/admin/aqbudgets.pl">Budgets</a> &rsaquo; Delete Budget?<!-- /TMPL_IF --></div>
142
143 <div id="doc3" class="yui-t2">
144 <div id="bd">
145 <div id="yui-main">
146 <div class="yui-b">
147
148 <!-- TMPL_INCLUDE NAME="budgets-admin.inc" -->
149 <!-- TMPL_IF name="else" -->
150
151 <h1>Budgets for '<!-- TMPL_VAR name="budget_period_description" -->'</h1>
152 <input type="hidden" name="budget_period_id" value="<!-- TMPL_VAR name=    'budget_period_id' -->" />
153         <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
154     <fieldset>
155         <legend>Budget filters</legend>
156         <ul>
157                 <li>
158                 <label for="filter_budgetbranch_id">Library: </label>
159                 <select name="filter_budgetbranch" id="filter_budgetbranch_id" style="width:10em;">
160                         <option value=""></option>
161                     <!-- TMPL_LOOP name="branchloop" -->
162                         <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="branchname" --></option>
163                     <!-- /TMPL_LOOP -->     
164                 </select>         
165                 </li>
166             <li>
167                 <!-- TMPL_IF NAME="show_mine" -->
168                     <input type="checkbox" id="show_mine"  name="show_mine" value="1" checked="checked" />
169                 <!-- TMPL_ELSE -->  
170                     <input type="checkbox" id="show_mine"  name="show_mine" value="1"  />
171                 <!-- /TMPL_IF -->  
172                 <label for="show_mine">Show my budgets only</label>
173         </li>
174         </ul>
175
176                 <input type="hidden" name="show" value="1"  />
177         <input type="hidden"  name="budget_period_id" value="<!-- TMPL_VAR NAME="budget_period_id" -->" /> 
178         <input type="submit" class="submit" name="filter" value="Select" />
179         </fieldset>
180 </form>
181
182 <table id="budgeth">
183     <thead>
184         <tr>
185                     <th>Budget hierarchy</th>
186                     <th>Budget name</th>
187                     <th>Total<br />allocated</th>
188                     <th>Base-level<br />allocated</th>
189                     <th>Base-level<br />spent</th>
190                     <th>Base-level<br />remaining</th>
191                     <th class="tooltipcontent">&nbsp;</th>
192                     <!-- Owner</th>
193                     <th>Branch</th>
194                     <th>Note</th> -->
195                     <th colspan="3">Actions</th>
196         </tr>
197     </thead>
198         <tbody>
199         <!-- TMPL_IF NAME="budget" -->
200                 <!-- TMPL_LOOP name="budget" -->
201     <!-- TMPL_IF NAME="toggle" -->
202     <tr id="node-<!-- TMPL_VAR NAME="budget_id" -->" class="highlight<!-- TMPL_IF NAME="budget_parent_id" --> child-of-node-<!-- TMPL_VAR NAME="budget_parent_id" --><!-- /TMPL_IF --> tooltiped">
203     <!-- TMPL_ELSE -->
204     <tr id="node-<!-- TMPL_VAR NAME="budget_id" -->" class="tooltiped <!-- TMPL_IF NAME="budget_parent_id" --> child-of-node-<!-- TMPL_VAR NAME="budget_parent_id" --><!-- /TMPL_IF -->">
205     <!-- /TMPL_IF -->
206
207     <td><!-- TMPL_VAR NAME="budget_code_indent" --></td>
208     <td><!-- TMPL_VAR NAME="budget_name" --></td>
209     <td align='right'><!-- TMPL_VAR NAME="budget_amount_total" --></td>
210     <td align='right'><!-- TMPL_VAR NAME="budget_amount" --> </td>
211     <td align='right'><!-- TMPL_VAR NAME="budget_spent" --> </td>
212     <td align='right'
213     <!-- TMPL_IF NAME="remaining_pos" --> STYLE="color: green;" <!-- /TMPL_IF -->
214     <!-- TMPL_IF NAME="remaining_neg" --> STYLE="color: red;" <!-- /TMPL_IF -->   >
215     <!-- TMPL_VAR NAME="budget_remaining" --> </td>
216
217     <td class="tooltipcontent">
218         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="budget_owner_id" -->"><!-- TMPL_VAR NAME="budget_owner_name" --></a>
219                 <!-- TMPL_VAR NAME="budget_branchcode" -->
220         <!-- TMPL_VAR NAME="budget_notes" -->
221         </td>
222     <!-- TMPL_IF NAME='budget_lock'-->
223         <td colspan="3"> <span STYLE="color: gray;" > Edit Delete </span> </td>
224     <!-- TMPL_ELSE -->
225         <td colspan="3">
226                 <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=<!-- TMPL_VAR NAME="budget_id" -->&amp;budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->" >Edit</a>
227                 <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&amp;budget_id=<!-- TMPL_VAR NAME="budget_id" -->&amp;budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->">Delete</a>
228                 <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_parent_id=<!-- TMPL_VAR NAME="budget_id" -->&amp;budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->">Add Sub-Budget</a>
229         </td>
230     <!-- /TMPL_IF -->
231     </tr>
232                 <!-- /TMPL_LOOP -->
233         <!-- TMPL_ELSE -->
234                 <tr><td colspan="12">No budget found</td></tr>
235         <!-- /TMPL_IF -->
236         </tbody>
237     <tfoot>
238     <tr>
239     <th colspan='2' style='text-align: left;' nowrap>Period allocated <!--TMPL_IF NAME="budget_period_total" --><!-- TMPL_VAR NAME='budget_period_total'--><!-- /TMPL_IF -->  </th>
240     <th nowrap style='text-align: right;' > <!-- TMPL_VAR NAME='period_alloc_total'--></th>
241     <th nowrap  style='text-align: right;'> <!-- TMPL_VAR NAME='base_alloc_total'--></th>
242     <th style='text-align: right;' ><!-- TMPL_VAR NAME='base_spent_total'--></th>
243     <th style='text-align: right;' ><!-- TMPL_VAR NAME='base_remaining_total'--></th>
244     <th class="tooltipcontent"></th>
245     <th colspan="3"></th>
246     </tr>
247     </tfoot>
248 </table>
249
250 <span><b>Currency = <!-- TMPL_VAR NAME="cur" --> <!-- TMPL_VAR NAME="cur_format" --></b></span><br />
251 <div class="paginationBar"><!-- TMPL_VAR NAME="pagination_bar" --></div>
252 <!-- /TMPL_IF --> <!-- else -->
253
254 <!-- ********************************************************************************************** -->
255 <!-- create add/mod entry form -->
256 <!-- TMPL_IF name="add_form" -->
257
258 <form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
259     <fieldset class="rows">
260     <legend><!-- TMPL_IF NAME="budget_id" -->Modify<!-- TMPL_ELSE -->Add<!-- /TMPL_IF --> Budget
261     <!-- TMPL_IF NAME="budget_period_description" -->
262         <!-- TMPL_VAR NAME="budget_name" --> for period <!-- TMPL_VAR NAME="budget_period_description" -->
263     <!-- /TMPL_IF -->
264     </legend>
265
266     <input type="hidden" name="op" value="add_validate" />
267     <input type="hidden" name="checked" value="0" />
268     <ol>
269     <!-- TMPL_IF NAME="budget_parent_id" -->
270     <li>
271         <label for="budget_parent_id">Budget Parent: </label>
272         <!-- TMPL_VAR NAME="budget_parent_name" -->
273         <input type="hidden" name="budget_parent_id" value="<!-- TMPL_VAR NAME="budget_parent_id" -->" />
274     </li>
275         <!-- /TMPL_IF -->
276     <li>
277     <label style="color: red;"  for="budget_code">Budget Code: </label>
278     <input type="text" name="budget_code" id="budget_code" value="<!-- TMPL_VAR NAME="budget_code" -->" size="30" />
279     </li>
280
281     <li>
282     <label style="color: red;" for="budget_name">Budget Name: </label>
283     <input type="text" name="budget_name" id="budget_name" value="<!-- TMPL_VAR NAME="budget_name" -->" size="60" />
284     </li>
285
286     <div class='hint'>budget amount cannot both be empty</div>
287     <li>
288     <label style='white-space: nowrap;' for="budget_amount">Amount: </label>
289     <input type="text" name="budget_amount" id="budget_amount" value="<!-- TMPL_VAR NAME="budget_amount" -->" size="8" />
290     </li>
291
292     <li>
293     <label for="">Encumbrance: </label>
294     <input type="text" name="budget_encumb" id="budget_encumb" value="<!-- TMPL_VAR NAME="budget_encumb" -->" size="8" />
295     </li>
296
297     <li>
298     <label for="">Expenditure: </label>
299     <input type="text" name="budget_expend" id="budget_expend" value="<!-- TMPL_VAR NAME="budget_expend" -->" size="8" />
300     </li>
301
302     <input type="hidden" name="budget_owner_id" id="budget_owner_id" value='<!-- TMPL_VAR NAME="budget_owner_id" -->' />
303     <li>
304     <label for="parents">Owner: </label>
305     <span  id="budget_owner_name">
306     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="budget_owner_id" -->"><!-- TMPL_VAR NAME="budget_owner_name" --></a>
307     </span>
308
309     <!-- FIXME: hardcoded button positions :/ -->
310     <input style="position:absolute; left:600px;" type="button" id="patron_search" value="Edit owner" onclick="ownerPopup(); return false;" />
311     <input style="position:absolute; left:680px;"  type="button" id="patron_removal" value="Remove owner" onclick="ownerRemove(this.form); return false;" />
312     </li>
313
314     <li>
315     <label for="branch">Library: </label>
316     <select name="budget_branchcode">
317     <option value=""></option>
318     <!-- TMPL_LOOP name="branchloop_select" -->
319         <option value="<!-- TMPL_VAR name="value" -->"<!-- TMPL_IF name="selected" -->selected="selected"<!-- /TMPL_IF -->>
320             <!-- TMPL_VAR name="value" --> - <!-- TMPL_VAR name="branchname" -->
321         </option>
322     <!-- /TMPL_LOOP -->
323     </select>
324     </li>
325
326     <li>
327     <label for="branch">Restrict access to: </label>
328     <!-- TMPL_VAR name="budget_perm_dropbox" -->
329     </li>
330
331     <li>
332     <label for="">Notes: </label>
333     <textarea name="budget_notes" id="budget_notes"  cols="80" rows="6" ><!-- TMPL_VAR NAME='budget_notes' --></textarea>
334     </li>
335
336     <li>
337     <label  style='white-space: nowrap;' for="parents">Planning Category1: </label>
338         <select name="sort1_authcat" id="authorised_value_category1">
339             <option value=""></option>
340             <!-- TMPL_LOOP name="authorised_value_categories1" -->
341                 <!-- TMPL_IF name="selected" -->
342                     <option value="<!-- TMPL_VAR name="category" -->" selected="selected">
343                         <!-- TMPL_VAR name="category" -->
344                     </option>
345                 <!-- TMPL_ELSE -->
346                     <option value="<!-- TMPL_VAR name="category" -->">
347                         <!-- TMPL_VAR name="category" -->
348                     </option>
349                 <!-- /TMPL_IF -->
350             <!-- /TMPL_LOOP -->
351         </select>
352     </li>
353     <li>
354     <label  style='white-space: nowrap;' for="parents">Planning Category2: </label>
355         <select name="sort2_authcat" id="authorised_value_category2">
356             <option value=""></option>
357             <!-- TMPL_LOOP name="authorised_value_categories2" -->
358                 <!-- TMPL_IF name="selected" -->
359                     <option value="<!-- TMPL_VAR name="category" -->" selected="selected">
360                         <!-- TMPL_VAR name="category" -->
361                     </option>
362                 <!-- TMPL_ELSE -->
363                     <option value="<!-- TMPL_VAR name="category" -->">
364                         <!-- TMPL_VAR name="category" -->
365                     </option>
366                 <!-- /TMPL_IF -->
367             <!-- /TMPL_LOOP -->
368         </select>
369     </li>
370     </ol>
371
372     <!-- TMPL_IF NAME="budget_id" -->
373         <input type="hidden" name="budget_id" value="<!-- TMPL_VAR NAME='budget_id' -->" />
374     <!-- /TMPL_IF -->
375     </fieldset>
376
377     <fieldset class="action">
378         <input type="submit" value="Submit" onclick="javascript:Check(this.form);" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl">Cancel</a>
379         <input type="hidden" name="budget_period_id" value="<!-- TMPL_VAR name='budget_period_id' -->" />
380     </fieldset>
381 </form>
382
383 <!-- /TMPL_IF --> <!-- add_form -->
384
385 <!-- TMPL_IF name="delete_confirm" -->
386 <div class="dialog alert"> <h3>Delete Budget <!-- TMPL_VAR NAME="budget_name" -->?</h3>
387 <table>
388     <tr>
389     <td scope="row">Budget Amount:</td>
390     <td><!-- TMPL_VAR NAME="budget_amount" --></td>
391     </tr>
392 </table>
393
394 <form action="<!-- TMPL_VAR NAME="action" -->" method="post">
395     <input type="hidden" name="op" value="delete_confirmed" />
396     <input type="hidden" name="budget_id" value="<!-- TMPL_VAR NAME="budget_id" -->" />
397     <input type="hidden" name="budget_period_id" value="<!-- TMPL_VAR NAME="budget_period_id" -->" />
398     <input type="submit" value="Delete this budget" class="approve" />
399 </form>
400
401 <form action="<!-- TMPL_VAR NAME="action" -->" method="get">
402     <input type="submit" class="deny" value="No, Do Not Delete" />
403 </form>
404 </div>
405 <!-- /TMPL_IF -->
406
407 </div>
408 </div>
409 <div class="yui-b">
410     <!-- TMPL_INCLUDE NAME="admin-menu.inc" -->
411 </div>
412 </div>
413 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->