]> wagnertech.de Git - mfinanz.git/blobdiff - js/autocomplete_part.js
kivi.js: alle jshint-Warnungen beseitigt & auf strict umgestellt
[mfinanz.git] / js / autocomplete_part.js
index 0366ed270c2018e0a73a75c30c065eec9fe99686..cbce72ceab38b027c86df0ef3d40a0f2ae507426 100644 (file)
@@ -28,10 +28,11 @@ namespace('kivi', function(k){
       UNDEFINED: CLASSES.UNDEFINED
     }
     var real_id = $real.attr('id');
-    var $dummy  = $('#' + real_id + '_name');
-    var $type   = $('#' + real_id + '_type');
-    var $unit   = $('#' + real_id + '_unit');
-    var $convertible_unit = $('#' + real_id + '_convertible_unit');
+    var $dummy             = $('#' + real_id + '_name');
+    var $part_type         = $('#' + real_id + '_part_type');
+    var $classification_id = $('#' + real_id + '_classification_id');
+    var $unit              = $('#' + real_id + '_unit');
+    var $convertible_unit  = $('#' + real_id + '_convertible_unit');
     var state   = STATES.PICKED;
     var last_real = $real.val();
     var last_dummy = $dummy.val();
@@ -63,8 +64,11 @@ namespace('kivi', function(k){
         current:  $real.val(),
       };
 
-      if ($type && $type.val())
-        data['filter.type'] = $type.val().split(',');
+      if ($part_type && $part_type.val())
+        data['filter.part_type'] = $part_type.val().split(',');
+
+      if ($classification_id && $classification_id.val())
+        data['filter.classification_id'] = $classification_id.val().split(',');
 
       if ($unit && $unit.val())
         data['filter.unit'] = $unit.val().split(',');
@@ -237,18 +241,17 @@ namespace('kivi', function(k){
     });
 
     // now add a picker div after the original input
-    var pcont  = $('<span>').addClass('position-absolute');
-    var picker = $('<div>');
-    $dummy.after(pcont);
-    pcont.append(picker);
-    picker.addClass('icon16 search').click(open_dialog);
+    var popup_button = $('<span>').addClass('ppp_popup_button');
+    $dummy.after(popup_button);
+    popup_button.click(open_dialog);
 
     var pp = {
-      real:           function() { return $real },
-      dummy:          function() { return $dummy },
-      type:           function() { return $type },
-      unit:           function() { return $unit },
-      convertible_unit: function() { return $convertible_unit },
+      real:              function() { return $real },
+      dummy:             function() { return $dummy },
+      part_type:         function() { return $part_type },
+      classification_id: function() { return $classification_id },
+      unit:              function() { return $unit },
+      convertible_unit:  function() { return $convertible_unit },
       update_results: update_results,
       result_timer:   result_timer,
       set_item:       set_item,
@@ -260,6 +263,7 @@ namespace('kivi', function(k){
             set_item({
               id:   $(this).children('input.part_picker_id').val(),
               name: $(this).children('input.part_picker_description').val(),
+              classification_id: $(this).children('input.part_picker_classification_id').val(),
               unit: $(this).children('input.part_picker_unit').val(),
               partnumber:  $(this).children('input.part_picker_partnumber').val(),
               description: $(this).children('input.part_picker_description').val(),