Merge branch 'bug_7969' into 3.12-master
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / currency.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; Currencies &amp; Exchange rates &rsaquo;
3 [% IF ( add_form ) %][% IF ( searchfield ) %]Modify currency '[% searchfield %]'[% ELSE %]New currency[% END %][% END %]
4 [% IF ( delete_confirm ) %]Confirm deletion of currency '[% searchfield %]'[% END %]
5 [% IF ( delete_confirmed ) %]Currency deleted[% END %]
6 [% IF ( else ) %]Currencies[% END %]</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <script type="text/javascript">
9 //<![CDATA[
10     function toUC(f) {
11         var x=f.value.toUpperCase();
12         f.value=x;
13         return true;
14     }
15     function Check(f) {
16         var _alertString="";
17         var alertString2;
18         if (f.currency.value.length==0) {
19             _alertString += _("- Currency name missing") + "\n";
20         }
21         if (f.rate.value.length==0) {
22             _alertString += _("- Rate missing") + "\n";
23         }
24         if (f.symbol.value.length==0) {
25             _alertString += _("- Symbol missing") + "\n";
26         }
27         if (_alertString.length==0) {
28             document.Aform.submit();
29         } else {
30             alertString2 = _("Form not submitted because of the following problem(s)") + "\n";
31             alertString2 += "------------------------------------------------------------------------------------\n";
32             alertString2 += _alertString;
33             alert(alertString2);
34         }
35     }
36
37     function check_currency(val) {
38         if ( val == 1.0 ) {
39             $("#active").removeAttr('disabled');
40             $("#hint").html("");
41         } else {
42             $("#active").removeAttr('checked');
43             $("#active").attr('disabled','disabled');
44             $("#hint").html(_("The active currency must have a rate of 1.0"));
45         }
46     }
47
48     $(document).ready(function() {
49         // prevents users to check active with a currency != 1
50         $("#rate").keyup(function() {
51             check_currency( $(this).val() );
52         });
53         check_currency( $("#rate").val() );
54     });
55 //]]>
56 </script>
57 </head>
58 <body id="admin_currency" class="admin">
59 [% INCLUDE 'header.inc' %]
60 [% INCLUDE 'currencies-admin-search.inc' %]
61
62
63
64 <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 ( add_form ) %][% IF ( searchfield ) %]Modify currency '[% searchfield %]'[% ELSE %]New currency[% END %][% END %]
65 [% IF ( delete_confirm ) %]Confirm deletion of currency '<span class="ex">[% searchfield %]</span>'[% END %]
66 [% IF ( delete_confirmed ) %]Currency deleted[% END %]
67 [% IF ( else ) %]Currencies[% END %]
68 </div>
69
70 <div id="doc3" class="yui-t2">
71
72 <div id="bd">
73     <div id="yui-main">
74     <div class="yui-b">
75
76 [% IF ( else ) %]
77 <div id="toolbar" class="btn-toolbar">
78     <a class="btn btn-small" id="newcurrency" href="[% script_name %]?op=add_form"><i class="icon-plus"></i> New currency</a>
79 </div>
80 [% END %]
81
82 [% IF ( add_form ) %]
83
84 <form action="[% script_name %]" name="Aform" method="post">
85     <input type="hidden" name="op" value="save" />
86     <fieldset class="rows">
87     <legend>[% IF ( searchfield ) %]
88         Modify currency
89     [% ELSE %]
90         New currency
91     [% END %]</legend>
92     <ol>
93         <li>
94     [% IF ( searchfield ) %]
95             <span class="label">Currency: </span>
96             <input type="hidden" name="currency" id="currency" value="[% searchfield %]" />[% searchfield %]
97     [% ELSE %]
98             <label for="currency">Currency: </label>
99             <input type="text" name="currency" id="currency" size="50" maxlength="50" onblur="toUC(this);" />
100     [% END %]
101         </li>
102         <li>
103             <label for="rate">Rate: </label>
104             <input type="text" name="rate" id="rate" size="10" maxlength="10" value="[% rate %]" />
105         </li>
106         <li>
107             <label for="symbol">Symbol: </label>
108             <input type="text" name="symbol" id="symbol" size="5" maxlength="5" value="[% symbol %]" />
109         </li>
110
111         <li>
112             <span class="label">Last updated: </span>[% timestamp %]
113         </li>
114         <li>
115             <label for="active">Active: </label>
116             [% IF ( active ) %]
117             <input type="checkbox" id="active" name="active" value="1" checked="checked" />
118             [% ELSE %]
119             <input type="checkbox" id="active" name="active" value="1" />
120             [% END %]
121             <span id="hint" class="hint"></span>
122         </li>
123
124         </ol>
125         </fieldset>
126
127     <fieldset class="action">
128         <input type="submit" value="Submit" onclick="Check(this.form); return false;" />
129         <a href="/cgi-bin/koha/admin/currency.pl" class="cancel">Cancel</a>
130     </fieldset>
131     </form>
132
133 [% END %]
134
135 [% IF ( delete_confirm ) %]
136     [% IF ( totalgtzero ) %]
137     <div class="dialog message">
138         <h3>Cannot delete currency <span class="ex">'[% searchfield %]'</span></h3>
139         <p>This currency is used [% total %] times. Deletion not possible</p>
140         <form action="[% script_name %]" method="post">
141             <input type="submit" value="OK" class="approve" />
142         </form>
143     </div>
144     [% ELSE %]
145     <div class="dialog alert">
146         <h3>Confirm deletion of currency <span class="ex">'[% searchfield %]'</span></h3>
147         <table>
148             <tr><th>Currency</th>
149                 <td>[% searchfield %]</td>
150             </tr>
151             <tr><th>Rate</th>
152                 <td>[% rate %]</td>
153             </tr>
154         </table>
155         <form action="[% script_name %]" method="post">
156             <input type="hidden" name="op" value="delete_confirmed" />
157             <input type="hidden" name="searchfield" value="[% searchfield %]" />
158             <input type="submit" class="approve" value="Delete this Currency" />
159         </form>
160         <form action="[% script_name %]" method="post">
161             <input type="submit" class="deny" value="No, Do Not Delete" />
162         </form>
163     </div>
164     [% END %]
165 [% END %]
166
167 [% IF ( delete_confirmed ) %]
168 <div class="dialog message"><h3>Currency deleted</h3>
169 <form action="[% script_name %]" method="post">
170     <input type="submit" class="approve" value="OK" />
171 </form></div>
172 [% END %]
173
174 [% IF ( else ) %]
175
176 <h2>Currencies and exchange rates</h2>
177
178 [% IF ( loop ) %][% UNLESS ( activecurrency ) %]<div class="dialog alert"><h3>No active currency is defined</h3><p>Please edit one currency and mark it as active.</p></div>[% END %][% END %]
179
180
181     [% IF ( searchfield ) %]
182         You searched for [% searchfield %]</span>
183     [% END %]
184
185     <table>
186         <tr>
187             <th>Currency</th>
188             <th>Rate</th>
189             <th>Symbol</th>
190             <th>Last updated</th>
191             <th>Active</th>
192             <th colspan="2">Actions&nbsp;</th>
193         </tr>
194         [% FOREACH loo IN loop %]
195         [% UNLESS ( loop.odd ) %]
196         <tr class="highlight">
197         [% ELSE %]
198         <tr>
199         [% END %]
200             <td>[% loo.currency %]</td>
201             <td>[% loo.rate %]</td>
202             <td>[% loo.symbol |html %]</td>
203             <td>[% loo.timestamp %]</td>
204             <td style="color:green;">[% IF ( loo.active ) %]✓[% END %]</td>
205             <td><a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.currency %]">Edit</a></td>
206             <td><a href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.currency %]">Delete</a></td>
207         </tr>
208         [% END %]
209     </table>
210 <br />
211
212     [% IF ( offsetgtzero ) %]
213         <a href="[% script_name %]?offset=[% prevpage %]">&lt;&lt; Previous</a>
214     [% END %]
215
216     [% IF ( ltcount ) %]
217         <a href="[% script_name %]?offset=[% nextpage %]">Next &gt;&gt;</a>
218     [% END %]
219
220 [% END %]
221
222 </div>
223 </div>
224 <div class="yui-b">
225 [% INCLUDE 'admin-menu.inc' %]
226 </div>
227 </div>
228 [% INCLUDE 'intranet-bottom.inc' %]