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