Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / part / _sales_price_information.html
diff --git a/templates/webpages/part/_sales_price_information.html b/templates/webpages/part/_sales_price_information.html
new file mode 100644 (file)
index 0000000..012a68b
--- /dev/null
@@ -0,0 +1,34 @@
+<div id='sales_price_information_sales_order'></div>
+<div id='sales_price_information_sales_quotation'></div>
+<div id='parts_price_history'></div>
+
+<script type='text/javascript'>
+  function get_report(target, source, data){
+    $.ajax({
+      url:        source,
+//      beforeSend: function () { $(target).html('<img src="image/spinner.gif">') },
+      success:    function (rsp) {
+        $(target).html(rsp);
+        $(target).find('.paginate').find('a').click(function(event){ redirect_event(event, target) });
+        $(target).find('a.report-generator-header-link').click(function(event){ redirect_event(event, target) });
+      },
+      data:       data,
+    });
+  };
+
+  function redirect_event(event, target){
+    event.preventDefault();
+    get_report(target, event.target + '', {});
+  }
+
+  $('.tabwidget').on('tabsbeforeactivate', function(event, ui){
+    if (ui.newPanel.attr('id') == 'sales_price_information') {
+      get_report('#sales_price_information_sales_order', 'controller.pl', { action: 'SellPriceInformation/list', 'filter.part.id': [% id %], 'filter.order.type': 'sales_order' });
+      get_report('#sales_price_information_sales_quotation', 'controller.pl', { action: 'SellPriceInformation/list', 'filter.part.id': [% id %], 'filter.order.type': 'sales_quotation' });
+      get_report('#parts_price_history', 'controller.pl', { action: 'PartsPriceHistory/list', 'filter.part_id': [% id %] });
+    }
+    return 1;
+  });
+
+
+</script>