function CreateEncodedActionLink(n,t,i,r){var f=i,u="";$.each(f,function(n,t){u=u+n+"="+t+"?"});r==!0?($("#EncodedActionLinkTag").attr("href","../"+t+"/"+n+"?q="+EncryptQueryString(u)),$("#EncodedActionLinkTag")[0].click()):window.location.href="../"+t+"/"+n+"?q="+EncryptQueryString(u)}function EncryptQueryString(n){var t="",i=EncryptStringAtJs(n,"");return $.ajax({url:"../Common/EncryptQueryString",type:"POST",async:!1,data:{queryString:i},success:function(n){t=n}}),t}function EncryptStringAtJs(n,t){(t==undefined||t==null||t.toString().trim()=="")&&(t=$("#HiddenKey").val());var i=t.split("_"),r=CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(n),CryptoJS.enc.Utf8.parse(i[0]),{keySize:16,iv:CryptoJS.enc.Utf8.parse(i[1]),mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return r.toString()}function sanitizeInJS(n){return n.replace(/<script[^>]*?>.*?<\/script>/gi,"").replace(/<[\/\!]*?[^<>]*?>/gi,"").replace(/<style[^>]*?>.*?<\/style>/gi,"").replace(/<![\s\S]*?--[ \t\n\r]*>/gi,"")}function setGridWidth(n){$("#"+n.sender.element[0].id).find("[role='grid']").width("100%")}function EnableMouseScrollonGrid(){const n=document.querySelector(".k-grid-content");if(n!=null){let t=!1,i,r;n.addEventListener("mousedown",function(u){t=!0;n.classList.add("active");i=u.pageX-n.offsetLeft;r=n.scrollLeft});n.addEventListener("mouseleave",function(){t=!1;n.classList.remove("active")});n.addEventListener("mouseup",function(){t=!1;n.classList.remove("active")});n.addEventListener("mousemove",function(u){if(t){u.preventDefault();const f=u.pageX-n.offsetLeft,e=(f-i)*3;n.scrollLeft=r-e}})}}function DateColumnFillter(n,t,i){var s,r,u,f,e,o;if(n.filter!=null&&$("#"+t).data("kendoGrid").dataSource._data.length>0&&(s=i.split(","),n.filter.filters.length>0))for(r=0;r<n.filter.filters.length;r++)i.indexOf(n.filter.filters[r].field)!=-1&&(u="",f=$.grep($("#"+t).data("kendoGrid").dataSource._data,function(t){if(n.filter.filters[r]!=undefined)return t[n.filter.filters[r].field]!=null&&t[n.filter.filters[r].field]!=""}),f.length>0&&(u=f[0][n.filter.filters[r].field].toTimeString()),e=new Date(n.filter.filters[r].value).toDateString(),o=e+" "+u,n.filter.filters[r].value=o)}function LanguageColumnFilter(n,t){for(var u=n.sender.dataSource._data,o=n.sender.dataSource._data.length,f,e,r,i=0;i<o;i++){for(f=[],e=u[i].LanguageCodeList.length,r=0;r<e;r++)f.push(jQuery.trim(u[i].LanguageCodeList[r].Text));u[i][t]=f.join(", ")}}function ValidateEmailorPhone(n){var t=n,i=/[0-9 -()+]+$/,r;if(i.test(t)){if(console.log("is phone"),t.length<9||t.length>15||!i.test(t))return"Invalidphone"}else if(r=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,r.test(t)==!1)return"InvalidEmail";return"Success"}function GetCurrentDateForExportFileName(){var n=new Date;return n.getFullYear()+"_"+("0"+(n.getMonth()+1)).slice(-2)+"_"+("0"+n.getDate()).slice(-2)}function SetMaxValueToGridFilterNumericTextbox(n){var t=n.container.find("[data-role=numerictextbox]");t.each(function(){var n=$(this).data("kendoNumericTextBox");n&&(n.options.max=100000000000000000000)})}function CheckIsIterativeSectionOnManualSubSection(n,t,i,r,u,f,e){var s=!1,o={},h=[];$.ajax({url:"../Workflow/GetIterativeSection",type:"GET",cache:!1,data:{subSectionKey:n},success:function(c){for(var v=0;v<c.length;v++)o.InterativeSectionKey=c[v].QuestionSectionKey,o.SectionTitle=c[v].SectionTitle,o.IterationSectionTitle=c[v].IterationSectionTitle,h.push(o);if(c.length>0?s=!0:(hideLoading($("#SubSectionArea_"+n).closest(".SubsectionSortOrder")),$("#AddNew_"+n).removeClass("isDisabled")),s){var a="",l=0,p="",y="";$.each(h,function(o,s){a=s.InterativeSectionKey;l=o;l=$("[id^=section_"+a+"]").length;p=s.IterationSectionTitle.replace("{Count}",l+1);y=s.SectionTitle;l>0&&l--;$.ajax({url:"../Workflow/IterativeSection",type:"POST",cache:!1,data:{SectionIterationCount:l,IteratedSectionKey:a,FormKey:t,WorkFlowInstanceDetailKey:i,Target:r,LinkFieldType:u,LinkFieldValues:f,Parameters:e},success:function(t){var r,i,u;$("[id^=section_"+a+"]").length>0&&(r="<a class='nav-item nav-link' IteratedBySubSectionKey = '"+n+"_"+l+"'  id='section_"+a+"_"+l+"' data-toggle='tab' href='#Tab_"+a+"_"+l+"' role='tab' aria-controls='nav-home' aria-selected='true'><i class='icon-flickr'><\/i><input class='SectionTitleToSave_' type='text' value='"+a+"^"+l+"^"+y+"' name='SectionTitles' hidden='true'><span class='SectionTitle' secTitle='"+y+"' sectionTitleOriginal='"+p+"'>"+y+"<\/span><\/a>",i="",i="#section_"+a+"_"+(l-1),$(r).insertAfter(i),u="<div class='tab-pane fade show SubsectionSortOrder' sectioniterativeindex='"+l+"' id='Tab_"+a+"_"+l+"' role='tabpanel' aria-labelledby='nav-home-tab'><div class='row d-md-flex d-sm-block align-items-stretch module-row mt-2'><div class='col-12 col-xl-12 module'><div class='card card-custom AllSubSection'><div class=''>"+t+"<\/div><\/div><\/div><\/div><\/div><div class='clearfix'><\/div>",$(".tab-content").append(u));hideLoading($("#SubSectionArea_"+n).closest(".SubsectionSortOrder"));$("#AddNew_"+n).removeClass("isDisabled")},error:function(){hideLoading($("#SubSectionArea_"+n).closest(".SubsectionSortOrder"));$("#AddNew_"+n).removeClass("isDisabled")}})})}},error:function(){hideLoading($("#SubSectionArea_"+n).closest(".SubsectionSortOrder"));$("#AddNew_"+n).removeClass("isDisabled")}})}function GetBrowserName(){var o=navigator.appVersion,n=navigator.userAgent,r=navigator.appName,t=""+parseFloat(navigator.appVersion),f=parseInt(navigator.appVersion,10),e,i,u;return(i=n.indexOf("Opera"))!=-1?(r="Opera",t=n.substring(i+6),(i=n.indexOf("Version"))!=-1&&(t=n.substring(i+8))):(i=n.indexOf("MSIE"))!=-1?(r="Microsoft Internet Explorer",t=n.substring(i+5)):!window.ActiveXObject&&"ActiveXObject"in window?(r="Microsoft Internet Explorer",t="IE11"):(i=n.indexOf("Firefox"))!=-1?(r="Firefox",t=n.substring(i+8)):(i=n.indexOf("Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0"))!=-1?(r="Microsoft Internet Explorer",t="Edge"):(i=n.indexOf("Chrome"))!=-1?(r="Chrome",t=n.substring(i+7)):(i=n.indexOf("Safari"))!=-1?(r="Safari",t=n.substring(i+7),(i=n.indexOf("Version"))!=-1&&(t=n.substring(i+8))):(e=n.lastIndexOf(" ")+1)<(i=n.lastIndexOf("/"))&&(r=n.substring(e,i),t=n.substring(i+1),r.toLowerCase()==r.toUpperCase()&&(r=navigator.appName)),(u=t.indexOf(";"))!=-1&&(t=t.substring(0,u)),(u=t.indexOf(" "))!=-1&&(t=t.substring(0,u)),f=parseInt(""+t,10),isNaN(f)&&(t=""+parseFloat(navigator.appVersion),f=parseInt(navigator.appVersion,10)),r}function CSVExportCommon(n,t,i){var u,f,e,o,s,h,c,r;displayLoading();u=i!=undefined&&i!=null&&i!=""?$("#"+i).data("kendoGrid").columns:$("#ReportGrid").data("kendoGrid").columns;f=[];jQuery.each(u,function(){this.hidden||this.field==undefined||f.push(this.field)});e={};jQuery.each(u,function(){if(!this.hidden){var n=this.field,t=this.title;e[this.field]=this.title}});o=i!=undefined&&i!=null&&i!=""?$("#"+i).data("kendoGrid").dataSource:$("#ReportGrid").data("kendoGrid").dataSource;s=new kendo.data.DataSource({data:o.data(),filter:o.filter()});s.read();h=s.view();t!=undefined&&t!=null&&t!=""?r=n:(c=moment(new Date).format("DD-MMM-YYYY"),r=n);toCSV(e,f,h,r,!0,["IdColumnToIgnore","AnotherColumnToIgnore"]);hideLoading()}function CSVExportCommon_FiduciaryReportIBS(n,t){var i,r,u,f,e;i=t!=undefined&&t!=null&&t!=""?$("#"+t).data("kendoGrid").columns:$("#ReportGrid").data("kendoGrid").columns;r=[];jQuery.each(i,function(){this.hidden||r.push(this.field)});u={};jQuery.each(i,function(){if(!this.hidden){var n=this.field,t=this.title;u[this.field]=this.title}});f=t!=undefined&&t!=null&&t!=""?$("#"+t).data("kendoGrid").dataSource:$("#ReportGrid").data("kendoGrid").dataSource;e=new kendo.data.DataSource({data:f.data(),filter:f.filter()});e.read();var o=e.view(),s=moment(new Date).format("DD-MMM-YYYY"),h=n+s;toCSV_FiduciaryReport(u,r,o,h,!0,["IdColumnToIgnore","AnotherColumnToIgnore"])}function downlaodexcel(){$("#ReportGrid").getKendoGrid().saveAsExcel()}function downlaodcsv(){$("#ReportGrid").getKendoGrid().saveAsCSV()}function downlaodpdf(){$("#ReportGrid").getKendoGrid().saveAsPDF()}function SerializeHandlerForKendoEditor(n){var t=$("<div><\/div>").html(n);return t.find("object").remove(),t.find("script").remove(),t.find("alert").remove(),t.find("iframe").remove(),t.html()||"﻿"}function GridDecimalFormat(n,t){for(var o=n.sender.dataSource._data,c=n.sender.dataSource.options.fields,l=n.sender.dataSource.options.schema.model.fields,a=o.length,f,i,s,e,h,r,u=0;u<a;u++)for(f=0;f<c.length;f++)i=c[f].field,i!=undefined&&(s=l[i],s!=null&&s.type==="number"&&(e=o[u][i],e!=undefined&&e!=null&&(h=$.grep(t,function(n){return n.ColumnName==i}),r=2,h.length>0&&(r=h[0].Precision),r=r==null?"":r,o[u][i]=kendo.parseFloat(kendo.toString(e,"n"+r+"")))))}var toCSV,toCSV_FiduciaryReport;$("body").delegate("[role='menuitemcheckbox']","click",function(){$(".k-grid").find("[role='grid']").width("100%")}),function(n){n.fn.hasScrollBar=function(){return this.get(0).scrollHeight>this.height()}}(jQuery);toCSV=function(n,t,i,r,u,f){var h="",v,o,e,s,a,p,l;f||(f=[]);var y=[],w=[],c=$("#ReportGrid").data("kendoGrid"),b=c.dataSource,k=b.total(),d=c.dataSource.pageSize(),g=c.dataSource.page();if(c.dataSource.pageSize(k),c.refresh(),$.each($("#ReportGrid").find("tr"),function(n,t){var i=[];$(t).hasClass("k-grouping-row")!=!0&&$(t).hasClass("k-group-footer")!=!0&&(n==0?$.each($(t).find("th"),function(n,t){$(t).hasClass("k-hierarchy-cell")!=!0&&$(t).attr("data-field")!=undefined&&i.push([$(t).data("title")==undefined?" ":$(t).data("title")])}):$.each($(t).find("td"),function(n,t){i.push([$(t).text()])}),w.push(i))}),c.dataSource.pageSize(d),c.refresh(),f=_.union(f,["_events","idField","_defaultId","constructor","init","get","_set","wrap","bind","trigger","one","first","unbind","uid","dirty","id","parent","length","_parent","_initOptions","extend","shouldSerialize","fn","define","fields","guid"]),i.length>0){o=[];for(e in i[0])i[0].hasOwnProperty(e)&&!_.include(f,e)&&$.inArray(e,t)>-1&&o.push([$.inArray(e,t),n[e]]);o.sort(function(n,t){return n[0]-t[0]});o.length>0&&y.push(o);for(v in i){o=[];for(e in i[v])i[v].hasOwnProperty(e)&&!_.include(f,e)&&$.inArray(e,t)>-1&&(s=i[v][e],s=s===null?"":s instanceof Date?moment(s).format("DD/MMM/YYYY"):s.toString(),s=s.replace(/"/g,'""'),o.push([$.inArray(e,t),s]));o.sort(function(n,t){return n[0]-t[0]});o.length>0&&y.push(o)}$.each(y,function(n,t){$.each(t,function(n,i){$("#ReportGrid").closest(".grid-wrapper").hasClass("SOCreport")==!0?(h+='"'+i[1]+'"',n!=t.length-1&&(h+=",")):i[1].trim()==""&&n==0||(h+='"'+i[1]+'"',n!=t.length-1&&(h+=","))});h+="\n"})}else h=" ";navigator.appName=="Microsoft Internet Explorer"?(a=window.open(),a.document.write("sep=,\r\n"+h),a.document.close(),a.document.execCommand("SaveAs",!0,r+".csv"),a.close()):(p=new Blob(["﻿",h],{type:"text/csv"}),navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(p,r+".csv"):(l=document.body.appendChild(document.createElement("a")),l.setAttribute("style","cursor: pointer;"),l.download=r+".csv",l.href=URL.createObjectURL(p),setTimeout(function(){l.click();document.body.removeChild(l)},500)))};toCSV_FiduciaryReport=function(n,t,i,r,u,f){var h="",l,a,o,e,s,c,v,y,p,w;if(f||(f=[]),l=[],f=_.union(f,["_events","idField","_defaultId","constructor","init","get","_set","wrap","bind","trigger","one","first","unbind","uid","dirty","id","parent","length","_parent","_initOptions","extend","shouldSerialize","fn","define","fields","guid"]),i.length>0){o=[];for(e in i[0])i[0].hasOwnProperty(e)&&!_.include(f,e)&&$.inArray(e,t)>-1&&o.push([$.inArray(e,t),n[e]]);o.sort(function(n,t){return n[0]-t[0]});o.length>0&&l.push(o);for(a in i){o=[];for(e in i[a])i[a].hasOwnProperty(e)&&!_.include(f,e)&&$.inArray(e,t)>-1&&(s=i[a][e],s=s===null?"":s instanceof Date?moment(s).format("DD/MMM/YYYY"):s.toString(),s=s.replace(/"/g,'""'),o.push([$.inArray(e,t),s]));o.sort(function(n,t){return n[0]-t[0]});o.length>0&&l.push(o)}$.each(l,function(n,t){$.each(t,function(n,i){h+='"'+i[1]+'"';n!=t.length-1&&(h+=",")});h+="\n"})}else h=" ";navigator.appName=="Microsoft Internet Explorer"?(c=window.open(),c.document.write("sep=,\r\n"+h),c.document.close(),c.document.execCommand("SaveAs",!0,r+".csv"),c.close()):(v=new Blob(["﻿",h],{type:"text/csv"}),navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(v,r+".csv"):(y=document.body.appendChild(document.createElement("a")),"download"in y&&(p=$("#FiduciaryReporttable_csvExport").data("kendoGrid").dataSource.data().toJSON(),w=JSON.stringify(p),$.ajax({url:"../Reports/SaveFile",type:"POST",data:{_data:w},async:!1,success:function(){alert("Exported Successfully")},error:function(){alert("Error while exporting")}}))))};$.ajaxPrefilter(function(n,t,i){var u,f,r;$("#IsMobileDevice").is(":visible")!=!0?$(".k-grid-pager").each(function(){$(this).removeClass("k-pager-sm")}):$(".k-grid-pager").each(function(){$(this).addClass("k-pager-sm")});u=n.error;f=$("#TosterNotification").data("kendoNotification");n.error=function(n,t,i){var f="",o="",e,s,r;try{n.responseJSON!=undefined&&n.responseJSON!=null?(n.responseJSON.ErrorMessage!=undefined&&n.responseJSON.ErrorMessage!=null&&(f=n.responseJSON.ErrorMessage),n.responseJSON.ReferenceNumber!=undefined&&n.responseJSON.ReferenceNumber!=null&&(o=n.responseJSON.ReferenceNumber)):n.responseText!=undefined&&n.responseText!=null&&(e=JSON.parse(n.responseText),e.ErrorMessage!=undefined&&e.ErrorMessage!=null&&(f=e.ErrorMessage),e.ReferenceNumber!=undefined&&e.ReferenceNumber!=null&&(o=e.ReferenceNumber))}catch(h){f="";o=""}i=="SESSION_TIMEOUT_EXCEPTION"||n.statusText=="SESSION_TIMEOUT_EXCEPTION"?(n.abort(),r=EncryptQueryString("comingPage=sessionexpired"),window.location.href="../Account/Logout?q="+r):i=="SESSIONEXPIRE"||n.statusText=="SESSIONEXPIRE"||f=="SESSIONEXPIRE"?(n.abort(),r=EncryptQueryString("comingPage=sessionexpired"),window.location.href="../Account/Logout?q="+r):f=="UNAUTHORIZED"||f=="PORTFOLIO_NOT_ACCESSIBLE"||f=="DOCUMENT_NOT_ACCESSIBLE"?(n.abort(),r=EncryptQueryString("comingPage=accessError"),window.location.href="../Account/Logout?q="+r):f=="ANTI_FORGERY_TOKEN_NOT_FOUND_EXCEPTION"?(n.abort(),r=EncryptQueryString("comingPage=errorCommon"),window.location.href="../Account/Logout?q="+r):f=="FORCED_LOGOUT"?(n.abort(),r=EncryptQueryString("comingPage=errorCommon"),window.location.href="../Account/Logout?q="+r):f=="InvalidInput"||n.statusText=="InvalidInput"?(n.abort(),r=EncryptQueryString("comingPage=InvalidInput"),window.location.href="../Account/Logout?q="+r):f.indexOf("OPENIDERROR_")!=-1?filterContext.HttpContext.Response.IsRequestBeingRedirected||(r=EncryptQueryString("comingPage="+f),filterContext.HttpContext.Response.Redirect("../Account/Logout?q="+r)):(n.abort(),s="ErrorMessage="+f+"?ReferenceNumber="+o+"?isAjax=true",r=EncryptQueryString(s),$.ajax({url:"../Account/CommonErrorPage?q="+r,success:function(n){$("#content").html(n)}}));u!=null&&u(n,t,i)};n.url.indexOf("../Account/CommonErrorPage")==-1&&n.url.indexOf("signalr/")==-1&&(r=n.success,n.success=function(n){var t,u,o,e;if(i.abort(),t=[].slice.call(arguments),n!=undefined&&n!=null){try{n=JSON.parse(n)}catch(s){n=n}$("#AllowErrorNotification").val()!=""&&$("#AllowErrorNotification").val()!=null&&$("#AllowErrorNotification").val()!=undefined&&($("#AllowErrorNotification").val()=="true"||$("#AllowErrorNotification").val()==!0||$("#AllowErrorNotification").val()=="True")&&(n.CustomSuccessMessage!=undefined&&n.CustomSuccessMessage!=null&&$.each(n.CustomSuccessMessage,function(n,t){f.show({message:t},"success")}),n.CustomErrorMessage!=undefined&&n.CustomErrorMessage!=null&&$.each(n.CustomErrorMessage,function(n,t){f.show({message:t},"error")}))}if(t!=undefined&&t!=null&&t.length>0&&t[0]!=undefined&&t[0]!=null)try{u=JSON.parse(t[0]);u!=undefined&&u!=null&&(t[0]=JSON.stringify(u.data))}catch(s){u=t[0];u!=undefined&&u!=null&&(t[0]=u.data!=undefined?u.data:u)}o=$(n);e=$.grep(o,function(n){return n.className=="partialNotificationDiv"});e.length>0&&$("#mainNotificationDiv").append(e[0].innerHTML);r&&r!==undefined&&r.apply(this,t)})});kendo.ui.validator.rules.requiredif=function(n){var t,i,r;return(n.is("[data-val-requiredif]")||n.is("[data-val-requiredIf]"))?(t=n.data("valRequiredifDependentproperty"),i=$("#"+t).is(":checkbox")?$("#"+t).is(":checked"):$("#"+t).val(),r=n.data("valRequiredifDependentvalue"),i.toString().toLowerCase()==r.toString().toLowerCase()&&(n.val()==null||n.val().trim()=="")?!1:!0):!0};kendo.ui.validator.messages.requiredif=function(n){return n.data("valRequiredif")}