Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt
Caroline Cyr La Rose 10cd6dc584
Bug 34103: Capitalization: Currencies & Exchange rates
This patch corrects the breadcrumbs in the Administration > Currencies
and exchange rates page to follow current capitalization and
typographical guidelines.

To test:
0. Apply patch
1. Go to Administration > Currencies and exchange rates
2. Verify that the breadcrumb has no spelling errors, and that
   capitalization and typography guidelines are applied
3. Click 'Delete' next to one of the currencies
4. Verify that the breadcrumb has no spelling errors, and that
   capitalization and typography guidelines are applied

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1a29ff17a5)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2023-07-17 15:35:02 +01:00

296 lines
12 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE KohaDates %]
[% USE TablesSettings %]
[% USE HtmlTags %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF op == 'add_form' %][% IF currency %]Modify currency '[% currency.currency | html %]'[% ELSE %]New currency[% END %][% END %]
[% IF op == 'delete_confirm' %]Confirm deletion of currency '[% currency.currency | html %]'[% END %]
[% IF op == 'list' %]Currencies[% END %] &rsaquo; Currencies and exchange rates &rsaquo; Administration &rsaquo; Koha
</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="admin_currency" class="admin">
[% WRAPPER 'header.inc' %]
[% INCLUDE 'currencies-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/currency.pl">Currencies and exchange rates</a>
[% END %]
[% IF op == 'add_form' %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
[% IF currency %]
<span>Modify currency '[% currency.currency | html %]'</span>
[% ELSE %]
<span>New currency</span>
[% END %]
[% END %]
[% END %]
[% IF op == 'delete_confirm' %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Confirm deletion of currency [% currency.currency | $HtmlTags tag='span' attributes=>'class="ex"' %]</span>
[% END %]
[% ELSIF op == 'list' %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Currencies</span>
[% END %]
[% 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>
[% IF op == 'list' %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default" id="newcurrency" href="/cgi-bin/koha/admin/currency.pl?op=add_form"><i class="fa fa-plus"></i> New currency</a>
</div>
[% END %]
[% FOR m IN messages %]
<div class="dialog [% m.type | html %]">
[% SWITCH m.code %]
[% CASE 'error_on_update' %]
<span>An error occurred when updating this currency. Perhaps it already exists</span>
[% CASE 'error_on_insert' %]
<span>An error occurred when adding this currency. The currency code might already exist</span>
[% CASE 'error_on_delete' %]
<span>An error occurred when deleting this currency. Check the logs</span>
[% CASE 'success_on_update' %]
<span>Currency updated successfully</span>
[% CASE 'success_on_insert' %]
<span>Currency added successfully</span>
[% CASE 'success_on_delete' %]
<span>Currency deleted successfully</span>
[% CASE %]
<span>[% m.code | html %]</span>
[% END %]
</div>
[% END %]
[% IF op == 'add_form' %]
<form action="/cgi-bin/koha/admin/currency.pl" name="Aform" method="post" class="validated">
<input type="hidden" name="op" value="add_validate" />
<fieldset class="rows">
<legend>
<h1>
[% IF currency %]
<span>Modify currency</span>
[% ELSE %]
<span>New currency</span>
[% END %]
</h1>
</legend>
<ol>
<li>
[% IF currency %]
<span class="label">Currency: </span>
<input type="hidden" name="is_a_modif" value="1" />
<input type="hidden" name="currency_code" id="currency" value="[% currency.currency | html %]" />[% currency.currency | html %]
[% ELSE %]
<label for="currency_code" class="required">Currency: </label>
<input type="text" name="currency_code" id="currency_code" class="focus" size="50" maxlength="50" required="required" class="required" /> <span class="required">Required</span>
[% END %]
</li>
<li>
<label for="rate" class="required">Rate: </label>
<input type="text" name="rate" id="rate" size="10" maxlength="10" value="[% currency.rate | html %]" required="required" class="required" /> <span class="required">Required</span>
</li>
<li>
<label for="symbol" class="required">Symbol: </label>
<input type="text" name="symbol" id="symbol" size="5" maxlength="5" value="[% currency.symbol | html %]" required="required" class="required" /> <span class="required">Required</span>
</li>
<li>
<label for="isocode">ISO code: </label>
<input type="text" name="isocode" id="isocode" size="5" maxlength="5" value="[% currency.isocode | html %]" />
</li>
<li>
<span class="label">Last updated: </span>[% currency.timestamp | $KohaDates %]
</li>
<li>
<label for="p_sep_by_space">Space separation between symbol and value: </label>
[% IF currency.p_sep_by_space %]
<input type="checkbox" id="p_sep_by_space" name="p_sep_by_space" value="1" checked="checked" />
[% ELSE %]
<input type="checkbox" id="p_sep_by_space" name="p_sep_by_space" value="1" />
[% END %]
</li>
<li>
<label for="active">Active: </label>
[% IF currency.active %]
<input type="checkbox" id="active" name="active" value="1" checked="checked" />
[% ELSE %]
<input type="checkbox" id="active" name="active" value="1" />
[% END %]
<span id="hint" class="hint"></span>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" class="btn btn-primary" value="Submit" />
<a href="/cgi-bin/koha/admin/currency.pl" class="cancel">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF op =='delete_confirm' %]
[% IF nb_of_orders or nb_of_vendors %]
<div class="dialog alert">
<h1>Cannot delete currency [% currency.currency | $HtmlTags tag='span' attributes=>'class="ex"' %]</h1>
<p>
[% IF nb_of_orders %]
<span>This currency is used by [% nb_of_orders | html %] orders.</span>
[% ELSIF nb_of_vendors %]
<span>This currency is used by [% nb_of_vendors | html %] vendors.</span>
[% END %]
<span>Deletion not possible</span>
</p>
<form action="/cgi-bin/koha/admin/currency.pl" method="post">
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
</form>
</div>
[% ELSE %]
<div class="dialog alert">
<h1>Confirm deletion of currency [% currency.currency | $HtmlTags tag='span' attributes=>'class="ex"' %]</h1>
<table>
<tr><th>Currency</th>
<td>[% currency.currency | html %]</td>
</tr>
<tr><th>Rate</th>
<td>[% currency.rate | html %]</td>
</tr>
</table>
<form action="/cgi-bin/koha/admin/currency.pl" method="post">
<input type="hidden" name="op" value="delete_confirmed" />
<input type="hidden" name="currency_code" value="[% currency.currency | html %]" />
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this currency</button>
</form>
<form action="/cgi-bin/koha/admin/currency.pl" method="post">
<button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
</form>
</div>
[% END %]
[% END %]
[% IF op == 'list' %]
<h1>Currencies and exchange rates</h1>
[% IF currencies and no_active_currency %]
<div class="dialog alert"><h3>No active currency is defined</h3><p>Please edit one currency and mark it as active.</p></div>
[% END %]
[% IF searchfield %]
You searched for [% searchfield | html %]</span>
[% END %]
<div class="page-section">
<table id='currencies-table'>
<thead>
<tr>
<th>Currency</th>
<th>Rate</th>
<th>Symbol</th>
<th>ISO code</th>
<th>Last updated</th>
<th>Active</th>
<th>Archived</th>
<th class="NoSort noExport">Actions</th>
</tr>
</thead>
<tbody>
[% FOREACH currency IN currencies %]
<tr>
<td>[% currency.currency | html %]</td>
<td>[% currency.rate | html %]</td>
<td>[% currency.symbol | html %]</td>
<td>[% currency.isocode | html %]</td>
<td data-order="[% currency.timestamp | html %]">[% currency.timestamp | $KohaDates %]</td>
<td style="color:green;">[% IF currency.active %]✓[% END %]</td>
<td>[% IF currency.archived %]Yes[% END %]</td>
<td class="actions">
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/currency.pl?op=add_form&amp;currency_code=[% currency.currency | html %]"><i class="fa fa-pencil"></i> Edit</a>
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/currency.pl?op=delete_confirm&amp;currency_code=[% currency.currency | html %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
</tbody>
</table>
</div>
<div class="hint">
<p>
When importing MARC files via the staging tools, the tool will attempt to find and use the price of the currently active currency.
</p>
<p>
Some examples of compatible price fields include "$9.99", "9.99 USD", "$9.99 USD", "9.99 USD (10.00 CAN)", "$9.99 USD (paperback)".
These examples assume USD is the active currency.
</p>
</div>
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'admin-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
<script>
function check_currency(val) {
if ( val == 1.0 ) {
$("#active").prop('disabled', false);
$("#hint").html("");
} else {
$("#active").prop('checked', false);
$("#active").prop('disabled', true);
$("#hint").html(_("The active currency must have a rate of 1.0"));
}
}
$(document).ready(function() {
columns_settings = [% TablesSettings.GetTableSettings( 'admin', 'currency', 'currencies-table', 'json' ) | $raw %]
var issuest = KohaTable("currencies-table", {
dom: 'B<"clearfix">t',
}, columns_settings );
// prevents users to check active with a currency != 1
$("#rate").keyup(function() {
check_currency( $(this).val() );
});
check_currency( $("#rate").val() );
$("#currency_code").on("blur",function(){
toUC(this);
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]