//We are using this js file in iview,listview,Listview & saveas files.
//-----------------------------List of functions in this file--------------------------------------
//ChangeTheme() -Function to change the theme of the page.
//Adjustwin(window)-Adjust the size of parent window according to the current window size
//pgReload()-Function to click the new button from iview ,display the tstruct page.
//CheckAll() -Function to check all the row once the header row is checked.
//ChkHdrCheckbox() -Function to check if the header checkbox is checked then check all.
//-------------------------------------------------------------------------------------------------
var traceSplitChar = "♦";
var traceSplitStr = "♦♦";
var NewTree = new Array();
var arrCheckedFilter = new Array();
var loadPop;
var isSqlPagination;
var parafilterfix = {};
var isDepsProcessed = true;
var formSubmited = false;
var strTimeTaken = "";
var arrcheckedvalues = new Array();
var timePickerSec = false;
var accordionHeight = 0;
var firstTimeScroll = true;
var windowResizer;
var beforeResizeHeight = "";
var ivirColumnTypeObj = ""; //if this variable is empty its not an interactive report
var ivirDataTableApi, ivirDatatable;
var isChkBox = "";
var rowTypeExist = false;
var gl_language = "";
var validateParamOnGo = false;
var isPlDepParBound = false;
var iframeindex = -1;
var HeaderText, ColumnType, FieldName, HideColumn, HideColumnLength, filteredColumns, hiddenColumnIndex, ivComps, ivHeadRows, ivExportHF, ivActions, ivScripts, ivHyperlinks, ivConfigurations, ivSmartViewSettings, ivDatas = [], tstFields = [], ivTemplates = [], ivColDesignJSON = [];
var initAdvFilters = true;
var isPerf = false;
var tableWidth = 0;
var visibleTableWidth = 0;
//var minCellWidth = 10;
var minCellWidth = 15;
var listViewCheckBoxSize = 40;
var responsiveColumnWidth = false;
var configNavProp = "default";
var enableCardsUi = false;
var isMobile = false;
var cardTemplatingHTML = ``;
var rowRefreshIndex = undefined;
var isCheckedRowRefresh = false;
var lazyBinding = false;
var submittedOnLoad = false;
var showColumnSeparator = false;
var stripedReport = false;
var actionCallFlag = Math.random();
var actionCallbackFlag = actionCallFlag;
var classicView = false;
var recordsExist = false;
var trimIviewData = true;
var resolveAttachmentPath = false;
var viewNavigationData = [];
var cellHeaderConf = {};
var bulkDownloadEnabled = true;
var toolbarHTML = "";
var exportType = "";
var scrollBarWidths = 5;
var loadViewName = "main";
var toolbarPinArr = [];
var popupContentcall = false;
var firstTimeParams = "";
var openFilters = false;
var viewLoadedColumns = false;
var viewLoadedSort = false;
var searchHiddenColumnsInReports = false;
var unselectReportRowOnAction = true;
var showChartsWithAllRecords = false;
let isChartCreationOnLoad = false;
let rowOptionsExist = false;
var openFastReportInNewWindow = false;
var splitRatio = "1:1:auto";
var tstFldsRequested = false;
let paramValuesArray = [];
var exportPerf = false;
//var loadViewDepParams = 0;
// // //to close all popups on unload of ListView
// // $j(window).on("unload", function () { // This needs to be replicated further, temp comments
// // if (loadPop && !loadPop.closed) {
// // loadPop.close();
// // }
// // callParentNew("removeOverlayFromBody()", "function"); //if any remodal popup is opened & user clicks on browser back button then remove window - header, footer & menu overlay css
// // });
var isLnkClicked = false;
//This function clears the cache files on unload and on opening another iview.
function DeleteIviewCacheFiles() {
// on unload deletes all existing cached iview files.
try {
ASB.WebService.DeleteIviewCacheFiles(iName);
} catch (ex) { }
}
function SetLnkClick() {
isLnkClicked = true;
}
function dvToolBarFix() {
//parafilterfix
if ($j("#dvToolbar").text() == "" || $j("#dvToolbar").text() == null || $j("#dvToolbar").text() == undefined) {
$j("#dvToolbar").parent().css("display", "none");
} else {
$j("#dvToolbar").parent().css("display", "inline-block");
}
if ($j("#FilterValues").text() == "" || $j("#FilterValues").text() == null || $j("#FilterValues").text() == undefined) {
$j("#dvSelectedFilters").css("display", "none");
}
}
/**
* Return Relemnt from multiple elements with data property and its value
* @author Prashik
* @Date 2019-04-11T10:27:23+0530
* @param {string} prop : data property name
* @param {string} val : data property value
* @return {object} : filtered element
*/
$.fn.filterByData = function (prop, val) {
var $self = this;
if (typeof val === 'undefined') {
return $self.filter(
function () { return typeof $(this).data(prop) !== 'undefined'; }
);
}
return $self.filter(
function () { return $(this).data(prop) == val; }
);
};
$.fn.single_double_click = function (single_click_callback, double_click_callback, timeout) {
return this.each(function () {
var clicks = 0,
self = this;
$(this).on("click", function (event) {
clicks++;
if (clicks == 1) {
setTimeout(function () {
if (clicks == 1) {
single_click_callback.call(self, event);
} else {
double_click_callback.call(self, event);
}
clicks = 0;
}, timeout || 300);
}
});
});
}
/**
* page load callback function trigerred from c# for an update panel's postback and not of postback page loads and should be used instead of $(document).ready() function since that won't call on postback
* @author Prashik
* @Date 2019-04-11T10:31:38+0530
*/
function pageLoad(sender, args) {
if ($("#hdnbElapsTimeGo").val() != "") {
let paramSearchRespons = $("#hdnbElapsTimeGo").val();
requestProcess_logtime = paramSearchRespons.split('♠')[1];
serverprocesstime = paramSearchRespons.split('♠')[0];
WireElapsTime(serverprocesstime, requestProcess_logtime, true);
}
else {
WireElapsTime(serverprocesstime, requestProcess_logtime);
}
showParam = true;
try {
pageLoadIvHook();
} catch (ex) { }
if (typeof appGlobalVarsObject == "undefined") {
appGlobalVarsObject = callParentNew("appGlobalVarsObject");
}
isMobile = isMobileDevice();
isMobile && $("body").addClass("isMobile");
enableCardsUi = enableCardsUi || isMobile;
requestJSON && $("body").addClass("requestJSON");
requestJSON && iviewButtonStyle == "old" && $("body").addClass("requestJsonOldUi");
inputControlType == "border" && $("body").addClass("borderInput");
exportType = redisLoadType;
constructToolbar();
$(".animationLoading").show();
if (typeof getAjaxIviewData != "undefined" && getAjaxIviewData) {
$("#dvSqlPages").show();
$("#nextPrevBtns").hide();
}
if (typeof capturedButton1Submit != "undefined" && capturedButton1Submit == true) {
capturedButton1Submit = false;
$("#button1").click();
return;
}
if (typeof totRowCount != "undefined" && totRowCount != "" && $("#getIviewRecordCountVal").length > 0) {
$("#lblNoOfRecs").html(" of " + totRowCount);
}
$("table#GridView1").each(function () {
var jTbl = $(this);
if (typeof getAjaxIviewData != "undefined" && !getAjaxIviewData) {
if (jTbl.find("tbody>tr>th").length > 0) {
jTbl.find("tbody").before("");
jTbl.find("tbody>tr").each(function () {
var thElem = $(this);
if (thElem.find("th").length > 0) {
jTbl.find("thead:first").append(thElem);
}
});
jTbl.find("tbody>tr>th").parent("tr").remove();
}
if (jTbl.find("table#GridView1 tfoot").length == 0) {
var thLength = jTbl.find("thead tr:last th").length;
var tfootHtml = "
"
for (var i = 0; i < thLength; i++) {
tfootHtml += "
"
}
tfootHtml += "";
jTbl.find("tbody").before(tfootHtml);
}
}
});
if (!$("#tasks").parent('li').hasClass('dropdown-submenu')) {
$("#tasks").html(callParentNew('lcm')[407] + " " + "").prop({ 'title': callParentNew('lcm')[407] });
}
else {
}
$(".print").prop({ 'title': callParentNew('lcm')[408] }).text(callParentNew('lcm')[408]);
if (requestJSON && iviewButtonStyle != "old") {
$("#ivInSearchInput").attr({ 'placeholder': callParentNew('lcm')[287] });
} else {
$("#ivInSearchInput").attr({ 'placeholder': callParentNew('lcm')[415] });
}
/**
* Entry point for initializing jquery Datatable
* @author Prashik
* @Date 2019-04-11T10:40:40+0530
*/
if (document.title == "Iview" && typeof getAjaxIviewData != "undefined" && getAjaxIviewData) {
var iVData = $("#hdnIViewData").val();
if (iVData != "") {
try {
if (iVData) {
createIvir(iVData);
try {
nxtScrollSize = 100; //default record size for datatable initilization
defaultRecsPerPage = 100; //fetch size value
dtTotalRecords = getDtRecordCount();
checkIfNextDBRowsExist(true);
} catch (ex) {
console.log(ex.message);
}
} else {
showParamsPlaceholder();
checkIfNextDBRowsExist(true);
}
} catch (e) {
}
} else {
showParamsPlaceholder();
checkIfNextDBRowsExist(true);
}
} else if (document.title == "Iview" && typeof ivirHeaderData != "undefined" && typeof getAjaxIviewData != "undefined" && !getAjaxIviewData) {
if (Object.keys(ivirHeaderData).length) {
createIvir(JSON.stringify(ivirHeaderData));
}
}
if (!ivConfigurations && typeof globalIvConfigurations != "undefined" && globalIvConfigurations) {
try {
ivConfigurations = globalIvConfigurations.configurations.config.length == undefined ? [globalIvConfigurations.configurations.config] : globalIvConfigurations.configurations.config;
processIvConfiguration(ivConfigurations);
} catch (ex) { }
}
if (document.title == "Iview" && $("table#GridView1").length != 0) {
if (ivirColumnTypeObj != "") {
$("table#GridView1").removeAttr('cellspacing rules border style');
$("table#GridView1").addClass('table table-row-bordered ms-0 ivirMainGrid ');
if (stripedReport) {
$("table#GridView1").addClass("table-striped");
}
$("#ivContainer").addClass("interactiveReport");
$(".iviewTableWrapper").addClass('interactiveReportWrapper');
if (requestJSON && iviewButtonStyle != "old") {
$(".iviewTableWrapper").addClass('iviewTableWrapperNew');
}
}
}
if (requestJSON && iviewButtonStyle == "modern") {
$("body").addClass("modernButtonOptions");
}
$('#Filterscollapse').on('shown.bs.collapse', function () {
$("#myFilters").removeClass("disabled");
$("#searchBar").find(".ccolapsee").removeClass("glyphicon-plus icon-arrows-plus").addClass("glyphicon-minus icon-arrows-minus");
$("#accordion").addClass("shadow");
}).on('hidden.bs.collapse', function () {
$("#myFilters").removeClass("disabled");
$("#searchBar").find(".ccolapsee").removeClass("glyphicon-minus icon-arrows-minus").addClass("glyphicon-plus icon-arrows-plus");
$("#accordion").addClass("shadow");
});
if (ivirColumnTypeObj == "") {
$('#Filterscollapse').off('show.bs.collapse').off('hide.bs.collapse');
$('#Filterscollapse').on('show.bs.collapse', function () {
if ($("#myFilters").hasClass("disabled")) {
return;
}
$("#myFilters").addClass("disabled");
$("#accordion").removeClass("shadow");
if (accordionHeight != 0) {
// $(".gridData.clonedHtml").animate({ "top": (parseInt($(".gridData.clonedHtml").css('top')) + accordionHeight) + "px" }, 300);
}
}).on('hide.bs.collapse', function () {
if ($("#myFilters").hasClass("disabled")) {
return;
}
$("#myFilters").addClass("disabled");
$("#accordion").removeClass("shadow");
});
}
if (document.title == "Iview") {
timePickerSecChecker();
$(window).resize(function () {
setSmartViewHeight();
setPinedIconContainerWidth();
});
}
$("#lnkPrev").single_double_click(function (e) {
EnablePageDimmer(e);
}, function (e) {
EnablePageDimmer(e);
return;
});
$("#lnkNext").single_double_click(function (e) {
EnablePageDimmer(e);
}, function (e) {
EnablePageDimmer(e);
return;
});
FocusOnFirstFieldParam();
$("a").keyup(function (event) {
event.preventDefault();
event.stopPropagation();
if (event.keyCode == 13) {
$(this).click();
}
});
if (!$("#nextPrevBtns").is(":visible") && document.title.toLowerCase() == "iview") {
classicView = false;
$("#chkall").attr("onclick", "javascript:CheckAll()");
$("input[name=chkItem]:checkbox").attr("onclick", "javascript:ChkHdrCheckbox();");
} else {
classicView = true;
$("#chkall").attr("onclick", "javascript:CheckAll()");
$("input[name=chkItem]:checkbox").attr("onclick", "javascript:ChkHdrCheckbox();");
}
$("#recPerPage").click(function () {
lastSelRecPerPage = $("#recPerPage option:selected");
});
if (ivirColumnTypeObj == "") {
scrollCloneHeader();
var maxTimeWaitCloneHeader = 2000; // 2 seconds
var timeWaitCloneHeader = 0;
var interval = setInterval(function () {
if ($('.gridData.clonedHtml thead').is(':visible')) {
// Clone Header visible
checkHeightOfTable();
clearInterval(interval);
} else {
if (timeWaitCloneHeader > maxTimeWaitCloneHeader) {
clearInterval(interval);
return;
}
timeWaitCloneHeader += 100;
}
}, 200);
if (!submittedOnLoad && $("#hdnIsParaVisible").val() != "hidden") {
$(".animationLoading").hide();
}
} else {
if ($(ivirTable).length > 0) {
try {
/**
* @description : axAttachExternalCustomPlugin hook function is used to render data using external plugins / implementation
* @author Prashik
* @date 2020-01-09
* @param {*} ivDatas : complete iview data json
* @param {string[]} FieldName : column name unique identifier
* @param {string[]} HeaderText : column caption
* @param {string[]} ColumnType : column type c/n/d
* @param {bool string[]} HideColumn: column hidden or not
* @param {bool} isChkBox : check is enabled or not
* @param {int[]} filteredColumns : visible column index
* @param {int[]} hiddenColumnIndex : hidden column index
* @param {json} ivConfigurations : iview advance settings configurations as json
* @additionalConfigurations
* Iview PageSize/Fetch Size to be set to 0
* Dependent css and js files to be loaded from custom.cs
*/
axAttachExternalCustomPlugin(ivDatas, FieldName, HeaderText, ColumnType, HideColumn, isChkBox, filteredColumns, hiddenColumnIndex, ivConfigurations);
$(".animationLoading").hide();
} catch (ex) {
if (requestJSON && iviewButtonStyle != "old") {
var tempWebServiceViewName = $("#hdnWebServiceViewName").val();
if (tempWebServiceViewName) {
loadViewName = tempWebServiceViewName;
if ($(`#viewTabs li a#${loadViewName}`).length > 0) {
$("#viewTabs li").removeClass("active")
$(`#viewTabs li a#${loadViewName}`).parent("li").addClass("active")
}
$("#hdnWebServiceViewName").val("");
}
getSavedConditionsNew(loadViewName, mergerSmartviewSettings(ivSmartViewSettings && !$.isEmptyObject(ivSmartViewSettings) && JSON.stringify(ivSmartViewSettings) || ""));
}
else {
getSavedConditions();
}
}
} else {
$(".animationLoading").hide();
}
}
typeof axAttachExternalCustomPlugin != "undefined" ? $("table#GridView1").hide() : $("table#GridView1").show();
/**
* delay any callback by some interval while continous keyup
* @author Prashik
* @Date 2019-02-28T15:12:10+0530
* @param {function} callback callback function
* @param {int} ms delay time in milliseconds
*/
function delay(callback, ms) {
var timer = 0;
return function () {
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
callback.apply(context, args);
}, ms || 0);
};
}
/**
* search callback function for gridview
* @author Prashik
* @Date 2019-02-28T15:14:27+0530
* @param {object} e : event object
*/
var searchCallBack = function (e) {
if (typeof ivirDataTableApi == "undefined") {
//is classic iview
var value = $(this).val().toLowerCase();
$("#GridView1 tbody tr").filter(function () {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
} else {
ivirDataTableApi.search('').columns().search('').draw();
ivirDataTableApi.search($(this).val()).draw();
}
}
$("#ivInSearchInput").on("keyup", delay(searchCallBack, 500)).on('blur', function (e) {
if (requestJSON && iviewButtonStyle != "old") {
$('.searchBoxChildContainer').addClass('d-none');
$('#idsearch').removeClass('fa-remove');
// // $('#idsearch').addClass('fa-search');
$("#idsearch").off("click.searchExpandCollapse");
setTimeout(() => {
$("#idsearch").on("click.searchExpandCollapse", searchExpandCollapse);
}, 500);
e.preventDefault();
e.stopPropagation();
}
}).on("mouseover", function () {
$(this).focus()
});
if (requestJSON && iviewButtonStyle != "old") {
$("#idsearch").on("click.searchExpandCollapse", searchExpandCollapse);
}
function searchExpandCollapse(e) {
if ($('#idsearch').hasClass('fa-remove')) {
$('#idsearch').removeClass('fa-remove');
// // $('#idsearch').addClass('fa-search');
} else {
$('#idsearch').addClass('fa-remove');
// // $('#idsearch').removeClass('fa-search');
$("#ivInSearchInput").focus();
}
e.stopPropagation();
e.preventDefault();
}
if (document.title == "Iview") {
if (!showParam || recordsExist) {
$("#accordion").removeClass("shadow");
$('#myFilters').addClass("collapsed").attr("aria-expanded", "false");
$('#Filterscollapse').removeClass("in show").attr("aria-expanded", "false");
} else {
$("#accordion").addClass("shadow");
$('#myFilters').removeClass("collapsed").attr("aria-expanded", "true");
$('#Filterscollapse').addClass("in show").attr("aria-expanded", "true");
}
}
ShowDimmer(false);
if (breadCrumbStr) {
var pageCaption = document.getElementsByClassName("page-caption")[0].innerText;
$("#breadcrumb .breadcrumb").length > 0 && $("#breadcrumb .breadcrumb").remove();
$("#breadcrumb").append(`
';
$j('#tblSubtotlList').append(html);
}
//bind dummy subtotal table
function bindSubtotalList() {
if ($j("#hdnSubtotalList").val() != "") {
var subtotallst = $j("#hdnSubtotalList").val().split(';');
var count = subtotallst.length;
var html = '';
for (var i = 0; i < count; i++) {
var subtotl = subtotallst[i].split(',');
// // var subcount = subtotl.length;
html += '
' + subtotl[0] + '
';
html += '
' + subtotl[1] + '
';
html += '
' + subtotl[2] + '
';
html += '
' + subtotl[3] + '
';
html += '
' + subtotl[4] + '
';
html += '
' + subtotl[5] + '
';
html += '
' + subtotl[6] + '
';
html += '
';
}
$j('#tblSubtotlList').append(html);
}
return false;
}
// These varibles will be used to store the position of the mouse
var X = 0;
var Y = 0;
//Function to find the left position of the given obj on screen.
function FindListPosX(obj) {
var curleft = 0;
if (obj.offsetParent) {
while (obj.offsetParent) {
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
} else if (obj.x)
curleft += obj.x;
return curleft;
}
//Function to find the top position of the given object on screen.
function FindListPosY(obj) {
var curtop = 0;
if (obj.offsetParent) {
while (obj.offsetParent) {
curtop += obj.offsetTop
obj = obj.offsetParent;
}
} else if (obj.y)
curtop += obj.y;
return curtop;
}
//Function to get the left and top position of the task button image on screen.
function FindListPos() {
var img = document.getElementById("imgView");
X = FindListPosX(img);
Y = FindListPosY(img);
}
//Set list view conditions to popup
function SetListCondition(condText) {
//No of conditions
var tblFilter = document.getElementById("tblFilter");
rowCount = tblFilter.rows.length;
if (rowCount > 0)
return;
var strWF = condText.split("|");
for (var i = 0; i < strWF.length; i++) {
var wfCond = strWF[i].split("^");
var ddlCol;
var ddlCond;
var txtValue1;
var txtValue2;
var suffix = "";
if (i == 0) {
//The first condition will not have the operator And/Or
if (i > 0)
suffix = i;
if (i == 0) {
ddlCol = $j("#ddlListFilter");
ddlCond = $j("#ddlListFilcond");
txtValue1 = $j("#txtListFilter");
txtValue2 = $j("#ListfilVal2");
} else {
ddlCol = $j("#ddlListFilter" + suffix);
txtValue1 = $j("#txtFilter" + suffix);
txtValue2 = $j("#txtFillVal" + suffix);
ddlCond = $j("#ddlOpr" + suffix);
}
ddlCol.val(wfCond[0]); // $j("#ddlCaption").val(val);
ddlCond.find("option").each(function () {
if ($j(this).val().toLowerCase() == wfCond[1].toLowerCase()) {
$j(this).attr("selected", "selected");
if ($j(this).text() == 'Between') {
txtValue2.prop("disabled", false);
txtValue1.prop("disabled", false);
} else if ($j(this).text() == 'Is empty') {
txtValue2.prop("disabled", true);
txtValue1.prop("disabled", true);
} else {
txtValue2.prop("disabled", true);
txtValue1.prop("disabled", false);
}
}
});
txtValue1.val(wfCond[2]);
txtValue2.val(wfCond[3]);
} else {
AddCondition();
var OprId = "#grpAndOr" + i;
//radOr1
var Opr = $j("#rad" + wfCond[4] + i);
Opr.prop("checked", true);
// i += 1;
suffix = i;
ddlCol = $j("#ddlListFilter" + suffix);
txtValue1 = $j("#txtFilter" + suffix);
txtValue2 = $j("#txtFillVal" + suffix);
ddlCond = $j("#ddlOpr" + suffix);
ddlCol.val(wfCond[0]);
ddlCond.find("option").each(function () {
if ($j(this).val() == wfCond[1]) {
$j(this).attr("selected", "selected");
if ($j(this).text() == 'Between') {
document.getElementById(txtValue2[0].id).disabled = false;
document.getElementById(txtValue1[0].id).disabled = false;
} else if ($j(this).text() == 'Is empty') {
document.getElementById(txtValue2[0].id).disabled = true;
document.getElementById(txtValue1[0].id).disabled = true;
} else {
document.getElementById(txtValue2[0].id).disabled = true;
document.getElementById(txtValue1[0].id).disabled = false;
}
}
});
txtValue1.val(wfCond[2]);
txtValue2.val(wfCond[3]);
}
}
}
var IsexistView = true;
function checkViewName(lname) {
var i = 0;
var str = 0;
var strCount = lname.length;
var viewName = lname;
while (IsexistView == true) {
if (IsexistView == true) {
str = lname.substr(lname.length - 1);
i = parseInt(str) + 1;
lname = lname.substr(0, lname.length - 1) + i;
NameEnd = lname.substr(strCount - 1, lname.length - 2);
if (NameEnd.toLowerCase() == "nan") {
lname = viewName + "01";
}
IsexistView = false;
checkddName(lname);
} else {
IsexistView = false;
$j("#ddlViewList").val(lname);
}
}
$j("#ddlViewList").val(lname);
$j("#txtViewName").val(lname);
}
function checkddName(lname) {
var views = $j("#hdnViewNames").val();
var viewarr = views.split(',');
for (var i = 0; i < viewarr.length; i++) {
if (viewarr[i] == lname) {
IsexistView = true;
}
}
}
//Check wether view name already exist
var isExistCondtn = 1;
var views = "";
var lname = "";
function isExistViewName() {
if ($j("#txtViewName").val().toLowerCase() == "new" || $j("#txtViewName").val().toLowerCase() == "" || $j("#txtViewName").val().toLowerCase() == "main" || (requestJSON && iviewButtonStyle != "old" && $j("#txtViewName").val().toLowerCase() == "charts")) {
showAlertDialog("warning", 3019, "client");
return false;
}
if ($j("#txtViewName").val().toLowerCase() == $j("#hdnTransId").val().toLowerCase()) {
showAlertDialog("warning", 3022, "client");
return false;
}
if ($j("#txtViewName").val().length > 15) {
showAlertDialog("warning", 3023, "client");
return false;
}
var chkd = false;
$j('#tvList input[type=checkbox]:checked').each(function () {
chkd = true;
})
if (!chkd) {
showAlertDialog("warning", 3021, "client");
return false;
}
$j("#hdnCondTxt").val('');
$j("#hdnSubtotal").val('');
$j("#hdnSubtotal").val('');
var mode = $j("#hdnSaveMode").val();
isExistCondtn = 1;
var exist = false;
views = $j("#hdnViewNames").val();
lname = $j("#txtViewName").val();
var viewarr = views.split(',');
for (var i = 0; i < viewarr.length; i++) {
if (viewarr[i].toLowerCase() == lname.toLowerCase()) {
exist = true;
}
}
if (exist == true && mode != "Edit") {
showAlertDialog("warning", 3022, "client");
return false;
} else {
var status = $j("#hdnStatus").val();
if (status == "ON") {
SaveListCondition();
if (isExistCondtn == 0) {
return false;
}
}
saveLViewActionCond();
document.getElementById('btnSav').click();
$j("#hdnViewNames").val(views + "," + lname);
return true;
}
}
//Remove changes from listview popup
function discardChanges() {
$j("#hdnSubtotal").val('');
$j("#hdnNoRepeat").val('');
$j("#ddlSortBy option:selected").val('');
$j("#hdnSort").val('');
$j("#ddlGroupBy option:selected").val('');
$j("#hdnGroup").val('');
$j("#rbtnOrder option:selected").text('');
$j("#hdnOrder").val('');
$j("#rbtnStatus option:selected").text('');
$j("#hdnStatus").val('');
$j("#hdnColumns").val('');
$j("#hdnSubtotlCaptn").val('');
$j("#hdnCondTxt").val('');
$j("#ddlSortBy").val('');
$j("#ddlGroupBy").val('');
$j("#rbtnOrder option:selected").text("Asc");
$j("#rbtnStatus option:selected").text("OFF");
$j("#tblFilter").empty();
$j("#ddlListFilter").val("");
$j("#ddlListFilcond").val("");
$j("#txtListFilter").val('');
$j("#ListfilVal2").val('');
$j("#txtHeader").val('');
$j("#txtFooter").val('');
$j("#ddlCaption").val('');
$j("#cbLineSpace").prop('checked', false);
$j("#cbTtl").prop('checked', false);
$j("#txtSubOrder").val('');
$j('#tblSubtotal input[type=checkbox]').each(function () {
$j(this)[0].checked = false;
});
$j('#tblNorep input[type=checkbox]').each(function () {
$j(this)[0].checked = false;
});
$j("#tblSubtotlList").empty();
}
//Function to get the left and top position of the task button image on screen.
function FindViewPos() {
var img = document.getElementById("imgView");
X = FindPosX(img);
Y = FindPosY(img);
}
// These varibles will be used to store the position of the mouse
var X = 0;
var Y = 0;
//Function to find the left position of the given obj on screen.
function FindPosX(obj) {
var curleft = 0;
if (obj.offsetParent) {
while (obj.offsetParent) {
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
} else if (obj.x)
curleft += obj.x;
return curleft;
}
//Function to find the top position of the given object on screen.
function FindPosY(obj) {
var curtop = 0;
if (obj.offsetParent) {
while (obj.offsetParent) {
curtop += obj.offsetTop
obj = obj.offsetParent;
}
} else if (obj.y)
curtop += obj.y;
return curtop;
}
//Function to hide the view list.
function HideNqIvViewList() {
var dvviewList = $j("#listViewPopUp");
if (IsNqViewBtnCliked == true) {
IsNqViewBtnCliked = false;
dvviewList.show();
} else {
dvviewList.hide();
}
}
function ConfirmDelete() {
var glType = callParentNew('gllangType');
var isRTL = glType == "ar" ? true : false;
var ConfirmDeleteCB = $.confirm({
theme: 'modern',
title: appGlobalVarsObject.lcm["155"],
onContentReady: function () {
disableBackDrop('bind');
},
backgroundDismiss: 'false',
rtl: isRTL,
escapeKey: 'buttonB',
content: appGlobalVarsObject.lcm[9],
buttons: {
buttonA: {
text: appGlobalVarsObject.lcm[164],
btnClass: 'btn btn-primary',
action: function () {
ConfirmDeleteCB.close();
var e = document.getElementById("ddlViewList");
var fname = e.options[e.selectedIndex].innerHTML;
$j('#hdnViewDelt').val(fname);
DeleteView(fname);
}
},
buttonB: {
text: appGlobalVarsObject.lcm[192],
btnClass: 'btn btn-bg-light btn-color-danger btn-active-light-danger',
action: function () {
disableBackDrop('destroy');
return false;
}
}
}
});
}
function DeleteView(fname) {
var a = $j('#btnRemv').click();
return false;
}
function EditCondPopUp() {
if ($j("#hdnCondTxt").val() != "") {
SetListCondition($j("#hdnCondTxt").val());
}
return false;
}
function NewViewMode() {
$j('#hdnNoRepeat').val('');
$j('#hdnNoRepeatCaptn').val('');
$j('#hdnSubtotlCaptn').val('');
$j('#hdnSubtotalList').val('');
$j('#hdnGridCond').val('');
$j('#hdnGroup').val('');
$j('#hdnSort').val('');
$j('#hdnStatus').val('OFF');
$j('#hdnColumns').val('');
$j('#hdnOrder').val("Asc");
return true;
}
function OpenopupWithCond() {
$j('#lblViewName').show();
$j('#txtViewName').show();
$j('#lblviewtext').hide();
$j('#ddlViewList').hide();
$j('#btnRemove').hide();
$j(divtr1).show();
tr1.className = "tvRow selProperty";
$j(divtr2).hide();
$j(divtr3).hide();
$j(divtr4).hide();
$j(divtr5).hide();
//Calculate Page width and height
var pageWidth = window.innerWidth;
var pageHeight = window.innerHeight;
if (typeof pageWidth != "number") {
if (document.compatMode == "CSS1Compat") {
pageWidth = document.documentElement.clientWidth;
pageHeight = document.documentElement.clientHeight;
} else {
pageWidth = document.body.clientWidth;
pageHeight = document.body.clientHeight;
}
}
//Make the background div tag visible...
var divbg = document.getElementById('bg');
$j(divbg).show();
var divobj = document.getElementById('divAction');
$j(divobj).show();
if (navigator.appName == "Microsoft Internet Explorer")
computedStyle = divobj.currentStyle;
else computedStyle = document.defaultView.getComputedStyle(divobj, null);
//Get Div width and height from StyleSheet
var divWidth = computedStyle.width.replace('px', '');
var divHeight = computedStyle.height.replace('px', '');
var divLeft = (pageWidth - divWidth) / 2;
var divTop = (pageHeight - divHeight) / 2;
//Set Left and top coordinates for the div tag
$j(divobj).css("left", divLeft + "px");
$j(divobj).css("top", divTop + "px");
$j(divobj).css("top", "40px");
//Adjust popup size when list view view is empty or less number of row
var listPnl = document.getElementById('Panel2');
var docHight = $j(document).height();
var height = 0;
var PopupHeight = 500;
var top = 40;
if (PopupHeight > docHight)
height = PopupHeight - docHight;
var winHeight = docHight + top + height;
Adjustwin(winHeight);
showAlertDialog("warning", 3024, "client");
}
function OpenPopup(id, Mode) {
var a = Mode;
var transId = $j('#hdnTransId').val()
var view = $j('#txtViewName').val();
if (view.toLowerCase() == "main")
Mode = "New";
if (Mode == 'New') {
$j('#lblViewName').show();
$j('#txtViewName').show();
$j('#lblviewtext').hide();
$j('#ddlViewList').hide();
$j('#btnRemove').hide();
checkViewName($j('#hdnViewName').val());
NewViewMode();
$j('#hdnSaveMode').val("New");
$j('#tblFilter').empty();
$j("#ddlSortBy option:selected").val('');
$j("#ddlGroupBy option:selected").val('');
$j('#ddlGroupBy')[0].selectedIndex = 0;
$j('#ddlSortBy')[0].selectedIndex = 0;
$j("#hdnSubtotlCaptn").val('');
$j("#tblSubtotlList").empty();
$j('#tblSubtotal input[type=checkbox]').each(function () {
$j(this)[0].checked = false;
});
} else if (Mode == 'Edit') {
$j('#hdnSaveMode').val("Edit");
$j('#lblViewName').hide();
$j('#txtViewName').hide();
$j('#lblviewtext').show();
$j('#ddlViewList').show();
$j('#btnRemove').show();
} else if (Mode == 'EditNew') {
$j('#lblViewName').show();
$j('#txtViewName').show();
$j('#lblviewtext').show();
$j('#ddlViewList').show();
$j('#btnRemove').hide();
$j('#hdnSaveMode').val("New");
NewViewMode();
}
var divtr1 = document.getElementById('divtr1');
var divtr2 = document.getElementById('divtr2');
var divtr3 = document.getElementById('divtr3');
var divtr4 = document.getElementById('divtr4');
var divtr5 = document.getElementById('divtr5');
var viewname = $j('#hdnViewName').val();
$j('#txtViewName').innerHTML = viewname;
$j("#ddlSortBy option:selected").val($j('#hdnSort').val());
$j("#ddlGroupBy option:selected").val($j('#hdnGroup').val());
$j("#ddlListFilcond").val("");
$j("#ddlListFilter").val("");
$j("#txtListFilter").val("");
$j("#ListfilVal2").val("");
$j("#FilterRowCount").val("0");
$j("#txtHeader").val("");
$j("#txtFooter").val("");
$j("#txtSubOrder").val("");
$j("#cbLineSpace").prop('checked', false);
$j("#cbTtl").prop('checked', false);
var order = $j('#hdnOrder').val();
var Status = $j('#hdnStatus').val();
$j('input:radio[name="rbtnOrder"]').filter('[value="' + order + '"]').attr('checked', true);
$j('input:radio[name="rbtnStatus"]').filter('[value="' + Status.toUpperCase() + '"]').attr('checked', true);
$j(divtr1).show();
tr1.className = "tvRow selProperty";
tr2.className = "tvRow RowCust";
tr3.className = "tvRow RowCust";
tr4.className = "tvRow RowCust";
tr5.className = "tvRow RowCust";
$j(divtr2).hide();
$j(divtr3).hide();
$j(divtr4).hide();
$j(divtr5).hide();
//Calculate Page width and height
var pageWidth = window.innerWidth;
var pageHeight = window.innerHeight;
if (typeof pageWidth != "number") {
if (document.compatMode == "CSS1Compat") {
pageWidth = document.documentElement.clientWidth;
pageHeight = document.documentElement.clientHeight;
} else {
pageWidth = document.body.clientWidth;
pageHeight = document.body.clientHeight;
}
}
//Make the background div tag visible...
var divbg = document.getElementById('bg');
$j(divbg).show();
var divobj = document.getElementById(id);
$j(divobj).show();
if (navigator.appName == "Microsoft Internet Explorer")
computedStyle = divobj.currentStyle;
else computedStyle = document.defaultView.getComputedStyle(divobj, null);
//Get Div width and height from StyleSheet
var divWidth = computedStyle.width.replace('px', '');
var divHeight = computedStyle.height.replace('px', '');
var divLeft = (pageWidth - divWidth) / 2;
var divTop = (pageHeight - divHeight) / 2;
//Set Left and top coordinates for the div tag
$j(divobj).css("left", divLeft + "px");
$j(divobj).css("top", divTop + "px");
$j(divobj).css("top", "40px");
//Adjust popup size when list view view is empty or less number of row
var listPnl = document.getElementById('Panel2');
var docHight = $j(document).height();
var height = 0;
var PopupHeight = 500;
var top = 40;
if (PopupHeight > docHight)
height = PopupHeight - docHight;
var winHeight = docHight + top + height;
Adjustwin(winHeight);
$('#txtViewName').focus();
jQuery(".popup_bg").bind("click.modalPopupKD", function (event) {
CloseListActionWin();
})
jQuery(document).bind("keydown.modalPopupKD", function (event) {
if (!event.shiftKey && event.keyCode == 9) {
//tab key
if ($(document.activeElement)[0].id == $("#btnSave")[0].id) {
event.preventDefault();
$('#closeList').focus();
} else if ($(document.activeElement)[0].id == $("#closeList")[0].id) {
event.preventDefault();
$('#txtViewName').focus();
}
} else if (event.shiftKey && event.keyCode == 9) {
if ($(document.activeElement)[0].id == $("#closeList")[0].id) {
event.preventDefault();
$('#btnSave').focus();
}
} else if (event.keyCode == 27) {
CloseListActionWin();
}
});
}
function CloseListActionWin() {
$j('#bg').hide();
$j('#divAction').hide();
var docHight = $j(document).height();
var height = 0;
var PopupHeight = 500;
var top = 40;
if (PopupHeight > docHight)
height = PopupHeight - docHight;
var winHeight = docHight + top + height;
Adjustwin(winHeight);
jQuery(document).unbind("keydown.modalPopupKD");
jQuery(document).unbind("click.modalPopupKD");
return false;
}
function EditView(context) {
context.onchange = "";
var e = document.getElementById("ddlViewList");
var fname = e.options[e.selectedIndex].innerHTML;
if (fname == "New view") {
$j('#lblViewName').show();
$j('#txtViewName').show();
$j('#lblviewtext').show();
$j('#ddlViewList').show();
$j('#btnRemove').hide();
checkViewName($j('#hdnViewName').val());
discardChanges();
$j("#ddlSortBy option:selected").val($j('#hdnSort').val());
$j("#ddlGroupBy option:selected").val($j('#hdnGroup').val());
$j('#hdnSaveMode').val("New");
} else {
$j('#hdnViewName').val(fname);
$j('#txtViewName').val(fname);
$j('#hdnSaveMode').val("Edit");
discardChanges();
BindXml(fname);
}
return true;
}
function BindXml(fxml) {
$j('#txtViewName').val(fxml);
$j('#hdnListViewName').val(fxml);
$j('#btnListView').click();
return true;
}
function BindGrid(viewName) {
$j('#hdnSelectedView').val(viewName);
$j('#btnShowGrid').click(); //hdnSelectedView
return true;
}
///Function to click the new button from iview ,display the tstruct page.
function pgReload() {
ResetNavGlobalVariables();
$j(location).attr("href", "tstruct.aspx?transid=" + tst);
try {
if (!window.parent.isSessionCleared && window.document.title == "List IView") {
ASB.WebService.ClearNavigationSession();
window.parent.isSessionCleared = true;
}
} catch (ex) { }
}
function submitIt() {
var empCode = $j("#EmployeeCode").val();
if (empCode == "") {
var dob = $j("#dob").val();
if (dob == "") {
ShowDimmer(false);
showAlertDialog("warning", 3025, "client");
return false;
} else {
var empName = $j("#EmployeeName").val();
var deptname = $j("#dept").val();
var ddo = $j("#dddo").val();
var doa = $j("#doa").val();
if ((empCode == "") && (empName == "") && (deptname == "--") && (ddo == "") && (doa == "")) {
ShowDimmer(false);
showAlertDialog("warning", 3026, "client");
return false;
}
}
}
return true;
}
//to set clicked rowIndex,column name and parent as IView
function SetColumnName(columnName, dataRowIndex, isParentIview) {
ShowDimmer(true);
window.parent.dataRowIndex = dataRowIndex;
window.parent.clickedColumn = columnName;
if (isParentIview)
window.parent.isParentIview = isParentIview;
}
function ShowCharts(calledFrom, action) {
if ($j("#dvCharts").is(':visible'))
return;
if (!isChartsAvailable) {
showAlertDialog("error", 3027, "client");
} else {
var chartSize = $j("#hdnChartSize").val();
if (chartSize == "" || chartSize == "half") {
$j("#dvCharts").show();
Adjustwin();
SetContentPanelWidth("half");
} else {
ShowChartPopUp(calledFrom, action);
}
}
}
function CloseChart(calledFrom) {
var chartSize = $j("#hdnChartSize").val();
var dvChart = $j("#dvCharts");
dvChart.hide();
var width = "";
if (chartSize == "" || chartSize == "half") {
ShowFilter();
} else {
$j("#bg").hide();
dvChart.removeClass("dvChartsPop");
dvChart.addClass("dvChart");
$j("#hdnChartSize").val("");
$j("#lnkChart").text("View Full Screen");
}
SetContentPanelWidth(width);
if (chartSize == "full") {
if (gl_language == "ARABIC") {
$j("#divcontainer").css("margin-top", "0%");
}
Adjustwin();
}
}
function ShowChartPopUp(calledFrom, action) {
var lnk = $j("#lnkChart");
var dvChart = $j("#dvCharts");
var width = "";
if (lnk.text() == "View Full Screen") {
$j("#bg").show();
if (isFilterSortEnabled || isParamVisible.toLowerCase() == "true")
width = "half";
else
width = "full";
dvChart.removeClass("dvChart");
dvChart.addClass("dvChartsPop");
$j("#hdnChartSize").val("full");
if (action == undefined) {
if ($j("#ddlChartCol1").val() != "" && $j("#ddlChartCol2").val() != "")
$j("#btnGetChart1").click();
}
dvChart.show();
dvChart.css("top", "20px");
$j("#lnkChart").text("Close Full Screen");
Adjustwin(100);
if (gl_language == "ARABIC") {
$j("#dvCharts").css("margin-top", "1%");
}
} else {
width = "half";
$j("#bg").hide();
dvChart.removeClass("dvChartsPop");
dvChart.addClass("dvChart");
$j("#hdnChartSize").val("half");
$j("#lnkChart").text("View Full Screen");
dvChart.show();
if (action == undefined) {
if ($j("#ddlChartCol1").val() != "" && $j("#ddlChartCol2").val() != "")
$j("#btnGetChart1").click();
}
if (gl_language == "ARABIC") {
$j("#dvCharts").css("margin-top", "-13%");
}
}
SetContentPanelWidth(width);
}
//#Region Filter Iview and ListView
var visibleColumns = new Array();
var visibleColumnIds = new Array();
var isFilterSortEnabled = false;
//Construction of filter using Json Object and Grid Header
var selectedFilterItem = '';
//To add sorting on the column name click.
function CallSorting(obj) {
callParentNew("loadFrame()", "function");
var colName = obj.innerHTML.replace(" ", "~");
selectedFilterItem = obj.id;
$j("#hdnSortColName").val(colName);
$j("#SortGrid").click();
}
//To add filter feature on the basis of Item selected to filter
function CallFilter(colName, filterVal, item) {
if (colName) {
callParentNew("loadFrame()", "function");
arrCheckedFilter.push(item);
if ($j("#cb" + item).attr('checked'))
$j("#hdnFilterChecked").val("checked");
else
$j("#hdnFilterChecked").val("unchecked");
selectedFilterItem = item;
$j("#hdnFilterBy").val(filterVal);
$j("#hdnFilterColName").val(colName);
$j("#FilterGrid").click();
$j("#showRecDetails").hide();
}
}
//To make filter hidden on hide filter click
function HideFilter(src) {
document.getElementById("hdnIsParaVisible").value = "0";
if (isFilterSortEnabled || isParamVisible.toLowerCase() == "true") {
$j("#leftPanel").hide("slide", { percent: 0 }, 500);
$j("#showFilter").css('display', 'block');
$j("#hideFilter").css('display', 'none');
$j(".dvContent").css('height', 'auto');
if (navigator.appName != "Microsoft Internet Explorer")
$j('.vertical').css('margin-left', '25px');
$j(".hdIvFilter").hide();
if (src == undefined) {
if (!($j("#dvCharts").is(":visible"))) {
$j("#divcontainer").css("width", "100%");
SetContentPanelWidth("full");
} else {
if ($j("#leftPanel").is(":visible"))
//halfchart
SetContentPanelWidth("half");
else
SetContentPanelWidth("halfchart");
}
}
}
if (gl_language == "ARABIC") {
$j("#divcontainer").css("margin-top", "0px");
$j("#divcontainer").css("margin-right", "0px");
} else {
$j("#divcontainer").css("margin-left", "0px");
}
setGridviewWidth();
}
function SetContentPanelWidth(strSize) {
var contentPanel;
if (document.title == "List IView")
contentPanel = $j("#contentPanelGrid");
else
contentPanel = $j("#contentPanelGridIview");
if (strSize == "full") {
contentPanel.css("width", "100%");
contentPanel.css("margin-left", "0px");
SetDynamicScrollWdith("full");
} else if (strSize == "half") {
contentPanel.css("width", "50%");
contentPanel.css("margin-left", "10px");
SetDynamicScrollWdith("half");
} else if (strSize == "halfchart") {
contentPanel.css("width", "60%");
contentPanel.css("margin-left", "10px");
SetDynamicScrollWdith("halfchart");
} else {
if (gl_language == "ARABIC" && screen.width > 1024)
$j("#divcontainer").css("width", "75%");
else if (gl_language == "ENGLISH" && screen.width > 1024)
$j("#divcontainer").css("width", "75%");
else
$j("#divcontainer").css("width", "75%");
$j("#contentPanelGrid").css("width", "75%");
contentPanel.css("width", "100%");
contentPanel.css("margin-left", "10px");
SetDynamicScrollWdith("");
}
if (window.opener != undefined) {
if (strSize == "") {
contentPanel.css("width", "65%");
contentPanel.css("margin-left", "10px");
}
}
}
function SetDynamicScrollWdith(action) {
var DivHR = document.getElementById('DivHeaderRow');
var DivMC = document.getElementById('DivMainContent');
var width = screen.width - 50;
if (DivHR && DivMC) {
if (action == "full") {
DivHR.style.width = (parseInt(width) - 16) + 'px';
DivMC.style.width = width + 'px';
} else if (action == "half") {
var newWid = width / 2;
DivHR.style.width = (parseInt(newWid) - 16) + 'px';
DivMC.style.width = newWid + 'px';
} else if (action == "halfchart") {
var newWid = width / 2;
DivHR.style.width = (parseInt(newWid) - 16) + 'px';
DivMC.style.width = newWid + 'px';
} else {
var newWid = (width * 75 / 100) + 50;
if (screen.width == 1024)
newWid = (width * 75 / 100);
DivHR.style.width = (parseInt(newWid) - 16) + 'px';
DivMC.style.width = newWid + 'px';
}
}
}
//To make filter visible on show filter click
function ShowFilter() {
// $j("#dvShowFilter").show();
$j("#dvHideFilter").css("display", "block");
$j(".dvContent").css("height", "60vh");
document.getElementById("hdnIsParaVisible").value = "1";
//added the condition if show filter is called hide the graph
if ($j("#dvCharts").is(":visible"))
$j("#dvCharts").hide();
if (isFilterSortEnabled || isParamVisible.toLowerCase() == "true") {
if (gl_language == "ARABIC") {
$j("#divcontainer").css("float", "right");
$j("#leftPanel").css("float", "right");
} else {
$j("#leftPanel").css("float", "left");
$j("#leftPanel").css("clear", "both");
$j("#divcontainer").css("margin-top", "1%");
if (screen.width == 1024) {
$j("#divcontainer").css("margin-left", "0%");
}
else {
$j("#divcontainer").css("margin-left", "0%");
}
}
$j("#leftPanel").show("slide", { percent: 0 }, 500);
$j("#showFilter").css('display', 'none');
$j('#dvUpdateFilter').css('margin-top', '-16px');
$j(".hdIvFilter").show();
if (!($j("#dvCharts").is(":visible"))) {
if (document.title == "List IView") {
$j("#contentPanelGrid").css("width", "75%");
}
else {
SetContentPanelWidth("");
}
} else {
SetContentPanelWidth("half");
}
}
setGridviewWidth();
}
//In List View This feature is to hide or show column on the basis of checked column
function CallColumnHide(obj) {
callParentNew("loadFrame()", "function");
var colId = obj.id;
var colName = obj.parentElement.textContent;
if (colId && colName) {
$j("#hdnHideColName").val(obj.value);
$j("#HideColumn").click();
}
}
//check the filter columns
function CheckFilterColumns() {
for (var j = 0; j < arrCheckedFilter.length; j++) {
if ($j("#cb" + arrCheckedFilter[j]).attr('checked')) {
$j("#cb" + arrCheckedFilter[j]).prop('checked', false);
}
else {
$j("#cb" + arrCheckedFilter[j]).prop('checked', 'checked');
}
}
}
//To select the checkboxes which are not visible
function CheckHiddenColumns(visibleColumns, visibleColumnIds) {
var arrayHiddenCol = new Array();
var gridColumn;
if (document.title == "Iview")
gridColumn = '#GridView1 tr:first-child th'
else
gridColumn = '#GridView1 tr:first-child th a'
$j(gridColumn).each(function (i) {
if (this.innerHTML && $j(this).text()) {
arrayHiddenCol.push(this.innerHTML.replace(/ /g, ""));
}
});
for (var k = 0; k < visibleColumns.length; k++) {
var colName = visibleColumns[k];
colName = colName.replace(/~/g, "");
var id = colName.replace(/[^\w\s]/gi, '').replace(/\s/g, '');
if ($j.inArray(colName, arrayHiddenCol) == -1)
$j("#cb" + id).prop('checked', 'checked');
else
$j("#cb" + id).prop('checked', false);
}
}
var calledFrom = "";
//To update global array AxIvFilterMinHeader, whenever a filter pannel is minimized or maximized
function UpdateActiveArray(obj) {
if (calledFrom == "") {
var id = $j(obj).attr('id');
if ($j(obj).hasClass("ui-state-active") && window.parent.AxIvFilterMinHeader.indexOf(id) == -1)
window.parent.AxIvFilterMinHeader.push(id);
else if (window.parent.AxIvFilterMinHeader.indexOf(id) > -1)
window.parent.AxIvFilterMinHeader.splice($j.inArray(id, window.parent.AxIvFilterMinHeader), 1);
}
if ($j("#filterIvParam").attr("aria-selected") == "true") {
$j("#leftPanel").css("margin-top", "-1%");
} else {
$j("#leftPanel").css("margin-top", "-2%");
}
}
//To maintain the Filter Pannel state for the end user
function ShowVisibleFilters() {
for (var k = 0; k < window.parent.AxIvFilterMinHeader.length; k++) {
calledFrom = "clicked";
$j("#" + window.parent.AxIvFilterMinHeader[k]).click();
}
calledFrom = "";
}
//To highlight selected Filter Item
function HighLightSelected() {
if (selectedFilterItem && $j("#" + selectedFilterItem).length > 0)
$j("#" + selectedFilterItem).addClass("selectedFilterItem");
else
selectedFilterItem = '';
}
//#End Region Filter Iview and List View
function toExcelWeb(a, c) {
//if (recordsFieldsValidForSave()) {
var left = (screen.width / 2) - (840 / 2);
var top = (screen.height / 2) - (600 / 2);
var pa = "";
var ivKey;
pa = form1.param.value;
if ($j("#hdnKey").length > 0 && $j("#hdnKey").val() != "")
ivKey = "&ivKey=" + $j("#hdnKey").val();
SetExport("../aspx/excelweb.aspx?ivname=" + a + "&ivtype=" + c + ivKey + "¶ms=", pa, a);
}
function MakeStaticHeader(gridId, height, width, headerHeight, isFooter) {
var tbl = document.getElementById(gridId);
if (tbl) {
var DivHR = document.getElementById('DivHeaderRow');
var DivMC = document.getElementById('DivMainContent');
headerHeight = $j('#GridView1').find("tr:first").height();
width = screen.width - 50;
//*** Set divheaderRow Properties ****
DivHR.style.height = headerHeight + 'px';
DivHR.style.width = (parseInt(width) - 16) + 'px';
DivHR.style.position = 'relative';
DivHR.style.top = '0px';
DivHR.style.zIndex = '10';
DivHR.style.verticalAlign = 'top';
//*** Set divMainContent Properties ****
DivMC.style.width = width + 'px';
DivMC.style.height = height + 'px';
DivMC.style.position = 'relative';
DivMC.style.top = -headerHeight + 'px';
DivMC.style.zIndex = '1';
DivHR.appendChild(tbl.cloneNode(true));
}
}
function OnScrollDiv(Scrollablediv) {
document.getElementById('DivHeaderRow').scrollLeft = Scrollablediv.scrollLeft;
}
$j(window).on("load", function () {
setGridviewWidth();
});
function setGridviewWidth() {
if ($j("#DivMainContent").width() > $j("#GridView1").width())
$j("#DivMainContent").width($j("#GridView1").width() + 17);
}
function ShowMessageBox(msg, objId) {
if (objId != undefined) {
var fld = document.getElementById(objId);
var posY = FindPosY(fld);
$j.msgBox({ content: msg, type: "info" }, posY);
} else
$j.msgBox({ content: msg, type: "info" }, 100);
}
function ddToggle(e) {
e.preventDefault();
$j(".ddlBtn dd ul").toggle();
}
function ShowViewPopup() {
$j("#divFilterView").css('display', 'block');
}
function CloseViewPopup() {
$j("#divFilterView").css('display', 'none');
}
function FilterMyView(id) {
callParentNew("loadFrame()", "function");
$j("#hdnMyViewName").val(id);
}
function DeleteMyView(id) {
var result = confirm("Are you sure you want to delete this item?");
if (result) {
$j("#hdnMyViewName").val(id);
$j("#btnDeleteMyView").click();
}
}
function CheckMyViewFilters() {
var strMyviewcol = $j("#hdnMyViewFilterCol").val();
if (strMyviewcol != "" && typeof strMyviewcol !== "undefined") {
var arrmyViewcolValues = new Array();
var arrColDtls = strMyviewcol.split("^");
for (var j = 0; j < arrColDtls.length; j++) {
var filColNm = arrColDtls[j].substring(0, arrColDtls[j].indexOf(":"));
var filColDt = arrColDtls[j].substring(arrColDtls[j].indexOf(":") + 1);
arrmyViewcolValues = filColDt.split(",");
for (var i = 0; i < arrmyViewcolValues.length; i++) {
$j("#leftPanel:input[value=" + arrmyViewcolValues[i] + "]").attr("checked", "true");
var chkId = "#" + filColNm + "colValue";
$j(chkId + " input").each(function () {
if ($j(this).val() == arrmyViewcolValues[i].toString()) {
$j(this).prop("checked", true);
}
});
}
}
if ($j("#hdnparamValues").val() != "") {
SetParamValues($j("#hdnparamValues").val());
}
}
$j("#hdnMyViewFilterCol").val("");
}
function OpenIviewFromIv(srcUrl, params, ivname, navigationType) {
if (navigationType != undefined)
configNavProp = navigationType;
else
configNavProp = "";
if (srcUrl != "") {
closeParentFrame();
srcUrl = srcUrl + "&AxIvNav=true";
try {
ASB.WebService.SetActionIvParams(srcUrl, params, ivname, SuccOpenIvAction);
} catch (ex) {
closeParentFrame();
}
}
}
function SuccOpenIvAction(result, eventArgs) {
if (result != "") {
callParentNew("updateAppLinkObj(" + result + ",1)", "function")
//todo : need to remove
var parFrm = $j("#axpiframe", parent.document);
if (configNavProp == "" && parFrm.hasClass("frameSplited"))
configNavProp = "split";
if (configNavProp === "split") {
ShowDimmer(false);
callParentNew(`OpenOnPropertyBase(${result})`, 'function');
}
else if (configNavProp === "popup") {
LoadPopPage(result)
}
else if (configNavProp === "default" || configNavProp === "") {
UpdatePrevMid1FrameUrl(result);
document.location.href = result;
}
else if (configNavProp === "newpage") {
popupFullPage(result);
}
}
}
function adjustwin(ht, iframeWindow, height) {
var framename = iframeWindow.name;
framename = framename.toLowerCase();
if ((framename.substring(0, 7) == "openpop") || (framename.substring(0, 7) == "loadpop") || (framename.substring(0, 7) == "ivewPop")) {
framename = "MyPopUp";
}
}
//global variable for pick list
var initialSrchVal = "";
$j(document).keydown(function (e) {
if (e.which == 13 && $j('#dvPickList').is(':visible') && $j('#tblPickData tr.active').length > 0) {
//check for the value
if (initialSrchVal == $j("#" + $j("#tblPickData").attr("data-pick")).val()) {
e.preventDefault();
e.stopPropagation();
var paramString = $j("#tblPickData tr.active td").attr("onclick");
paramString = paramString.split(';')[0];
paramString = paramString.substring(23, paramString.length - 2);
SetPickVal(paramString, $j("#tblPickData tr.active td").data());
FillDependents(paramString.split('^')[0]);
pickStatus = false;
selectedRow = 0;
e.which = -1;
//clear the value
initialSrchVal = "";
} else {
createPlSmartSelect($j("#" + $j("#tblPickData").attr("data-pick"))[0]);
}
}
if (e.which == 40 && $j('#dvPickList').is(':visible') && $j('#tblPickData tr.active').length > 0) {
e.preventDefault();
e.stopPropagation();
pickDownn();
if ($("#dvPickHead .active").offset().top - $("#dvPickHead").offset().top + $("#dvPickHead .active").outerHeight() >= $("#dvPickHead").height() || $("#dvPickHead .active").offset().top - $("#dvPickHead").offset().top < 0) {
$("#dvPickHead").animate({
scrollTop: ($("#dvPickHead .active").offset().top - $("#dvPickHead").offset().top) + $("#dvPickHead .active").height()
}, 100);
}
return false;
}
if (e.which == 38 && $j('#dvPickList').is(':visible') && $j('#tblPickData tr.active').length > 0) {
e.preventDefault();
e.stopPropagation();
pickUpp();
$("#dvPickHead").animate({
scrollTop: ($("#dvPickHead .active").offset().top - $("#dvPickHead").offset().top) - $("#dvPickHead .active").height()
}, 100);
return false;
}
});
/**
* @description : Iview Tstruct Attachments Implemetation
* @author Prashik
* @date 2020-01-21
* @param {*} proj : Project name
* @param {*} tid : transid of the tstruct
* @param {*} fldname : field name in tstruct
* @param {*} filename : attachment name
* @param {string} [attachtype="image"]
* @param {boolean} [onlygetPath=false]
* @iviewColumnConfiguration:
* Iview columns to be added:
* transid : transid of the tstruct
* fieldname : field name in tstruct(to be kept empty for header attachment)
* recordid : record id for attachment
* axp_attach : text to be shown on download hyperlink(this column is an flag to enable/disable attachments componenet)/grid attachment name
* isdbattach : this is an optional column which determines wheater the attachment is db attachment or file attachment, if the attachment type is db attachment then this column value should be true
* @resolvePathForTemplates:
* "resolve attachment path" property is used for iview templetes in case of resolving image path to show image in iview templates
* "resolve attachment path" Advanced Setting configuration property with property code as "resolve attachment path" to be added as true or false.
*/
function SetFileToDownload(proj, tid, fldname, filename, attachtype = "image", onlyRecordId, onlyFileName, isDbAttachment, onlygetPath = false) {
var axp_attachfilename;
if (proj != undefined && tid != undefined && filename != undefined) {
$j.ajax({
type: "POST",
async: !onlygetPath,
url: "../WebService.asmx/GetFilePathForIviewAttachment",
contentType: "application/json;charset=utf-8",
//data: '{proj: "' + proj + '",tid: "' + tid + '",fldname: "' + fldname + '",filename: "' + filename + '"}',
data: JSON.stringify({ proj, tid, fldname, filename, attachtype, onlyRecordId, onlyFileName, isDbAttachment, onlygetPath }),
dataType: "json",
success: function (data) {
axp_attachfilename = InvokeDownloadButton(data.d, attachtype, onlygetPath);
},
failure: function (response) {
showAlertDialog("error", 3028, "client");
axp_attachfilename = [];
},
error: function (response) {
showAlertDialog("error", 3028, "client");
axp_attachfilename = [];
}
});
return axp_attachfilename;
} else {
return [];
}
}
/**
* @description : Lisiview AxpFile Tstruct Attachments Implemetation
* @author Prashik
* @date 2020-06-27
* @param {*} filepath : attachment path
* @param {*} filename : attachment name
* @param {string} [attachtype="axpfile"]
*/
function SetAxpFileListviewDownload(filepath, filename, attachtype = "axpfile") {
var axp_attachfilename;
if (filename != undefined) {
$j.ajax({
type: "POST",
async: true,
url: "../WebService.asmx/GetAxpFilePathForListviewAttachment",
contentType: "application/json;charset=utf-8",
data: JSON.stringify({ filepath, filename }),
dataType: "json",
success: function (data) {
axp_attachfilename = InvokeDownloadButton(data.d, attachtype);
},
failure: function (response) {
showAlertDialog("error", 3028, "client");
axp_attachfilename = [];
},
error: function (response) {
showAlertDialog("error", 3028, "client");
axp_attachfilename = [];
}
});
return axp_attachfilename;
} else {
return [];
}
}
function InvokeDownloadButton(link, attachtype, onlygetPath = false) {
if (link) {
link = [...new Set(link.split("♠"))].join("♠");
if (!onlygetPath) {
for (var i = 0; i < link.split('♠').length; i++) {
var fileUrl = link.split('♠')[i];
if (fileUrl.indexOf('Error:') > -1) {
fileUrl = fileUrl.replace('Error:', '')
showAlertDialog("error", fileUrl);
continue;
}
var urlSplitted = fileUrl;
let downloadCommand = "";
try {
downloadCommand = JSON.parse(urlSplitted);
} catch (ex) {
urlSplitted = urlSplitted.split(/\\|\//g);
urlSplitted = urlSplitted[urlSplitted.length - 1];
downloadCommand = JSON.parse("{\"command\":[{\"cmd\":\"openfile\",\"cmdval\":\"" + urlSplitted + "\",\"isatt\":\"T\"}]}");
}
AssignLoadValues(JSON.stringify(downloadCommand));
}
return [];
} else {
return link.split('♠').map(lnk => {
try {
var cmdVal = JSON.parse(lnk)?.command?.["0"]?.cmdval;
if (cmdVal) {
return (JSON.parse(lnk).basePath || "") + cmdVal;
} else {
return lnk;
}
} catch (ex) {
return lnk;
}
}) || [];
}
} else if (!onlygetPath) {
showAlertDialog("error", 3007, "client");
}
}
function downloadImage(fileUrl) {
var image = new Image();
image.crossOrigin = "anonymous";
image.src = fileUrl;
// get file name - you might need to modify this if your image url doesn't contain a file extension otherwise you can set the file name manually
var fileName = image.src.split(/(\\|\/)/g).pop();
image.onload = function () {
var canvas = document.createElement('canvas');
canvas.width = this.naturalWidth; // or 'width' if you want a special/scaled size
canvas.height = this.naturalHeight; // or 'height' if you want a special/scaled size
canvas.getContext('2d').drawImage(this, 0, 0);
var blob;
switch (fileName.match(/\.(jpeg|jpg|gif|png)$/)[0]) {
case ".gif":
blob = canvas.toDataURL("image/gif");
break;
case ".jpg":
case ".jpeg":
blob = canvas.toDataURL("image/jpeg");
break;
case ".png":
default:
blob = canvas.toDataURL("image/png");
break;
}
$("body").append("");
$(".hdnButtonInvokeDownload:last img").click().parents(".hdnButtonInvokeDownload").remove();
};
}
var ivAttachRid = [];
var ivAttachTransid = [];
var ivAttachRowNo = [];
var ivFileNames = [];
function DownloadSelectedFiles() {
$j('#GridView1').find('input[type="checkbox"]:checked').each(function (index) {
var rowIdx = $j('.downloadLink' + (parseInt($j(this).val()) - 1));
rowIdx.each(function (i) {
var link = $j(this).attr("href");
if (link != undefined && link != null && link != "") {
link = link.replace("javascript:SetFileToDownload(", "");
link = link.replace(");", "");
link = link.replace(/'/g, "");
var tempArray = link.split(',');
GetFileValues(tempArray);
}
})
});
GetDownloadLink();
ivAttachRid = [];
ivAttachTransid = [];
ivAttachRowNo = [];
ivFileNames = [];
}
function GetDownloadLink() {
try {
if (ivAttachRid.length > 0) {
ASB.WebService.GetZipPathForIviewAttachment(ivAttachRid, ivAttachTransid, ivAttachRowNo, ivFileNames, InvokeDownloadButton, OnException);
} else
showAlertDialog("warning", 3029, "client");
} catch (exp) { }
}
function OnException(response) {
}
function GetFileValues(arr) {
ivAttachRid.push(arr[0]);
ivAttachTransid.push(arr[1]);
ivAttachRowNo.push(arr[2]);
ivFileNames.push(arr.slice(3).join(","));
}
function setWidth() {
HideFilter();
$j("#showFilter").css("display", "block");
$j("#dvHideFilter").css("display", "none");
$j("#contentPanelGridIview").css("margin-top", "2%");
}
function parafilterfixer() {
if (parafilterfix.myFilters == false) {
$j("#myFilters").attr("aria-expanded", "false");
if ($j("#Filterscollapse").hasClass("in")) {
iviewTableWrapperHeightFix();
}
$j("#Filterscollapse").removeClass("in show");
$("#accordion").removeClass("shadow");
$j("#Filterscollapse").attr("aria-expanded", "false");
} else {
$j("#myFilters").attr("aria-expanded", "true");
if (!$j("#Filterscollapse").hasClass("in")) {
iviewTableWrapperHeightFix();
}
$j("#Filterscollapse").addClass("in");
$j("#Filterscollapse").attr("aria-expanded", "true");
$("#accordion").addClass("shadow");
}
}
function RefreshParams() {
$j('#hdnGo').val("refreshparams");
$j('#btnRefreshParams').click();
}
function UpdateGetParamCache() {
$j('#hdnGo').val("updateCache");
clearAdvancedFiltersforNewData();
capturedButton1Submit = true;
}
function GetStagRecords(checkLink) {
callParentNew("loadFrame()", "function");
$j("#hdnIViewShow").val(checkLink);
var key = $j("#hdnKey").val();
var tableno = $j("#hdnStagTableNo").val();
var totalRecords = $j("#hdnTotalIViewRec").val();
if (totalRecords > 20) {
if (checkLink == 'More') {
try {
ASB.WebService.GetNextStagPage(key, tableno, SuccessGetStag);
} catch (ex) { AxWaitCursor(false); }
} else if (checkLink == 'All') {
try {
ASB.WebService.GetAllPages(key, tableno, SuccessGetStag);
} catch (ex) { AxWaitCursor(false); }
}
} else {
showMore = false;
DisableStagLoad();
callParentNew("closeFrame()", "function");
}
}
function FailureGetStag(result, eventArgs) {
closeParentFrame();
}
function SuccessGetStag(result, eventArgs) {
if (CheckSessionTimeout(result))
return;
var xmlDoc = $j.parseXML(result);
var xml = $j(xmlDoc);
var tableno = $j("#hdnStagTableNo").val();
tableno = parseInt(tableno, 10) + 1;
$j("#hdnStagTableNo").val(tableno);
var iViewShowCat = $j("#hdnIViewShow").val();
var customers;
if (iViewShowCat == 'More') {
customers = xml.find("Table_" + tableno);
} else {
customers = $j(xml).find("Table1");
}
customers.each(function () {
var customer = $j(this);
var row = $j("[id$=GridView1] tr").eq(1).clone(true);
var rowHtml = "";
if (customer[0].childNodes) {
var idx = 0;
for (var j = 0; j < customer[0].childNodes.length; j++) {
var colText = customer[0].childNodes[j].textContent;
if (colText != "\n ") {
if (j == 0 || j == 1) {
var htmlString = row.find("td").eq(idx).html();
if (htmlString.indexOf("checkbox") > -1) {
row.find("td").eq(idx).html(htmlString.replace('value="1"', 'value="' + colText + '"'));
} else
row.find("td").eq(idx).html(colText);
} else {
if (colText == "Grand Total")
row.find("td").eq(idx - 1).html("");
row.find("td").eq(idx).html(colText);
}
idx++;
}
}
} else {
for (var j = 0; j < customer[0].children.length; j++) {
var colText = customer[0].children[j].textContent;
if (j == 0) {
var htmlString = row.find("td").eq(j).html();
if (htmlString.indexOf("checkbox") > -1) {
row.find("td").eq(j).html(row[0].children[0].innerHTML.replace('value="1"', 'value="' + colText + '"'));
} else {
row.find("td").eq(j).html(colText);
}
} else {
row.find("td").eq(j).html(colText);
}
}
}
$j("[id$=GridView1]").append(row);
});
var totalGridRows = $j("#GridView1 tr").length - 1;
if ($j("#GridView1 tr:last td:eq(0)").text() == "Grand Total" || $j("#GridView1 tr:last td:eq(1)").text() == "Grand Total" || $j("#GridView1 tr:first td:eq(1)").text() == "Grand Total") {
if ($j("#GridView1 tr:last td:eq(0)").text() == "Grand Total") {
$j("#GridView1 tr:last td:eq(1)").text("Grand Total");
$j("#GridView1 tr:last td:eq(1)").css("color", "DarkGreen");
$j("#GridView1 tr:last td:eq(1)").css("font-weight", "bold");
$j("#GridView1 tr:last td:eq(0)").text(" ")
} else if ($j("#GridView1 tr:last td:eq(1)").text() == "Grand Total") {
$j("#GridView1 tr:last td:eq(2)").text("Grand Total");
$j("#GridView1 tr:last td:eq(2)").css("color", "DarkGreen");
$j("#GridView1 tr:last td:eq(2)").css("font-weight", "bold");
$j("#GridView1 tr:last td:eq(1)").text(" ");
}
totalGridRows = totalGridRows - 1;
}
var totalRecords = $j("#hdnTotalIViewRec").val();
if ($j("#nextPrevBtns").is(':visible')) {
$j("#lblNoOfRecs").text("Total no of Rows : " + (totalGridRows) + " of " + totalRecords);
} else {
if ($j("#dvFilteredRowCount").is(':visible')) {
var cutMsg = appGlobalVarsObject.lcm[12];
cutMsg = cutMsg.replace('{0}', totalGridRows).replace('{1}', totalRecords);
$j("#lblFilteredRowCount").text(cutMsg);
}
}
if (iViewShowCat == 'All' || totalGridRows == totalRecords) {
showMore = false;
DisableStagLoad();
}
callParentNew("closeFrame()", "function");
}
function DisableStagLoad() {
var lnkShow = $j("#dvStagLoad").find('a');
lnkShow.removeAttr('onclick');
lnkShow.removeClass('handCursor');
lnkShow.attr("disabled", "disabled");
lnkShow.css("color", "GREY");
}
function CheckValidTime(fldValue) {
var finalFldValue = "";
var values = fldValue.split(':');
if (timePickerSec && values.length == 2) {
values.push("");
} else if (timePickerSec && values.length == 1) {
values.push("");
values.push("");
} else if (!timePickerSec && values.length == 1) {
values.push("");
}
values[0] = values[0].replace(/[^0-9]/g, "0");
values[1] = values[1].replace(/[^0-9]/g, "0");
if (timePickerSec) {
values[2] = values[2].replace(/[^0-9]/g, "0");
}
if (!(parseInt(values[0]) <= 23)) {
values[0] = (values[0].charAt(1) == ":" ? "0" : values[0].charAt(1)) + (values[0].charAt(0) == ":" ? "0" : values[0].charAt(0));
if (!(parseInt(values[0]) <= 23))
values[0] = "00";
}
if (!(parseInt(values[1]) <= 59)) {
values[1] = (values[1].charAt(1) == ":" ? "0" : values[1].charAt(1)) + (values[1].charAt(0) == ":" ? "0" : values[1].charAt(0));
if (!(parseInt(values[1]) <= 59))
values[1] = "00";
}
if (timePickerSec && !(parseInt(values[2]) <= 59)) {
values[2] = (values[2].charAt(1) == ":" ? "0" : values[2].charAt(1)) + (values[2].charAt(0) == ":" ? "0" : values[2].charAt(0));
if (!(parseInt(values[2]) <= 59))
values[2] = "00";
}
if (timePickerSec) {
finalFldValue = values[0] + ":" + values[1] + ":" + values[2];
} else {
finalFldValue = values[0] + ":" + values[1];
}
return finalFldValue;
}
function ParamSearchOpen(txtobj) {
curPageNo = 1;
var id = txtobj.id;
var fname1 = "";
var fname = id.split('~');
if (id.indexOf("~") != -1)
fname1 = fname[1].toString();
else
fname1 = fname[0].toString();
var obj = $j("#" + fname1);
var value = obj.val();
plname = fname1;
plvalue = value;
plpageNo = 1;
plpagesize = 10;
objid = id;
CallPicklistService(plname, plvalue, plpageNo, plpagesize, objid);
}
var fallback;
var totalCount;
function CallPicklistService(fldname, value, pageNo, pagesize, id) {
ShowDimmer(true);
initialSrchVal = value;
GetParamValues("clear");//To get all the parameters name & value for picklist dependency. //"clear" param is passed to skip the alert msg.
$j.ajax({
type: "POST",
url: "../aspx/iview.aspx/GetIviewPickListData",
contentType: "application/json;charset=utf-8",
data: '{iviewName: "' + iName + '",pageNo: "' + pageNo +
'",pageSize: "' + pagesize + '",fieldName :"' + fldname + '",fieldValue :"' +
value + '",depParamVal:"' + $j("#hdnparamValues").val() + '"}',
dataType: "json",
success: function (data) {
var resultString = "";
if (CheckSessionTimeout(data.d)) {
ShowDimmer(false);
return;
}
if (data.d.toLowerCase().indexOf("\"error\":") > -1) {
;
showAlertDialog("error", appGlobalVarsObject.lcm[10]);
ShowDimmer(false);
} else {
var json = JSON.parse(data.d.replace(/@/g, ''));
let attrs = [];
if (json.sqlresultset.response != null) {
var count = -1;
if (!fallback) {
count = parseInt(json.sqlresultset.response.totalrows);
totalCount = count;
} else {
count = totalCount;
fallback = false;
}
resultString = count + '♣';
var dfparam = eval('dfval' + fldname);
if (count == 1) {
json.sqlresultset.response.row = [json.sqlresultset.response.row];
}
$j.each(json.sqlresultset.response.row, function (i, item) {
var temp = json.sqlresultset.response.row[i];
if (typeof temp == "object" && Object.keys(temp).length > 1) {
let attr = "";
Object.keys(temp).forEach((pickColName, pickColInd) => {
let colObj = temp[pickColName];
let colVal = typeof colObj == "string" ? colObj : colObj["#text"];
colVal = CheckSpecialCharsInHTML(colVal);
let colDt = colObj["dt"] || "";
attr += " data-optionsss" + (pickColInd == 0 ? fldname : pickColName) + "=\"" + colVal + "\" " + (pickColInd == 0 || !colDt ? "" : " data-dtypeee" + (pickColInd == 0 ? fldname : pickColName) + "=\"" + (colDt) + "\" ") + " ";
});
attrs.push(attr);
} else {
attrs.push("");
}
if (typeof temp != "object" && dfparam != "" && temp.indexOf("~") != -1) {
resultString += (typeof temp[dfparam.split('|')[0].split('~')[0].toUpperCase()] == "string" ? temp[dfparam.split('|')[0].split('~')[0].toUpperCase()] : temp[dfparam.split('|')[0].split('~')[0].toUpperCase()]["#text"]) + '¿';
} else {
resultString += (typeof temp[Object.keys(temp)[0]] == "string" ? temp[Object.keys(temp)[0]] : temp[Object.keys(temp)[0]]["#text"]) + '¿';
}
});
}
AssignPLValues(resultString, pagesize, id, fldname, attrs);
}
},
failure: function (response) {
showAlertDialog("error", appGlobalVarsObject.lcm[10]);
ShowDimmer(false);
AxWaitCursor(false);
},
error: function (response) {
showAlertDialog("error", appGlobalVarsObject.lcm[10]);
ShowDimmer(false);
AxWaitCursor(false);
}
});
}
function AssignPLValues(result, pageSize, id, field, attrs = []) {
var resultArr;
if (result != "" && result.substring(0, 7) != "") {
TogglePrevNextLink("inline");
var tableStr = "";
if (result.indexOf("♣") != -1) {
var totRowStr = result.split("♣");
totalPLRows = parseInt(totRowStr[0], 10);
if ((totalPLRows / pageSize) % 1 > 0)
noOfPLPages = Math.floor(totalPLRows / pageSize) + 1;
else
noOfPLPages = totalPLRows / pageSize;
resultArr = totRowStr[1].split("¿");
} else {
resultArr = result.split("¿");
}
var dv = $j("#dvPickHead");
if (resultArr != undefined && resultArr != "") {
tableStr = "
";
for (var i = 0; i < resultArr.length; i++) {
var tdId = "axPickTd00" + (i + 1) + 'F';
var pickValue = CheckSpecialCharsInHTML(resultArr[i]);
if (resultArr[i].toString() != "") {
var displayText = resultArr[i].toString();
if (resultArr[i].toString().indexOf("^") != -1) {
displayText = resultArr[i].toString().split('^')[1];
}
if (pickValue.indexOf("\\") != -1) {
pickValue = pickValue.replace("\\", "\\\\");
}
tableStr += "