+ };
+
+ 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);
+ };