Bug 15285: Update for 3 specific tables
[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 ( add_form ) %][% IF ( searchfield ) %]Modify currency '[% searchfield %]'[% ELSE %]New currency[% END %][% END %]
6 [% IF ( delete_confirm ) %]Confirm deletion of currency '[% searchfield %]'[% END %]
7 [% IF ( delete_confirmed ) %]Currency deleted[% END %]
8 [% IF ( else ) %]Currencies[% END %]</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 <link rel="stylesheet" type="text/css" href="[% themelang %]/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").removeAttr('disabled');
19             $("#hint").html("");
20         } else {
21             $("#active").removeAttr('checked');
22             $("#active").attr('disabled','disabled');
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     });
43 //]]>
44 </script>
45 </head>
46 <body id="admin_currency" class="admin">
47 [% INCLUDE 'header.inc' %]
48 [% INCLUDE 'currencies-admin-search.inc' %]
49
50
51
52 <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 %]
53 [% IF ( delete_confirm ) %]Confirm deletion of currency '<span class="ex">[% searchfield %]</span>'[% END %]
54 [% IF ( delete_confirmed ) %]Currency deleted[% END %]
55 [% IF ( else ) %]Currencies[% END %]
56 </div>
57
58 <div id="doc3" class="yui-t2">
59
60 <div id="bd">
61     <div id="yui-main">
62     <div class="yui-b">
63 [% IF ( else ) %]
64 <div id="toolbar" class="btn-toolbar">
65     <a class="btn btn-small" id="newcurrency" href="[% script_name %]?op=add_form"><i class="fa fa-plus"></i> New currency</a>
66 </div>
67 [% END %]
68
69 [% IF ( add_form ) %]
70
71 <form action="[% script_name %]" name="Aform" method="post" class="validated">
72     <input type="hidden" name="op" value="save" />
73     <fieldset class="rows">
74     <legend>[% IF ( searchfield ) %]
75         Modify currency
76     [% ELSE %]
77         New currency
78     [% END %]</legend>
79     <ol>
80         <li>
81     [% IF ( searchfield ) %]
82             <span class="label">Currency: </span>
83             <input type="hidden" name="currency" id="currency" value="[% searchfield %]" />[% searchfield %]
84     [% ELSE %]
85             <label for="currency" class="required">Currency: </label>
86             <input type="text" name="currency" id="currency" size="50" maxlength="50" onblur="toUC(this);" required="required" class="required" /> <span class="required">Required</span>
87     [% END %]
88         </li>
89         <li>
90             <label for="rate" class="required">Rate: </label>
91             <input type="text" name="rate" id="rate" size="10" maxlength="10" value="[% rate %]" required="required" class="required" /> <span class="required">Required</span>
92         </li>
93         <li>
94             <label for="symbol" class="required">Symbol: </label>
95             <input type="text" name="symbol" id="symbol" size="5" maxlength="5" value="[% symbol %]" required="required" class="required" /> <span class="required">Required</span>
96         </li>
97         <li>
98             <label for="isocode">ISO code: </label>
99             <input type="text" name="isocode" id="isocode" size="5" maxlength="5" value="[% isocode %]" />
100         </li>
101         <li>
102             <span class="label">Last updated: </span>[% timestamp | $KohaDates %]
103         </li>
104         <li>
105             <label for="active">Active: </label>
106             [% IF ( active ) %]
107             <input type="checkbox" id="active" name="active" value="1" checked="checked" />
108             [% ELSE %]
109             <input type="checkbox" id="active" name="active" value="1" />
110             [% END %]
111             <span id="hint" class="hint"></span>
112         </li>
113
114         </ol>
115         </fieldset>
116
117     <fieldset class="action">
118         <input type="submit" value="Submit" />
119         <a href="/cgi-bin/koha/admin/currency.pl" class="cancel">Cancel</a>
120     </fieldset>
121     </form>
122
123 [% END %]
124
125 [% IF ( delete_confirm ) %]
126     [% IF ( totalgtzero ) %]
127     <div class="dialog message">
128         <h3>Cannot delete currency <span class="ex">'[% searchfield %]'</span></h3>
129         <p>This currency is used [% total %] times. Deletion not possible</p>
130         <form action="[% script_name %]" method="post">
131             <input type="submit" value="OK" class="approve" />
132         </form>
133     </div>
134     [% ELSE %]
135     <div class="dialog alert">
136         <h3>Confirm deletion of currency <span class="ex">'[% searchfield %]'</span></h3>
137         <table>
138             <tr><th>Currency</th>
139                 <td>[% searchfield %]</td>
140             </tr>
141             <tr><th>Rate</th>
142                 <td>[% rate %]</td>
143             </tr>
144         </table>
145         <form action="[% script_name %]" method="post">
146             <input type="hidden" name="op" value="delete_confirmed" />
147             <input type="hidden" name="searchfield" value="[% searchfield %]" />
148             <input type="submit" class="approve" value="Delete this currency" />
149         </form>
150         <form action="[% script_name %]" method="post">
151             <input type="submit" class="deny" value="No, do not delete" />
152         </form>
153     </div>
154     [% END %]
155 [% END %]
156
157 [% IF ( delete_confirmed ) %]
158 <div class="dialog message"><h3>Currency deleted</h3>
159 <form action="[% script_name %]" method="post">
160     <input type="submit" class="approve" value="OK" />
161 </form></div>
162 [% END %]
163
164 [% IF ( else ) %]
165
166 <h2>Currencies and exchange rates</h2>
167
168 [% 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 %]
169
170
171     [% IF ( searchfield ) %]
172         You searched for [% searchfield %]</span>
173     [% END %]
174
175     <table id='currencies-table'>
176       <thead>
177         <tr>
178             <th>Currency</th>
179             <th>Rate</th>
180             <th>Symbol</th>
181             <th>ISO code</th>
182             <th class="title-string">Last updated</th>
183             <th>Active</th>
184             <th>Actions</th>
185         </tr>
186       </thead>
187       <tbody>
188         [% FOREACH loo IN loop %]
189           <tr>
190             <td>[% loo.currency %]</td>
191             <td>[% loo.rate %]</td>
192             <td>[% loo.symbol |html %]</td>
193             <td>[% loo.isocode |html %]</td>
194             <td><span title="[% loo.timestamp %]">[% loo.timestamp | $KohaDates %]</span></td>
195             <td style="color:green;">[% IF ( loo.active ) %]✓[% END %]</td>
196             <td>
197               <a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.currency %]">Edit</a>
198               |
199               <a href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.currency %]">Delete</a>
200             </td>
201           </tr>
202         [% END %]
203       </tbody>
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     <div class="hint">
216         <p>
217             When importing MARC files via the staging tools, the tool will attempt to find and use the price of the currently active currency.
218         </p>
219         <p>
220             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)".
221             These examples assume USD is the active currency.
222         </p>
223     </div>
224
225 [% END %]
226
227 </div>
228 </div>
229 <div class="yui-b">
230 [% INCLUDE 'admin-menu.inc' %]
231 </div>
232 </div>
233 [% INCLUDE 'intranet-bottom.inc' %]