X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fkivi.CustomerVendor.js;h=2c192872a68daee8d35c236d0da806319ec3e15d;hb=cf0455f57e7fe398b59a3c4a01f459d16b9db419;hp=f809e3498fbbb441d90a73d690c63018e64dedda;hpb=564b5410a5b4913215b53e659be6ee2a9cf259be;p=kivitendo-erp.git diff --git a/js/kivi.CustomerVendor.js b/js/kivi.CustomerVendor.js index f809e3498..2c192872a 100644 --- a/js/kivi.CustomerVendor.js +++ b/js/kivi.CustomerVendor.js @@ -58,7 +58,7 @@ namespace('kivi.CustomerVendor', function(ns) { this.selectContact = function(params) { var contactId = $('#contact_cp_id').val(); - var url = 'controller.pl?action=CustomerVendor/ajaj_get_contact&id='+ $('#cv_id').val() +'&db='+ $('#db').val() +'&contact_id='+ contactId; + var url = 'controller.pl?action=CustomerVendor/ajaj_get_contact&id='+ $('#cv_id').val() +'&db='+ $('#db').val() +'&contact_id='+ contactId; $.getJSON(url, function(data) { var contact = data.contact; @@ -455,7 +455,39 @@ namespace('kivi.CustomerVendor', function(ns) { ns.reinit_widgets(); } + ns.get_price_report = function(target, source, data) { + $.ajax({ + url: source, + success: function (rsp) { + $(target).html(rsp); + $(target).find('a.report-generator-header-link').click(function(event){ ns.price_report_redirect_event(event, target) }); + }, + }); + }; + + ns.price_report_redirect_event = function (event, target) { + event.preventDefault(); + ns.get_price_report(target, event.target + ''); + }; + + ns.price_list_init = function () { + $("#customer_vendor_tabs").on('tabsbeforeactivate', function(event, ui){ + if (ui.newPanel.attr('id') == 'price_list') { + ns.get_price_report('#price_list', "controller.pl?action=CustomerVendor/ajax_list_prices&id=" + $('#cv_id').val() + "&db=" + $('#db').val() + "&callback=" + $('#callback').val()); + } + return 1; + }); + + $("#customer_vendor_tabs").on('tabscreate', function(event, ui){ + if (ui.panel.attr('id') == 'price_list') { + ns.get_price_report('#price_list', "controller.pl?action=CustomerVendor/ajax_list_prices&id=" + $('#cv_id').val() + "&db=" + $('#db').val() + "&callback=" + $('#callback').val()); + } + return 1; + }); + } + $(function(){ ns.init(); + ns.price_list_init(); }); });