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