Bug 10306: Support for multiple mappings in koha2marclinks
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / currency.tt
1 [% USE KohaDates %]
2 [% USE ColumnsSettings %]
3 [% USE HtmlTags %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Administration &rsaquo; Currencies &amp; Exchange rates &rsaquo;
6 [% IF op == 'add_form' %][% IF currency %]Modify currency '[% currency.currency %]'[% ELSE %]New currency[% END %][% END %]
7 [% IF op == 'delete_confirm' %]Confirm deletion of currency '[% currency.currency %]'[% END %]
8 [% IF op == 'list' %]Currencies[% END %]</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
11 [% INCLUDE 'datatables.inc' %]
12 [% INCLUDE 'columns_settings.inc' %]
13 <script type="text/javascript">
14 //<![CDATA[
15
16     function check_currency(val) {
17         if ( val == 1.0 ) {
18             $("#active").prop('disabled', false);
19             $("#hint").html("");
20         } else {
21             $("#active").prop('checked', false);
22             $("#active").prop('disabled', true);
23             $("#hint").html(_("The active currency must have a rate of 1.0"));
24         }
25     }
26
27     $(document).ready(function() {
28         columns_settings = [% ColumnsSettings.GetColumns( 'admin', 'currency', 'currencies-table', 'json' ) %]
29         var issuest = KohaTable("#currencies-table", {
30             dom: 'B<"clearfix">t',
31             "columnDefs": [
32                 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
33                 { "sType": "title-string", "aTargets" : [ "title-string" ] }
34                 ],
35         }, columns_settings );
36
37         // prevents users to check active with a currency != 1
38         $("#rate").keyup(function() {
39             check_currency( $(this).val() );
40         });
41         check_currency( $("#rate").val() );
42         $("#currency_code").on("blur",function(){
43             toUC(this);
44         });
45     });
46 //]]>
47 </script>
48 </head>
49 <body id="admin_currency" class="admin">
50 [% INCLUDE 'header.inc' %]
51 [% INCLUDE 'currencies-admin-search.inc' %]
52
53
54
55 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;  <a href="/cgi-bin/koha/admin/currency.pl">Currencies &amp; Exchange rates</a> &rsaquo; [% IF op == 'add_form' %][% IF currency %]Modify currency '[% currency.currency %]'[% ELSE %]New currency[% END %][% END %]
56 [% IF op == 'delete_confirm' %]Confirm deletion of currency [% currency.currency | $HtmlTags tag='span' attributes=>'class="ex"' %]
57 [% ELSIF op == 'list' %]Currencies
58 [% END %]
59 </div>
60
61 <div id="doc3" class="yui-t2">
62
63 <div id="bd">
64     <div id="yui-main">
65     <div class="yui-b">
66 [% IF op == 'list' %]
67 <div id="toolbar" class="btn-toolbar">
68     <a class="btn btn-default btn-sm" id="newcurrency" href="/cgi-bin/koha/admin/currency.pl?op=add_form"><i class="fa fa-plus"></i> New currency</a>
69 </div>
70 [% END %]
71
72 [% FOR m IN messages %]
73     <div class="dialog [% m.type %]">
74         [% SWITCH m.code %]
75         [% CASE 'error_on_update' %]
76             An error occurred when updating this currency. Perhaps it already exists.
77         [% CASE 'error_on_insert' %]
78             An error occurred when adding this currency. The currency code might already exist.
79         [% CASE 'error_on_delete' %]
80             An error occurred when deleting this currency. Check the logs.
81         [% CASE 'success_on_update' %]
82             Currency updated successfully.
83         [% CASE 'success_on_insert' %]
84             Currency added successfully.
85         [% CASE 'success_on_delete' %]
86             Currency deleted successfully.
87         [% CASE %]
88             [% m.code %]
89         [% END %]
90     </div>
91 [% END %]
92
93
94
95 [% IF op == 'add_form' %]
96
97 <form action="/cgi-bin/koha/admin/currency.pl" name="Aform" method="post" class="validated">
98     <input type="hidden" name="op" value="add_validate" />
99     <fieldset class="rows">
100         <legend>
101             [% IF currency %]
102                 Modify currency
103             [% ELSE %]
104                 New currency
105             [% END %]
106         </legend>
107         <ol>
108             <li>
109                 [% IF currency %]
110                     <span class="label">Currency: </span>
111                     <input type="hidden" name="is_a_modif" value="1" />
112                     <input type="hidden" name="currency_code" id="currency" value="[% currency.currency %]" />[% currency.currency %]
113                 [% ELSE %]
114                     <label for="currency_code" class="required">Currency: </label>
115                     <input type="text" name="currency_code" id="currency_code" size="50" maxlength="50" required="required" class="required" /> <span class="required">Required</span>
116                 [% END %]
117             </li>
118             <li>
119                 <label for="rate" class="required">Rate: </label>
120                 <input type="text" name="rate" id="rate" size="10" maxlength="10" value="[% currency.rate %]" required="required" class="required" /> <span class="required">Required</span>
121             </li>
122             <li>
123                 <label for="symbol" class="required">Symbol: </label>
124                 <input type="text" name="symbol" id="symbol" size="5" maxlength="5" value="[% currency.symbol %]" required="required" class="required" /> <span class="required">Required</span>
125             </li>
126             <li>
127                 <label for="isocode">ISO code: </label>
128                 <input type="text" name="isocode" id="isocode" size="5" maxlength="5" value="[% currency.isocode %]" />
129             </li>
130             <li>
131                 <span class="label">Last updated: </span>[% currency.timestamp | $KohaDates %]
132             </li>
133             <li>
134                 <label for="active">Active: </label>
135                 [% IF currency.active %]
136                 <input type="checkbox" id="active" name="active" value="1" checked="checked" />
137                 [% ELSE %]
138                 <input type="checkbox" id="active" name="active" value="1" />
139                 [% END %]
140                 <span id="hint" class="hint"></span>
141             </li>
142         </ol>
143     </fieldset>
144
145     <fieldset class="action">
146         <input type="submit" value="Submit" />
147         <a href="/cgi-bin/koha/admin/currency.pl" class="cancel">Cancel</a>
148     </fieldset>
149     </form>
150
151 [% END %]
152
153 [% IF op =='delete_confirm' %]
154     [% IF nb_of_orders or nb_of_vendors %]
155     <div class="dialog alert">
156         <h3>Cannot delete currency [% currency.currency | $HtmlTags tag='span' attributes=>'class="ex"' %]</h3>
157         <p>
158             [% IF nb_of_orders %]
159                 This currency is used by [% nb_of_orders %] orders.
160             [% ELSIF nb_of_vendors %]
161                 This currency is used by [% nb_of_vendors %] vendors.
162             [% END %]
163             Deletion not possible
164         </p>
165         <form action="/cgi-bin/koha/admin/currency.pl" method="post">
166             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
167         </form>
168     </div>
169     [% ELSE %]
170     <div class="dialog alert">
171         <h3>Confirm deletion of currency [% currency.currency | $HtmlTags tag='span' attributes=>'class="ex"' %]</h3>
172         <table>
173             <tr><th>Currency</th>
174                 <td>[% currency.currency %]</td>
175             </tr>
176             <tr><th>Rate</th>
177                 <td>[% currency.rate %]</td>
178             </tr>
179         </table>
180         <form action="/cgi-bin/koha/admin/currency.pl" method="post">
181             <input type="hidden" name="op" value="delete_confirmed" />
182             <input type="hidden" name="currency_code" value="[% currency.currency %]" />
183             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this currency</button>
184         </form>
185         <form action="/cgi-bin/koha/admin/currency.pl" method="post">
186             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
187         </form>
188     </div>
189     [% END %]
190 [% END %]
191
192 [% IF op == 'list' %]
193
194 <h2>Currencies and exchange rates</h2>
195
196     [% IF currencies and no_active_currency %]
197         <div class="dialog alert"><h3>No active currency is defined</h3><p>Please edit one currency and mark it as active.</p></div>
198     [% END %]
199
200     [% IF searchfield %]
201         You searched for [% searchfield |html %]</span>
202     [% END %]
203
204     <table id='currencies-table'>
205       <thead>
206         <tr>
207             <th>Currency</th>
208             <th>Rate</th>
209             <th>Symbol</th>
210             <th>ISO code</th>
211             <th class="title-string">Last updated</th>
212             <th>Active</th>
213             <th>Archived</th>
214             <th>Actions</th>
215         </tr>
216       </thead>
217       <tbody>
218         [% FOREACH currency IN currencies %]
219           <tr>
220             <td>[% currency.currency %]</td>
221             <td>[% currency.rate %]</td>
222             <td>[% currency.symbol |html %]</td>
223             <td>[% currency.isocode |html %]</td>
224             <td><span title="[% currency.timestamp %]">[% currency.timestamp | $KohaDates %]</span></td>
225             <td style="color:green;">[% IF currency.active %]✓[% END %]</td>
226             <td>[% IF currency.archived %]Yes[% END %]</td>
227             <td class="actions">
228               <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/currency.pl?op=add_form&amp;currency_code=[% currency.currency %]"><i class="fa fa-pencil"></i> Edit</a>
229               <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/currency.pl?op=delete_confirm&amp;currency_code=[% currency.currency %]"><i class="fa fa-trash"></i> Delete</a>
230             </td>
231           </tr>
232         [% END %]
233       </tbody>
234     </table>
235
236     <br />
237     <div class="hint">
238         <p>
239             When importing MARC files via the staging tools, the tool will attempt to find and use the price of the currently active currency.
240         </p>
241         <p>
242             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)".
243             These examples assume USD is the active currency.
244         </p>
245     </div>
246
247 [% END %]
248
249 </div>
250 </div>
251 <div class="yui-b">
252 [% INCLUDE 'admin-menu.inc' %]
253 </div>
254 </div>
255 [% INCLUDE 'intranet-bottom.inc' %]