X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/e3810fbd565d14993f6b5a6fe89f0e4e27c95869..180b77bc8c2b1be95ed0f505920a16d1121d9080:/js/kivi.CustomerVendor.js diff --git a/js/kivi.CustomerVendor.js b/js/kivi.CustomerVendor.js index 67820bea5..c6671c8fe 100644 --- a/js/kivi.CustomerVendor.js +++ b/js/kivi.CustomerVendor.js @@ -8,7 +8,7 @@ namespace('kivi.CustomerVendor', function(ns) { $.getJSON(url, function(data) { for(var key in data) - $(document.getElementById('shipto_'+ key)).val(data[key]); + $('#shipto_'+ key).val(data[key]); $('#action_delete_shipto').show(); @@ -70,7 +70,7 @@ namespace('kivi.CustomerVendor', function(ns) { $.getJSON(url, function(data) { var contact = data.contact; for(var key in contact) - $(document.getElementById('contact_'+ key)).val(contact[key]) + $('#contact_'+ key).val(contact[key]) kivi.CustomerVendor.setCustomVariablesFromAJAJ(data.contact_cvars); @@ -117,7 +117,7 @@ namespace('kivi.CustomerVendor', function(ns) { var isNotEmpty = function() { for(var i in $mapSearchElements) - if( ($mapSearchElements[i].attr('id') != prefix + 'country') && ($mapSearchElements[i].val() == '') ) + if( ($mapSearchElements[i].attr('id') != prefix + 'country') && ($mapSearchElements[i].val() === '') ) return false; return true; }; @@ -137,7 +137,7 @@ namespace('kivi.CustomerVendor', function(ns) { } source_address = source_address || ''; - var query = source_address != '' ? 'saddr=' + encodeURIComponent(source_address) + '&daddr=' : 'q='; + var query = source_address !== '' ? 'saddr=' + encodeURIComponent(source_address) + '&daddr=' : 'q='; var url = 'https://maps.google.com/maps?' + query + encodeURIComponent(searchString); window.open(url, '_blank'); @@ -155,9 +155,7 @@ namespace('kivi.CustomerVendor', function(ns) { showMap(); }); for(var i in $mapSearchElements) - $mapSearchElements[i].keyup(function() { - testInputs(); - }); + $mapSearchElements[i].keyup(testInputs); this.testInputs(); }; @@ -189,7 +187,7 @@ namespace('kivi.CustomerVendor', function(ns) { return true; var number = $input.val().replace(/\s+/g, ''); - if (number == '') + if (number === '') $action.hide(); else $action.prop('href', 'controller.pl?action=CTI/call&number=' + encodeURIComponent(number)).show(); @@ -215,6 +213,22 @@ namespace('kivi.CustomerVendor', function(ns) { return true; }; + + this.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, + }); + }; + this.redirect_event = function(event, target){ + event.preventDefault(); + ns.inline_report(target, event.target + '', {}); + }; }); function local_reinit_widgets() {