Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / layout / javascript_setup.js
index bc4c5ef..2b03f4a 100644 (file)
@@ -1,13 +1,11 @@
-[%- USE T8 %]
+[%- USE LxERP %]
+[%- USE JavaScript %]
+[%- USE JSON %]
+kivi.myconfig = [% JSON.json(MYCONFIG) %];
 $(function() {
-[% IF datefmt %]
-  namespace("kivi").initLocale("[% MYCONFIG.countrycode | html %]");
-  setupPoints('[% MYCONFIG.numberformat %]', '[% 'wrongformat' | $T8 %]');
-  setupDateFormat('[% MYCONFIG.dateformat %]', '[% 'Falsches Datumsformat!' | $T8 %]');
-
   $.datepicker.setDefaults(
-    $.extend({}, $.datepicker.regional["[% MYCONFIG.countrycode %]"], {
-      dateFormat: "[% datefmt %]",
+    $.extend({}, $.datepicker.regional[kivi.myconfig.countrycode], {
+      dateFormat: kivi.myconfig.dateformat.replace(/d+/gi, 'dd').replace(/m+/gi, 'mm').replace(/y+/gi, 'yy'),
       showOn: "button",
       showButtonPanel: true,
       changeMonth: true,
@@ -16,12 +14,15 @@ $(function() {
       buttonImageOnly: true
   }));
 
-  $('.datepicker').each(function() {
-    $(this).datepicker();
+  kivi.setup_formats({
+    numbers: kivi.myconfig.numberformat,
+    dates:   kivi.myconfig.dateformat,
+    times:   kivi.myconfig.timeformat
   });
-[% END %]
 
-[% IF ajax_spinner %]
+  kivi.reinit_widgets();
+
+[%- IF ajax_spinner %]
   $(document).ajaxSend(function() {
     $('#ajax-spinner').show();
   }).ajaxStop(function() {
@@ -30,8 +31,8 @@ $(function() {
 [% END %]
 });
 
-function fokus() {
 [%- IF focus -%]
+function fokus() {
   $('[% focus %]').focus();
-[%- END -%]
 }
+[%- END -%]