Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt
Owen Leonard fac6523b3c
Bug 34404: Fix inconsistencies in Budgets and funds page titles, breadcrumbs, and headers
This patch fixes some inconsistencies in the budget and fund
administration templates, making sure the page title, breadcrumb
navigation, and page headers are consistent with each other.

Other changes: Bootstrap tooltips have been enabled in a few places
where the markup showed intent for the tooltips to be active but where
the JS was not being initiated.

Some translation imrovements have been added where budget planning
strings could be improved with context:

 '<span>by months</span>' ->
 '[% tp("Budget planning", "by months") | html %]'

To test, apply the patch and go to Administration -> Budgets. Test each
of these cases:

- Budgets list
  - New budget
  - Edit budget
  - Duplicate budget
  - Close budget
    - Close a budget with and without unreceived orders.
  - Delete budget
    - Test the delete button on a budget which has funds attached to
      confirm that the menu item is disabled and a tooltip shows with an
      explanation.
    - Delete a budget which has no funds attached.
  - Add fund
    - Test the add fund button on a budget which is locked. The menu
      item should be disabled and it should show a tooltip, "Budget is
      locked."
    - Test the add fund page for a budget which is not locked.
  - Click the name of a budget with funds attached to see the funds view
    - In this view, if the budget is locked, the "New" toolbar menu
      should have a disabled "New fund" item with a Bootstrap tooltip.
  - While viewing the funds on a budget, test the "Planning" button to
    confirm that the view of each planning type.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-11-08 09:58:57 -03:00

346 lines
15 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Price %]
[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
[% PROCESS 'budget_planning.inc' %]
<title>[% FILTER collapse %]
[% PROCESS planning plan=authcat %] &rsaquo;
[% t("Funds") | html %] &rsaquo;
[% t("Budgets") | html %] &rsaquo;
[% t("Administration") | html %] &rsaquo;
[% t("Koha") | html %]
[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<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>
</head>
<body id="admin_aqplan" class="admin">
[% WRAPPER 'header.inc' %]
[% INCLUDE 'budgets-admin-search.inc' %]
[% END %]
[% WRAPPER 'sub-header.inc' %]
[% WRAPPER breadcrumbs %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
[% END %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
[% END %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">Funds</a>
[% END %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
[% PROCESS planning plan=authcat %]
[% END %]
[% END #/ WRAPPER breadcrumbs %]
[% END #/ WRAPPER sub-header.inc %]
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% INCLUDE 'budgets-admin-toolbar.inc' %]
<form method="post" id="Aform" name="Aform" action="/cgi-bin/koha/admin/aqplan.pl">
<h1>[% PROCESS planning plan=authcat %]</h1>
<input type="hidden" name="authcat" value="[% authcat | html %]" />
<!-- Budget Lines -->
<div class="page-section">
[% IF ( budget_lines ) %]
[% INCLUDE 'budgets-active-currency.inc' %]
[% IF ( show_actual ) %]
<p><strong>Each cell contain both actual and estimated values.</strong></p>
[% ELSE %]
<p><strong>Cells contain estimated values only.</strong></p>
[% END %]
<p id="selections">
<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>
[% FOREACH authvals_ro IN authvals_row %]
<span class="selected"><label><input type="checkbox" checked="checked" id="col[% authvals_ro.colnum | html %]">[% authvals_ro.code | html %]</label></span>
[% END %]
</p>
<table id="plan">
<thead>
<tr>
<th>Fund name</th>
<th>Fund total</th>
[% FOREACH authvals_ro IN authvals_row %]
[% IF ( authvals_ro.display ) %]
<th id="col[% authvals_ro.code | html %]" class="[% authvals_ro.colnum | html %]">
[% ELSE %]
<th id="col[% authvals_ro.code | html %]" style="display:none;" class="[% authvals_ro.colnum | html %]">
[% END %]
[% authvals_ro.code | html %]</th>
[% END %]
<th class="remaining">Fund remaining</th>
<th class="noExport">Actions</th>
</tr>
</thead>
<tbody>
[% FOREACH budget_line IN budget_lines %]
<tr id="[% budget_line.budget_id | html %]">
[% IF ( budget_line.budget_lock ) %]
<td class="locked" title="Fund locked">
[% ELSE %]
<td>
[% END %]
<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>
<td><span id="[% budget_line.budget_amount | html %]">[% budget_line.budget_amount | $Price %]&nbsp;</span>
<!-- NEXT DIV ELEMENT IS USED BY JS FOR CALC-ING AUTO-FILL AND ESTIMATED AMOUNTS -->
<div style="display:none;" id="budget_tot_[% budget_line.budget_id | html %]">[% budget_line.budget_amount | html %]</div></td>
[% FOREACH line IN budget_line.lines %]
[% IF ( line.display ) %]
<td class="[% line.colnum | html %]">
[% ELSE %]
<td style="display:none;" class="[% line.colnum | html %]">
[% END %]
<table class="invis">
<tr>
[% IF show_actual %]
<td >[% line.actual_amount | html %]</td>
[% END %]
<td>
[% IF ( line.budget_lock ) %]
[% line.estimated_amount | html %]&nbsp;
<input type="hidden" style="text-align: right;" name="[% line.cell_name | html %]" value="[% line.estimated_amount | html %]" />
[% ELSE %]
<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 %]" />
[% END %]
</td></tr>
</table>
</td>
[% END %]
<td>
<table class="invis">
<tr>
[% IF show_actual %]
[% IF ( budget_line.act_negative ) %]
<td style="color: red;">
[% ELSIF ( budget_line.act_positive ) %]
<td style="color: green;">
[% ELSE %]
<td>
[% END %]
[% budget_line.budget_act_remain | html %]
</td>
[% END %]
[% IF ( budget_line.est_negative ) %]
<td style="color: red;" id="budget_est_[% budget_line.budget_id | html %]">
[% ELSIF ( budget_line.est_positive ) %]
<td style="color: green;" id="budget_est_[% budget_line.budget_id | html %]">
[% ELSE %]
<td id="budget_est_[% budget_line.budget_id | html %]">
[% END %]
[% budget_line.budget_est_remain | $Price %]&nbsp;
</td>
</tr>
</table>
</td>
<td class="actions">
[% UNLESS ( budget_line.budget_lock ) %]
<input type="button" class="auto_fill_row btn btn-default btn-xs" data-budget-id="[% budget_line.budget_id | html %]" value="Auto-fill row"/>
<input type="button" class="clear_fields btn btn-default btn-xs" data-budget-id="[% budget_line.budget_id | html %]" value="Clear">
[% ELSE %]
<div style="color:red;">not owned</div>
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
<input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
[% IF ( budget_period_locked ) %]
<!-- <input STYLE="background: gray;" type="submit" value="Save" disabled="disabled"/> -->
[% ELSE %]
<input type="hidden" name="op" value="save" />
<fieldset class="action"><input type="submit" class="btn btn-primary" value="Save" /></fieldset>
[% END %]
</div> <!-- /.page-section -->
<div id="hide_div">
[% FOREACH authvals_ro IN authvals_row %]
[% UNLESS ( authvals_ro.display ) %]
<input type="hidden" value="[% authvals_ro.code | html %]" name="hide_cols"/>
[% END %]
[% END %]
</div>
</form>
[% ELSIF not budget_period_id %]
<div class="dialog alert">That budget does not exist! Please select a budget to continue.</div>
[% ELSE %]
<div class="dialog message">No funds to display for this search criteria</div>
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
<form method="post" action="/cgi-bin/koha/admin/aqplan.pl">
<input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
<fieldset class="brief">
<h4>Filter</h4>
[% BLOCK planning_types %]
[% SWITCH type %]
[% CASE 'MONTHS' %][% tp("Budget planning", "by months") | html %]
[% CASE 'ITEMTYPES' %][% tp("Budget planning", "by item types") | html %]
[% CASE 'BRANCHES' %][% tp("Budget planning", "by libraries") | html %]
[% CASE %][% tpx("Budget planning", "by {type}", {type = type}) | html %]
[% END %]
[% END %]
<ol>
<li>
<label for="authcat"> Select planning type:</label>
<select name="authcat" id="authcat">
[% FOREACH value IN authcat_dropbox.values %]
[% IF ( value == authcat_dropbox.default ) %]
<option value="[% value | html %]" selected="selected">[% PROCESS planning_types type=value %]</option>
[% ELSE %]
<option value="[% value | html %]">[% PROCESS planning_types type=value %]</option>
[% END %]
[% END %]
</select>
</li>
<li class="radio">
[% IF ( show_mine ) %]
<input type="checkbox" id="show_mine" name="show_mine" value="1" checked="checked" />
[% ELSE %]
<input type="checkbox" id="show_mine" name="show_mine" value="1" />
[% END %]
<label for="show_mine">Show my funds only</label>
</li>
<li class="radio">
[% IF ( show_active ) %]
<input type="checkbox" id="show_active" name="show_active" value="1" checked="checked" />
[% ELSE %]
<input type="checkbox" id="show_active" name="show_active" value="1" />
[% END %]
<label for="show_active">Show active funds only</label>
</li>
<li class="radio">
[% IF ( show_actual ) %]
<input type="checkbox" id="show_actual" name="show_actual" value="1" checked="checked" />
[% ELSE %]
<input type="checkbox" id="show_actual" name="show_actual" value="1" />
[% END %]
<label for="show_actual">Show actual/estimated values</label>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" name="option_submit" class="btn btn-primary" value="Submit" />
<input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
</fieldset>
</form>
[% IF ( budget_lines ) %]
<form method="post" action="/cgi-bin/koha/admin/aqplan.pl">
<fieldset class="brief">
<h4>Export</h4>
<ol>
<li><label for="basename">Output to a file named: </label><input type="text" name="basename" id="basename" value="Export" /></li>
<li><label class="inline" for="MIME">Into an application</label>
<select name="MIME" id="MIME">
[% FOREACH value IN CGIextChoice %]
<option value="[% value | html %]">[% value | html %]</option>
[% END %]
</select>
<select name="sep" id="sep">
[% FOREACH value IN CGIsepChoice %]
<option value="[% value | html %]">[% value | html %]</option>
[% END %]
</select>
</li>
</ol>
<input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
<input type="hidden" name="authcat" value="[% authcat | html %]" />
</fieldset>
<fieldset class="action"> <input type="submit" class="btn btn-primary" value="Submit" />
<input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
<input type="hidden" name="report_name" value="[% report_name | html %]" />
<input type="hidden" name="output" value="file" /></fieldset>
</form>
[% END %]
[% INCLUDE 'acquisitions-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/acq.js") | $raw %]
<script>
jQuery.validator.addClassRules({ plan_entry: { pnumber: true } }); // require that input be a number in fields with the class 'plan_entry'
jQuery.validator.addMethod("pnumber", $.validator.methods.number, _("Please enter a valid number.") );
var zero_formatted = "[% 0 | $Price on_editing => 1 %]";
$(document).ready(function() {
$("#selections input").on("change",function(e){
var num = $(this).attr("id");
if(num == 'showall'){
showAllColumns();
e.stopPropagation();
} else if(num == 'hideall'){
hideAllColumns();
e.stopPropagation();
} else {
if($(this).prop("checked")){
showColumn(num);
} else {
hideColumn(num);
}
}
});
$(".plan_entry").on("change",function(){
calcTotalRow( this );
});
$("#Aform").validate();
$(".auto_fill_row").on("click",function(){
var budget_id = $(this).data("budget-id");
autoFillRow( budget_id );
});
$(".clear_fields").on("click",function(){
var budget_id = $(this).data("budget-id");
var edit_row = $("#"+budget_id);
$(edit_row).find("input").each(function(){
var type = $(this).attr("type");
if (type != "button" && type != "submit" ) {
$(this).val(zero_formatted);
$(this).prop('disabled', false);
}
});
$("#budget_est_"+budget_id).text($("#budget_tot_"+budget_id).prev().text());
$("#budget_est_"+budget_id).css("color","green");
});
$('[data-toggle="tooltip"]').tooltip();
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]