Part Picker
[kivitendo-erp.git] / templates / webpages / part / _part_picker_result.html
diff --git a/templates/webpages/part/_part_picker_result.html b/templates/webpages/part/_part_picker_result.html
new file mode 100644 (file)
index 0000000..0e65243
--- /dev/null
@@ -0,0 +1,43 @@
+[%- USE T8 %]
+[%- USE HTML %]
+[%- USE L %]
+[%- USE LxERP %]
+
+[%# L.dump(SELF.parts) %]
+
+[% FOREACH part = SELF.parts %]
+  [% PROCESS part_block %]
+[% END %]
+
+[%- BLOCK part_block %]
+<div class='part_picker_part'>
+  <input type='hidden' class='part_picker_id' value='[% part.id %]'>
+  <input type='hidden' class='part_picker_partnumber' value='[% part.partnumber %]'>
+  <input type='hidden' class='part_picker_description' value='[% part.description %]'>
+  <span style='float:left'>[% part.partnumber | html %]</span>
+  <span style='float:right; font-weight:bold'>[% part.description | html %]</span>
+  <div style='clear:both;'></div>
+  [% 'Sellprice' | $T8 %]: [% part.sellprice_as_number | html %]
+</div>
+[%- END %]
+
+<div style='clear:both'></div>
+
+[% L.paginate_controls(target='#part_picker_result', selector='#part_picker_result') %]
+
+<script type='text/javascript'>
+  $('div.part_picker_part').each(function(){
+    $(this).click(function(){
+      var real_id = $('#part_picker_real_id').val();
+      var $dummy  = $('#' + real_id + '_name');
+      var $real   = $('#' + real_id);
+
+      $dummy.val($(this).children('input.part_picker_description').val());
+      $real.val($(this).children('input.part_picker_id').val());
+
+      $('#part_selection').jqmClose();
+
+      return true;
+    });
+  });
+</script>