var Unibase;(function(Unibase){let Platform;(function(Platform){let Forms;(function(Forms){let Components;(function(Components){class FormBuilder_Template{tabsForPropertyTemplate(){return`
`}basicFormPropertyTemplate(){return`

`}loadSectionProperty(){return`
`}validationTemplate(){return`
Validations
`}controlSettingTemplate(){return`
`}propertySettingTemplate(){return``}addRowForValidationTemplate(){return`
Validation-{{length}}
`}loadAddSectionHtml(){return`
`}loadPropertyHtml(){let html=`
  • {{docPropertyName}}
  • `;return`
  • {{docPropertyName}}
  • `}loadDocTypesHtml(installedappid){let oldhtml=``,html=``;return html=`
    `}loadAddControlHtml(){return`
    `}loadControlProperties(len){return`
    `}loadTemplate(){return``}static Instance(){return new FormBuilder_Template}}Components.FormBuilder_Template=FormBuilder_Template})(Components=Forms.Components||(Forms.Components={}))})(Forms=Platform.Forms||(Platform.Forms={}))})(Platform=Unibase.Platform||(Unibase.Platform={}))})(Unibase||(Unibase={})),function(Unibase){let Platform;(function(Platform){let Forms;(function(Forms){let Components;(function(Components){class PropertyEditor extends Platform.Core.BaseComponent{constructor(){super();this.DocPropertyId=0;this.TempSectionPropertyId=0;this.RowIndex=0;this.SectionPropertyId=0;this.AutoCompleteId_Section=0;this.DocPropertyName="";this.ParentTagjson="";this.FormId=0;this._docTypeManager=Platform.DataSources.Managers.DocTypeManager.Instance()}jsFiles(){return["platform/apps/managers/stagemanager.js","platform/permission/managers/permissionmanager.js","platform/controls/subform/subform.settings.js","platform/analytics/enums/datatype.js"]}cssFiles(){return[]}html(){var propertyTabs_Template=Unibase.Platform.Forms.Components.FormBuilder_Template.Instance().tabsForPropertyTemplate(),BasicFormProperty_Template=Unibase.Platform.Forms.Components.FormBuilder_Template.Instance().basicFormPropertyTemplate(),Validation_Template=Unibase.Platform.Forms.Components.FormBuilder_Template.Instance().validationTemplate(),Controlsetting_Template=Unibase.Platform.Forms.Components.FormBuilder_Template.Instance().controlSettingTemplate(),propertysetting_Template=Unibase.Platform.Forms.Components.FormBuilder_Template.Instance().propertySettingTemplate();return`
    Add New Property
    `+propertyTabs_Template+`
    `+BasicFormProperty_Template+``+Validation_Template+Controlsetting_Template+`
    `}load(id,containerid){var instance=this,ControlClass,SettingPageUrl,ControlId;if(instance.clickEventsInPropertyCreation(),instance.loadDocTypesAutoComplete(instance.prop),this.isProperty){instance.loadDataTypes(Number(instance.prop.DataTypeId));Unibase.Platform.Forms.Components.PropertyEditor.Instance().loadControlsByDataTypeId(instance.prop);instance.loadIsHelp(instance.prop);$("#loadDatatypes").on("change",function(){if($("#loadDatatypes").val()!=null){var DataTypeId=$("#loadDatatypes option:selected").val().toString();Unibase.Platform.Forms.Components.PropertyEditor.Instance().loadControlsByDataTypeId(null)}});$("#txtControls").on("change",function(){if($("#divControlSettings").empty(),$("#divPropSetting").empty(),$("#txtControls").val()!=null){var ControlClass=$("#txtControls option:selected").val().toString(),SettingPageUrl=ControlClass.split("|"),ControlId=SettingPageUrl[0];instance.fileCacheHelper.loadJsFile(SettingPageUrl[1],function(){eval(SettingPageUrl[2]+".Instance().loadSettingHtml('#divControlSettings')");eval(SettingPageUrl[2]+".Instance().loadControlPropertiesHtml('#divPropSetting')")})}})}else{ControlClass=instance.prop.ControlVariable;SettingPageUrl=ControlClass.split("|");SettingPageUrl.length==1&&(ControlClass=instance.prop.ControlId+"|"+instance.prop.SettingPageUrl+"|"+instance.prop.SettingJsVariableName,SettingPageUrl=ControlClass.split("|"));ControlId=SettingPageUrl[0];instance.loadControls(Number(ControlId),ControlClass,instance.prop);$("#txtControls").on("change",function(){$("#divControlSettings").empty();$("#divPropSetting").empty();$("#txtControls").val()!=null&&(Unibase.Platform.Forms.Components.PropertyEditor.Instance().loadDataTypes(Number(instance.prop.DataTypeId)),instance.fileCacheHelper.loadJsFile(SettingPageUrl[1],function(){eval(SettingPageUrl[2]+".Instance().loadSettingHtml('#divControlSettings')");eval(SettingPageUrl[2]+".Instance().loadControlPropertiesHtml('#divPropSetting')")}))});instance.prop.ControlName=="Tag"&&(jQuery("#txtPropertyName").val("TagControl"),jQuery("#txtPropertyName").css({"background-color":"#eee",color:"black",border:"0",cursor:"not-allowed"}),jQuery("#txtPropertyName").attr("disabled","disabled"))}$("#btnSavePropSection").click(function(e){e.preventDefault();var formviewerinstance=new Unibase.Platform.Forms.Components.FormViewer;let result=formviewerinstance.requiredFieldValidation("frmUnibaseForm_AddActionProperty");if(result==!1)return MessageHelper.Instance().showError("Mandatory fields are missing","unibase_addnewproperty_errorsummary"),!1;instance.navigationHelper.showLoading();Unibase.Platform.Forms.Components.PropertyEditor.Instance().saveActionProperty(instance.prop,containerid)});$("#btnSaveProperties").click(function(e){var formviewerinstance,formPropertyName,uniqueFormProperty;e.preventDefault();formviewerinstance=new Unibase.Platform.Forms.Components.FormViewer;let result=formviewerinstance.requiredFieldValidation("frmUnibaseForm_AddProperty");if(result==!1)return MessageHelper.Instance().showError("Mandatory fields are missing","unibase_addnewproperty_errorsummary"),!1;let docPropId=instance.prop.DocPropertyId,controlId=instance.prop.DocPropertyId;if(formPropertyName=$("#txtPropertyName").val().toString(),uniqueFormProperty=Unibase.Platform.Forms.Components.FormBuilder.instance.FormPropertiesJson.find(x=>x.FormPropertyName==formPropertyName&&x.DocPropertyId!=docPropId),uniqueFormProperty!=undefined||uniqueFormProperty!=null)return MessageHelper.Instance().showError("FormPropertyName should be unique.","unibase_addnewproperty_errorsummary"),!1;instance.navigationHelper.showLoading();Unibase.Platform.Forms.Components.PropertyEditor.Instance().saveProperty(instance.prop,containerid);$("#controlsDiv-"+controlId).addClass("selected");$("#"+controlId).addClass("selected");$("#docPropDiv-"+docPropId).addClass("selected")});instance.popUpCallBack!=null&&instance.popUpCallBack()}loadDocTypes(installedAppId){this._docTypeManager.getDocTypesByAppId(installedAppId).then(function(response){var html="";let result=response.result;for(let i=0;i26?prop.DocTypeName.slice(0,26)+" ...":prop.DocTypeName.slice(0,26),docTypeTooltipTitle:prop.DocTypeName.length>26?prop.DocTypeName:""};html+=templateScript(context)}$("#DocTypeAccordion").append(html)})}loadProperties(formId,installedAppId){Unibase.Platform.DataSources.Managers.DocTypeManager.Instance().getUnassignedProperties(installedAppId,formId).then(function(response){var html="";let result=response.result;for(let i=0;i=1||$(".docPropHighlight-"+prop.DocPropertyId).length>=1)&&($("#controlsDiv-"+prop.ControlId).addClass("selected"),$("#"+prop.ControlId).addClass("selected"),$("#docPropDiv-"+prop.DocPropertyId).addClass("selected"),Unibase.Platform.Forms.Components.FormBuilder.Instance().HiddenSectionId==prop.SectionId&&($("#hidePropertyBtn"+prop.DocPropertyId).addClass("d-none"),$("#editPropertyBtn"+prop.DocPropertyId).removeClass("d-none"),$("#PropertyEye"+prop.DocPropertyId).addClass("d-none"),$("#PropertyEyeOff"+prop.DocPropertyId).removeClass("d-none")))}}).then(function(){let propli=$(".docTypeBody");propli.sortable();let clone,before,parent,propertyEvent=$(".docTypeBody");propertyEvent.sortable({connectWith:".sectionBody-Element",cursor:"move",helper:"clone",start:function(event,ui){var liWidth=$("#propTabDiv").width();$("#DocTypeAccordion").css({position:"fixed",width:""});$(ui.item).show();clone=$(ui.item).clone();before=$(ui.item).prev();parent=$(ui.item).parent()},stop:function(){$("#DocTypeAccordion").css({position:"static",width:""});$("#collapseDocType_"+parent.attr("data-id")).find("#docPropDiv-"+clone.attr("data-id")).length==0&&(before.length?before.after(clone):parent.prepend(clone))}})}).then(function(){$(".collapse").collapse("hide")})}searchDocProperty(searchText,docTypeBody){var filter,ul,li,a,i,txtValue;for(filter=searchText.toLowerCase(),ul=docTypeBody,li=ul.getElementsByTagName("li"),i=0;i-1?"":"none"}openAddPropertyPage(DocpropertyId,DocPropertyName,ControlId,SectionId,SectionName,SectionType,IsNewEntry,FormId,FormPropertiesJson){this.FormId=FormId;this.loadAddPropertyHtml(DocpropertyId,DocPropertyName,ControlId,SectionId,SectionName,Number(SectionType),"Create",IsNewEntry,FormPropertiesJson,null)}loadAddPropertyHtml(DocPropertyId,DocPropertyName,ControlId,SectionId,SectionName,SectionType,PageType,IsNewEntry,FormPropertiesJson,callback){if(SectionName==""||SectionName==undefined)return MessageHelper.Instance().showError("Enter Section Name","unibase_formbuilder_errorsummary"),!1;Unibase.Platform.Forms.Components.PropertyEditor.Instance().ValidationArray=[];DocPropertyId==undefined&&(DocPropertyId=0);Unibase.Platform.Forms.Components.PropertyEditor.Instance().DocPropertyId=DocPropertyId;Unibase.Platform.Forms.Components.PropertyEditor.Instance().DocPropertyName=DocPropertyName;Unibase.Platform.Forms.Components.PropertyEditor.Instance().SectionPropertyId=0;PageType=="Create"?DocPropertyId!=0&&DocPropertyId!=undefined?(Unibase.Platform.Forms.Components.PropertyEditor.Instance().DocPropertyId=DocPropertyId,this._docTypeManager.getDocProperty(DocPropertyId).then(function(response){var docpropinfo,propertyjson,uniqueId,curFormProp,propertyjson1;let result=response.result;if(Unibase.Platform.Forms.Components.PropertyEditor.Instance().DocPropertyName=result.DocPropertyName,docpropinfo=result,docpropinfo.ControlId==0)uniqueId=result.FormPropertyId,(result.FormPropertyId==0||result.FormPropertyId==undefined)&&(curFormProp=Unibase.Platform.Forms.Components.FormBuilder.instance.FormPropertiesJson.find(x=>x.DocPropertyId==result.DocPropertyId),uniqueId=curFormProp==undefined?moment().valueOf():curFormProp.UniqueId),propertyjson={FormPropertyId:result.FormPropertyId,DocPropertyId:result.DocPropertyId,DocPropertyName:result.DocPropertyName,FormPropertyName:"",DocTypeId:result.DocTypeId,DataTypeId:result.DataTypeId,DocTypeName:result.DocTypeName,SectionId:SectionId,SectionName:SectionName,PropertyWidth:Number(result.PropertyWidth),IsDefault:result.IsDefault,IsRequired:result.IsRequired,ControlId:result.ControlId,ControlName:result.ControlName,ControlVariable:result.JsVariableName,ControlJsUrl:result.Url,SettingPageUrl:result.SettingsPageUrl,SettingJsVariableName:result.SettingJsVariableName,LabelName:result.DocPropertyName,Placeholder:result.DocPropertyName,ControlJsonText:result.ControlJsonText,IncludedRoles:result.IncludedRoles,ExcludedRoles:result.IncludedRoles,IncludedStages:result.IncludedStages,ExcludedStages:result.ExcludedStages,RowIndex:result.RowIndex,DocTypeTableName:result.DocTypeViewName,Validations:null,PropertySettings:null,SectionType:SectionType.toString(),PropertyType:"Property",GroupName:"",Level:0,StagesForRequired:null,IsMultiple:!1,IsSwitch:!1,IsExtProperty:!1,IsNewEntry:!1,Value:"",IsStaticControl:!1,UniqueId:uniqueId,ParentFormPropertyId:0,IsHelp:!1,HelpText:"",HelpDisplayType:0},Unibase.Platform.Forms.Components.PropertyEditor.Instance().openPropertyPopup(propertyjson,!0,function(){var docPropName,SelectedDataType,SelectedSection,selectedSection,selectedDoctype;$("#txtWidth").select2({placeholder:"Select Width"});docPropName=docpropinfo.DocPropertyName;$("#txtPropertyName").val(docPropName);$("#txtDocPropertyName").val(docPropName);$("#txtDisplayName").val(docPropName);$("#txtPlaceHolder").val(docPropName);$("#txtWidth").val(docpropinfo.PropertyWidth);jQuery("#txtWidth").val(docpropinfo.PropertyWidth).trigger("change");SelectedDataType=new Option(docpropinfo.DataTypeName,docpropinfo.DataTypeId.toString(),!1,!1);SelectedSection=new Option(SectionName,SectionId.toString(),!1,!1);jQuery("#loadDatatypes").append(SelectedDataType).trigger("change");jQuery("#txtAutoComplete_Section").append(SelectedSection).trigger("change");selectedSection=new Option(SectionName,SectionId.toString(),!0);$("#txtAutoComplete_Section").append(selectedSection);selectedDoctype=new Option(docpropinfo.DocTypeName,docpropinfo.DocTypeId.toString(),!0);$("#txtDocTypes").append(selectedDoctype);$(document).ready(function(){jQuery("#txtDocTypes").val(docpropinfo.DocTypeId).trigger("change");jQuery("#loadDatatypes").attr("disabled","disabled");jQuery("#txtAutoComplete_Section").attr("disabled","disabled");jQuery("#txtDocTypes").attr("disabled","disabled");SectionType==Unibase.Platform.Forms.Enums.SectionType.HiddenSection&&(jQuery("#txtControls").attr("disabled","disabled"),$("#txtWidth").val("2").trigger("change"))})});else if(uniqueId=result.FormPropertyId,(result.FormPropertyId==0||result.FormPropertyId==undefined)&&(curFormProp=Unibase.Platform.Forms.Components.FormBuilder.instance.FormPropertiesJson.find(x=>x.DocPropertyId==result.DocPropertyId),uniqueId=curFormProp==undefined?moment().valueOf():curFormProp.UniqueId),propertyjson1={FormPropertyId:result.FormPropertyId,DocPropertyId:result.DocPropertyId,DocPropertyName:result.DocPropertyName,FormPropertyName:"",DocTypeId:result.DocTypeId,DataTypeId:result.DataTypeId,DocTypeName:result.DocTypeName,SectionId:SectionId,SectionName:SectionName,PropertyWidth:Number(result.PropertyWidth),IsDefault:result.IsDefault,IsRequired:result.IsRequired,ControlId:result.ControlId,ControlName:result.ControlName,ControlVariable:result.JsVariableName,ControlJsUrl:result.Url,SettingPageUrl:result.SettingsPageUrl,SettingJsVariableName:result.SettingJsVariableName,LabelName:result.DocPropertyName,Placeholder:result.DocPropertyName,ControlJsonText:result.ControlJsonText,IncludedRoles:result.IncludedRoles,ExcludedRoles:result.IncludedRoles,IncludedStages:result.IncludedStages,ExcludedStages:result.ExcludedStages,RowIndex:result.RowIndex,DocTypeTableName:result.DocTypeViewName,Validations:null,PropertySettings:null,SectionType:SectionType.toString(),PropertyType:"Property",GroupName:"",Level:0,StagesForRequired:null,IsMultiple:!1,IsSwitch:!1,IsExtProperty:!1,IsNewEntry:!1,Value:"",IsStaticControl:!1,UniqueId:uniqueId,ParentFormPropertyId:0,IsHelp:!1,HelpText:"",HelpDisplayType:0},SectionType==Unibase.Platform.Forms.Enums.SectionType.HiddenSection)if(result.ControlName=="HiddenField"){Unibase.Platform.Forms.Components.FormBuilder.instance.loadFormProperty(propertyjson1);let id=result.DocPropertyId;$("#docPropDiv-"+id).parent().remove();$("#txtWidth").val("2").trigger("change")}else MessageHelper.Instance().showError("Only Hidden Controls can be added Hidden Section.","unibase_formbuilder_errorsummary");else if(result.ControlName=="HiddenField")MessageHelper.Instance().showError("Hidden Control can be added only in Hidden Section.","unibase_formbuilder_errorsummary");else{Unibase.Platform.Forms.Components.FormBuilder.instance.loadFormProperty(propertyjson1);let id=result.DocPropertyId;$("#docPropDiv-"+id).parent().remove()}}).then(function(){$("#txtAutoComplete_Section").select2();callback!=null&&callback()})):Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/analytics/enums/datatype.js",function(){Unibase.Platform.Forms.Components.PropertyEditor.Instance().TempSectionPropertyId+=1;ControlId!=0&&Unibase.Platform.Forms.Managers.FormManager.Instance().getControl(ControlId).then(function(response){var result=response.result,PropArray={SectionId:SectionId,SectionName:SectionName,SectionType:SectionType,ControlVariable:result.ControlId+"|"+result.SettingsPageUrl+"|"+result.SettingJsVariableName,DataTypeId:Number(Unibase.Platform.Analytics.Reports.Enums.DataType.object),ControlJsonText:FormPropertiesJson.ControlJsonText,PropertySettings:FormPropertiesJson.PropertySettings,SettingJsVariableName:FormPropertiesJson.SettingJsVariableName},FormPropertyJson;if(SectionType==Unibase.Platform.Forms.Enums.SectionType.HiddenSection&&SectionName=="Hidden")result.ControlName=="HiddenField"?Unibase.Platform.Forms.Components.PropertyEditor.Instance().openPropertyPopup(PropArray,!1,function(){$("#txtWidth").select2({placeholder:"Select Width"});var selectedSection=new Option(SectionName,SectionId.toString(),!0);$("#txtAutoComplete_Section").append(selectedSection);jQuery("#txtAutoComplete_Section").val(SectionId).trigger("change");$("#txtControls").attr("disabled","true");$("#txtWidth").val("2").trigger("change");jQuery("#txtAutoComplete_Section").attr("disabled","disabled")}):MessageHelper.Instance().showError("Only HiddenField Control can be added in Hidden Section.","unibase_formbuilder_errorsummary");else if(result.ControlName=="HiddenField")MessageHelper.Instance().showError("HiddenField Control should be added in Hidden Section.","unibase_formbuilder_errorsummary");else{if(SectionType==Unibase.Platform.Forms.Enums.SectionType.Section&&result.ControlName=="Tag"&&(FormPropertyJson=Unibase.Platform.Forms.Components.FormBuilder.Instance().FormPropertiesJson.find(x=>x.ControlId==result.ControlId),FormPropertyJson!=null))return MessageHelper.Instance().showError("Cannot add multiple TagCategories.","unibase_formbuilder_errorsummary"),!1;Unibase.Platform.Forms.Components.PropertyEditor.Instance().openPropertyPopup(PropArray,!1,function(){$("#txtWidth").select2({placeholder:"Select Width"});var selectedSection=new Option(SectionName,SectionId.toString(),!0);$("#txtAutoComplete_Section").append(selectedSection);jQuery("#txtAutoComplete_Section").val(SectionId).trigger("change");$("#txtControls").attr("disabled","true");$("#loadDatatypes").attr("disabled","true");jQuery("#txtAutoComplete_Section").attr("disabled","disabled");SectionType==Unibase.Platform.Forms.Enums.SectionType.Section&&result.ControlName=="Tag"&&(jQuery("#txtPropertyName").val("TagControl"),jQuery("#txtPropertyName").css({"background-color":"#eee",color:"black",border:"0",cursor:"not-allowed"}),jQuery("#txtPropertyName").attr("disabled","disabled"))})}}).then(function(){eval("_floatingLabelHelper.init()");$("#txtAutoComplete_Section").select2();callback!=null&&callback()})}):DocPropertyId!=0&&DocPropertyId!=undefined?Unibase.Platform.Forms.Components.PropertyEditor.Instance().openPropertyPopup(FormPropertiesJson,!0,function(){jQuery("#loadDatatypes").attr("disabled","disabled");jQuery("#txtAutoComplete_Section").attr("disabled","disabled");jQuery("#txtDocTypes").attr("disabled","disabled");SectionType==Unibase.Platform.Forms.Enums.SectionType.HiddenSection&&(jQuery("#txtControls").attr("disabled","disabled"),$("#txtWidth").val("2").trigger("change"));callback!=null&&callback()}):Unibase.Platform.Forms.Components.PropertyEditor.Instance().openPropertyPopup(FormPropertiesJson,!1,function(){jQuery("#loadDatatypes").attr("disabled","disabled");jQuery("#txtAutoComplete_Section").attr("disabled","disabled");jQuery("#txtDocTypes").attr("disabled","disabled");jQuery("#txtControls").attr("disabled","disabled");callback!=null&&callback()});DocPropertyId!=0&&DocPropertyId!=undefined?$("#divSectionProperties_ActionProperty").removeClass("hidden"):$("#divSectionProperties_ActionProperty").addClass("hidden")}clickEventsInPropertyCreation(){var instance=Unibase.Platform.Forms.Components.PropertyEditor.Instance();$("#rdbsection_ActionProperty").click(function(){var sectionproperty_Template=Unibase.Platform.Forms.Components.FormBuilder_Template.Instance().loadSectionProperty();$("#divActionProperty").removeClass("d-none");$("#btnSavePropSection").removeClass("d-none");$("#btnSaveProperties").addClass("d-none");$("#divProperty").addClass("hidden");$("#divActionProperty").html(sectionproperty_Template);$(".sectionPropertyHeader").addClass("d-none");$(".optionGray").css("color","#9e9e9e");$(".optionBlack").css("color","black");$("#ddlWidth").on("change",function(){$("#ddlWidth option:selected").hasClass("optionBlack")?($("#ddlWidth").removeClass("optionGray"),$("#ddlWidth").addClass("optionBlack"),$(".optionBlack").css("color","black")):($("#ddlWidth").removeClass("optionBlack"),$("#ddlWidth").addClass("optionGray"),$(".optionGray").css("color","#9e9e9e"))});$("#ddl_SectionType").on("change",function(){$("#ddl_SectionType option:selected").hasClass("optionBlack")?($("#ddl_SectionType").removeClass("optionGray"),$("#ddl_SectionType").addClass("optionBlack"),$(".optionBlack").css("color","black")):($("#ddl_SectionType").removeClass("optionBlack"),$("#ddl_SectionType").addClass("optionGray"),$(".optionGray").css("color","#9e9e9e"))})});$("#rdbsection_Property").click(function(){$("#divActionProperty").addClass("hidden");$("#btnSavePropSection").addClass("hidden");$("#btnSaveProperties").removeClass("hidden");$("#divProperty").removeClass("hidden");$("#divActionProperty").addClass("d-none");$("#btnSavePropSection").addClass("d-none");$("#btnSaveProperties").removeClass("d-none");$("#divProperty").removeClass("d-none")});$("#chkIsRequired").click(function(){$("#chkIsRequired").is(":checked")?($("#divStages").removeClass("hidden"),Unibase.Platform.Forms.Components.PropertyEditor.instance.GetStagesForRequired("select2_IncludedStages",""),Unibase.Platform.Forms.Components.PropertyEditor.instance.GetStagesForRequired("select2_ExcludedStages","")):$("#divStages").addClass("hidden")});$("#chkApplyRoles").click(function(){$("#chkApplyRoles").is(":checked")?($("#divRoles").removeClass("hidden"),Unibase.Platform.Forms.Components.PropertyEditor.instance.loadRoles("select2_IncludedRoles",""),Unibase.Platform.Forms.Components.PropertyEditor.instance.loadRoles("select2_ExcludedRoles","")):$("#divRoles").addClass("hidden")});$("#chkHelp").click(function(){$("#chkHelp").is(":checked")?($("#divHelp").removeClass("hidden"),$("#HelpDisplayTypediv").removeClass("hidden")):($("#txtHelpDetails").val(""),$("#ddl_lblHelpDisplayType").val(0),$("#divHelp").addClass("hidden"),$("#HelpDisplayTypediv").addClass("hidden"))});$("#btn-add-validation").click(function(){var element;let len=Unibase.Platform.Forms.Components.PropertyEditor.Instance().ValidationArray.length;Unibase.Platform.Forms.Components.PropertyEditor.Instance().ValidationArray.push({key:len,value:0});var validation_addrow_Template=Unibase.Platform.Forms.Components.FormBuilder_Template.Instance().addRowForValidationTemplate(),templateScript=Handlebars.compile(validation_addrow_Template),context={length:len+1,ValidationType:"",ValidationId:"",RegularExp:"",ErrorMessage:""};let html=templateScript(context);$(".ValidationInProperty").append(html);$(".ValidationInProperty-no-data").addClass("hidden");element=$(".Validation-row:last");instance.bindList(element)})}bindList(element){element.find("#delete").on("click",function(){let id=$(this).children().children().attr("data-id"),arrayIndex=Unibase.Platform.Forms.Components.PropertyEditor.Instance().ValidationArray.findIndex(x=>x.key===Number(id)-1);Unibase.Platform.Forms.Components.PropertyEditor.Instance().ValidationArray.splice(arrayIndex,1);$(this).parents(".Validation-row").remove();$(".Validation-row").length==0&&$(".ValidationInProperty-no-data").removeClass("hidden");$(".Validation-row").each(function(i){$(this).find(".title").text(`Validation-`+(i+1))})})}openPropertyPopup(prop,isProperty,callback){this.prop=prop;this.isProperty=isProperty;this.popUpCallBack=callback;this.navigationHelper.popup(0,"",Unibase.Platform.Forms.Components.PropertyEditor.Instance(),function(){},Platform.Helpers.Size.Auto)}loadDataTypesByControlId(ControlId){ControlId!=0&&Unibase.Platform.DataSources.Managers.DocTypeManager.Instance().getDataTypesByControlId(ControlId).then(function(response){let dataTypes=[];dataTypes.push({id:"",text:"-- Select --"});let result=response.result;for(let i=0;ix.DocPropertyId==prop.DocPropertyId),uniqueId=curFormProp==undefined?moment().valueOf():curFormProp.UniqueId):uniqueId=moment().valueOf());helpDisplayType=0;Number($("#ddl_lblHelpDisplayType").val())!=NaN&&Number($("#ddl_lblHelpDisplayType").val())!=undefined&&(helpDisplayType=Number($("#ddl_lblHelpDisplayType").val()));propertyjson={FormPropertyId:prop.FormPropertyId!=undefined?prop.FormPropertyId:0,DocPropertyId:prop.DocPropertyId!=undefined?prop.DocPropertyId:Unibase.Platform.Forms.Components.FormBuilder.Instance().TempDocPropertyId,DocPropertyName:prop.DocPropertyName,FormPropertyName:$("#txtPropertyName").val().toString(),DocTypeId:Number($("#txtDocTypes option:selected").val()),DataTypeId:Number($("#loadDatatypes option:selected").val()),DocTypeName:$("#txtDocTypes option:selected").text(),SectionId:Number($("#txtAutoComplete_Section option:selected").val()),SectionName:$("#txtAutoComplete_Section option:selected").text(),PropertyWidth:Number($("#txtWidth").val()),IsDefault:prop.IsDefault!=undefined?prop.IsDefault:!1,IsRequired:IsRequired,ControlId:ControlId,ControlName:response.ControlName,ControlVariable:response.JsVariableName,ControlJsUrl:response.URL,SettingPageUrl:response.SettingsPageUrl,SettingJsVariableName:response.SettingJsVariableName,LabelName:$("#txtDisplayName").val().toString(),Placeholder:$("#txtPlaceHolder").val().toString(),ControlJsonText:Controljsontext,IncludedStages:$("#select2_IncludedStages").val().toString().replace(/,/g,"|"),ExcludedStages:$("#select2_ExcludedStages").val().toString().replace(/,/g,"|"),IncludedRoles:$("#select2_IncludedRoles").val().toString().replace(/,/g,"|"),ExcludedRoles:$("#select2_ExcludedRoles").val().toString().replace(/,/g,"|"),RowIndex:prop.RowIndex!=undefined?prop.RowIndex:0,DocTypeTableName:"",Validations:Unibase.Platform.Forms.Components.PropertyEditor.instance.getValidations(),PropertySettings:propertysettings,SectionType:prop.SectionType,PropertyType:"Property",GroupName:"",Level:0,StagesForRequired:null,IsMultiple:!1,IsSwitch:!1,IsExtProperty:prop.DocPropertyId!=undefined?!1:!0,IsNewEntry:prop==null?!0:!1,Value:"",IsStaticControl:prop.IsStaticControl,UniqueId:uniqueId,ParentFormPropertyId:prop.ParentFormPropertyId,IsHelp:isHelp,HelpText:helpText,HelpDisplayType:Number($("#ddl_lblHelpDisplayType").val())};Unibase.Platform.Forms.Components.FormBuilder.instance.loadFormProperty(propertyjson);$("#"+containerid).modal("hide");$("#"+containerid).remove();instance.navigationHelper.hideLoading();prop.SectionName=="Hidden"&&($("#hidePropertyBtn"+prop.DocPropertyId).addClass("d-none"),$("#editPropertyBtn"+prop.DocPropertyId).removeClass("d-none"),$("#PropertyEye"+prop.DocPropertyId).addClass("d-none"),$("#PropertyEyeOff"+prop.DocPropertyId).removeClass("d-none"))})})}saveActionProperty(prop,containerid){var instance=this,sectionPropertyId=Unibase.Platform.Forms.Components.PropertyEditor.Instance().SectionPropertyId,DocPropertyId=0,PropArray=prop,propertyjson;sectionPropertyId!=0?(PropArray={SectionId:prop.SectionId,SectionName:prop.SectionName},DocPropertyId=sectionPropertyId):DocPropertyId=Unibase.Platform.Forms.Components.PropertyEditor.Instance().TempSectionPropertyId;propertyjson={FormPropertyId:sectionPropertyId,DocPropertyId:DocPropertyId,FormPropertyName:"",DocPropertyName:$("#txt_SectionPropertyName").val().toString(),DocTypeId:0,DataTypeId:0,DocTypeName:"",SectionId:Number(PropArray.SectionId),SectionName:PropArray.SectionName,PropertyWidth:Number($("#ddlWidth").val()),IsDefault:!1,IsRequired:!1,ControlId:0,ControlName:"",ControlVariable:"",ControlJsUrl:"",SettingPageUrl:"",SettingJsVariableName:"",LabelName:$("#txt_SectionPropertyName").val().toString(),Placeholder:$("#txt_SectionPropertyName").val().toString(),ControlJsonText:null,IncludedStages:null,ExcludedStages:null,IncludedRoles:null,ExcludedRoles:null,RowIndex:prop!=null?prop.RowIndex:0,DocTypeTableName:"",Validations:null,PropertySettings:null,SectionType:$("#ddl_SectionType option:selected").val().toString(),PropertyType:"Section",GroupName:$("#txt_GroupName").val().toString(),Level:0,StagesForRequired:null,IsMultiple:!1,IsSwitch:!1,IsExtProperty:!1,IsNewEntry:!1,Value:"",IsStaticControl:!1,UniqueId:sectionPropertyId==0||sectionPropertyId==undefined?moment().valueOf():sectionPropertyId,ParentFormPropertyId:0,IsHelp:!1,HelpText:"",HelpDisplayType:0};Unibase.Platform.Forms.Components.FormBuilder.instance.loadFormProperty(propertyjson);$("#"+containerid).modal("hide");$("#"+containerid).remove();instance.navigationHelper.hideLoading()}loadingFormPropertiesData(prop){var instance=Unibase.Platform.Forms.Components.PropertyEditor.Instance();instance.loadAddPropertyHtml(prop.DocPropertyId,prop.DocPropertyName,prop.ControlId,prop.SectionId,prop.SectionName,Number(prop.SectionType),"Edit",!1,prop,function(){if(prop.PropertyType=="Section")$("#rdbsection_ActionProperty").prop({checked:!0}).trigger("click"),$("#ddl_SectionType").val(prop.SectionType.toString()),$("#txt_SectionPropertyName").val(prop.DocPropertyName),$("#txt_GroupName").val(prop.GroupName),$("#ddlWidth").val(prop.PropertyWidth.toString()),Unibase.Platform.Forms.Components.PropertyEditor.Instance().SectionPropertyId=prop.FormPropertyId;else{$("#rdbsection_Property").prop({checked:!0}).trigger("click");var SettingPageUrl=prop.SettingPageUrl;SettingPageUrl!=""&&instance.fileCacheHelper.loadJsFile(SettingPageUrl,function(){instance.bindFormProperties(prop);Unibase.Platform.Forms.Components.FormBuilder.instance.preparingPropertiesList(prop)})}eval("_floatingLabelHelper.init()")})}bindFormProperties(prop){$(document).ready(function(){var selectedSection,validations,includedRoles,excludedRoles;if($("#txtDocTypes").prop("disabled",!0),$("#txtDisplayName").val(prop.LabelName),$("#txtPlaceHolder").val(prop.Placeholder),$("#txtPropertyName").val(prop.FormPropertyName),$("#txtDocPropertyName").val(prop.DocPropertyName),Unibase.Platform.Forms.Components.PropertyEditor.Instance().RowIndex=prop.RowIndex,prop.IsSwitch==!0?($("#chkIsSwitch").prop({checked:!0}),$("#CheckBoxdetails_div").removeClass("hidden")):($("#chkIsSwitch").prop({checked:!1}),$("#CheckBoxdetails_div").addClass("hidden")),prop.IsMultiple==!0?$("#CheckBoxdetails_div").removeClass("hidden"):$("#CheckBoxdetails_div").addClass("hidden"),prop.IsRequired==!0?$("#chkIsRequired").prop({checked:!0}):$("#chkIsRequired").prop({checked:!1}),$("#txtWidth").val(prop.PropertyWidth),selectedSection=new Option(prop.SectionName,prop.SectionId.toString(),!1,!1),$("#txtAutoComplete_Section").append(selectedSection).trigger("change"),$("#txtAutoComplete_Section").select2(),Unibase.Platform.Forms.Components.PropertyEditor.Instance().AutoCompleteId_Section=prop.SectionId,validations=prop.Validations,validations!=null){let k=0;for(let i=validations.length-1;i>=0;i--)$("#btn-add-validation").click(),k+=1,$(".txt_ValidationName_"+k).val(validations[i].ValidationType),$(".txt_RegularExpression_"+k).val(validations[i].RegularExp),$(".txt_ErrorMessage_"+k).val(validations[i].ErrorMessage),Unibase.Platform.Forms.Components.PropertyEditor.Instance().ValidationArray[k-1].value=validations[i].ValidationId}Unibase.Platform.Forms.Components.PropertyEditor.instance.GetStagesForRequired("select2_IncludedStages",prop.IncludedStages);Unibase.Platform.Forms.Components.PropertyEditor.instance.GetStagesForRequired("select2_ExcludedStages",prop.ExcludedStages);Unibase.Platform.Forms.Components.PropertyEditor.instance.loadRoles("select2_IncludedRoles",prop.IncludedRoles);Unibase.Platform.Forms.Components.PropertyEditor.instance.loadRoles("select2_ExcludedRoles",prop.ExcludedRoles);prop.IsRequired==!0&&($("#divStages").removeClass("hidden"),(prop.IncludedStages!=""||prop.ExcludedStages!="")&&(prop.IncludedStages!=null||prop.ExcludedStages!=null)&&($("#chkApplyRoles").prop("checked",!0),$("#divRoles").removeClass("hidden"),prop.IncludedStages!=""&&prop.IncludedStages!=null&&$("#select2_ExcludedStages").prop("disabled",!0),prop.ExcludedStages!=""&&prop.ExcludedStages!=null&&$("#select2_IncludedStages").prop("disabled",!0)));(prop.IncludedRoles!=""||prop.ExcludedRoles!="")&&(prop.IncludedRoles!=null||prop.ExcludedRoles!=null)&&($("#chkApplyRoles").prop("checked",!0),$("#divRoles").removeClass("hidden"),prop.IncludedRoles!=""&&prop.IncludedRoles!=null&&($("#select2_ExcludedRoles").prop("disabled",!0),includedRoles=prop.IncludedRoles.toString().split("|"),jQuery("#select2_IncludedRoles").val(includedRoles).trigger("change")),prop.ExcludedRoles!=""&&prop.ExcludedRoles!=null&&($("#select2_IncludedRoles").prop("disabled",!0),excludedRoles=prop.ExcludedRoles.toString().split("|"),jQuery("#select2_ExcludedRoles").val(excludedRoles).trigger("change")));Unibase.Platform.Forms.Components.PropertyEditor.Instance().ParentTagjson=prop.ControlJsonText;eval("_floatingLabelHelper.init()")})}loadDocTypesAutoComplete(prop){var InstalledAppId=Unibase.Platform.Forms.Components.FormBuilder.Instance().InstalledAppId;this._docTypeManager.getDocTypesByAppId(InstalledAppId).then(function(response){var docTypeData=[],docTypes;let result=response.result;for(let i=0;i31&&(iKeyCode<48||iKeyCode>57))return!1}saveFormProperty(prop){return prop}saveFormpropertiesNew(prop){var oldSectionId=prop.SectionId,oldSectionName=prop.SectionName,oldDocPropertyId=prop.DocPropertyId,chkvalue,chkIsReqvalue;return chkvalue=$("#chkIsSwitch").prop("checked")?!0:!1,chkIsReqvalue=$("#chkIsRequired").prop("checked")?!0:!1,prop.DocPropertyId=Unibase.Platform.Forms.Components.PropertyEditor.Instance().DocPropertyId,prop.ControlId=$("#ddlControlType option:selected").val(),prop.LabelName=$("#txtLabelName").val(),prop.Placeholder=$("#txtPlaceHolder").val(),prop.IsRequired=chkIsReqvalue,prop.Width=$("#ddlWidth").val(),prop.IsSwitch=chkvalue,prop.SectionId=Unibase.Platform.Forms.Components.PropertyEditor.Instance().AutoCompleteId_Section,prop.SectionName=$("#txtAutoComplete_Section option:selected").text(),prop.IncludedStages=$("#select2_IncludedStages").val()!=undefined?$("#select2_IncludedStages").val().toString().replace(/,/g,"|"):"",prop.ExcludedStages=$("#select2_ExcludedStages").val()!=undefined?$("#select2_ExcludedStages").val().toString().replace(/,/g,"|"):"",prop.IncludedRoles=$("#select2_IncludedRoles").val()!=undefined?$("#select2_IncludedRoles").val().toString().replace(/,/g,"|"):"",prop.ExcludedRoles=$("#select2_ExcludedRoles").val()!=undefined?$("#select2_ExcludedRoles").val().toString().replace(/,/g,"|"):"",oldSectionId!=prop.SectionId&&(oldSectionName=oldSectionName.replace(/ /g,""),$("#SectionBody_"+oldSectionName).find(".divCustomFormProperties_"+oldDocPropertyId).remove()),prop}loadControl(prop){var instance=Unibase.Platform.Forms.Components.PropertyEditor.Instance(),FormPropertiesJson=JSON.stringify(prop),html="",sectionname=prop.SectionName.replace(/ /g,""),sectionhtml,textcolumn,DocPropertyName,controljsurl;if(prop.PropertyType=="Section"){if(sectionhtml="",prop.SectionType=="Radio")textcolumn=prop.DocPropertyName.replace(/ /g,""),sectionhtml+='
    Hide Section
    AutoCollapse
    `}load(){}preparingSectionsList(SectionName,SectionId,SectionType,FormJson){var checkSection,sectionIndex,secObj;FormJson!=null&&FormJson.Sections.length>=0&&(checkSection=FormJson.Sections.find(x=>x.SectionId==SectionId),checkSection!=null&&checkSection!=undefined?(sectionIndex=FormJson.Sections.findIndex(x=>x.SectionId==SectionId),secObj={SectionId:SectionId,SectionName:SectionName,SectionType:SectionType.toString(),FormProperties:checkSection.FormProperties,EnableAutoCollapse:Boolean(checkSection.EnableAutoCollapse),HideSection:Boolean(checkSection.HideSection),ParentDivId:checkSection.ParentDivId},FormJson.Sections[sectionIndex]=secObj):(secObj={SectionId:SectionId,SectionName:SectionName,SectionType:SectionType.toString(),FormProperties:[],EnableAutoCollapse:Boolean($("#chkautocollapse_").prop("checked")),HideSection:Boolean($("#chkhidesection_").prop("checked")),ParentDivId:$("#txt_parentdivid").val().toString()},FormJson.Sections.push(secObj)))}loadSectionHtml(SectionName,SectionId,SectionType,SectionStatus,FormJson){var checkSection;Components.FormBuilder.instance.formpropertyNames[Components.FormBuilder.instance.formPropertyCount]=SectionName.replace(/\s/g,"")+"-SectionName";Components.FormBuilder.instance.formPropertyCount++;this.preparingSectionsList(SectionName,SectionId,SectionType,FormJson);var autocollapse=!1,hidesection=!1,parentdivid="";FormJson!=undefined&&(checkSection=FormJson.Sections.find(x=>x.SectionId==SectionId),autocollapse=checkSection.EnableAutoCollapse,hidesection=checkSection.HideSection,parentdivid=checkSection.parentdivid);let newhtml=``,leftsectionhtml="";SectionType==Unibase.Platform.Forms.Enums.SectionType.HiddenSection?(Unibase.Platform.Forms.Components.FormBuilder.Instance().HiddenSectionId=SectionId,newhtml=`
    `+SectionName+`
    `):(newhtml=`
    `,leftsectionhtml=`
  • ${""} `+SectionName+` ${""}
  • `);$("#form-builder-elements").append(newhtml);autocollapse==!0&&$("#chkautocollapse_"+SectionId).prop("checked",!0);hidesection==!0&&$("#chkhidesection_"+SectionId).prop("checked",!0);SectionType==Unibase.Platform.Forms.Enums.SectionType.HiddenSection&&$(".section_"+SectionId).hide();leftsectionhtml!=""&&$("#left-sections-list").append(leftsectionhtml);$(".listitem-a-"+SectionId).click(function(){let SectionId=$(this).attr("data-sectionid");$(this).hasClass("focused-block")?($(this).removeClass("focused-block"),$("#section-focus-"+SectionId).removeClass("focused")):($(".dsl-sec-block-wrap .dsl-block").removeClass("focused-block"),$(this).addClass("focused-block"),$(".form-sec-wrap").removeClass("focused"),$("#section-focus-"+SectionId).addClass("focused"));var elmnt=document.getElementById("section-focus-"+SectionId);return elmnt.scrollIntoView(),!1});let sectionsList=$("#left-sections-list"),itemId,startIndex,endIndex;sectionsList.sortable({connectWith:"#left-sections-list",cursor:"move",start:function(event,ui){itemId=$(ui.item).children("a.dsl-block").attr("data-sectionid");console.log(itemId);let i=0;$("#left-sections-list .dd-item").each(function(){let id=$(this).children("a.dsl-block").attr("data-sectionid");id==itemId&&(startIndex=i,console.log(startIndex));i++})},stop:function(){let i=0;$("#left-sections-list .dd-item").each(function(){let id=$(this).children("a.dsl-block").attr("data-sectionid");id==itemId&&(endIndex=i,console.log(endIndex));i++});let sectionItemCopy=$("#form-builder-elements.ui-sortable .form-sec-wrap")[startIndex];startIndex>endIndex?$(sectionItemCopy).insertBefore($("#form-builder-elements.ui-sortable .form-sec-wrap")[endIndex]):$(sectionItemCopy).insertAfter($("#form-builder-elements.ui-sortable .form-sec-wrap")[endIndex])}});SectionName!=""&&($("#secHeader_"+SectionId).find(".sectionName").text(SectionName),$("#secHeader_"+SectionId).addClass("secHeader"),$("#secHeader_"+SectionId).find(".fixedHeader").removeClass("hidden"),$("#secHeader_"+SectionId).removeClass("pt-0 pb-2"),$("#secHeader_"+SectionId).find(".editHeader").addClass("hidden"));$("#sectionType").val(SectionType.toString());$("#txt_"+SectionId).focus();$("#editSection_"+SectionId).click(function(){Unibase.Platform.Forms.Components.SectionEditor.Instance().EditSection(SectionId,SectionType)});$(".deleteSection_"+SectionId).click(function(){if(console.log($('[data-sectionid="'+SectionId+'"]').length),$('[data-sectionid="'+SectionId+'"]').length>3)return MessageHelper.Instance().showError("Remove all Properties before removing a Section.","unibase_formbuilder_errorsummary"),Components.FormBuilder.instance.formpropertyNames.splice(SectionId),!1;$("#left-sections-list").find(".listitem-"+SectionId).remove();$(".section_"+SectionId).remove()});$("#txt_"+SectionId).keyup(function(e){e.keyCode===13&&$("#saveSection_"+SectionId).click()});$("#secHeader_"+SectionId).hover(function(){return $(this).find(".sorticon").removeClass("hidden"),$(this).find(".editremoveSectionicons").removeClass("hidden"),!1},function(){$(this).find(".sorticon").addClass("hidden");$(this).find(".editremoveSectionicons").addClass("hidden")});let formBodyEvent=$(".sectionBody-Element");formBodyEvent.sortable({connectWith:"#controls-list, #DocTypeAccordion",cursor:"move",receive:function(event,ui){console.log(ui);Unibase.Platform.Forms.Components.SectionEditor.Instance().SectionId=Number(ui.item.attr("data-id"));$("#DocTypeAccordion").css({position:"static",width:""});var PropertyId=$(ui.item).attr("data-id"),PropertyName=$(ui.item).attr("data-name"),ControlId=$(ui.item).attr("data-controlid")==undefined?0:Number($(ui.item).attr("data-controlid"));Unibase.Platform.Forms.Components.PropertyEditor.Instance().openAddPropertyPage(PropertyId,PropertyName,ControlId,Number($("#"+event.target.id).attr("data-sectionid")),$("#"+event.target.id).attr("data-sectionname"),$("#"+event.target.id).attr("data-sectiontype"),!0,0,0);ui.item.remove()}})}EditSection(SectionId,SectionType){Unibase.Platform.Helpers.NavigationHelper.Instance().popup(0,"",Unibase.Platform.Forms.Components.SectionEditor.Instance(),function(){if(Unibase.Platform.Forms.Components.FormBuilder.Instance().FormJson!=undefined){var secobj=Unibase.Platform.Forms.Components.FormBuilder.Instance().FormJson.Sections.find(x=>x.SectionId==SectionId);secobj!=null&&($("#txt_sectionname").val(secobj.SectionName),$("#txt_parentdivid").val(secobj.ParentDivId),$("#chkhidesection_").prop("checked",secobj.HideSection),$("#chkautocollapse_").prop("checked",secobj.EnableAutoCollapse),eval("_floatingLabelHelper.init();"))}$("#saveSection").click(function(){var text=$("#txt_sectionname").val().toString(),parentdivid=$("#txt_parentdivid").val().toString(),sectionNameValidate=Array.prototype.slice.call(document.getElementsByClassName("sectionName")).find(x=>x.innerHTML.toLowerCase()==text.toLowerCase()),sectype,formjson,checkSection;if(sectionNameValidate!=undefined&§ionNameValidate.id!=SectionId.toString()&§ionNameValidate.id!="")return MessageHelper.Instance().showError("SectionName already exist.","unibase_sectioneditor_errorsummary"),!1;if(text=="")return MessageHelper.Instance().showError("SectionName cannot be empty.","unibase_sectioneditor_errorsummary"),!1;sectype=$(".sectionType_"+SectionId).val();$("#secHeader_"+SectionId).find(".sectionName").text(text);$("#left-sections-list #listitem-"+SectionId).text(text);$("#SectionBody_"+SectionId).attr("data-sectionname",text);$("#SectionBody_"+SectionId).attr("data-parentdivid",parentdivid);$("#SectionBody_"+SectionId).attr("data-autocollapse",$("#chkautocollapse_").prop("checked").toString());$("#SectionBody_"+SectionId).attr("data-hidesection",$("#chkhidesection_").prop("checked").toString());$("#sectionBodyRow_"+SectionId).attr("data-sectionname",text);$("#sectionBodyRow_"+SectionId).attr("data-autocollapse",$("#chkautocollapse_").prop("checked").toString());$("#sectionBodyRow_"+SectionId).attr("data-hidesection",$("#chkhidesection_"+SectionId).prop("checked").toString());formjson=Unibase.Platform.Forms.Components.FormBuilder.Instance().FormJson;formjson!=undefined&&formjson!=null&&(checkSection=formjson.Sections.find(x=>x.SectionId==SectionId),checkSection!=undefined&&(checkSection.EnableAutoCollapse=Boolean($("#chkautocollapse_").prop("checked")),checkSection.HideSection=Boolean($("#chkhidesection_").prop("checked")),checkSection.ParentDivId=$("#txt_parentdivid").val().toString(),$("#SectionBody_"+SectionId).attr("data-sectiontype",Number(SectionType))));Unibase.Platform.Forms.Components.SectionEditor.instance.preparingSectionsList(text,SectionId,SectionType,Unibase.Platform.Forms.Components.FormBuilder.Instance().FormJson);Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp()})},Platform.Helpers.Size.DockLeft)}loadSectionAutoComplete(FormId){FormId!=0&&this._formManager.getSections(FormId).then(function(response){var sectionData=[],result=response.result,controls;for(let i=0;i
    Add Control
    `+control_Template+`
    `}load(id,containerid){$("#divAddControl").height($(window).outerHeight()-148);$("#chkIsStaticControl").prop("checked",!0);$("#chkIsStaticControl").is(":checked")?$("#div_ControlJson").removeClass("hidden"):$("#div_ControlJson").addClass("hidden");$("#btnCloseControl").click(function(){$("#"+containerid).modal("hide");$("#"+containerid).remove()});$("#chkIsStaticControl").click(function(){$("#chkIsStaticControl").is(":checked")?($("#divAutoComplete_InstalledApps").removeClass("hidden"),$("#txtAutoComplete_InstalledApps").addClass("required"),$("#div_ControlJson").removeClass("hidden"),$("#txt_ControlJson").addClass("required")):($("#divAutoComplete_InstalledApps").addClass("hidden"),$("#txtAutoComplete_InstalledApps").removeClass("required"),$("#div_ControlJson").addClass("hidden"),$("#txt_ControlJson").removeClass("required"))});var instance=this;$("#btnSaveControl").click(function(){let result=Unibase.Platform.Forms.Components.FormViewer.Instance().requiredFieldValidation("frmUnibase_AddControl");if(result==!1)return MessageHelper.Instance().showError("Mandatory fields are missing",""),!1;Unibase.Platform.Forms.Components.ControlEditor.Instance().saveControl(containerid)});$("#btnControlProperty").click(function(){var length=$("#divControlProperties").children().length,ControlProperty_Template=Unibase.Platform.Forms.Components.FormBuilder_Template.Instance().loadControlProperties(length);$("#divControlProperties").append(ControlProperty_Template)});Unibase.Platform.DataSources.Managers.DocTypeManager.Instance().getDataTypes().then(function(response){var datatypes=[],controls;let result=response.result;for(let i=0;i
    `;$("#controls-list").append(html)}).then(function(){let controlEvent=$("#controls-list"),clone,before,parent;controlEvent.sortable({connectWith:".sectionBody-Element",cursor:"move",helper:"clone",start:function(event,ui){console.log(ui);var liWidth=ui.item.css("width");$(ui.item).show();clone=$(ui.item).clone();before=$(ui.item).prev();parent=$(ui.item).parent()},stop:function(event,ui){console.log(ui);$("#controls-list").find("#controlsDiv-"+clone.attr("data-controlid")).length==0&&(before.length?before.after(clone):parent.prepend(clone))}})})}openAddControlPage(){Unibase.Platform.Forms.Components.ControlEditor.Instance().ControlId=0;this.navigationHelper.popup(0,"",Unibase.Platform.Forms.Components.ControlEditor.Instance(),function(){},Platform.Helpers.Size.Auto)}editControl(controlId){Unibase.Platform.Forms.Components.ControlEditor.Instance().openAddControlPage();var manager=this._formManager;$(document).ready(function(){manager.getControl(controlId).then(function(response){var dataTypeIds,Values,dataTypeId,installedAppValues,installedAppIds,appIds,controlProperties,controlPropertyIds,i;let result=response.result;if(Unibase.Platform.Forms.Components.ControlEditor.Instance().ControlId=result.ControlId,$("#txt_ControlName").val(result.ControlName),$("#chkIsStaticControl").prop("checked",result.IsStaticControl),$("#txt_URL").val(result.URL),$("#txt_SettingsPageUrl").val(result.SettingsPageUrl),$("#txt_JsInstanceName").val(result.JsVariableName),$("#txt_SettingJsInstanceName").val(result.SettingJsVariableName),$("#txt_Assembly").val(result.Assembly),$("#txt_ControlJson").val(result.ControlJson),response.result.IsStaticControl==!1?($("#div_ControlJson").addClass("hidden"),$("#txt_ControlJson").addClass("required")):($("#div_ControlJson").removeClass("hidden"),$("#txt_ControlJson").removeClass("required")),dataTypeIds=result.DataTypeIds.split(","),Values=[],dataTypeIds.length>0){for(i=0;i0&&$("#btnControlProperty").trigger("click"),$("#txt_PropertyName_"+i).val(controlProperties[i].PropertyName),$("#txt_DefaultValue_"+i).val(controlProperties[i].PropertyName),controlPropertyIds[i]=Number(controlProperties[i].ControlPropertyId);Unibase.Platform.Forms.Components.ControlEditor.Instance().ControlPropertyIds=controlPropertyIds}).then(function(){eval("_floatingLabelHelper.init()")})})}saveControl(containerid){var instance=this,controlId=Unibase.Platform.Forms.Components.ControlEditor.Instance().ControlId,controlPropertyIds=Unibase.Platform.Forms.Components.ControlEditor.Instance().ControlPropertyIds,controlPropertyId=0,length=$("#divControlProperties").children().length,datatypeIds=[],numDatatypeIds=[],installedAppIds=[],numInstalledAppIds="|",i,k,m,postData,formId;let controlProperties=[];for(i=0;i0&&$("#chkIsmultiple").prop("checked",!0),i=0;i