ActionBar: Verwendung in Kreditorenbuchungen
[kivitendo-erp.git] / js / kivi.Order.js
index 538e26e..5d891d5 100644 (file)
@@ -219,24 +219,24 @@ namespace('kivi.Order', function(ns) {
 
   ns.hide_second_row = function(row) {
     $(row).children().not(':first').hide();
-    $(row).data('expanded', false);
+    $(row).data('expanded', 0);
     var elt = $(row).find('.expand');
-    elt.attr('src', "image/expand3.gif");
+    elt.attr('src', "image/expand.svg");
     elt.attr('alt', kivi.t8('Show details'));
     elt.attr('title', kivi.t8('Show details'));
   };
 
   ns.show_second_row = function(row) {
     $(row).children().not(':first').show();
-    $(row).data('expanded', true);
+    $(row).data('expanded', 1);
     var elt = $(row).find('.expand');
-    elt.attr('src', "image/collapse3.gif");
+    elt.attr('src', "image/collapse.svg");
     elt.attr('alt', kivi.t8('Hide details'));
     elt.attr('title', kivi.t8('Hide details'));
   };
 
   ns.toggle_second_row = function(row) {
-    if ($(row).data('expanded') === true) {
+    if ($(row).data('expanded') == 1) {
       ns.hide_second_row(row);
     } else {
       ns.show_second_row(row);
@@ -275,13 +275,6 @@ namespace('kivi.Order', function(ns) {
           return false;
         }
       });
-      $(elt).dblclick(function(event) {
-        event.preventDefault();
-        var row = $(event.target).parents(".row_entry").first();
-        ns.load_second_row(row);
-        ns.toggle_second_row(row);
-        return false;
-      });
     });
 
     kivi.run_once_for('.expand', 'expand_second_row', function(elt) {
@@ -296,9 +289,18 @@ namespace('kivi.Order', function(ns) {
 
   };
 
-  ns.redisplay_linetotals = function(data) {
-    $('.row_entry [name="linetotal"]').each(function(idx, elt) {
-      $(elt).html(data[idx]);
+  ns.redisplay_line_values = function(is_sales, data) {
+    $('.row_entry').each(function(idx, elt) {
+      $(elt).find('[name="linetotal"]').html(data[idx][0]);
+      if (is_sales && $(elt).find('[name="second_row"]').data('loaded') == 1) {
+        var mt = data[idx][1];
+        var mp = data[idx][2];
+        var h  = '<span';
+        if (mt[0] === '-') h += ' class="plus0"';
+        h += '>' + mt + '&nbsp;&nbsp;' + mp + '%';
+        h += '</span>';
+        $(elt).find('[name="linemargin"]').html(h);
+      }
     });
   };
 
@@ -546,17 +548,17 @@ $(function(){
 
   $('#expand_all').on('click', function(event) {
     event.preventDefault();
-    if ($('#expand_all').data('expanded') === true) {
-      $('#expand_all').data('expanded', false);
-      $('#expand_all').attr('src', 'image/expand3.gif');
+    if ($('#expand_all').data('expanded') == 1) {
+      $('#expand_all').data('expanded', 0);
+      $('#expand_all').attr('src', 'image/expand.svg');
       $('#expand_all').attr('alt', kivi.t8('Show all details'));
       $('#expand_all').attr('title', kivi.t8('Show all details'));
       $('.row_entry').each(function(idx, elt) {
         kivi.Order.hide_second_row(elt);
       });
     } else {
-      $('#expand_all').data('expanded', true);
-      $('#expand_all').attr('src', "image/collapse3.gif");
+      $('#expand_all').data('expanded', 1);
+      $('#expand_all').attr('src', "image/collapse.svg");
       $('#expand_all').attr('alt', kivi.t8('Hide all details'));
       $('#expand_all').attr('title', kivi.t8('Hide all details'));
       kivi.Order.load_all_second_rows();
@@ -566,4 +568,5 @@ $(function(){
     }
     return false;
   });
+
 });