Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / part / _sales_price_information.html
1 <div id='sales_price_information_sales_order'></div>
2 <div id='sales_price_information_sales_quotation'></div>
3 <div id='parts_price_history'></div>
4
5 <script type='text/javascript'>
6   function get_report(target, source, data){
7     $.ajax({
8       url:        source,
9 //      beforeSend: function () { $(target).html('<img src="image/spinner.gif">') },
10       success:    function (rsp) {
11         $(target).html(rsp);
12         $(target).find('.paginate').find('a').click(function(event){ redirect_event(event, target) });
13         $(target).find('a.report-generator-header-link').click(function(event){ redirect_event(event, target) });
14       },
15       data:       data,
16     });
17   };
18
19   function redirect_event(event, target){
20     event.preventDefault();
21     get_report(target, event.target + '', {});
22   }
23
24   $('.tabwidget').on('tabsbeforeactivate', function(event, ui){
25     if (ui.newPanel.attr('id') == 'sales_price_information') {
26       get_report('#sales_price_information_sales_order', 'controller.pl', { action: 'SellPriceInformation/list', 'filter.part.id': [% id %], 'filter.order.type': 'sales_order' });
27       get_report('#sales_price_information_sales_quotation', 'controller.pl', { action: 'SellPriceInformation/list', 'filter.part.id': [% id %], 'filter.order.type': 'sales_quotation' });
28       get_report('#parts_price_history', 'controller.pl', { action: 'PartsPriceHistory/list', 'filter.part_id': [% id %] });
29     }
30     return 1;
31   });
32
33
34 </script>