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