X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fkivi.PriceRule.js;h=d3c6a2aefaff5a096c4799020bfc29cb189111ba;hb=2a51537014d67c1f97a37b18548506f3e15549b5;hp=00ed4fb3657777a90e9c96a0d380fea78ad62e80;hpb=c383fc0b2cf6b284a428ecca41c5f00190ca640b;p=kivitendo-erp.git diff --git a/js/kivi.PriceRule.js b/js/kivi.PriceRule.js index 00ed4fb36..d3c6a2aef 100644 --- a/js/kivi.PriceRule.js +++ b/js/kivi.PriceRule.js @@ -33,6 +33,29 @@ namespace('kivi.PriceRule', function(ns) { } } + ns.inline_report = function(target, source, data){ + $.ajax({ + url: source, + success: function (rsp) { + $(target).html(rsp); + $(target).find('.paginate').find('a').click(function(event){ ns.redirect_event(event, target) }); + $(target).find('a.report-generator-header-link').click(function(event){ ns.redirect_event(event, target) }); + }, + data: data, + }); + }; + ns.redirect_event = function(event, target){ + event.preventDefault(); + ns.inline_report(target, event.target + '', {}); + }; + + ns.load_price_rules_for_part = function(id) { + window.setTimeout(function(){ + ns.inline_report('#price_rules_customer_report', 'controller.pl', { action: 'PriceRule/list', 'filter.item_type_matches[].part': id, 'filter.type': 'customer', inline: 1 }); + ns.inline_report('#price_rules_vendor_report', 'controller.pl', { action: 'PriceRule/list', 'filter.item_type_matches[].part': id, 'filter.type': 'vendor', inline: 1 }); + }, 200); + } + $(function() { $('#price_rule_item_add').click(function() { ns.add_new_row($('#price_rules_empty_item_select').val()); @@ -43,4 +66,5 @@ namespace('kivi.PriceRule', function(ns) { $('#price_rule_price_type_help').click(ns.open_price_type_help_popup); $('#price_rule_filter_type').change(ns.on_change_filter_type); }); + });