// Define dialog box pop-up $bodyDiv.on('click', "a.pop", function(e){ var url = this.href; var pagetitle = this.title; //var dialogWidth = this.width; var div = $("#dialog"); div.text(''); // clear out any contents // Use query plugin to parse value from URL $.query = $.query.load(url); var dialogWidth = $.query.get('popwidth'); if (! dialogWidth) dialogWidth = 300; var ajaxType = $.query.get('ajaxType'); if (! ajaxType) ajaxType = 'json'; var winht = $(window).height(); var dialogHeight = winht - 100; // If invoice view then add a print button var invNum = $.query.get('invoiceNumber'); var custNum = $.query.get('customerNumber'); // Start scrolling div div.append('
'); // load remote content $.ajax({ url: url, dataType: ajaxType, success: function(data, textStatus, jqXHR) { if (ajaxType == "json") { div.append(''); for(var prop in data) { div.append(''); } div.append('
' + prop + ': ' + data[prop] + '
'); } else { div.append(data); // Make look of it match $('.lbctablehead').removeClass("lbctablehead").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all"); $('.lbctabcolhead').removeClass("lbctabcolhead").addClass("ui-state-default ui-th-column ui-th-ltr"); } // Standard invoice view if(invNum) div.dialog({ modal: true, title: pagetitle, width: dialogWidth, height: dialogHeight, buttons: { 'Print': function() { window.open("getdatamaster.php?module=invoiceprt&cmd=print_invoice&format=pdf&invoice_number="+invNum+"&customer_number="+custNum, "_new"); }, 'Close': function() { $(this).dialog('close'); }, }, /* open: function( event, ui ) { $('#scrollDiv').show(); alert("pop2.9"); //$('#scrollDiv').scrollTop(0); $('body, html, #scrollDiv').scrollTop(0); } */ }); // Generic pop-up else div.dialog({ modal: true, title: pagetitle, width: dialogWidth, height: dialogHeight, buttons: { 'Close': function() { $(this).dialog('close'); }, }, /* open: function( event, ui ) { $('#scrollDiv').show(); alert("pop2.9"); //$('#scrollDiv').scrollTop(0); $('body, html, #scrollDiv').scrollTop(0); }, */ }); }, error: function(jqXHR, textStatus, errorThrown) { alert('an error occured'); }, complete: function(jqXHR, textStatus) { //alert('all done'); }, }); // End scrolling div div.append('
'); // Make sure starts at top //alert("pop2.3"); //$('#scrollDiv').show(); //$("#scrollDiv").animate({ scrollTop: 0 }, "fast"); //$('body, html, #scrollDiv').scrollTop(0); //$('#scrollDiv').scrollTop(0); //prevent the browser to follow the link return false; }); // Define dialog box pop-up for settings $("body").on('click', "a.popSettings", function(e){ //var url = this.href; var settingsUrl = "getdatamaster.php?module=setmonitor&screen=" + curScreen; var url = settingsUrl + "&cmd=getsettings&ajaxType=html&format=html&popwidth=400"; //var pagetitle = this.title; var pagetitle = "Your settings for this screen"; //var dialogWidth = this.width; var div = $("#dialog"); div.text(''); // clear out any contents // Use query plugin to parse value from URL $.query = $.query.load(url); var dialogWidth = $.query.get('popwidth'); if (! dialogWidth) dialogWidth = 400; var ajaxType = $.query.get('ajaxType'); if (! ajaxType) ajaxType = 'json'; // Build buttons var buttonObj = {}; buttonObj = { 'Submit': function() { var params = ''; // Loop over all settings $('.settings').each(function(index, item) { params = params + this.id + ':' + $(item).val() + ';'; }); $(this).dialog('close'); // Save the selections in the database saveSettings(settingsUrl + "&cmd=saveSettings¶ms=" + params); }, 'Close': function() { $(this).dialog('close'); } }; // load remote content $.ajax({ url: url, dataType: ajaxType, //data: { debug: 'yes' }, success: function(data, textStatus, jqXHR) { if (ajaxType == "json") { //alert(JSON.stringify(data)); thedata=data.userdata.data.line; var uldiv = $('
', { id: "infocontainer" }).appendTo(div); var ul = $('