Bug 16752 - Remove the use of event attributes from some acquisitions templates ...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / currency.tt
index 305e471..1bbacf2 100644 (file)
@@ -3,10 +3,10 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Administration &rsaquo; Currencies &amp; Exchange rates &rsaquo;
 [% IF op == 'add_form' %][% IF currency %]Modify currency '[% currency.currency %]'[% ELSE %]New currency[% END %][% END %]
-[% IF op == 'delete_' %]Confirm deletion of currency '[% searchfield %]'[% END %]
+[% IF op == 'delete_confirm' %]Confirm deletion of currency '[% currency.currency %]'[% END %]
 [% IF op == 'list' %]Currencies[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
 [% INCLUDE 'datatables.inc' %]
 [% INCLUDE 'columns_settings.inc' %]
 <script type="text/javascript">
 
     function check_currency(val) {
         if ( val == 1.0 ) {
-            $("#active").removeAttr('disabled');
+            $("#active").prop('disabled', false);
             $("#hint").html("");
         } else {
-            $("#active").removeAttr('checked');
-            $("#active").attr('disabled','disabled');
+            $("#active").prop('checked', false);
+            $("#active").prop('disabled', true);
             $("#hint").html(_("The active currency must have a rate of 1.0"));
         }
     }
@@ -38,6 +38,9 @@
             check_currency( $(this).val() );
         });
         check_currency( $("#rate").val() );
+        $("#currency_code").on("blur",function(){
+            toUC(this);
+        });
     });
 //]]>
 </script>
@@ -49,7 +52,7 @@
 
 
 <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 %]
-[% IF op == 'delete_confirm' %]Confirm deletion of currency '<span class="ex">[% searchfield %]</span>'
+[% IF op == 'delete_confirm' %]Confirm deletion of currency '[% '<span class="ex">' _ currency.currency _ '</span>' %]'
 [% ELSIF op == 'list' %]Currencies
 [% END %]
 </div>
 </div>
 [% END %]
 
+[% FOR m IN messages %]
+    <div class="dialog [% m.type %]">
+        [% SWITCH m.code %]
+        [% CASE 'error_on_update' %]
+            An error occurred when updating this currency. Perhaps it already exists.
+        [% CASE 'error_on_insert' %]
+            An error occurred when adding this currency. The currency code might already exist.
+        [% CASE 'error_on_delete' %]
+            An error occurred when deleting this currency. Check the logs.
+        [% CASE 'success_on_update' %]
+            Currency updated successfully.
+        [% CASE 'success_on_insert' %]
+            Currency added successfully.
+        [% CASE 'success_on_delete' %]
+            Currency deleted successfully.
+        [% CASE %]
+            [% m.code %]
+        [% END %]
+    </div>
+[% END %]
+
+
+
 [% IF op == 'add_form' %]
 
 <form action="/cgi-bin/koha/admin/currency.pl" name="Aform" method="post" class="validated">
                     <input type="hidden" name="currency_code" id="currency" value="[% currency.currency %]" />[% currency.currency %]
                 [% ELSE %]
                     <label for="currency_code" class="required">Currency: </label>
-                    <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>
+                    <input type="text" name="currency_code" id="currency_code" size="50" maxlength="50" required="required" class="required" /> <span class="required">Required</span>
                 [% END %]
             </li>
             <li>
 [% END %]
 
 [% IF op =='delete_confirm' %]
-    [% IF nb_of_orders %]
+    [% IF nb_of_orders or nb_of_vendors %]
     <div class="dialog alert">
-        <h3>Cannot delete currency <span class="ex">'[% currency.currency %]'</span></h3>
-        <p>This currency is used by [% nb_of_orders %] orders. Deletion not possible</p>
+        <h3>Cannot delete currency '[% '<span class="ex">' _ currency.currency _ '</span>' %]'</h3>
+        <p>
+            [% IF nb_of_orders %]
+                This currency is used by [% nb_of_orders %] orders.
+            [% ELSIF nb_of_vendors %]
+                This currency is used by [% nb_of_vendors %] vendors.
+            [% END %]
+            Deletion not possible
+        </p>
         <form action="/cgi-bin/koha/admin/currency.pl" method="post">
             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
         </form>
     </div>
     [% ELSE %]
     <div class="dialog alert">
-        <h3>Confirm deletion of currency <span class="ex">'[% currency.currency %]'</span></h3>
+        <h3>Confirm deletion of currency '[% '<span class="ex">' _ currency.currency _ '</span>' %]'</h3>
         <table>
             <tr><th>Currency</th>
                 <td>[% currency.currency %]</td>
         </table>
         <form action="/cgi-bin/koha/admin/currency.pl" method="post">
             <input type="hidden" name="op" value="delete_confirmed" />
-            <input type="hidden" name="currency_code" value="[% currency.currency_code %]" />
+            <input type="hidden" name="currency_code" value="[% currency.currency %]" />
             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this currency</button>
         </form>
         <form action="/cgi-bin/koha/admin/currency.pl" method="post">
             <td><span title="[% currency.timestamp %]">[% currency.timestamp | $KohaDates %]</span></td>
             <td style="color:green;">[% IF currency.active %]✓[% END %]</td>
             <td>[% IF currency.archived %]Yes[% END %]</td>
-            <td>
-              <a href="/cgi-bin/koha/admin/currency.pl?op=add_form&amp;currency_code=[% currency.currency %]">Edit</a>
-              |
-              <a href="/cgi-bin/koha/admin/currency.pl?op=delete_confirm&amp;currency_code=[% currency.currency %]">Delete</a>
+            <td class="actions">
+              <a class="btn btn-mini" href="/cgi-bin/koha/admin/currency.pl?op=add_form&amp;currency_code=[% currency.currency %]"><i class="fa fa-pencil"></i> Edit</a>
+              <a class="btn btn-mini" href="/cgi-bin/koha/admin/currency.pl?op=delete_confirm&amp;currency_code=[% currency.currency %]"><i class="fa fa-trash"></i> Delete</a>
             </td>
           </tr>
         [% END %]