var g_memberItemDelimiter="|",g_memberRowDelimiter="ยง",intMaxValue=2147483647,g_currentRowSelection=null;function updateSelectedRow(items,selectedItems,delegate){for(var i=0;i{var pub={onChangeDataRights:function(roleId,tableName,relationToOwnerPosition,value){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminRolesDataHandler.OnChangeDataRights","",roleId,tableName,relationToOwnerPosition,value)},openDeleteRoleDialog:function(currentName){Dialog.open("admindeleterole","admindeleterole[dialog=stop]?adminrolecurrentname_name="+currentName,"QueuedPageUpdate('soprotocol:?"+currentName+"_id=0&"+currentName+"listentry_id=0&');")}};return pub})(),SuperOffice.Admin.Preferences=(()=>{var pub={ClearCache:function(){var selectedSection=AjaxMethodDispatcher.CallSync("SuperOffice.DCF.Web.AjaxMethods.SuperState.GetCurrent","","selectedsection"),selectedKey=AjaxMethodDispatcher.CallSync("SuperOffice.DCF.Web.AjaxMethods.SuperState.GetCurrent","","selectedpreference");null!=selectedSection.Type&&0{1==state&&QueuedPageUpdate("soprotocol:adminlists[noupdate=true].main[refresh=true]?adminlistitem_id="+ctx.state.listItemId)})},openEditItemDialog:function(callBackString){Dialog.open("adminlistsedititem","adminlistsedititem[dialog=stop]",callBackString)},openEditItemSingleLangDialog:function(callBackString){Dialog.open("adminlistsedititem","adminlistsedititemsinglelang[dialog=stop]",callBackString)},openEditSaleTypeDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditsaletype[dialog=stop]&newItem="+newItem,callBackString)},openEditProjectTypeDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditprojecttype[dialog=stop]&newItem="+newItem,callBackString)},openEditCurrencyDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditcurrency[dialog=stop]&newItem="+newItem,callBackString)},openEditLegalBaseDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditlegalbase[dialog=stop]&newItem="+newItem,callBackString)},openEditConsentSourceDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditconsentsource[dialog=stop]&newItem="+newItem,callBackString)},openEditAmountClassDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditamountclass[dialog=stop]&newItem="+newItem,callBackString)},openEditFollowUpDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditfollowup[dialog=stop]&newItem="+newItem,callBackString)},openEditWebPanelDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditwebpanel[dialog=stop]&newItem="+newItem,callBackString)},openEditExtAppDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditextapp[dialog=stop]&newItem="+newItem,callBackString)},openEditResourceDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditresource[dialog=stop]&newItem="+newItem,callBackString)},openEditSaleStageDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditsalestage[dialog=stop]&newItem="+newItem,callBackString)},openAddHeadingDialog:function(type,setHeadingCurrent){Dialog.open("adminlistsedititem","adminlistseditheading[dialog=stop]&id="+type,setHeadingCurrent?"QueuedPageUpdate('soprotocol:adminlists[noupdate=true].main[refresh=true]');":"SuperOffice.PageBuilder.refreshCurrent('adminlistitem');")},openEditRelationDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditrelation[dialog=stop]&newItem="+newItem,callBackString)},openAddTemplateDialog:function(newItem,callBackString,adminlistitemId){"1"==newItem?Dialog.open("adminlistsaddtemplate","adminlistsaddtemplate[dialog=stop]","SuperOffice.Admin.Lists.callCallBack();"):Dialog.open("adminlistsedititem","adminlistsedittemplate[dialog=stop]?adminlistitem_id="+adminlistitemId,callBackString)},openEmailTemplateDialog:function(newItem,callBackString){"1"==newItem?Dialog.open("adminlistsaddemailtemplate","adminlistsaddemailtemplate[dialog=stop]","SuperOffice.Admin.Lists.callEmailTemplateCallBack();"):Dialog.open("adminlistseditemailtemplate","adminlistseditemailtemplate[dialog=stop]",callBackString)},openEditCategoryListItemDialog:function(listItemId){$dlgm.open(null,{id:"editCategoryListItem",recipeName:"EditCategoryListItem",caption:"[SR_ADMIN_LIST_EDIT_LIST_ITEM]",windowSetting:{width:"700",height:"510"}},function(ctx){ctx.set("listItemId",listItemId)},(ctx,state)=>{1===state&&QueuedPageUpdate("soprotocol:adminlists[noupdate=true].main[refresh=true]?adminlistitem_id="+ctx.state.listItemId)})},openEditTaskMenuDialog:function(taskMenuId,refreshListItem){$dlgm.open(null,{id:"EditTaskMenu",recipeName:"EditTaskMenu",caption:"[SR_ADMIN_LIST_EDIT_LIST_ITEM]",windowSetting:{width:"710",height:"482"}},function(ctx){ctx.set("taskMenuId",taskMenuId)},function(ctx){var tm=ctx.state.taskMenu;!tm||"appointment"!==tm.TableName&&"document"!==tm.TableName&&"Quote"!==tm.TableName?refreshListItem?QueuedPageUpdate("soprotocol:adminlists[noupdate=true].main[refresh=true]?adminlistitem_id="+ctx.state.taskMenuId):QueuedPageUpdate("soprotocol:adminlists[noupdate=true].main[refresh=true]"):QueuedPageUpdate("soprotocol:adminlists[flush=true].main[refresh=true]?adminlistitem_id="+ctx.state.taskMenuId)})},openEditMailingDomainsDialog:function(mailingDomainId,refreshListItem){$dlgm.open(null,{id:"EditMailingDomain",recipeName:"EditMailingDomain",caption:"[SR_ADMIN_LIST_EDIT_LIST_ITEM]",windowSetting:{width:"500",height:"240"}},function(ctx){ctx.set("mailingDomainId",mailingDomainId)},function(ctx){refreshListItem?QueuedPageUpdate("soprotocol:adminlists[noupdate=true].main[refresh=true]?adminlistitem_id="+ctx.state.taskMenuId):QueuedPageUpdate("soprotocol:adminlists[noupdate=true].main[refresh=true]")})},openEditUsergroupDialog:function(usergroupId,refreshListItem){$dlgm.open(null,{id:"editUsergroupDialog",recipeName:"EditUsergroupDialog",caption:"[SR_ADMIN_LIST_EDIT_LIST_ITEM]",windowSetting:{width:"750",height:"440"}},function(ctx){ctx.set("usergroupId",usergroupId)},function(ctx){refreshListItem?QueuedPageUpdate("soprotocol:adminlists[noupdate=true].main[refresh=true]?adminlistitem_id="+ctx.state.usergroupId):QueuedPageUpdate("soprotocol:adminlists[noupdate=true].main[refresh=true]")})},openEditCountryDialog:function(newItem,callBackString){Dialog.open("adminlistsedititem","adminlistseditcountry[dialog=stop]&newItem="+newItem,callBackString)},openAddDocumentTemplateLanguageDialog:function(callBackString){Dialog.open("adminlistsaddtemplatelanguage","adminlistsaddtemplatelanguage[dialog=stop]","editTemplateRegisteredLanguagesArchiveControl.RefreshList();")},openAddEmailTemplateLanguageDialog:function(callBackString){Dialog.open("adminlistaddlanguageemailtemplate","adminlistaddlanguageemailtemplate[dialog=stop]","editTemplateRegisteredLanguagesArchiveControl.RefreshList();")},setDocumentTemplateLanguageCreationMode:function(mode){""==mode&&(mode=$("[soid=addTemplateLanguageUploadOrCopy]").attr("value"));var controlGroups_upload=["addTemplateLanguageUpload"],controlGroups_copy=["addTemplateLanguageCopyFile"];$("[soid=addTemplateLanguageUploadOrCopy]").attr("value",mode),"upload"==mode?($("[soid=addTemplateLanguageUploadRadio]").attr("Checked","1"),SuperOffice.SoHelper.enableElementsBySoId(controlGroups_upload),SuperOffice.SoHelper.disableElementsBySoId(controlGroups_copy)):"copy"==mode?(SuperOffice.SoHelper.getElementBySoId("addTemplateLanguageUploadFile_textfield").style.color="",$("[soid=addTemplateLanguageCopyRadio]").attr("Checked","1"),SuperOffice.SoHelper.disableElementsBySoId(controlGroups_upload),SuperOffice.SoHelper.enableElementsBySoId(controlGroups_copy)):pub.setDocumentTemplateLanguageCreationMode("upload")},documentTemplateLanguage:function(title,soprotocol){$.fromSoId("addTemplateLanguageUploadFile_textfield").attr("value",decodeURIComponent((title+"").replace(/\+/g,"%20"))),defValue1=ResourceUtils.GetResourceText("[SR_SELECT_A_FILE]"),defValue2=ResourceUtils.GetResourceText("[SR_SELECT_A_HTMLFILE]"),curVal=SuperOffice.SoHelper.getElementBySoId("addTemplateLanguageUploadFile_textfield").value,defValue1===curVal||defValue2===curVal?SuperOffice.SoHelper.getElementBySoId("addTemplateLanguageUploadFile_textfield").style.color="red":SuperOffice.SoHelper.getElementBySoId("addTemplateLanguageUploadFile_textfield").style.color="",soprotocol?QueuedPageUpdate("soprotocol:adminlistsaddtemplatelanguage[dialog=stop].main[refresh=false]"):QueuedPageUpdate("soprotocol:"+soprotocol+"[dialog=stop].main[refresh=false]")},deleteDocumentTemplateLanguage:function(){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.Admin.AdminEditTemplateDataHandler.DeleteDocumentTemplateLanguage",""),editTemplateRegisteredLanguagesArchiveControl.RefreshList()},saveDocumentTemplateLanguageCallback:function(title){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.Admin.AdminEditTemplateDataHandler.SaveDocumentTemplateLanguageWithCurrent","",title)},saveDocumentTemplateLanguage:function(){OpenFileDialog("document",0,"saveDocumentTemplateLanguage")},editDocumentTemplateLanguage:function(doRefresh){var languageCode=parseInt(editTemplateRegisteredLanguagesArchiveControl.getSelectedKey());SuperOffice.Admin.Lists.DownloadTemplate(languageCode,doRefresh)},callCallBack:function(){SuperOffice.Admin.Lists.setListItemsUserGroup(SuperOffice.SoCheckedListBox("visibleForUserGroups").getSimpleMdoItems(),!0),PageUpdate("soprotocol:adminlists[noupdate=true].main[refresh=true]?adminlistitem_id="+g_clientOptions.LastValidHistoryItem);Dialog.open("adminlistsedititem","adminlistsedittemplate[dialog=stop]","QueuedPageUpdate('soprotocol:adminlists[noupdate=true].main[refresh=true]?adminlistitem_id=' + g_clientOptions.LastValidHistoryItem);")},callEmailTemplateCallBack:function(){SuperOffice.Admin.Lists.setListItemsUserGroup(SuperOffice.SoCheckedListBox("visibleForUserGroups").getSimpleMdoItems(),!0),PageUpdate("soprotocol:adminlists[noupdate=true].main[refresh=true]?adminlistitem_id="+g_clientOptions.LastValidHistoryItem);var historyItem=AjaxMethodDispatcher.CallSync("SuperOffice.DCF.Web.AjaxMethods.SuperState.GetCurrent","","adminlistItem");historyItem&&0"+$("[soid=relationName_textfield]").attr("value")+" "+passiveWho+" B"),""!=$("[soid=relationPassive_textfield]").attr("value")&&(passive+=passiveWho+" B "+$("[soid=relationPassive_textfield]").attr("value")+" "+activeWho+" A"),$("[soid=relationExample1]").html(active),$("[soid=relationExample2]").html(passive)},deleteHeading:function(ids){for(var stringArray="",i=0;i{var pub={onNoRowsSelected:function(id,instance){instance.setFirstRowSelected()},openAddActivityDialog:function(id,type){Dialog.open("adminworkfloweditactivity","adminworkfloweditactivity[dialog=stop]&id="+id+"&type="+type,"QueuedPageUpdate('soprotocol:adminworkflow[noupdate=true]."+type+"[refresh=true]');")},openAddDocumentDialog:function(id,type){Dialog.open("adminworkfloweditdocument","adminworkfloweditdocument[dialog=stop]&id="+id+"&type="+type,"QueuedPageUpdate('soprotocol:adminworkflow[noupdate=true]."+type+"[refresh=true]');")},deleteActivities:function(ids,type){for(var idList="",i=0;i{var pub={setDeletedNumbersListItemCallback:function(context){1==context._status&&(AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminSystemNumberAllocationDataHandler.DeleteRefCount","",context._context),g_archiveadminusersNumbersArchive.RefreshList())},setDeletedNumbersListItem:function(row,value){Dialog.YesNo("SuperOffice","[SR_ADMIN_REMOVE_NUMBERING]","question","","SuperOffice.Admin.System.setDeletedNumbersListItemCallback",row.id)},setDeletedEventsListItemCallback:function(context){1==context._status&&(AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminSystemEventDataHandler.deleteSystemEvent","",context._context),g_archiveadmineventsArchive.Refresh())},addSystemEvent:function(){Dialog.open("admineditsystemevent","admineditsystemevent[dialog=stop]?adminsystemevent_id=0",'QueuedPageUpdate("soprotocol:adminlicense.main[refresh=true]?adminsystemevent=g_clientOptions.LastValidHistoryItem");')},setDeletedEventsListItem:function(row,value){Dialog.YesNo("SuperOffice","[SR_ADMIN_DELETE_SYSTEMEVENT]","question","","SuperOffice.Admin.System.setDeletedEventsListItemCallback",row.id)},EnableDisableNumberAllocTextFields:function(nextNumber,travel,satellite,allocCheckbox){"checked"==$("[soid='"+allocCheckbox+"']").attr("checked")?(SuperOffice.SoHelper.enableElementBySoId(nextNumber),SuperOffice.SoHelper.enableElementBySoId(travel),SuperOffice.SoHelper.enableElementBySoId(satellite)):(SuperOffice.SoHelper.disableElementBySoId(nextNumber),SuperOffice.SoHelper.disableElementBySoId(travel),SuperOffice.SoHelper.disableElementBySoId(satellite))},SaveNumberEachTemplate:function(elementName,buttonName){elementName=SuperOffice.SoHelper.getElementBySoId(elementName).checked;elementName?SuperOffice.SoHelper.enableElementBySoId(buttonName):SuperOffice.SoHelper.disableElementBySoId(buttonName),AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminSystemNumberAllocationDataHandler.SetNumberEachTemplate","",elementName)},openPreferredTimeZoneDialog:function(){Dialog.open("adminsystemeditpreferredtimezone","adminsystemeditpreferredtimezone[dialog=stop]?",'QueuedPageUpdate("soprotocol:adminsystem[noupdate=true].timezones[refresh=true]");')},openBaseTimeZoneDialog:function(){Dialog.open("adminsystemeditbasetimezone","adminsystemeditbasetimezone[dialog=stop]?",'QueuedPageUpdate("soprotocol:adminsystem[noupdate=true].timezones[refresh=true]");')},enableTimeZones:function(tz){Dialog.open("adminsystemedittimezone","adminsystemedittimezone[dialog=stop]?","SuperOffice.Admin.System.fetchTimeZones();")},openEnableTimezoneDialog:function(){SuperOffice.Admin.Fields.hideStuff(),setTimeout('AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminTimeZoneDataHandler.RetrieveTimeZoneData", "");SuperOffice.Admin.System.openEnableTimezoneDialog2();',1e3)},openEnableTimezoneDialog2:function(){Dialog.open("adminsystemedittimezone","adminsystemedittimezone[dialog=stop]?",'QueuedPageUpdate("soprotocol:adminsystem[noupdate=true].timezones[refresh=true]");')},regenFreeTextIndex:function(){SendWorkerCommand("AlarmWorker","CreateTempTask","[SR_BATCH_FREETEXTREGENBATCHPLUGIN_NAME]"),SuperOffice.SoHelper.disableElementBySoId("adminFreetextRegenButt"),AjaxMethodDispatcher.CallASync("","","","","SuperOffice.CRM.Web.Data.AdminSystemFreetextSearchDataHandler.GenereateFreeTextIndex"),setTimeout(()=>SuperOffice.SoHelper.enableElementBySoId("adminFreetextRegenButt"),1e4)},fetchTimeZones:function(){SuperOffice.Admin.Fields.hideStuff(),setTimeout('AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminTimeZoneDataHandler.RetrieveTimeZoneData", "");QueuedPageUpdate("soprotocol:adminsystem[noupdate=true].timezones[refresh=true]");',1e3)},updateGuiIfAvailableTimeZones:function(availablegroup,unavailablegroup){var timeZonesAvailable=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminTimeZoneDataHandler.CheckNewTimeZoneDataAvailable","");return AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminTimeZoneDataHandler.IsTimeZonesEnabled","")?timeZonesAvailable?(SuperOffice.SoHelper.hideElementBySoId(unavailablegroup),SuperOffice.SoHelper.showElementBySoId(availablegroup)):(SuperOffice.SoHelper.hideElementBySoId(availablegroup),SuperOffice.SoHelper.showElementBySoId(unavailablegroup)):(SuperOffice.SoHelper.hideElementBySoId(unavailablegroup),SuperOffice.SoHelper.hideElementBySoId(availablegroup)),timeZonesAvailable},timeZoneDataFromFileCallback:function(filename){filename=decodeURIComponent((filename+"").replace(/\+/g,"%20")),AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminTimeZoneDataHandler.UploadTimeZoneDataFile","",filename),QueuedPageUpdate("soprotocol:adminsystem[noupdate=true].timezones[refresh=true]")},timezonesFilterSearch:function(){var value=so("adminSystemTimeZonesSearchBox_textfield").value;AjaxMethodDispatcher.CallSync("SuperOffice.DCF.Web.AjaxMethods.SuperState.SetCurrent","","admintimezonesfilter",0,value,"source"),QueuedPageUpdate("soprotocol:adminsystem[noupdate=true].timezones[refresh=true]")},searchBoxSourceKeyPressed:function(event){13==event.keyCode&&SuperOffice.Admin.System.timezonesFilterSearch()},toggleActiveTimeZoneRow:function(primaryKey){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminTimeZoneDataHandler.ToggleActiveTimeZoneRow","",parseInt(primaryKey,10))},deleteTimezones:function(){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminSystemEditTimezoneDataHandler.DeleteTimezones",""),Dialog.closeWithCallback()},setActiveTimeZonesByFilter:function(archive,active){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminTimeZoneDataHandler.SetActiveTimeZonesByFilter","",active),archive.RefreshList()},OnBatchEvent:function(obj){g_debug.trace("OnBatchEvent("+obj+")","FreetextRegenBatchPlugin")}};return pub})(),SuperOffice.Admin.Protocol=(()=>{var pub={tryExecuteHandler:function(protocol){var elemId="soTestProtocolElement",win=document.getElementById(elemId),elemId=(null==win&&((win=document.createElement("iframe")).setAttribute("id",elemId),win.setAttribute("style","height:0px;width:0px;visibility:hidden"),win=document.body.appendChild(win)),document.createElement("a")),elemId=(elemId.setAttribute("href",protocol),elemId.protocolLong);if(alert(elemId),"Unknown Protocol"!=elemId)try{win.contentWindow.location=protocol}catch(e){alert(e)}}};return pub})(),SuperOffice.Admin.Import=(()=>{var pub={},lastBatchJob=0;return new Array,pub.uploadExcelFile=function(filename){filename=decodeURIComponent((filename+"").replace(/\+/g,"%20")),AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminImportFileUploadDataHandler.UploadFile","",filename)},pub.clearImportData=function(){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminImportDataHandler.ClearImportData","")},pub.checkGoogleDialog=function(){1==JsHelper.GetCookie("importDone")?PageUpdate("soprotocol:adminimportwizard.importfile[mode=edit]?stage=1&adminimportselectedsource_id=3",""):2!=JsHelper.GetCookie("importDone")&&setTimeout(pub.checkGoogleDialog,400)},pub.openGoogleDialog=function(){JsHelper.SetCookie("importDone",0,1),Dialog.openExt("adminimportgoogle","adminimportgoogle[dialog=stop]",""),setTimeout(pub.checkGoogleDialog,400)},pub.openErpDialog=function(){JsHelper.SetCookie("importDone",0,1),Dialog.open("adminimportselecterp","adminimporterp[dialog=stop&usersuperstatecopy=true]","SuperOffice.Admin.Import.OpenErpCallback();")},pub.OpenImportSettingsDialog=function(){var currentImportEntity=AjaxMethodDispatcher.CallSync("SuperOffice.DCF.Web.AjaxMethods.SuperState.GetCurrent","","AdminImportEntityType");null!=currentImportEntity&&4==currentImportEntity.Id?Dialog.open("adminimportrules","adminimportproductrules[dialog=stop]","PageUpdate('soprotocol:importfile[refresh=true]', '')"):Dialog.open("adminimportrules","adminimportrules[dialog=stop]","PageUpdate('soprotocol:importfile[refresh=true]', '')")},pub.gotoErpStep=function(step){PageUpdate("soprotocol:adminimportwizard.importfile[mode=edit]?stage="+step+"&adminimportselectedsource_id=4","")},pub.OpenErpCallback=function(){var connection=Dialog.getReturnValue();Dialog.open("adminimporterpfind","adminimporterpfind[dialog=stop].findcontact?criterionentity_id=0&criterionentity_name=findcontact&findtype_id=1&findtype_type=single&connectionid="+connection.connection+"&erpactortype="+connection.actorType,'SuperOffice.Admin.Import.gotoErpStep("1")')},pub.startImport=function(){var elems=$('[soid="AdminImportWizardCard"]');1==elems.length&&elems.append("
 
"),PageUpdate("soprotocol:adminimportwizard[refresh=true].importdone[mode=save]?stage=last","")},pub.previewImport=function(){var elems=$('[soid="adminImportGridControlGroup"]'),elems=(1==elems.length&&elems.append("
 
"),$('[soid="adminImportComment_textfield"]'));1==elems.length&&AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.UserPreferences.SetAndSave","","GDPR","ImportConsentComment",elems[0].value),AjaxMethodDispatcher.CallASync("SuperOffice.Admin.Import.previewImportBeforeCallback","","","","SuperOffice.CRM.Web.AjaxMethods.Import.GetPreviewData")},pub.previewImportAll=function(){var elems=$('[soid="adminImportGridControlGroup"]'),elems=(1==elems.length&&elems.append("
 
"),$('[soid="adminImportComment_textfield"]'));1==elems.length&&AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.UserPreferences.SetAndSave","","GDPR","ImportConsentComment",elems[0].value),AjaxMethodDispatcher.CallASync("SuperOffice.Admin.Import.previewImportAllBeforeCallback","","","","SuperOffice.CRM.Web.AjaxMethods.Import.GetPreviewDataAll")},pub.previewImportAllBeforeCallback=function(){PageUpdate("soprotocol:importpreview[refresh=true]?stage=2","")},pub.previewImportBeforeCallback=function(){PageUpdate("soprotocol:importpreview?stage=2","")},pub.navigateToImportSelection=function(selectionId){0{var pub={entityTypeNumber:"0",entityTypeName:"",savePositions:function(fieldArray){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.UserDefinedFields.SetPosition","",this.entityTypeName,fieldArray),PageUpdate("soprotocol:?AdminAllowPageOnePerGroup_id=1","")},selectUdefFields:function(type){SuperOffice.Controls.Udef("admin"+this.entityTypeName+"udef").select(type)},openNewFieldDialog:function(){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.SuperState.SetCurrent","","AdminUserDefinedField",0,"",""),Dialog.open("adminfieldseditfield","adminfieldseditfield[dialog=stop]?adminuserdefinedfieldentitytype_id="+this.entityTypeNumber+"&adminuserdefinedfieldentitytype_name="+this.entityTypeName,"QueuedPageUpdate('soprotocol:adminfields[noupdate=true&nocache=true].udef_"+this.entityTypeName+"[refresh=true]');")},openEditFieldDialog:function(rowid){var soprotocol;1==AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminUdefDataHandler.SelectedUdefHasAdminVersion","")&&(soprotocol="adminfieldseditfield[dialog=stop]?adminuserdefinedfieldentitytype_id="+this.entityTypeNumber+"&adminuserdefinedfieldentitytype_name="+this.entityTypeName,void 0!==rowid&&(soprotocol+="&AdminUserDefinedField_id="+rowid),Dialog.open("adminfieldseditfield",soprotocol,"QueuedPageUpdate('soprotocol:adminfields[noupdate=true&nocache=true].udef_"+this.entityTypeName+"[refresh=true]');"))},setPageOneGroup:function(groupId){PageUpdate("soprotocol:?AdminPageOneGroup_id="+groupId,"")},setGrouping:function(isSet){SuperOffice.SoHelper.disableElementsBySoId(this.pageoneCheckboxid),AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.UserDefinedFields.SetUdefGrouping","",this.entityTypeName+"",isSet),PageUpdate("soprotocol:?AdminPageOneGroup_id=0&AdminAllowPageOnePerGroup_id="+(isSet?"1":"0"),"")},setFieldType:function(type){QueuedPageUpdate("soprotocol:adminfieldseditfield[dialog=stop].main[mode=edit]","")},changeIndex:function(){QueuedPageUpdate("soprotocol:adminfieldseditfield[dialog=stop].main[mode=edit]","")},changeIsMandatory:function(){var mandatoryCheckBox=so("MandatoryCheckbox"),readOnlyCheckBox=so("ReadOnlyCheckbox");mandatoryCheckBox.checked&&(readOnlyCheckBox.checked=!1),readOnlyCheckBox.disabled=mandatoryCheckBox.checked},changeIsReadOnly:function(){var mandatoryCheckBox=so("MandatoryCheckbox"),readOnlyCheckBox=so("ReadOnlyCheckbox");readOnlyCheckBox.checked&&(mandatoryCheckBox.checked=!1),mandatoryCheckBox.disabled=readOnlyCheckBox.checked},publish:function(){pub.hideStuff(function(){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.UserDefinedFields.CheckIfPublishNeedsBackupWarning","",pub.entityTypeName)?Dialog.YesNo("","[SR_UDEF_PUBLISHWARNING]","question","","SuperOffice.Admin.Fields.publishCallback",""):(AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.UserDefinedFields.Publish","",pub.entityTypeName),pub.publishFinishedCallback())})},hideStuff:function(callback){$(so("whiteCurtain")).fadeTo(0,0,function(){$(so("whiteCurtain")).css({zIndex:999}).fadeTo(500,.75,callback)})},showStuff:function(){$(so("whiteCurtain")).fadeTo(0,.75).css({zIndex:999}).fadeTo(500,0,function(){$(so("whiteCurtain")).css({zIndex:-999})})},hideIfPublishing:function(){""!=pub.entityTypeName&&AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.UserDefinedFields.IsPublishEventActive","",pub.entityTypeName)&&$(so("whiteCurtain")).fadeTo(0,.75).css({zIndex:999})},publishCallback:function(res){1==res.getStatus()?(pub.hideIfPublishing(),AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.UserDefinedFields.Publish","",pub.entityTypeName),SendWorkerCommand("AlarmWorker","CreateTempTask","SR_FIELDS_PUBLISH_STARTED")):pub.showStuff()},revert:function(){Dialog.YesNo("","[SR_UDEF_REVERT_TOOLTIP]","question","","SuperOffice.Admin.Fields.revertCallback","")},revertCallback:function(res){1==res.getStatus()&&(AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.UserDefinedFields.Revert","",pub.entityTypeName),QueuedPageUpdate("soprotocol:adminfields[noupdate=true&nocache=true].udef_"+pub.entityTypeName+"[refresh=true]"))},setPageOneField:function(id,pageNo){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.UserDefinedFields.SetPageOneField","",pub.entityTypeName,Number(id),pageNo),PageUpdate("soprotocol:?AdminAllowPageOnePerGroup_id="+g_clientOptions.LastValidHistoryItem,"")},deleteSelectedField:function(){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminUdefDataHandler.DeleteSelectedField",""),QueuedPageUpdate("soprotocol:adminfields[noupdate=true&nocache=true].udef_"+pub.entityTypeName+"[refresh=true]")},OnBatchEvent:function(obj){if(g_debug.trace("OnBatchEvent("+obj+")","PublishUserDefinedFields"),null!=obj.BatchTaskInfos&&0{var pub={reassignToId:0,setReassignToId:function(id){this.reassignToId=id},selectAll:function(archive){archive.selectAll()},markSelectedUsersForDeletion:function(archive){for(var rows=archive.getSelectedRows(),ids="",i=0;i{var pub={searchBoxSourceKeyPressed:function(event){13==event.keyCode&&pub.searchBoxSourceSearch()},searchBoxSourceSetIcon:function(search){search?(so("AdminSystemLabelsSourceSearchBoxIcon").style.display="inline-block",so("AdminSystemLabelsSourceSearchBoxIcon").style.visibility="visible",so("AdminSystemLabelsSourceClearBoxIcon").style.display="none",so("AdminSystemLabelsSourceClearBoxIcon").style.visibility="hidden"):(so("AdminSystemLabelsSourceSearchBoxIcon").style.display="none",so("AdminSystemLabelsSourceSearchBoxIcon").style.visibility="hidden",so("AdminSystemLabelsSourceClearBoxIcon").style.display="inline-block",so("AdminSystemLabelsSourceClearBoxIcon").style.visibility="visible")},searchBoxSourceSearch:function(){var value;"InitText"!=so("AdminSystemLabelsSourceSearchBox_textfield").className&&(value=so("AdminSystemLabelsSourceSearchBox_textfield").value,pub.searchBoxSourceSetIcon(0==value.length),QueuedPageUpdate("soprotocol:adminsystem[noupdate=true].labels?adminlabelssearchBox_id=0&adminlabelssearchBox_name="+value+"&adminlabelssearchBox_type=source"))},searchBoxSourceClear:function(){so("AdminSystemLabelsSourceSearchBox_textfield").value="",pub.searchBoxSourceSetIcon(!0),QueuedPageUpdate("soprotocol:adminsystem[noupdate=true].labels?adminlabelssearchBox_id=0&adminlabelssearchBox_name="+so("AdminSystemLabelsSourceSearchBox_textfield").value+"&adminlabelssearchBox_type=source")},searchBoxSourceKeyDown:function(){so("AdminSystemLabelsTargetSearchBox_textfield").value="",pub.searchBoxSourceSetIcon(!0),pub.searchBoxTargetSetIcon(!0)},searchBoxTargetKeyPressed:function(event){13==event.keyCode&&pub.searchBoxTargetSearch()},searchBoxTargetSetIcon:function(search){search?(so("AdminSystemLabelsTargetSearchBoxIcon").style.display="inline-block",so("AdminSystemLabelsTargetSearchBoxIcon").style.visibility="visible",so("AdminSystemLabelsTargetClearBoxIcon").style.display="none",so("AdminSystemLabelsTargetClearBoxIcon").style.visibility="hidden"):(so("AdminSystemLabelsTargetSearchBoxIcon").style.display="none",so("AdminSystemLabelsTargetSearchBoxIcon").style.visibility="hidden",so("AdminSystemLabelsTargetClearBoxIcon").style.display="inline-block",so("AdminSystemLabelsTargetClearBoxIcon").style.visibility="visible")},searchBoxTargetSearch:function(){var value;"InitText"!=so("AdminSystemLabelsTargetSearchBox_textfield").className&&(value=so("AdminSystemLabelsTargetSearchBox_textfield").value,pub.searchBoxTargetSetIcon(0==value.length),QueuedPageUpdate("soprotocol:adminsystem[noupdate=true].labels?adminlabelssearchBox_id=0&adminlabelssearchBox_name="+value+"&adminlabelssearchBox_type=target"))},searchBoxTargetClear:function(){so("AdminSystemLabelsTargetSearchBox_textfield").value="",pub.searchBoxTargetSetIcon(!0),QueuedPageUpdate("soprotocol:adminsystem[noupdate=true].labels?adminlabelssearchBox_id=0&adminlabelssearchBox_name="+so("AdminSystemLabelsTargetSearchBox_textfield").value+"&adminlabelssearchBox_type=target")},searchBoxTargetKeyDown:function(){so("AdminSystemLabelsSourceSearchBox_textfield").value="",pub.searchBoxTargetSetIcon(!0),pub.searchBoxSourceSetIcon(!0)},clearSearchBox:function(){QueuedPageUpdate("soprotocol:adminsystem[noupdate=true].labels?adminlabelssearchBox_id=0&adminlabelssearchBox_name=&adminlabelssearchBox_type=")},openEditLabelDialog:function(resourceName){Dialog.open("adminsystemeditlabel","adminsystemeditlabel[dialog=stop]?adminlabel_id=123&adminlabel_type="+resourceName,"QueuedPageUpdate('soprotocol:adminsystem[noupdate=true].labels[refresh=true]');")},deleteSelectedLabels:function(ids){for(var stringArray="",i=0;i{var pub={OpenAddConsentPurposeDialog:function(id,archiveControl){var isEdit=0<(id=parseInt(id,10));$sodlgm.open(null,{id:"AddConsentPurpose",recipeName:"AddConsentPurposeDialog",caption:isEdit?"[SR_ADMIN_CONSENT_PURPOSE_EDIT]":"[SR_ADMIN_CONSENT_PURPOSE_ADD]",windowSetting:{width:"700px",height:"570px"}},function(ctx){isEdit&&(ctx.set("purposeId",id),console.log(ctx))},function(){archiveControl.RefreshList()},"editconsentpurpose")},DeleteConsentPurposes:function(consentPurposeRows,archiveControl){consentPurposeRows=consentPurposeRows.map(function(r){return parseInt(r.id)});AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminPrivacyDataHandler.RemoveConsentPurposes","",consentPurposeRows),archiveControl.RefreshList()},RestoreConsentPurposes:function(consentPurposeRows,archiveControl){consentPurposeRows=consentPurposeRows.map(function(r){return parseInt(r.id)});AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminPrivacyDataHandler.RestoreConsentPurposes","",consentPurposeRows),archiveControl.RefreshList()},ToggleActive:function(selectedRows,archiveControl){selectedRows=selectedRows.map(function(r){return parseInt(r.id)});AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminPrivacyDataHandler.ToggleActive","",selectedRows),archiveControl.RefreshList()},sort:function(archiveControl){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminPrivacyDataHandler.SortList",""),archiveControl.RefreshList()},moveUp:function(archiveControl){var id=archiveControl.getSelectedRows().map(function(r){return parseInt(r.id)})[0];id<=0||(AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminPrivacyDataHandler.MoveListItem","",id,-1),archiveControl.RefreshList())},moveDown:function(archiveControl){var id=archiveControl.getSelectedRows().map(function(r){return parseInt(r.id)})[0];id<=0||(AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminPrivacyDataHandler.MoveListItem","",id,1),archiveControl.RefreshList())},setRestoreButtonState:function(id,archiveControl){for(var rows=archiveControl.getSelectedRows(),i=0;i{var pub={addConnector:function(callback){Dialog.open("adminediterpsyncconnector","adminediterpsyncconnector[dialog=stop]",callback)},addConnection:function(callback){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminErpSyncDataHandler.IsErpSyncEngineOn","")?Dialog.Information("[SR_ADMIN_EIS]","[SR_EIS_ON]","error"):(AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.SuperState.SetCurrent","","AdminErpConnection",0,"",""),AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.SuperState.SetCurrent","","AdminErpSelectedConnector",0,"",""),AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminEditErpConnectionDataHandler.ClearCachedErpConnection",""),Dialog.open("AdminEditErpConnection","adminediterpconnection[dialog=stop]?newItem=1",callback+"SuperOffice.PageBuilder.refreshCurrent('adminerpconnection');"))},adminEditErpConnection:function(erpConnectionId,isActive,callback){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminErpSyncDataHandler.IsErpSyncEngineOn","")?Dialog.Information("[SR_ADMIN_EIS]","[SR_EIS_ON]","error"):(AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminEditErpConnectionDataHandler.ClearCachedErpConnection",""),Dialog.open("AdminEditErpConnection","adminediterpconnection[dialog=stop]?connectionId="+erpConnectionId+"&adminerpconnection_id="+erpConnectionId,callback+" SuperOffice.PageBuilder.refreshCurrent('adminerpconnection');"))},SelectFirstRow:function(id,instance){0{var pub={setQuoteConnector:function(id,name){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.SuperState.SetCurrent","","AdminQuoteSelectedConnector",id,name,"")},saveSettings:function(fieldname,value){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminConfigureQuoteSettingsDataHandler.SaveSettings","",fieldname,value)&&SuperOffice.PageBuilder.refresh()},OpenSaleTypes:function(id){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.SuperState.SetCurrent","","adminlist",id,"",""),QueuedPageUpdate("soprotocol:adminlists.main")},enableLabelSubstitution:function(){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminConfigureQuoteLineDataHandler.EnableLabelSubstitution",""),SuperOffice.PageBuilder.refresh()},addConnection:function(){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.SuperState.SetCurrent","","AdminQuoteConnection",0,"",""),AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminEditQuoteConnectionDataHandler.ClearCachedQuoteConnection",""),Dialog.open("AdminEditQuoteConnection","admineditquoteconnection[dialog=stop]","QueuedPageUpdate('soprotocol:adminquote[noupdate=true].connections[refresh=true]');")},editConnection:function(id){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.SuperState.SetCurrent","","AdminQuoteConnection",id,"",""),Dialog.open("AdminEditQuoteConnection","admineditquoteconnection[dialog=stop]","adminquoteConnectionsControlArchiveControl.RefreshList();")},removeConnection:function(){Dialog.YesNo("","[SR_ADMIN_QUOTE_CONFIRM_DELETE_CONNECTION]","question","","SuperOffice.Admin.Quote.removeConnectionCallback","")},removeConnectionCallback:function(res){1==res.getStatus()&&(AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminEditQuoteConnectionDataHandler.RemoveConnection",""),g_archiveadminquoteConnectionsControl.RefreshList())},restoreConnection:function(){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminEditQuoteConnectionDataHandler.RestoreConnection",""),g_archiveadminquoteConnectionsControl.RefreshList()},testConnection:function(){PageUpdate("soprotocol:admineditquoteconnection[dialog=stop].main[mode=edit]?test=true",""),Dialog.open("AdminTestQuoteConnection","admintestquoteconnection[dialog=stop]","QueuedPageUpdate('soprotocol:admineditquoteconnection[dialog=stop].main[mode=edit]', '');")},testConnectionFromToolbar:function(){Dialog.open("AdminTestQuoteConnection","admintestquoteconnection[dialog=stop]?fromToolbar=true","")},disableEditConnectionOk:function(soElement){},editConnectionScope:function(){Dialog.open("AdminEditQuoteConnectionScope","admineditquoteconnectionscope[dialog=stop]","QueuedPageUpdate('soprotocol:admineditquoteconnection[dialog=stop].main[refresh=true]&specificScope=true', '');")},setScope:function(specific){QueuedPageUpdate("soprotocol:admineditquoteconnection[dialog=stop].main[refresh=true]&specificScope="+specific,"")},hideOrShowScope:function(allAccess){"True"==allAccess?SuperOffice.SoHelper.hideElementBySoId("AdminEditQuoteConnectionScopeSpecificLink"):SuperOffice.SoHelper.showElementBySoId("AdminEditQuoteConnectionScopeSpecificLink")},showAssociates:function(){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.SuperState.SetCurrent","","AdminQuoteScopeAssociateOrUserGroup",0,"associates",""),QueuedPageUpdate("soprotocol:admineditquoteconnectionscope[dialog=stop].main[refresh=true]")},showUserGroups:function(){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.SuperState.SetCurrent","","AdminQuoteScopeAssociateOrUserGroup",0,"usergroups",""),QueuedPageUpdate("soprotocol:admineditquoteconnectionscope[dialog=stop].main[refresh=true]")},addProduct:function(){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.SuperState.SetCurrent","","AdminProduct",0,"",""),AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.SuperState.SetCurrent","","AdminProductImage",0,"","");var priceListId=so("adminquoteProductsPriceLists_SelectedValue").value;Dialog.open("AdminEditProduct","admineditproduct[dialog=stop]?priceListForProduct="+priceListId,"QueuedPageUpdate('soprotocol:adminquote[noupdate=true].products[refresh=true]?adminpricelist_id="+priceListId+"');")},editProduct:function(id){AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.SuperState.SetCurrent","","AdminProduct",id,"",""),Dialog.open("AdminEditProduct","admineditproduct[dialog=stop]","QueuedPageUpdate('soprotocol:adminquote[noupdate=true].products[refresh=true]');")},saveProductAndCreateNew:function(){SuperOffice.PageBuilder.save(function(){Dialog.close(),UIHelper.GetOpener().Dialog.open("AdminEditProduct","admineditproduct[dialog=stop]?AdminProduct_id=0&AdminProductImage_id=0",'QueuedPageUpdate("soprotocol:adminquote[noupdate=true].products[refresh=true]", "");'),UIHelper.GetOpener().QueuedPageUpdate("soprotocol:adminquote[noupdate=true].products[refresh=true]","")})}};return pub._productsToDelete=new Array,pub.removeProductFromPriceList=function(products){pub._productsToDelete=products,SuperOffice.Admin.Quote.doRemoveProducts()},pub.doRemoveProducts=function(){var products=pub._productsToDelete,yesToAll=1{var pub={SetWidth:function(width,names){for(var i=0;i{var pub={},soStateDataObjectsObject=null;return pub.hasDataCarrier=function(dataCarrierId){return void 0!==this[dataCarrierId]},pub.updateServerState=function(fnRefresh){this.updateStateObject(),"function"==typeof fnRefresh?fnRefresh():QueuedPageUpdate("soprotocol:"+SuperOffice.Environment.SoProtocolPageAndView+"[Request=Callback&mode=edit]","")},pub.updateStateObject=function(){var dStart=new Date;null==soStateDataObjectsObject&&(soStateDataObjectsObject=$.fromSoId("sostatedata").jsonParse());for(var t=0;t{for(var t=0;t{var pub={OpenFromScilRecipe:function(recipeName,caption,options,dialogOptions){dialogOptions=dialogOptions||{},$sodlgm.open(null,{id:recipeName,recipeName:recipeName,caption:caption,windowSetting:{resizable:dialogOptions.resizable,width:dialogOptions.width||"500px",height:dialogOptions.height||"570px"}},function(ctx){for(var propertyName in options)ctx.set(propertyName,options[propertyName])},function(ctx,state){if(99===state)return ctx.sendCommand("closeMyDialog",null).then(function(){return!0}).catch(function(){return!1})})},GetDialogCallbackFunction:function(){try{return opener.Dialog.getChildDialog(Dialog.getDialogName()).getCloseCallback()}catch(e){try{return UIHelper.SafeGetOpener().Dialog.getChildDialog(Dialog.getDialogName()).getCloseCallback()}catch(ex){return""}}},ShowOnlineLearning:function(){var sURL=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Dialog.GetOnlineLearningURL","");""!=sURL&&window.open(sURL,"CourseWindow","top=0,left=0,height=813,width=1515,scrollbars=yes, resizable=yes, status=no,toolbar=no,menubar=no,location=no")},ShowUrl:function(sURL){""!=(sURL=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Dialog.SubstituteTemplateVariablesInUrl","",sURL))&&window.open(sURL,"CourseWindow","top=0,left=0,height=810,width=1264,scrollbars=yes, resizable=yes, status=no,toolbar=no,menubar=no,location=no")},ShowUrlInNewTab:function(sURL){""!==(sURL=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Dialog.SubstituteTemplateVariablesInUrl","",sURL))&&window.open(sURL,void 0,"noopener")},SetFirstTimeDialogHookFunction:function(f){alert("OBSOLETE function SetFirstTimeDialogHookFunction called. This MUST be fixed. This applies to online only.")}};return pub})(),SuperOffice.Dialog.Size=(()=>{var pub={};return pub.pages=new Array,pub.GetDialogInfos=function(callback){var lPages=SuperOffice.Dialog.Size.GetPages();AjaxMethodDispatcher.CallASync(function(dialogInfo){for(var i=0;i"),that=this,name=$(""+$("").text(name).html()+""),di=(g_clientOptions.Debug&&null!=(di=that.getRootWindow().Dialog.dialogList[level])&&name.attr("title",di.SoProtocol),$("").addClass("DialogCloseButton")),dialogInfo=(di.css({visibility:"visible"}),0==level?di.on("click",function(){Dialog.close(level)}):di.on("click",function(){getIframeWindow(that.getRootWindow().Dialog.dialogList[level].iframe).IFrameClose(level)}),this.getRootWindow().Dialog.dialogList[0]);return dialogInfo&&dialogInfo.Info?.Minimizable&&0==this.getRootWindow().$("[minimized='true']").length&&0==level&&((minimizeImg=$("").addClass("DialogMinimizeButton")).css({visibility:"visible"}),tName=dialogInfo.name+"",minimizeImg.on("click",function(){return that.getRootWindow().Dialog.minimize(tName),!1}),crumb.on("click",function(){that.getRootWindow().Dialog.maximize(tName)}),crumb.append(minimizeImg)),crumb.append(di),crumb.append(name),crumb},_this.removeCrumb=function(level){void 0===level&&(level=this.getDialogLevel());var elem=this.getRootWindow().$("#crumb"+(level-1));elem.fadeTo(400,0,"",function(){elem.remove()})},_this.setHeight=function(height){this.getRootWindow().Dialog._setHeight(height)},_this._setHeight=function(height){var headerDiv=$("#inlinedialogContainer"),rect=getWindowRectangle();headerDiv.css({top:(rect._y-height)/2+"px",height:height}),this.onFrameResize(height,32,32)},_this.onResize=function(doAnimation){var that=this,level=this.getRootWindow().Dialog.currentLevel,level=this.getRootWindow().Dialog.dialogList[level],headerDiv=$("#inlinedialogContainer"),rect=getWindowRectangle(),useRealSize=level.Info.Size.Width<=600||level.Info.ForceSize,height=Math.min(useRealSize?level.Info.Size.Height+34:.84*rect._y,1440,rect._y-100),useRealSize=Math.min(useRealSize?level.Info.Size.Width:.84*rect._x,2048,rect._x-100);this.onFrameResize(height,32,32),doAnimation?headerDiv.animate({top:(rect._y-height)/2+"px",left:(rect._x-useRealSize)/2+"px",width:useRealSize,height:height},200,function(){$(that.getRootWindow().Dialog.childDialog.iframe).css({width:"100%"})}):headerDiv.css({top:(rect._y-height)/2+"px",left:(rect._x-useRealSize)/2+"px",width:useRealSize,height:height})},_this.onFrameResize=function(headerHeight,top,bottom){Dialog.childDialog&&($(Dialog.childDialog.iframe).css({top:top+"px",height:headerHeight-bottom+"px"}),getIframeWindow(Dialog.childDialog.iframe).Dialog)&&getIframeWindow(Dialog.childDialog.iframe).Dialog.onFrameResize(headerHeight,0,32)},_this.maximize=function(name){var that,headerDiv=$("#minimized_"+name+"_inlinedialogContainer");0")).attr("class","dialogHeaderDiv"),0==level&&(captionDiv=$("
"),headerDiv.append(captionDiv)),0"),$("#inlinedialogfrm"+name));0!=jIframe.length&&dialogInfo.ClientCache?(null!=(elem=getIframeWindow(ifrm=jIframe[0]).getFromSoId("DialogCard"))&&(elem.innerHTML="",$(elem).append("
")),headerDiv.find(".SpinnerCenter").remove(),getIframeWindow(ifrm).getPlaceholders().each(function(){this.innerHTML="",$(this).append("
")}),queryitems=soprotocol.replace("soprotocol:",""),0===(callbackqueryItems=getIframeWindow(ifrm).$("#__CALLBACKQUERYITEMS")).length?getIframeWindow(ifrm).$("#aspnetForm").append(""):callbackqueryItems.val(queryitems),getIframeWindow(ifrm).IFramePageUpdate(soprotocol,""),getIframeWindow(ifrm).IFrameOnLoad("var crumb = Dialog.makecrumb(g_pageTitle,"+level+');crumb.appendTo( Dialog.getRootWindow().$("#inlinedialogCaption")); Dialog.getRootWindow().$("#inlinedialogContainer").find(".SpinnerCenter").remove();')):($("#inlinedialogfrm"+name).remove(),ifrm=document.createElement("IFRAME"),primerSoprotocol=soprotocol.replace("soprotocol:",""),$(ifrm).attr({name:"iframe_"+name,id:"inlinedialogfrm"+name,class:"dialogHeaderFrm",frameBorder:0,marginHeight:0,marginWidth:0,scrolling:"no",allow:"camera; microphone; display-capture",src:"default.aspx?"+primerSoprotocol}),$(ifrm).appendTo(headerDiv),backgroundload||$(ifrm).on("load",function(){that.makecrumb(getIframeWindow(ifrm).g_pageTitle,level,ifrm).appendTo(captionDiv),headerDiv.find(".SpinnerCenter").remove()})),backgroundload?($(ifrm).hide(),$(ifrm).load(function(){setTimeout("Dialog.getRootWindow().focus();",500)})):(g_isMainpage?this.lockMainWindow(!0):0==level?headerDiv.css({top:"0",left:"2px",right:"2px",bottom:"0px"}):(headerDiv.css({top:"0",left:"0px",right:"0px",bottom:"0px"}),$(ifrm).css({border:"solid 0px white"})),this.childDialog={name:name,container:headerDiv[0],iframe:ifrm,Dialog:that,Info:dialogInfo,SoProtocol:soprotocol},Dialog.scilDialogHeaderZIndex=$(".scilDialogHeader").last().css("z-index"),Dialog.scilLockLayerZIndex=$(".SCILLockLayerMain").last().css("z-index"),$(".scilDialogHeader").css({zIndex:198}),$(".SCILLockLayerMain").css({zIndex:198}),$(ifrm).show(),$(ifrm).siblings("iframe").hide(),$(headerDiv).show(),$("html").hasClass("k-ff")&&$(ifrm).on("load",function(){$(ifrm).contents().find("body").on("keydown",function(e){return e.target&&"BODY"===e.target.nodeName&&8===e.keyCode?(e.preventDefault(),!1):void 0})}),this.getRootWindow().Dialog.dialogList[level]=this.childDialog,(0==(this.getRootWindow().Dialog.currentLevel=level)?($(this.lockLayerMain).on("mousedown",function(){$(that.lockLayerMain).fadeTo(200,0),$("#inlinedialogContainer").fadeTo(200,.1)}),$(this.lockLayerMain).on("mouseup",function(){$(that.lockLayerMain).fadeTo(200,.3),$("#inlinedialogContainer").fadeTo(200,1)}),$(this.lockLayerMain).on("mouseout",function(){$(that.lockLayerMain).fadeTo(200,.3),$(that.lockLayerMain).is(":visible")&&$("#inlinedialogContainer").fadeTo(200,1)}),PageEventHandler.addEvent(EventType.ONPAGERESIZE,"dialogResize","Dialog.onResize()"),rect=getWindowRectangle(),headerDiv.css({top:rect._y/2+"px",left:rect._x/2+"px",width:"0px",height:"0px"}),this):this.getRootWindow().Dialog).onResize())}catch(ex){console.log("ERROR:"+ex.message)}},_this.preLoad=function(){if(""==g_clientOptions.SubClient)for(var preLoadItems=[{pageId:"appointment",soprotocol:"appointment[dialogwinname=appointment&dialog=stop&fakeGET=true&preload=true]?appoinment_id=0&appointment_type=1"},{pageId:"person",soprotocol:"person[dialogwinname=person&dialog=stop&fakeGET=true&superstatecopy=0&preload=true]?person_id=0"}],i=0;ithis.getDialogLevel())){this.removeCrumb();var level=UIHelper.GetOpener().$("#inlinedialogContainer");if(0!=level.length&&(level.find("#inlinedialogfrm"+UIHelper.GetOpener().Dialog._dialogName).hide(),level.find("#inlinedialogfrm"+UIHelper.GetOpener().Dialog._dialogName).siblings("iframe").hide(),level.hide(),$(window).trigger("unload"),g_isMainpage||PageEventHandler.clearAllEvents(),UIHelper.GetOpener().g_isMainpage&&UIHelper.GetOpener().Dialog.unLockMainWindow(),UIHelper.GetOpener().Dialog._isModal)){level=UIHelper.GetOpener().Dialog.getCloseCallback();try{UIHelper.GetOpener().Dialog.evalCallback(level)}catch(ex){alert("Dialog callback execution went horribly wrong: "+ex.message)}UIHelper.GetOpener().Dialog.clearCloseCallback()}1===this.getDialogLevel()&&(level=UIHelper.GetOpener().Dialog,UIHelper.GetMainPageWindow().$(".scilDialogHeader").last().css({zIndex:level.scilDialogHeaderZIndex}),UIHelper.GetMainPageWindow().$(".SCILLockLayerMain").last().css({zIndex:level.scilLockLayerZIndex})),this.getRootWindow().Dialog.currentLevel=this.getRootWindow().Dialog.currentLevel-1,-1 Please allow pop-ups before continuing.","warning"),debug.trace("Dialog.open exception: "+ex.message,"Dialog")}},_this.ShowHelp=function(isMainPage){var pageId=SuperOffice.Environment.CurrentMainPageId===g_currentPageId?SuperOffice.Environment.SoProtocol:g_currentPageId,pageId=SuperOffice.Util.UrlDispatcher.GetHelpUrl(pageId);window.open(pageId,"SoHelpWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=yes,width=1024px,height=600px")},_this.ShowHelpFromIndex=function(index){index=SuperOffice.Util.UrlDispatcher.GetHelpUrlByIndex(index);window.open(index,"SoHelpWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=yes,width=1024px,height=600px")},_this.YesNo=function(title,text,dialogType,checkBoxText,callBack,context){title=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Dialog.YesNo","",title,text,dialogType,checkBoxText,callBack);Dialog.displayInlineModalDialog(title,context)},_this.YesNoHeading=function(title,text,dialogType,checkBoxText,callBack,context,heading){title=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Dialog.YesNoHeading","",title,text,dialogType,checkBoxText,callBack,heading);Dialog.displayInlineModalDialog(title,context)},_this.YesNoCancel=function(title,text,dialogType,callBack,context){title=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Dialog.YesNoCancel","",title,text,dialogType,callBack);Dialog.displayInlineModalDialog(title,context)},_this.ThreeButton=function(title,text,buttonText1,buttonText2,dialogType,context,callBack){title=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Dialog.ThreeButton","",title,text,buttonText1,buttonText2,dialogType,context,callBack);Dialog.displayInlineModalDialog(title,context)},_this.OkNormalButton=function(title,text,buttonText1,buttonText2,dialogType,context,callBack){title=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Dialog.OkNormalButton","",title,text,buttonText1,buttonText2,dialogType,context,callBack);Dialog.displayInlineModalDialog(title,context)},_this.OkNormalButtonWithCancel=function(title,text,buttonText1,buttonText2,dialogType,context,callBack){title=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Dialog.OkNormalButtonWithCancel","",title,text,buttonText1,buttonText2,dialogType,context,callBack);Dialog.displayInlineModalDialog(title,context)},_this.ButtonDialogWithCancel=function(title,text,dialogType,context,callBack){var buttonTexts="";if(4",i=0;ithis._clientWidth&&(newPosX=this._clientWidth-this.dlgLayer.getWidth()),newPosY+this.dlgLayer.getHeight()>this._clientHeight&&(newPosY=this._clientHeight-this.dlgLayer.getHeight()),this.dlgLayer.setLeft(newPosX),this.dlgLayer.setTop(newPosY)):data.cancelDragDrop()}onCancelDrag(data){this.afterDrag()}}class ResizeableDialog extends HeaderDialog{constructor(options){super(options),this._resizeDragStartWidth=0,this._resizeDragStartHeight=0,this._minWidth=this.getValue(this.options.Layout.MinWidth,10),this._minHeight=this.getValue(this.options.Layout.MinHeight,10),this._maxWidth=this.getValue(this.options.Layout.MaxWidth,0),this._maxHeight=this.getValue(this.options.Layout.MaxHeight,0)}Show(title){super.Show(title),this.dlgResizeGrip=$(document.createElement("DIV")),this.dlgResizeGrip.attr("id",this.dlgLayer.attr("id")+"ResizeGrip"),this.dlgResizeGrip.setClass(this.resizeGripClassName),this.dlgResizeGrip.setStyle({position:"absolute",zIndex:99,cursor:"nw-resize"}),this.dlgLayer.append(this.dlgResizeGrip);var that=this;this.dlgResizeGrip.on("mousedown",function(event){that.beforeDrag(),new DragDrop(that,{DragDropStartMethod:that.onResizeDragStart,DragDropEndMethod:that.onResizeDragEnd,DragDropMoveMethod:that.onResizeDragMove,DragDropCancelMethod:that.onResizeCancelDrag,DragElement:that.dlgResizeGrip,UseDragCursor:!1},null).StartDrag(event)}),null!=this.onOpenCallback&&("function"==typeof this.onOpenCallback?this.onOpenCallback.apply(null,[this,this.dlgLayer.attr("id"),this.contentLayer.getWidth(),this.contentLayer.getHeight()]):new Function("this","id","w","h",this.onOpenCallback+"(this,id,w,h)")(this,this.dlgLayer.attr("id"),this.contentLayer.getWidth(),this.contentLayer.getHeight()))}onResizeDragStart(data){this._resizeDragStartWidth=this.dlgLayer.getWidth(),this._resizeDragStartHeight=this.dlgLayer.getHeight();var rect=UIHelper.getClientRectangle();this._clientWidth=rect[0],this._clientHeight=rect[1]}onResizeDragEnd(data){null!=this.onResizeDoneCallback&&("function"==typeof this.onResizeDoneCallback?this.onResizeDoneCallback.apply(null,[this,this.dlgLayer.attr("id"),this.contentLayer.getWidth(),this.contentLayer.getHeight()]):new Function("thisObj","id","w","h",this.onResizeDoneCallback+"(thisObj,id,w,h)")(this,this.dlgLayer.attr("id"),this.contentLayer.getWidth(),this.contentLayer.getHeight())),this.afterDrag()}onResizeDragMove(data){var newW=Math.max(this._minWidth,this._resizeDragStartWidth+data.getMouseDeltaX()),data=Math.max(this._minHeight,this._resizeDragStartHeight+data.getMouseDeltaY());0this._clientWidth&&(newW=this._clientWidth-this.dlgLayer.getLeft()),data+this.dlgLayer.getTop()>this._clientHeight&&(data=this._clientHeight-this.dlgLayer.getTop()),newW==this.dlgLayer.getWidth()&&data==this.dlgLayer.getHeight()||(this.dlgLayer.setWidth(newW),this.dlgLayer.setHeight(data),this.setDimension(this.dlgHeader,this.dlgLayer.getWidth()-2+"px",this.getValue(this.options.Layout.HeaderHeight,"28px")),this.setDimension(this.contentLayer,this.dlgLayer.getWidth()+"px",this.dlgLayer.getHeight()-this.dlgHeader.getHeight()+"px"),null!=this.onResizeCallback&&("function"==typeof this.onResizeCallback?this.onResizeCallback.apply(null,[this,this.dlgLayer.attr("id"),this.contentLayer.getWidth(),this.contentLayer.getHeight()]):new Function("thisObj","id","w","h",this.onResizeCallback+"(thisObj,id,w,h)")(this,this.dlgLayer.attr("id"),this.contentLayer.getWidth(),this.contentLayer.getHeight())))}onResizeCancelDrag(data){JsHelper.EnableSelectTextOnTarget(document)}}var g_documentIdToDelete=0;function DeleteDocument(documentId){0!=documentId&&(documentId="{nav=document&document_id="+(g_documentIdToDelete=documentId)+"}",Dialog.ConfirmDelete(documentId,!1,"DeleteDocumentCallback"))}function DeleteDocumentCallback(res){0!=g_documentIdToDelete&&(1!=res.getStatus()&&2!=res.getStatus()||(res="{nav=document&document_id="+g_documentIdToDelete+"}",AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.ArchiveDelete.DeleteFromLinkHint","",res,""),Dialog.closeWithCallback(),PageUpdate("soprotocol:refresh","")),g_documentIdToDelete=0)}function CloseDocumentDialog(){""==UIHelper.GetOpener().Dialog.getCloseCallback()&&void 0===UIHelper.GetOpener().Dialog.isQuoteDialog&&(null==Dialog._closeCallback||void 0===Dialog._closeCallback||""==Dialog._closeCallback)?(UIHelper.GetMainPageWindow().RefreshCurrent("document","contact","project"),Dialog.close()):Dialog.closeWithCallback()}function CancelDocumentDialog(soid){DeleteTempDocument(soid),"true"===getQueryVariable("deleteoncancel")?(soid=getQueryVariable("document_id"),Dialog.YesNo("","[SR_L_DELETE]?","question","","_DeleteDocument",soid)):(CancelReport(),Dialog.close())}function DeleteTempDocument(soid){soid=$.fromSoId(soid).val();0{eval(callback),closeCallback()},UIHelper.GetOpener().Dialog.setCloseCallback(newCallback)):UIHelper.GetOpener().Dialog.setCloseCallback(callback+closeCallback)}}}function _DeleteDocument(res){null!=res&&1==res.getStatus()&&(res=res._context,AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Document.DeleteDocument","",Number(res)),null!=(res=UIHelper.GetOpener())?res.RefreshCurrent("document"):RefreshCurrent("document")),CancelReport(),Dialog.close()}function OpenCurrentDocument(){var res=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Document.GetPreferredOpenScript","");setTimeout(()=>EvalDocumentDownload(res),100)}function OpenDocumentDialog(){OpenDocumentDialogWithCallback("document[dialog=stop]?document_id=0","RefreshDocumentCurrent();")}function OpenDocumentDialogWithCallback(dialog,callback){AjaxMethodDispatcher.GetData({ajaxMethod:"SuperOffice.CRM.Web.AjaxMethods.SuperStateCRM.IsRunningTestDrive",methodArguments:[],cacheoptions:{useCache:!0,duration:6e4,refresh:!1},fnCallback:function(data){data?Dialog.Information("SuperOffice","[SR_COMMON_TESTDRIVE_NODOCS]"):Dialog.open("document",dialog,callback)},readonlysession:!0})}function OpenDocumentDialogByIdWithCallback(docId,callback){var readOnlyString="",checkoutState=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Document.GetCheckOutState","",docId);OpenDocumentDialogWithCallback("document[dialog=stop]"+(readOnlyString=null!=checkoutState&&2===checkoutState.State?".details[display=readonly&mode=edit]":readOnlyString)+"?document_id="+docId,callback)}function DownloadCurrentDocument(){var res;PendingRequest.isReady()?(debug.trace("DownloadCurrentDocument","Document"),res=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Document.DownloadCurrentDocument",""),setTimeout(()=>EvalDocumentDownload(res),100)):(debug.warning("DownloadCurrentDocument, try again","Document"),setTimeout("DownloadCurrentDocument()",100))}function EvalDocumentDownload(res){PendingRequest.isReady()?eval(res):(debug.warning("EvalDocumentDownload, try again","Document"),setTimeout(()=>EvalDocumentDownload(res),100))}function OnCloseDocumentDialog(documentId,docFileUploadId){debug.trace("OnCloseDocumentDialog executing","Document"),0{var result=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Document.OpenDocumentGeneral","",documentId,closeDocDialog);eval(result)},openReadOnly:function(documentId,name,closeDocDialog){documentId=JSON.stringify({documentId:documentId,closeDocDialog:closeDocDialog,closeDocDialog:closeDocDialog}),closeDocDialog=ResourceUtils.GetResourceText("[SR_COMMON_CHECKEDOUTBY]").replace("{0}",""+name+"");Dialog.OkNormalButton("[SR_MENU_LIST_OPEN_DOCUMENT]",closeDocDialog,"[SR_COMMON_READ]","[SR_MB_CANCEL]","question",documentId,"SuperOffice.Document.ReadCallback")},openReadOnlySentryRestrict:function(documentId,dialogTitle,closeDocDialog){documentId=JSON.stringify({documentId:documentId,closeDocDialog:closeDocDialog,closeDocDialog:closeDocDialog});Dialog.OkNormalButton("[SR_MENU_LIST_OPEN_DOCUMENT]",dialogTitle,"[SR_COMMON_READ]","[SR_MB_CANCEL]","question",documentId,"SuperOffice.Document.ReadCallback")},tryOpenDocumentFromTaskMenu:function(documentId){pubs.openGeneral(documentId,!1)},openCheckOutOrReadDirect:function(documentId,closeDocDialog){documentId=JSON.stringify({documentId:documentId,closeDocDialog:closeDocDialog,closeDocDialog:closeDocDialog}),closeDocDialog=ResourceUtils.GetResourceText("[SR_MENU_LIST_OPEN_DOCUMENT]");this.hasTrayApp()&&(closeDocDialog="SuperOffice WebTools - "+closeDocDialog);Dialog.OkNormalButtonWithCancel(closeDocDialog,"[SR_COMMON_EDITORREAD]","[SR_MB_EDIT]","[SR_COMMON_READ]","question",documentId,"SuperOffice.Document.CheckOutOrReadCallback")},CheckOutOrReadCallback:function(returnObj){var context=JSON.parse(returnObj._context),result,res,res;1===returnObj._status?(result=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Document.CheckOutDocument","",context.documentId),result.Success?this.hasTrayApp()?(context.closeDialog&&$('[soid="DlgButtonBar_okButton"]').trigger("click"),res=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Document.OpenDocumentWithTrayApp","",context.documentId),eval(res)):(PageUpdate("soprotocol:document[dialog=stop].details[mode=edit]?setCompleted=0",""),setTimeout(function(){DownloadDocument(context.documentId)},100)):Dialog.Information("[SR_FDLG_WARNING]","Unable to checkout the document. ","warning")):2===returnObj._status&&(this.hasTrayApp()?(res=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Document.OpenDocumentWithTrayApp","",context.documentId),eval(res)):setTimeout(function(){pubs.DownloadReadOnlyDocumentFile(context.documentId)},100),context.closeDialog)&&$('[soid="DlgButtonBar_okButton"]').trigger("click")},ReadCallback:function(returnObj){var context=JSON.parse(returnObj._context),res,closeButton;1===returnObj._status&&(this.hasTrayApp()?(res=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Document.OpenDocumentWithTrayApp","",context.documentId),eval(res)):(setTimeout(function(){pubs.DownloadReadOnlyDocumentFile(context.documentId)},100),context.closeDialog&&(closeButton=$('[soid="DlgButtonBar_okButton"]'),("disabled"!==closeButton.attr("disabled")?closeButton:$('[soid="DlgButtonBar_cancelButton"]')).trigger("click"))))},DownloadReadOnlyDocumentFile:function(docId){var res=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Document.DownloadReadOnlyDocumentFile","",docId);eval(res)},hasTrayApp:function(){return 2===SuperOffice.DocumentHandler}};return pubs}(),SuperOffice.ejTicket=(()=>{var pub={setNewUrl:function(url){var iframes=document.getElementsByTagName("iframe");0this._counter?(this._searchString=this._unresolvedEmails[this._counter],this._labelVariable=this._labelConstant,0=this._resolvedEmails.length));i++);},_this.IsNumber=function(possibleNumber){return"number"==typeof possibleNumber};var EMailResolveHelper=new _EMailResolveHelper;function _EMailResolveHelper(){this._to=null,this._cc=null,this._bcc=null,this._globalCounter=0,this._returnedValues=null}function OpenFileDialog(filetype,id,callbackscript){window.open("FileUpload.aspx?filetype="+filetype+"&id="+id+"&callbackscript="+callbackscript,"FileUpload","width=500,height=194,resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no")}function UpdateProjectPicture(imgElemSoId,binId){SuperOffice.SoHelper.getElementBySoId(imgElemSoId).value=binId,document.getElementById("ImageList_SelectedPrimaryKeys").value=binId,document.getElementById("ImageList_SelectedValues").value="",setTimeout(" QueuedPageUpdate('soprotocol:projectimage[dialog=stop]?projectimage_id="+binId+"&projectimage_type="+binId+"');",200)}function UpdateProductPicture(imgElemSoId,binId){binId=binId||Dialog.getReturnValue(),console.log("UpdateProductPicture id "+binId);SuperOffice.SoHelper.getElementBySoId(imgElemSoId);AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminEditProductDataHandler.ChangeProductImage","",parseInt(binId,10)),QueuedPageUpdate("soprotocol:admineditproduct[dialog=stop].main[refresh=true]")}_EMailResolveHelper.prototype.Clear=function(){this._globalCounter=0,this._returnedValues=null},_EMailResolveHelper.prototype.ShowDialog=function(to,cc,bcc){this._to=to,this._cc=cc,this._bcc=bcc;to=this.MakeRecipientString();0{var pub={OpenDefaultDialog:function(connectionId,crmActorType,crmId,useSCIL){Dialog.open("connecttoerpdefaults","connecttoerpdefaults[dialog=stop]&connectionId="+connectionId+"&crmActorType="+crmActorType+"&crmId="+crmId,useSCIL?Dialog._closeCallback:"SuperOffice.PageBuilder.customPostback('edit','edit', true);")},OpenDefaultDialogFromFind:function(){Dialog.close(),UIHelper.GetOpener().SuperOffice.ErpSync.OpenDefaultDialog(SuperOffice.SoHelper.getElementValueBySoId("ConnectionId"),SuperOffice.SoHelper.getElementValueBySoId("CrmActorType"),SuperOffice.SoHelper.getElementValueBySoId("CrmId"))},OpenCreateInErpDialog:function(connectionId,crmActorType,erpActorType,crmId,useSCIL){Dialog.open("createinerp","createinerp[dialog=stop]&connectionId="+connectionId+"&crmActorType="+crmActorType+"&erpActorType="+erpActorType+"&crmId="+crmId,useSCIL?Dialog._closeCallback:"SuperOffice.PageBuilder.customPostback('edit','edit', true);")},ConnectToErpDialogGuiLogic:function(){$("[soid=noMatchChk]").is(":checked")?(g_archiveErpMatches.SetSelectedById(""),$("[soid=ErpActorType_SearchBox]").removeAttr("disabled"),$("[soid=ConnectButton]").parent().hide(),$("[soid=SearchButton]").attr("disabled","disabled"),$("[soid=CreateButton]").parent().show(),$("[soid=findBtn_Image]").hide()):($("[soid=ErpActorType_SearchBox]").attr("disabled","disabled"),$("[soid=ConnectButton]").parent().show(),$("[soid=SearchButton]").removeAttr("disabled"),$("[soid=CreateButton]").parent().hide(),$("[soid=findBtn_Image]").show()),0{try{return new MouseEvent("test")}catch(e){}var MouseEvent=function(eventType,params){params=params||{bubbles:!1,cancelable:!1};var mouseEvent=document.createEvent("MouseEvent");return mouseEvent.initMouseEvent(eventType,params.bubbles,params.cancelable,window,0,0,0,0,0,!1,!1,!1,!1,0,null),mouseEvent};MouseEvent.prototype=Event.prototype,window.MouseEvent=MouseEvent})(window);var g_findtypeNormal="findtype_id=0&findtype_type=normal",g_findtypeSingle="findtype_id=1&findtype_type=single",g_findtypeNoResult="findtype_id=2&findtype_type=noresult",g_findtypeAttachment="findtype_id=3",g_currentCriterionFieldName="",g_currentCriterionPrimaryKey="",g_currentCriterionEntityName="",g_pageHasChanged=!1,g_externalFreetext=!0;function RedirectSearch(){CriterionProxy.refreshResults()}function OpenSingleFindDialog(callback,type,staticOverride,multiselect,isSelectionAdd){var type=getCriterionEntityName(type),multiSelectArgs=(so_defined(staticOverride)||(staticOverride=null),so_defined(isSelectionAdd)||(isSelectionAdd=!1),""),multiselect=((multiselect=so_defined(multiselect)?multiselect:!1)&&(multiSelectArgs="&multiselect=true"),"");null!=staticOverride&&(multiselect="&setCriteria="+staticOverride),""!=type&&Dialog.open("findsingle","findsingle[dialog=stop]."+type+"?"+g_findtypeSingle+multiSelectArgs+"&criterionentity_id=0&criterionentity_name="+type+"&find_id=0"+multiselect+"&isseladd="+isSelectionAdd,callback,!0)}function OpenSingleFindSelectionDialog(callback,selectionType,selectionMemberType,onlywriteable){var staticOverride="";return so_defined(onlywriteable)||(onlywriteable=!1),so_defined(selectionType)&&(staticOverride+="static"==selectionType?"kind,set,0,[SR_SELECTION_STATIC],true,true":"kind,set,1,[SR_SELECTION_DYNAMIC],true,true"),so_defined(selectionMemberType)&&(""!=staticOverride&&(staticOverride+="|"),staticOverride+="targetTableNumber,set,"+selectionMemberType+","+selectionMemberType+",true,true"),onlywriteable&&(""!=staticOverride&&(staticOverride+="|"),staticOverride+="onlywriteable,set,true, onlywriteable,true,true"),OpenSingleFindDialog(callback,"selection",staticOverride)}function getCriterionEntityName(type){var criterionentity="";switch(type){case"contact":criterionentity="findcontact";break;case"diary":case"appointment":criterionentity="findappointment";break;case"sale":criterionentity="findsale";break;case"project":criterionentity="findproject";break;case"selection":criterionentity="findselection";break;case"mail":case"maillogin":case"mergedocument":case"document":case"report":criterionentity="finddocument";break;default:criterionentity="findcontact"}return criterionentity}function GetValueAndReturn(){setSingleSelected(""),Dialog.close()}SuperOffice.Find=function(){var pub={DisplayInMainWindow:!1,CriteriaGuiName:"",OpenDialogOnShow:!0,findtypeNormal:"findtype_id=0&findtype_type=normal",findtypeSingle:"findtype_id=1&findtype_type=single",findtypeNoResult:"findtype_id=2&findtype_type=noresult",findtypeAttachment:"findtype_id=3",FindTypeEnum:{Normal:0,Single:1,NoResult:2,Attachment:3},OpenFindDialog:function(){var criterionentity=getCriterionEntityName(AjaxMethodDispatcher.CallSync("SuperOffice.DCF.Web.AjaxMethods.SuperState.GetPageName",""));""!=criterionentity&&Dialog.open("find","find[dialog=stop]."+criterionentity+"?"+g_findtypeNormal+"&criterionentity_id=0&criterionentity_name="+criterionentity+"&find_id=0")},OpenFindInlineDialog:function(findContext){var criterionentity="",findType="",findTypeEnum=(findContext=so_defined(findContext)?findContext:{}).FindType||this.FindTypeEnum.Normal,staticOverride=findContext.StaticOverride||null,multiSelectArgs="";!findContext.MultiSelect&&1||(multiSelectArgs="&multiselect=true");var isSelectionArgs="",isSelectionArgs=findContext.IsSelectionAdd||!1?"&isseladd=true":"&isseladd=false";switch(findTypeEnum){case this.FindTypeEnum.Normal:findType=this.findtypeNormal;break;case this.FindTypeEnum.Single:findType=this.findtypeSingle;break;case this.FindTypeEnum.NoResult:findType=this.findtypeNoResult;break;case this.FindTypeEnum.Attachment:findType=this.findtypeAttachment;break;default:findType=this.findtypeNormal}findTypeEnum=findContext.PageName||this.getPageName(),(criterionentity=findContext.CriterionEntity||getCriterionEntityName(findTypeEnum)).startsWith("find")||(criterionentity="find"+criterionentity);var staticFindArgs="";if(staticOverride)for(var staticFindArgs="&setCriteria=",t=0;t{var pub=Object.create(Object.prototype);return pub.pubStr="Public string",pub.doTest=function(){console.log("BaseClass:privStr"),console.log("BaseClass:"+this.pubStr);var that=this;setTimeout(function(){console.log("BaseClass delayed:privStr"),console.log("BaseClass delayed:"+that.pubStr)},100)},pub})(),SuperOffice.DynamicListView=(()=>{var pub=Object.create(SuperOffice.BaseClass);return pub.dynamicStr="DynamicListView",pub.doAnotherTest=function(){return console.log("DynamicListView:"+this.dynamicStr),console.log("DynamicListView:"+this.pubStr),this.doTest(),!0},pub})(),SuperOffice.Find.CriteriaControlManager=Object.create(SuperOffice.DynamicListView),SuperOffice.Find.CriteriaControlManager.__class=!0,SuperOffice.Find.CriteriaControlManager.CriteriaControls={},SuperOffice.Find.CriteriaControlManager.OpenDialogOnShow=!0,SuperOffice.Find.CriteriaControlManager.CurrentSelected="",SuperOffice.Find.CriteriaControlManager.CurrentDialogSoProtocol="",SuperOffice.Find.CriteriaControlManager.CurrentDialogName="",SuperOffice.Find.CriteriaControlManager.CurrentCriteriaControl=null,SuperOffice.Find.CriteriaControlManager.add=function(criteriaControl){criteriaControl.onChangeEvent=function(cc,ari){SuperOffice.Find.CriteriaControlManager.criteriaChanged(criteriaControl,ari)},criteriaControl.onDeleteEvent=function(cc,ari){SuperOffice.Find.CriteriaControlManager.criteriaDeleted(criteriaControl,ari)},criteriaControl.onAddEvent=function(cc,ari){SuperOffice.Find.CriteriaControlManager.criteriaAdded(criteriaControl,ari)},criteriaControl.onCriteriaReplaceEvent=function(cc,ari){SuperOffice.Find.CriteriaControlManager.criteriaReplaced(criteriaControl,ari)},criteriaControl.onValueHintChanged=function(cc,ari){SuperOffice.Find.CriteriaControlManager.valueHintChanged(criteriaControl,ari)},criteriaControl.onDialogCallback=function(cc,ari){SuperOffice.Find.CriteriaControlManager.dialogCallback(criteriaControl,ari)},criteriaControl.onRowSelectEvent=function(cc){SuperOffice.Find.CriteriaControlManager.rowSelect(criteriaControl)},criteriaControl.onNoRowSelectEvent=function(cc){SuperOffice.Find.CriteriaControlManager.noRowSelect(criteriaControl)},this.CriteriaControls[criteriaControl.id]=criteriaControl,SuperOffice.Find.CriteriaControlManager.CurrentCriteriaControl=criteriaControl,$(document).on("keyup",function(event){"45"==event.keyCode&&SuperOffice.Find.CriteriaControlManager.getCriteriaControl(criteriaControl.id).onAddClick(criteriaControl.id),"114"==event.keyCode&&SuperOffice.Find.CriteriaControlManager.currentResultArchiveControl&&SuperOffice.Find.CriteriaControlManager.doFind()});var that=this;PageEventHandler.addEvent(EventType.ONBEFOREVIEWCHANGE,"findsavecriteriaonviewchange",function(){null!=that.CurrentCriteriaControl&&that.saveRestrictions(that.CurrentCriteriaControl)}),PageEventHandler.addEvent(EventType.ONPAGEUNLOAD,"findsavecriteriaonunload",function(){null!=that.CurrentCriteriaControl&&that.saveRestrictions(that.CurrentCriteriaControl)})},SuperOffice.Find.CriteriaControlManager.disableCurrentCriteriaControl=function(){null!=this.CurrentCriteriaControl&&this.CurrentCriteriaControl.disable()},SuperOffice.Find.CriteriaControlManager.saveRestrictions=function(criteriaControl,callback){var saveMethod;criteriaControl.isDirty?(this.updateStateObject(criteriaControl),debug.trace("saveRestrictions, len: "+criteriaControl.criteriaState.Restrictions.length,"CriteriaControlManager"),saveMethod=""!==criteriaControl.criteriaState.SaveMethod?criteriaControl.criteriaState.SaveMethod:"FindCriteriaList/SaveRestrictions",UIHelper.GetMainPageWindow().$clientapi.post(saveMethod,{criteriaState:criteriaControl.criteriaState},null,!0).then(function(){criteriaControl.isDirty=!1,callback&&callback()})):callback&&callback()},SuperOffice.Find.CriteriaControlManager.saveRestrictionsToSelection=function(criteriaControl){this.updateStateObject(criteriaControl);var membermode=SuperOffice.Util.getCurrentId("membermode");1===membermode?SuperOffice.Toast.show(ResourceUtils.GetResourceText("[SR_SELECTION_REMOVING_MEMBERS]"),SuperOffice.Toast.Wait):SuperOffice.Toast.show(ResourceUtils.GetResourceText("[SR_SELECTION_ADDING_MEMBERS]"),SuperOffice.Toast.Wait),UIHelper.GetMainPageWindow().$clientapi.post("FindCriteriaList/SaveRestrictionsToSelection",{criteriaState:criteriaControl.criteriaState},null,!0).then(function(res){SuperOffice.Toast.close();res=1!=membermode?ResourceUtils.GetResourceText("[SR_SELECTION_ADDED_MEMBERS]").replace("{0}",res):ResourceUtils.GetResourceText("[SR_SELECTION_REMOVED_MEMBERS]").replace("{0}",-1*res);UIHelper.GetMainPageWindow().SuperOffice.Toast.show(res,SuperOffice.Toast.Confirm),criteriaControl.isDirty=!1,Dialog.closeWithCallback()})},SuperOffice.Find.CriteriaControlManager.getCriteriaControl=function(id){return this.CriteriaControls[id]},SuperOffice.Find.CriteriaControlManager.valueHintChanged=function(criteriaControl,ari){criteriaControl.isDirty=!0,this.sendChangeEvent(criteriaControl),this.saveStateAndRefresh(criteriaControl,ari)},SuperOffice.Find.CriteriaControlManager.dialogCallback=function(criteriaControl,ari){null!=ari&&(debug.trace("dialogCallback: "+ari.UniqueHash,"FindInline"),criteriaControl.isDirty=!0,this.saveStateAndRefresh(criteriaControl,ari))},SuperOffice.Find.CriteriaControlManager.criteriaChanged=function(criteriaControl,ari){criteriaControl.isDirty=!0,this.sendChangeEvent(criteriaControl),this.setResultStatus(criteriaControl)},SuperOffice.Find.CriteriaControlManager.sendChangeEvent=function(criteriaControl){var fn;""!==criteriaControl.criteriaState.OnChangedEvent&&(fn=new Function("criteriaControl",criteriaControl.criteriaState.OnChangedEvent),SuperOffice.Throttle.run("onchange"+criteriaControl.id,1e3,function(){fn(criteriaControl)}))},SuperOffice.Find.CriteriaControlManager.hasActiveAndVisibleRows=function(criteriaControl){debug.trace("Number of Restrictions: "+criteriaControl.criteriaState.Restrictions.length,"FindInline");for(var t=0;ti&&(ari.DisplayValues[i]=disVal[i])})}},SuperOffice.Find.CriteriaControl.onOperatorChange=function(uniqueHash,mdoControl){mdoControl.getSelectedValue();var operatorType=$("[soid=operator"+uniqueHash.replace("-","_")+"_SelectedType]")[0].value,ari=(mdoControl.getSelectedExtraInfo(),this.getArchiveRestrictionInfo(uniqueHash)),that=this;null!=ari&&this.doChange(ari,function(){var hasChangedValueType=ari.OperatorValueHint!=mdoControl.getSelectedExtraInfo();if(ari.Operator=operatorType,ari.OperatorValueHint=mdoControl.getSelectedExtraInfo(),ari.IsOperatorChange=!0,hasChangedValueType&&null!=that.onValueHintChanged){for(var i=0;i{var icon=pageIcons[i];(i=$("")).on("click",function(e){return onClick(icon),e.preventDefault(),!1}),container.append(i)})(i)}var self=this,pageSize=(self.controlContainer=container,self.valueCtrl=valueCtrl,self.icons=icons,36),currentPage=1,getPageIcons=function(pageNum){var pageNum=(pageNum-1)*pageSize,end=pageNum+pageSize;return $(self.icons).slice(pageNum,end)},onClick=function(icon){$(self.valueCtrl).val(JsonHelper.toJSON(icon)),self.control.remove(),setSelectedIcon(icon)},setSelectedIcon=function(icon){$(".previewImage",self.controlContainer).attr("src",icon.iconSrc)},container=(self.nextPage=function(){getIsDisabled()||(currentPage
'),{position:"absolute",zIndex:"1000",top:container.top+20,left:container.left+20}),totalPages=(self.control.css(valueCtrl),$(document.body).append(self.control),$(document).on("mousedown.iconselector",function(e){$(self.control).is(":hover")||$(self.control).remove()}),$(".left",self.control).on("click",self.prevPage),$(".right",self.control).on("click",self.nextPage),getNumPages(icons.length));renderPage(currentPage)},ns.IconSelector.init=function(icons,container,valueCtrl){return new ns.IconSelector(icons,container,valueCtrl)},ns.IconSelector.popup=function(container,valueCtrl){var icons=AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.UI.Controls.IconSelector.GetApplicationIcons");return ns.IconSelector.init(icons,container,valueCtrl)}});var g_isMainpage=null,g_standaloneDialog=null,g_yellowUpdate=!1,g_splitter=null,g_hSplitter=null,EditMode={READ:0,EDIT:1},g_mdcount=0,g_calendarDay=null,g_calendarMonth=null,g_calendarWeek=null,g_calendarWiew=null,g_miniMonth="",g_currentCalendar=null,g_containerElementId="container",g_viewContainerMarginRight=34,g_viewContainerMarginTop=20,g_pageRefreshed=!0,g_superStateCopy="",g_formIsValid=!0,g_isReport=!1,g_scrollBarWidth=0,g_checkInterval=2,g_currentPageId=null;function loggedOnMailServerCallback(res){res&&UIHelper.EnableSpeedBarButton($.fromSoId("ToolBarEmail_6"))}function loggedOnMailServerError(res){UIHelper.DisableSpeedBarButton($.fromSoId("ToolBarEmail_6"))}function setReport(isReport){g_isReport=isReport}function isReport(){return g_isReport}var g_clientRect=null,classKeyPressOverride=($(window).on("load",function(){var container=$("#container");container&&0!==container.length&&isReport()&&(container.css({width:"99%",height:"100%"}),container.css({visibility:"visible"}))}),function(){}),classKP=(classKeyPressOverride.prototype.toString=function(){return" Class Key Press Override "},classKeyPressOverride.prototype.attachListener=function(type,functionCode){var obj=window.document;obj.eventParent=this,"addEventListener"in obj?obj.addEventListener(type,functionCode,!0):"attachEvent"in obj&&obj.attachEvent("on"+type,functionCode)},classKeyPressOverride.prototype.stopPropagation=function(ev){"stopPropagation"in ev?(ev.stopPropagation(),ev.preventDefault()):(ev.keyCode=0,ev.cancelBubble=!0,ev.returnValue=!1)},new classKeyPressOverride),onReady=(classKP.attachListener("help",classKP.stopPropagation),classKP.attachListener("keydown",function(event,parentClass){var ev=event||window.event,ev=ev.keyCode||ev.which,fKeyPressed=!1;112==ev?(fKeyPressed=!0,Dialog.ShowHelp(g_isMainpage)):113!=ev&&114!=ev&&115!=ev||(fKeyPressed=!0),1==fKeyPressed&&this.eventParent&&this.eventParent.stopPropagation(event)}),$(document).ready(function(){$(document).on("mousedown",function(evt){if("INPUT"!==evt.target.nodeName&&"TEXTAREA"!==evt.target.nodeName&&evt.target.attributes.contenteditable||$(evt.target).first().hasClass("forceSelectable"))return(evt=$(evt.target).first()).hasClass("cdlgbodytext")||evt.hasClass("forceSelectable")?(evt.removeClass("TextUnselectable").addClass("TextSelectable"),!0):!!evt.closest(".TextSelectable").length||void evt.addClass("TextUnselectable")})}),function(){var inner=document.createElement("p"),outer=(inner.style.width="100%",inner.style.height="200px",document.createElement("div")),w1=(outer.style.position="absolute",outer.style.top="0px",outer.style.left="0px",outer.style.visibility="hidden",outer.style.width="200px",outer.style.height="150px",outer.style.overflow="hidden",outer.appendChild(inner),document.body.appendChild(outer),inner.offsetWidth),inner=(outer.style.overflow="scroll",inner.offsetWidth);w1==inner&&(inner=outer.clientWidth),document.body.removeChild(outer),console.log||(console.log=function(){}),window.g_scrollBarWidth=w1-inner}),g_dialogCounter=($(document).ready(onReady),window.getFromSoId=function(soid){return SuperOffice.SoHelper.getElementBySoId(soid)},window.getPlaceholders=function(){return $("[id*='DialogCardPlaceHolder']")},window.unBindLoad=function(){$(document).off("load")},0),g_dialogLastZIndex=98;function InlineDialog(){this._containerId="",this._dialogId="",this._dialogLayer=null,this._isDragging=!1,this._dialogStartPos=new Object,this._mouseStartPos=new Object,this._checkBoxes=new Array,this._radioButtons=new Array,this._radioButtonGroups=[],this._radioButtonGroupValues=new Array,this._context,this._closeCallback="","admin"==g_clientOptions.SubClient?(this._closeImage="../Images/System/Web/Close.png",this._closeImageHover="../Images/System/Web/Close.png"):(this._closeImage="Images/System/Web/Close.png",this._closeImageHover="Images/System/Web/Close.png"),this._textArea=null,this._originalText="",this._postItMinWidth=154,this._postItMinHeight=154,this._paperclipCallback="",this._isDeleted=!1,this._dragLayer=null,this._onDragInitCallback="",this._onDragCancelCallback="",this._onDragMoveCallback="",this._onDragDropCallback="",this._initialMousePosX=0,this._initialMousePosY=0,this._initialDialogWidth=0,this._initialDialogHeight=0,this._clientRectX=0,this._clientRectY=0}InlineDialog.prototype.CreateContainer=function(){var dlgLayer=document.createElement("DIV");dlgLayer.id="dialogContainer"+ ++g_dialogCounter,this._containerId=dlgLayer.id,this._dialogLayer=$(dlgLayer)},InlineDialog.prototype.AddDialogToDocument=function(src){this._dialogLayer.html(src),$(document.forms[0]).append(this._dialogLayer)},InlineDialog.prototype.GetHeight=function(){return this._dialogLayer.children().first().getHeight()},InlineDialog.prototype.GetWidth=function(){return this._dialogLayer.children().first().getWidth()},InlineDialog.prototype.Display=function(src,closeCallback){if(""==src)return!1;this._closeCallback=closeCallback;var midButtonLeft,x,closeCallback=document.createElement("DIV"),src=($(closeCallback).attr("id","dialogContainer"+ ++g_dialogCounter),$(closeCallback).setStyle({position:"absolute",top:"0px",left:"0px",right:"0px",zIndex:++g_dialogLastZIndex}),this._containerId=closeCallback.id,$(closeCallback).append(src),document.forms[0].appendChild(closeCallback),$(closeCallback).children().first()),closeCallback=(this._dialogId=src.attr("soid"),$(getFromSoId(this._dialogId)).find(".cdlgbody")),minHeight=50,imgs=closeCallback.children().first().find("IMG").each(function(){"none"!==$(this).css("float")&&(minHeight=Math.max(minHeight,$(this).position().top+$(this).getHeight()))}),firstBlock=closeCallback.children().first(),that=(0onClose","InlineDialog"),that.onClose(Event,inputFnAttrib)};$(this).on("mouseup",function(){mouseupHandler()});var p=$(this).parent();p.hasClass("SoInputButton")&&p.on("mouseup",function(e){mouseupHandler()})}$(this).attr("onclick","")}buttons.push($(this));break;case"checkbox":that._checkBoxes.push(inputs[t]);break;case"radio":var groupId=inputs[t].id.substring(0,inputs[t].id.indexOf("_"));-1===$.inArray(groupId,that._radioButtonGroups)&&that._radioButtonGroups.push(groupId),inputs[t].checked&&(that._radioButtonGroupValues[$.inArray(groupId,that._radioButtonGroups)]=inputs[t].value),$(inputs[t]).on("click",function(e){that.onRadioButtonDown(e,groupId)}),that._radioButtons.push($(inputs[t]))}t+=1}),0rect[0]&&(deltaX=rect[0]-width),event+height>rect[1]&&(event=rect[1]-height),dialog.setStyle({left:deltaX+"px",top:event+"px"}),!1}),$(document).on("mouseup.inlinedialog",function(e){return debug.trace("onDrop","InlineDialog"),that._isDragging=!1,$(document).off("mousemove.inlinedialog"),$(document).off("mouseup.inlinedialog"),!1}),!(that._isDragging=!0)}),$("#"+this._dialogId+"Close"));0closeCallback[0]-5&&width.setWidth(closeCallback[0]-height.left-5),height.top+width.getHeight()>closeCallback[1]-5&&width.setHeight(closeCallback[1]-height.top-5);$("#"+paperclipCallback+"paperclip").on("mousedown",this.onPaperclipMouseDown);var targetElement=$(document.createElement("DIV")),that=(targetElement.attr("id",this._containerId+"resize"),this._dialogLayer.children().first().append(targetElement),targetElement.setClass("dialogresize"),targetElement.setStyle({position:"absolute",bottom:"0px",right:"0px",width:"13px",height:"13px",zIndex:199}),this),src=(this.registerDragDrop(targetElement,that.onPostitResizeInit,that.onPostitResizeMove,that.onPostitResizeDrop,that.onPostitResizeCancel),this._dialogLayer.css({visibility:"visible"}),null),src=textArea.setSelectionRange?function(){textArea.selectionStart=0,textArea.selectionEnd=textArea.value.indexOf("\n"),textArea.focus()}:function(){var rng=textArea.createTextRange(),str=textArea.value.substring(0,textArea.value.indexOf("\n"));""!=str&&(rng.findText(str),rng.select()),textArea.focus()};setTimeout(src,200),$(document).on("keydown.notebook",function(e){27==JsHelper.GetKeyCode(e)&&that.Close()}),$(document).on("mousedown.notebook",function(e){try{for(var node=$(Event.element(e));null!=node&&0this._clientRectX-5&&(deltaX=this._clientRectX-dialogId.left-5),dialogId.top+deltaY>this._clientRectY-5&&(deltaY=this._clientRectY-dialogId.top-5),this.resizePostitElements(deltaX,deltaY)},InlineDialog.prototype.onPostitResizeDrop=function(e,deltaX,deltaY){this._dialogLayer.children().first().getWidth(),this._dialogLayer.children().first().getHeight()},InlineDialog.prototype.onPaperclipMouseDown=function(e){void 0!==this._paperclipCallback&&""!=this._paperclipCallback&&eval(this._paperclipCallback+"(e, this);")},InlineDialog.prototype.onDocumentMouseDown=function(e){try{for(var node=Event.element(e);null!=node&&"FORM"!=node.tagName&&"BODY"!=node.tagName;){if(node.id==this._containerId)return!1;node=node.parentNode}}catch(ex){console.log("onDocumentMouseDown exception: "+ex.message)}return this.Close(),!1},InlineDialog.prototype.registerDragDrop=function(dragLayer,dragInitCallback,dragMoveCallback,dragDropCallback,dragCancelCallback){this._dragLayer=dragLayer,this._onDragInitCallback=dragInitCallback,this._onDragCancelCallback=dragCancelCallback,this._onDragMoveCallback=dragMoveCallback,this._onDragDropCallback=dragDropCallback;var that=this;$(this._dragLayer).on("mousedown",function(e){that._initialMousePosX=Event.pointerX(e),that._initialMousePosY=Event.pointerY(e);var rect=UIHelper.getClientRectangle();that._clientRectX=rect[0],that._clientRectY=rect[1],that._onDragInitCallback(e),$(document).on("mousemove.inlinedragdrop",function(e){var deltaX=Event.pointerX(e)-that._initialMousePosX,deltaY=Event.pointerY(e)-that._initialMousePosY;that._onDragMoveCallback(e,deltaX,deltaY)}),$(document).on("mouseup.inlinedragdrop",function(e){var deltaX,deltaY;$(document).off("mousemove.inlinedragdrop"),$(document).on("mouseup.inlinedragdrop"),deltaX=Event.pointerX(e)-that._initialMousePosX,deltaY=Event.pointerY(e)-that._initialMousePosY,that._onDragDropCallback(e,deltaX,deltaY),that._initialMousePosX=0,that._initialMousePosY=0,that._initialDialogWidth=0,that._initialDialogHeight=0})})};var ModifyKey={NONE:0,CTRL:1,SHIFT:2,ALT:3},g_shiftDown=!1,g_ctrlDown=!1,g_altDown=!1,KeyPressHandler=new _KeyPressHandler;function _KeyPressHandler(){this._keyPressCollection=new SoCollection}function _LinksArchive(){this._dataFieldSoId="LinksArchiveData",this._dataField=null}function _LinksArchiveData(){this._inputFieldSoId="LinksArchiveData",this._inputField=null,this._saleIds=new Array,this._appIds=new Array,this._docIds=new Array,this._projIds=new Array,this._urlIds=new Array,this._personIds=new Array,this._contactIds=new Array,this._selectionIds=new Array}function TableRowState(){this._selectedItems=new SoCollection}function TableRowParser(id,tableId){this._id=id,this._tableId=tableId,this._table=null,this._selectedClassName="",this._passiveClassName="",this._borderClassName="",this._isMultiSelect=!1,this._tableRowState=new TableRowState,this._lastSelectedRow="",this._prevSelectedRows=null,this._lastSelectedIndex=0,this._funcMD=new Function("e","try{"+id+".onMouseDown(e);}catch(ex){}"),this._funcMU=new Function("e","try{"+id+".onMouseUp(e);}catch(ex){}"),this._active=!1,debug.trace("Id: "+id,"TableRowParser"),this.initialize()}function ListRowState(){this._selectedItems=new SoCollection}function ListRowParser(id,tableId){this._id=id,this._divId=tableId,this._div=null,this._selectedClassName="",this._passiveClassName="",this._borderClassName="",this._isMultiSelect=!1,this._listRowState=new ListRowState,this._lastSelectedRow="",this._prevSelectedRows=null,this._lastSelectedIndex=0,this._funcMD=new Function("e","try{"+id+".onMouseDown(e);}catch(ex){}"),this._funcMU=new Function("e","try{"+id+".onMouseUp(e);}catch(ex){}"),this._active=!1,debug.trace("Id: "+id,"ListRowParser"),this.initialize()}_this=_KeyPressHandler.prototype,$(window).on("load",function(){PageEventHandler.addEvent(EventType.ONKEYDOWN,"KeyPressHandler","KeyPressHandler.OnKeyDown(e)"),PageEventHandler.addEvent(EventType.ONKEYUP,"KeyPressHandler","KeyPressHandler.OnKeyUp(e)")}),_this.AddKeyPressListenerByKeyCode=function(keycode,modifyKey,func){this.AddKeyPressListener(String.fromCharCode(keycode),modifyKey,func)},_this.RemoveKeyPressListenerByKeyCode=function(keycode,modifyKey,func){this.RemoveKeyPressListener(String.fromCharCode(keycode),modifyKey,func)},_this.AddKeyPressListener=function(key,modifyKey,func){var col,modifyKey=this.getModifyKeyString(modifyKey);this._keyPressCollection.exist(modifyKey+key)?(col=this._keyPressCollection.get(modifyKey+key)).exist(func)||col.add(func,func):((col=new SoCollection).add(func,func),this._keyPressCollection.add(modifyKey+key,col))},_this.RemoveKeyPressListener=function(key,modifyKey,func){var col;this._keyPressCollection.exist(modifyKey+key)&&((col=this._keyPressCollection.get(modifyKey+key)).exist(func)||col.remove(func),0==col.getLength)&&this._keyPressCollection.remove(modifyKey+key)},_this.getModifyKeyString=function(modifyKey){switch(modifyKey){case ModifyKey.NONE:return"";case ModifyKey.SHIFT:return"SHIFT";case ModifyKey.CTRL:return"CTRL";case ModifyKey.ALT:return"ALT"}},_this.FireEvent=function(key){if("undefined{"==key&&(key="{"),this._keyPressCollection.exist(key))for(var collection=this._keyPressCollection.get(key),t=0;t{var pub={EnDisBoth:function(id){pub.EnDisRadio(id),pub.EnDis(id)},EnDis:function(id){var chosenRadio=$("[soid=SoLicenseEditorRadioButtonCurrentSelected]")[0],noSelectionRadio=$("[soid=SoLicenseEditorNoSelectionHiddenField]")[0],validRadioSelect=!0;null!=noSelectionRadio&&""!=noSelectionRadio.value&&(validRadioSelect=null!=chosenRadio&&0<=chosenRadio.value&&""!=chosenRadio.value&&chosenRadio.value!=noSelectionRadio.value);($("[soid='"+id+"']").prop("checked")&&validRadioSelect?($("span[sohierarchyid] input:checkbox").attr("disabled",!1).length,$("span[sohierarchyid] input:checkbox:not(:checked)").each(function(i,e){$(this).closest("table").find("[sohierarchyid^='"+$(e).parent().attr("sohierarchyid")+"/']").find(":checkbox").removeAttr("checked").length}).length,$("span[sohierarchyid] input:checkbox:not(:checked)").each(function(i,e){$(this).closest("table").find("[sohierarchyid^='"+$(e).parent().attr("sohierarchyid")+"/']").find(":checkbox").attr("disabled",!0).length})):($("span[sohierarchyid] input:checkbox").removeAttr("checked").length,$("span[sohierarchyid] input:checkbox").attr("disabled",!0))).length;for(var uncheckedboxes=$("span[sohierarchyid] input:checkbox:not(:checked)"),i=0;i=indexOfPrevSelected?(event=indexOfPrevSelected,this._lastSelectedIndex):(event=this._lastSelectedIndex,indexOfPrevSelected);this._tableRowState.setSelectedItems(new SoCollection);for(var i=event;i<=endIdx;i++){var row=this._table.rows[i];this._tableRowState.getSelectedItems().add(row.id,row.id)}}}else(selItems=new SoCollection).add(id,id),this._tableRowState.setSelectedItems(selItems);this.setSelectedRows()},_this.setSelectedOnIndex=function(idx,event){idx=this._table.rows[idx];this.setSelectedOnElementId(idx.id,event)},_this.selectAll=function(){this._prevSelectedRows=this._tableRowState.getSelectedItems();for(var selItems=new SoCollection,i=0;i=indexOfPrevSelected?(startIdx=indexOfPrevSelected,this._lastSelectedIndex):(startIdx=this._lastSelectedIndex,indexOfPrevSelected);this._listRowState.setSelectedItems(new SoCollection);for(var i=startIdx;i<=endIdx;i++){var rows=this._div.getElementsByTagName("DIV");row=rows[i],this._listRowState.getSelectedItems().add(row.id,row.id)}}}else(selRow=new SoCollection).add(id,id),this._listRowState.setSelectedItems(selRow);this.setSelectedRows()},_this.setSelectedOnIndex=function(idx){idx=this._div.getElementsByTagName("DIV")[idx];this.setSelectedOnElementId(idx.id)},_this.selectAll=function(){this._prevSelectedRows=this._listRowState.getSelectedItems();for(var selItems=new SoCollection,rows=this._div.getElementsByTagName("DIV"),i=0;i'+nStr+"":nStr}function toPercentageNF(){return nNum=100*this.num,(nNum=this.getRounded(nNum))+"%"}function getZerosNF(places){for(var extraZ="",i=0;irect.getX()&&(x=rect.getX()-mouseCoords-32),y+elementId>rect.getY()&&(y=Math.max(0,y-(elementId-(rect.getY()-y))-10)),cmenuLayer.moveTo(x,y)):"ontop"==position?((y-=elementId/2)<5&&(y=5),x+=(elementLayer.getWidth()-cmenuLayer.getWidth())/2,cmenuLayer.moveTo(x,y)):cmenuLayer.moveTo(x,Math.max(0,y-elementId)),$("#shadow")),menuHtml=cmenuLayer.getLeft()+2,mouseCoords=cmenuLayer.getTop()+6,rect=(cmenuContainerLayer.setLeft(menuHtml),cmenuContainerLayer.setTop(mouseCoords),cmenuContainerLayer.setHeight(cmenuLayer.getHeight()),cmenuContainerLayer.setWidth(cmenuLayer.getWidth()),cmenuContainerLayer.css("visibility","visible"),cmenuLayer.height());return cmenuLayer.height(0),cmenuLayer.css({visibility:"visible",overflow:"hidden"}),cmenuLayer.animate({height:rect},100,function(){cmenuLayer.css({height:"",overflow:""})}),$(document).on("keydown.menumanager",MenuManager.onKeyDown),$(document).on("mouseup.menumanager",function(evt){debug.trace("onMouseDownForContextMenu","menu");var src=Event.element(evt),src=$(src);if(src.exists()){try{for(var node=src;null!=node&&"FORM"!=node.tagName&&"BODY"!=node.tagName;){if("cmenu"==node.id)return!1;node=node.parentNode}}catch(ex){debug.error("mousedown.menumanager: "+ex.message,"MenuManager")}debug.trace("closed on mousedown","menu"),MenuManager.hideMenu()}return!(evt.cancelBubble=!0)}),MenuManager.flushCache(),$("body").css("overflow","hidden"),!1},_MenuManager.prototype.SetMenuItems=function(strHtml){document.getElementById("cmenu").innerHTML=strHtml},_MenuManager.prototype.hideMenu=function(){debug.trace("hideMenu","menu"),$(document).off("mouseup.menumanager"),$(document).off("keydown.menumanager"),$(document).off("mousemove.menumanager"),MenuManager.onKeyDownCallback=null,MenuManager.hideSubMenu();var shadow=$("#shadow"),shadow=(null!=shadow&&shadow.css("visibility","hidden"),$("#cmenu"));null!=shadow&&shadow.css("visibility","hidden"),$("body").css("overflow","")},_MenuManager.prototype.displaySubMenu=function(parentItem,menuElementId){null!=g_lastParent&&MenuManager.hideSubMenu();var subMenuLayer=$("#"+menuElementId),parentLayer=$("#"+parentItem.id),overflow=Math.min(0,UIHelper.getClientRectangle()[0]-(parentLayer.offset().left+3+parentLayer.outerWidth()+subMenuLayer.outerWidth()+10));subMenuLayer.setLeft(parentLayer.outerWidth()+3+overflow),subMenuLayer.setTop(parentItem.offsetTop),document.getElementById(menuElementId).getBoundingClientRect().bottom>document.documentElement.clientHeight&&subMenuLayer.setTop(parentItem.offsetTop+parentLayer.outerHeight()-subMenuLayer.outerHeight()),subMenuLayer.css("visibility","visible"),g_lastParent=parentItem,g_currentSubMenuId=menuElementId},_MenuManager.prototype.hideSubMenu=function(){null!=g_lastParent&&(debug.trace("hidesubmenu:"+g_currentSubMenuId,"menu"),$("#"+g_currentSubMenuId).css("visibility","hidden"),g_lastParent=null,g_currentSubMenuId="")},_MenuManager.prototype.onMenuItemHover=function(elem,index,force){(!0===force||null!=elem&&elem!=g_lastItemElem)&&($(g_lastItemElem).removeClass("hover"),g_currentMenuElement=elem.parentNode,$(elem).addClass("hover"),force=!1,-1startIndex+3&&!this.isQuote(str[startIndex+3]))return this.parseInlineMultiLanguageString(str,cultureName,startIndex+3,returnAlternativeTranslation);for(var quotes=0,i=startIndex;ii+4&&":"!==str.charAt(i+4)){var c=1,c=(str.length>i+1&&";"===str.charAt(i+1)&&(c=2),str.substring(startIndex,i+c-startIndex)),newString=0")}function RemoveWhiteCurtain(){$("[soid='pleasewaitdimmer']").remove()}function NewProject(){PageUpdate("soprotocol:project.main[mode=edit&new=true]?project_id=0","")}function NewPerson(){PageUpdate("soprotocol:person.main[mode=edit&new=true]?person_id=0","")}function EditPerson(id){PageUpdate("soprotocol:person.main[mode=edit]?person_id="+id,"")}var g_personIdToDelete=0;function DeletePerson(personId){0!=personId&&(personId="{nav=person&person_id="+(g_personIdToDelete=personId)+"}",Dialog.ConfirmDelete(personId,!1,"DeletePersonCallback"))}function DeleteCurrentPerson(){var personCurrent=AjaxMethodDispatcher.CallSync("SuperOffice.DCF.Web.AjaxMethods.SuperState.GetCurrent","","person");void 0!==personCurrent&&0controlGroup&&(labelWithButtonId.css("position","absolute"),label.css("position","absolute")),labelWithButton.css("width",labelWithButton=controlGroup-10),label.css("width",labelWithButton-(labelWithButtonId.outerWidth()+20)))}function SetLabelWidth(labelWithButtonId){var controlGroup,labelWithButton=$(SuperOffice.SoHelper.getElementBySoId(labelWithButtonId));null!=labelWithButton&&0!=(controlGroup=labelWithButton.parent().parent().parent()).length&&(labelWithButtonId=$("[soid="+labelWithButtonId+"_label]"),controlGroup=controlGroup.width()+controlGroup.offset().left-labelWithButton.offset().left-10,labelWithButton.css("width",controlGroup),labelWithButtonId.css("width",controlGroup))}function DeleteProjectImage(imageId,current){imageId=$("[soid="+imageId+"]").attr("value");AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.AjaxMethods.Project.DeleteProjectImage","",parseInt(imageId)),SuperOffice.PageBuilder.refresh(null,current+"_id=0&"+current+"_type=0")}function openEditProjectMembersDialog(){for(var rows=ProjectMemberArchiveArchiveControl.getSelectedRows(),ids="",i=0;i{var pub={Archive:{}};return pub.Archive.Current={},pub.MiniCardArchive={},pub.MiniCardArchive.Current={},pub.SelectionId=0,pub.SelectionMemberType=null,pub.SelectionType=null,pub.miniSelectionRefresh=!1,pub.Current=null,pub.SwitchTaskView=function(o){o=$(so(o)).attr("soprotocol");"selection"==SuperOffice.Environment.CurrentMainPageId&&QueuedPageUpdate(o+"[refresh=false]?selection_id="+g_clientOptions.LastValidHistoryItem)},pub.openFindFromSelectionMenu=function(){var context=new Object;context.CriterionEntity="findselection",context.FindType=SuperOffice.Find.FindTypeEnum.Normal,SuperOffice.Find.OpenFindInlineDialog(context)},pub.OpenAddDialog=function(){"contact"!=this.SelectionMemberType&&SuperOffice.Find.OpenFindInlineDialog({FindType:SuperOffice.Find.FindTypeEnum.Single,CriterionEntity:this.SelectionMemberType,Callback:"SuperOffice.Selection.OpenAddDialogCallback",IsSelectionAdd:!0,MultiSelect:!0})},pub.OpenAddDialogCallback=function(res){res=res.getValue();if(null!=res&&""!=res){var items=res.split("|,|");if(0!=items.length){for(var idArray=new Array,t=0;t{var pub={IsPerformOnSelected:function(){try{if(!SuperOffice.SoHelper.getSoCheckBoxState("SelectionPerformOnSelected"))return 0}catch(ex){return 0}return 1},CheckCreateTempSelection:function(overrideCheckbox){var selectionArchiveControl=null;if(!so_defined(selectionArchiveControl=!SuperOffice.Selection.Current.HasShadowArchive||SuperOffice.Selection.Current.MemberArchiveVisible?SelectionMemberArchiveArchiveControl:ShadowSelectionMemberArchiveArchiveControl))return 0;if(!(overrideCheckbox=so_defined(overrideCheckbox)?overrideCheckbox:!1)&&!this.IsPerformOnSelected())return 0;var overrideCheckbox=0,idArray=selectionArchiveControl.getSelectedKeys(),idString="",isContact=!1;if(0maxWidth&&(tableCells=this.getTableCells(headerTable,0),headerTable=headerTable.offsetWidth-maxWidth,tableCells[tableCells.length-1].style.width=tableCells[tableCells.length-1].offsetWidth-headerTable+"px")},_this.dragColumn=function(e,obj){this.initHeader(),this.initData(),JsHelper.DisableSelectTextOnTarget(this.getHeaderTable()),JsHelper.DisableSelectTextOnTarget(this.getDataContainer());var that=this;$(document).on("mousemove.archive",function(e){JsHelper.DisableSelectTextOnTarget(that.getHeaderTable()),JsHelper.DisableSelectTextOnTarget(that.getDataContainer());var leftCellPosX=findPosX(that._currentObj.previousSibling),leftCellWidth=that._currentObj.previousSibling.offsetWidth,e=JsHelper.GetMouseCoordinates(e).getX(),leftCellPosX=(that._newDiff=leftCellPosX+leftCellWidth-e,that._currentObj.nextSibling.offsetWidth);that._leftCellNewWidth=leftCellWidth-that._newDiff,that._rightCellNewWidth=leftCellPosX+that._newDiff,that._dragDiv.style.left=e+"px"}),$(document).on("mouseup.archive",function(){JsHelper.EnableSelectTextOnTarget(that.getHeaderTable()),JsHelper.EnableSelectTextOnTarget(that.getDataContainer()),document.body.removeChild(that._dragDiv);var headerTable=that.getHeaderTable();that.setPixelWidth(headerTable);0listelem.offsetWidth&&(widthFactor=(listelem.offsetWidth-seperatorwidth)/($(header).width()-seperatorwidth)),debug.trace("width factor:"+widthFactor,"initHeader"),this.initCellsWithComp(headercells,widthFactor),debug.trace("head:"+$(header).width()+"data:"+$(this.getDataContainer()).width(),"initHeader"))},_this.initCellsWithComp=function(cells,widthFactor){},_this.initData=function(){var widthFactor,datacells,seperatorwidth,dataTable=this.getDataTable(),listelem=document.getElementById(this._archiveControlContext.ClientDataContainerID);null!=dataTable&&(widthFactor=1,null!=(datacells=this.getTableCells(dataTable,seperatorwidth=0))&&(seperatorwidth=10*(datacells.length/2-1)),$(dataTable).width()>listelem.offsetWidth&&(widthFactor=(listelem.offsetWidth-seperatorwidth)/($(dataTable).width()-seperatorwidth)),this.initCellsWithComp(datacells,widthFactor))},_this.initCells=function(cells){if(null!=cells)for(var i=0;ithis._archiveControlContext.ExportPageSize?(msg=(msg=ResourceUtils.GetResourceText("[SR_ARCHIVE_EXPORT_CONFIRMATION]")).replace("{0}",(that=this)._archiveControlContext.ExportPageSize),$sodlgm.confirm(SCIL.Router.createUIContext(),{caption:"Export to Excel",message:msg,height:256,ok:function(){that._exportToFile(customRestriction)}})):this._exportToFile(customRestriction)},_this._exportToFile=function(customRestriction){100dataContainer.offsetHeight+dataContainer.scrollTop?dataContainer.scrollTop=rowOffsetTop-(dataContainer.offsetHeight-row.offsetHeight):row.offsetTop=jObj[0].scrollHeight-jObj[0].offsetHeight&&!this._ignoreLoad&&(this._curScrollTop=jObj[0].scrollTop,this._ignoreLoad=!0,this.FetchList(this._instance+".AddPage",parseInt(this._currentPage)+1),null!=this.OnListReceived)&&this.OnListReceived(this.tableRowParser)},_this.pagingDelay=function(){this._ignoreLoad=!1,null!=this.getDataContainer()&&(this.getDataContainer().scrollTop=this._curScrollTop)},_this.AddPage=function(html){var tmpLayer;null!=html&&(tmpLayer=document.createElement("div"),html=new ArchiveResultParser(html),this._currentPage=html.getPageNumber(),this._hasMorePages=html.getHasMorePages(),this._archiveControlContext.CurrentValue=html.getCurrentValues(),tmpLayer.innerHTML=html.getDataGrid(),null!=(html=tmpLayer.getElementsByTagName("TABLE")[0])&&(this.addNewPage(html),this.disposeElement(html),this.updateTableRowParser(),setTimeout(this.GetClientControlId()+".pagingDelay()",50)),setTimeout(this.GetClientControlId()+".onScroll()",10)),this.HideProgressImage()},_this.addNewPage=function(newPageTable){var dataTable=this.getDataTable();if(null!=dataTable)for(var tBody=dataTable.getElementsByTagName("TBODY");0"==restrictionValue[0]?(ari.Operator="greater",restrictionValue=restrictionValue.substring(1)):"<"==restrictionValue[0]?(ari.Operator="less",restrictionValue=restrictionValue.substring(1)):-1!=restrictionValue.indexOf(",")?(ari.Operator="in",restrictionValue=restrictionValue.split(",")):-1!=restrictionValue.indexOf("-")?(ari.Operator="between",restrictionValue=restrictionValue.split("-")):ari.Operator=defaultOperator:ari.Operator=defaultOperator,"string"==typeof restrictionValue?(ari.Values=[restrictionValue],ari.DisplayValues=[restrictionDisplayValue]):(ari.Values=restrictionValue,ari.DisplayValues=restrictionDisplayValue),doRefresh=!0)),doRefresh&&(this._archiveControlContext.HasDynamicFilter?(that=this,UIHelper.GetMainPageWindow().$clientapi.post("SoArchiveControl/SaveDynamicFilter",{archiveControlContext:this.GetArchiveControlContextCopy()},null,!0).then(function(){that.RefreshList()})):this.RefreshList())},_this=ArchiveResultParser.prototype,_this.getResponseInstanceId=function(){return this._responseInstanceId},_this.getCurrentValues=function(){return this._currentValues},_this.getCount=function(){return this._count},_this.getPageNumber=function(){return this._currentPage},_this.getHasMorePages=function(){return this._hasMorePages},_this.getExtraReturn=function(){return this._extraReturn},_this.getDataGrid=function(){return this._dataGrid},_this.getInputRowIds=function(){return this._inputRowIds};var g_ListContainerID="";function RefreshArchive(ListContainerID){g_ListContainerID=ListContainerID,setTimeout("FetchList()",200)}function ToggleAppointments(tmp){alert(tmp.length)}function KillMe(instance){}function DisableOnEmpty(id,archiveControl){0==archiveControl.getSelectedRows().length?SuperOffice.SoHelper.disableElementBySoId(id):SuperOffice.SoHelper.enableElementBySoId(id)}function JustDisableOnEmpty(id,archiveControl){0==archiveControl.getSelectedRows().length&&SuperOffice.SoHelper.disableElementBySoId(id)}function DisableOnNoRows(id,archiveControl){0==archiveControl.count()?SuperOffice.SoHelper.disableElementBySoId(id):SuperOffice.SoHelper.enableElementBySoId(id)}function canDelete(id,archiveControl){try{for(var rows=archiveControl.getSelectedRows(),can=!1,obj=SuperOffice.SoHelper.getElementBySoId(id),i=0;i"),stickyHeaderTable.append(stickythead),elem.append(stickyHeaderContainer),stickyContainer=this.getStickyContainer(),stickyHeaderTable=this.getStickyTable(),stickyContainer.append(stickyHeaderTable),stickytbody=$(""),stickyHeaderTable.append(stickytbody),elem.append(stickyContainer)),this.getHeaderContainer()),mainContainer=(elem.append(stickyHeaderContainer),this.getMainContainer()),stickyHeaderTable=(elem.append(mainContainer),this.getHeaderTable()),stickyHeaderContainer=(stickyHeaderContainer.append(stickyHeaderTable),thead=$(""),stickyHeaderTable.append(thead),this.getMainTable());mainContainer.append(stickyHeaderContainer),tbody=$(""),stickyHeaderContainer.append(tbody),mainContainer.scroll(function(){that.scrollFunc(that,stickyContainer,mainContainer)}),_context.ShowHeader&&this.addHeaderRow(context.ArchiveConfiguration.ArchiveColumnInfo),this.getPage()},pub.scrollFunc=function(that,stickyContainer,mainContainer){0=mainContainer[0].scrollHeight-mainContainer[0].offsetHeight&&that.getPage()},pub.getContainer=function(id,className){var id=soid+"_"+id,container=$("#"+id);return 0==container.length&&(container=$("
")).addClass(className),container},pub.getMainContainer=function(){var mainContainer=this.getContainer("mainContainer","ArchiveGridViewDataContainer");return mainContainer.addClass(archiveGridViewContext.CssClassBody),mainContainer},pub.getStickyContainer=function(){return this.getContainer("stickyContainer","ArchiveGridViewStickyDataContainer")},pub.getHeaderContainer=function(){var headerContainer=this.getContainer("headerContainer","ArchiveGridViewHeaderContainer");return headerContainer.addClass(archiveGridViewContext.CssClassHeader),headerContainer},pub.getStickyHeaderContainer=function(){return this.getContainer("stickyHeaderContainer","ArchiveGridViewStickyHeaderContainer")},pub.getTable=function(id,cssClass){var id=soid+"_"+id,table=$("#"+id);return 0==table.length&&(table=$("")).addClass(cssClass),table},pub.getHeaderTable=function(){return this.getTable("headerTable","SoArchiveGridView")},pub.getStickyHeaderTable=function(){return this.getTable("stickyHeaderTable")},pub.getMainTable=function(){return this.getTable("mainTable","SoArchiveGridView")},pub.getStickyTable=function(){return this.getTable("stickyTable")},pub.onClick=function(element,text){$(element).html(""),$(element).append(this.createDropDown(text)),this.recalcWidth(this.getMainTable(),this.getHeaderTable()),this.scrollFunc(this,this.getStickyContainer(),this.getMainContainer())},pub.recalcWidth=function(from,to){var fromRow=from[0].rows[0],toRow=to[0].rows[0];if(fromRow)for(var i=0;ith:last").css({width:"+="+g_scrollBarWidth}),0tbody").children().remove(),this.getMainTable().find(">tbody").children().remove(),this.getMainContainer().scrollTop(0),this.getPage()},pub.getPage=function(){var realPage,that,resultSet;pub.addingPage||(pub.addingPage=!0,realPage=this.getRealPage(),pub.loadingElem=$("
"),elem.append(pub.loadingElem),null===(resultSet=(that=this).getResultSet(realPage))?UIHelper.GetMainPageWindow().$clientapi.post("SoArchiveGridView/GetArchiveData",{context:context,page:realPage,pageSize:fetchPageSize},null,!0).then(function(res){that.getPageCallBack(res)}).catch(function(){}):(pub.loadingElem.remove(),this.addPage(resultSet)))},pub.getPageCallBack=function(res){pub.loadingElem.remove();var result=eval(res);this.setResultSet(this.getRealPage(),result),this.addPage(result)},pub.addPage=function(result){for(var mainContainer,stickyContainer,cursor=this.getCursor(),ii=cursor;iimainContainer.width()?stickyContainer.css({bottom:g_scrollBarWidth+"px"}):stickyContainer.css({bottom:"0px"}))},pub.createDropDown=function(displayText){var tmp=$("
"),icon=(tmp.attr("title",displayText),$("")),icon=(tmp.append(icon),$(""+(""!=displayText?displayText:" ")+""));return tmp.append(icon),tmp},pub.addHeaderRow=function(rowObj){var row=$("
"),stickyrow;row.css({height:headerHeight}),row.data("row",rowObj),0"),stickyrow.css({height:headerHeight}),$(stickythead).append(stickyrow));for(var i=0;i"),dropDownContext,tmp;"dropdown"===rowObj[i].DisplayType?(headerElem.append(this.createDropDown(rowObj[i].DisplayName)),""!=context.HeaderContext&&(dropDownContext=eval("("+context.HeaderContext+")"),dropDownContext.soid=soid+row.children().length,headerElem.dropDown("init",dropDownContext))):(tmp=$("
"+(null!=rowObj[i]?rowObj[i].DisplayName:" ")+"
"),tmp.attr("title",rowObj[i].DisplayName),headerElem.append(tmp)),(i"),$(thead).append(row),row},pub.onLinkHintClick=function(row){var onclickScr=archiveGridViewContext.LinkHints[$(this).data("item").LinkHint];new Function("row",onclickScr).call(this,$(row).data("row"))},pub.addRow=function(rowObj,rowClass){var stickyrow,that=this,row=$("
");row.css({height:rowHeight}),row.addClass(rowClass),$(tbody).append(row),0")).css({height:rowHeight}),stickyrow.addClass(rowClass),$(stickytbody).append(stickyrow)),row.data("row",rowObj);for(var i=0;i"),tdContainer=(retVal.data("item",rowObj.ColumnData[i]),$("
"));switch(retVal.append(tdContainer),context.ArchiveConfiguration.ArchiveColumnInfo[i].DisplayType){case"bool":var chkElem=$("");chkElem.attr("name",context.ArchiveConfiguration.ArchiveColumnInfo[i].Name),chkElem.data("item",rowObj.ColumnData[i]),chkElem.on("click",function(){that.onLinkHintClick.call(this,row)}),tdContainer.append(chkElem);break;case"icon":for(var icons=rowObj.ColumnData[i].DisplayValue.split(","),tooltip=rowObj.ColumnData[i].TooltipHint.split(","),ii=0;ii");iconElem.css({width:"16px"}),iconElem.attr("src",rowObj.ColumnData[i].LinkHint+"/"+icons[ii].trim()+".png"),iconElem.data("item",rowObj.ColumnData[i]),tooltip.length>ii&&""!=(tmp=tooltip[ii].trim())&&(iconElem.bind("mouseover",{param:tmp},function(e){ToolTipManager.Show(e,"qwerty"+i,e.data.param,!0)}),iconElem.bind("mouseout",function(){ToolTipManager.Hide()})),tdContainer.css({width:16*icons.length+"px"}),tdContainer.append(iconElem)}break;default:tdContainer.text(null!=rowObj.ColumnData[i]?rowObj.ColumnData[i].DisplayValue:"")}(i=Math.min(indexClicked,lastClickIndex)&&i<=Math.max(indexClicked,lastClickIndex)&&$(rows[i]).addClass(selectedClass)}else this.getRows().removeClass(selectedClass),this.getRowFromId(id).toggleClass(selectedClass),this.setCache("lastClickIndex",indexClicked);else this.getRows().removeClass(selectedClass),this.getRowFromId(id).addClass(selectedClass),this.setCache("lastClickIndex",indexClicked);setToolbarButtonStates()},pub.getRows=function(){return $.fromSoId(this.soid).find("[rowid]")},pub.getListBox=function(){return listBox},pub.getToolBar=function(){return toolBar},pub.getRowIndexFromId=function(id){return this.getRowFromId(id).prevAll().length},pub.getSimpleMdoItems=function(){return simpleMdoList.getList()},pub.getIdsFromHighlightedRows=function(){var ids=[],that=this;return listBox.find(".ArchiveSelectedRow").each(function(){ids.push(that.getIdFromRow($(this)))}),ids},pub.getTypesFromHighlightedRows=function(){var types=[];return listBox.find(".ArchiveSelectedRow").each(function(){types.push($(this).attr("rowtype"))}),types},pub.getRowIdFromRowType=function(rowType){return listBox.find("[rowtype='"+rowType+"']").first().attr("rowid")},pub.getRowFromId=function(id){return listBox.find("[rowid="+id+"]").first()},pub.getIdFromRow=function(row){return parseInt(row.attr("rowid"),10)},pub.getSimpleMdoItemsFromHighlightedRows=function(){return simpleMdoList.getFromIds(this.getIdsFromHighlightedRows())},pub.getSimpleMdoItem=function(id){return simpleMdoList.getFromId(id)},pub.getCheckedRows=function(){return simpleMdoList.getCheckedItems()},pub.getAllTypes=function(){return simpleMdoList.getAllTypes()},pub.toggleSelectedValue=function(elem){var isChecked=elem.is(":checked"),elem=elem.parent().attr("listid");simpleMdoList.toggleSelectedValue(elem,isChecked),setState()},pub.setAllSelectedValue=function(val){$("[soid="+this.soid+"] input:checkbox").prop("checked",val),simpleMdoList.setSelectedValueForItems(val),setState()},pub.highlightAll=function(){listBox.find("[rowid]").each(function(){$(this).addClass("ArchiveSelectedRow")}),setState(),setToolbarButtonStates()},pub.highlightNone=function(){listBox.find("[rowid]").each(function(){$(this).removeClass("ArchiveSelectedRow")})},pub.deleteHighlightedRows=function(){for(var ids=this.getIdsFromHighlightedRows(),i=0;i
"),tbody=$.fromSoId(socheckedListBoxSoId).find(".sclbbody TABLE TBODY")),tbody}return pub.hasCache("sostate_"+soid)?simpleMdoList=pub.getCache("sostate_"+soid):(sostate=JSON.parse(pub.getStateElement().val()),simpleMdoList=SuperOffice.SimpleMdoList(sostate.SimpleMdoItems),stateElement.jsonStringify(simpleMdoList.getList()),pub.setCache("sostate_"+soid,simpleMdoList),pub.setCache("instantsave",sostate.InstantSave)),pub.init=function(){},pub.getSimpleMdoList=function(){return simpleMdoList.getList()},pub.highlightAll=function(which){SuperOffice.SoCheckedListBox(this.soid+"_"+which).highlightAll()},pub.toggleSelected=function(id,fnCallback){simpleMdoList.getFromId(id).Selected?(rowRight=SuperOffice.SoCheckedListBox(soid+"_right").getRowFromId(id),tbodyLeft=getTableTbodyElement(soid+"_left"),rowRight.removeClass("ArchiveSelectedRow"),tbodyLeft.append(rowRight),rowRight.attr("onclick",rowRight.attr("onclick").replace(/_right/g,"_left")),simpleMdoList.toggleSelectedValue(id,!1)):(tbodyLeft=SuperOffice.SoCheckedListBox(soid+"_left").getRowFromId(id),rowRight=getTableTbodyElement(soid+"_right"),tbodyLeft.removeClass("ArchiveSelectedRow"),rowRight.append(tbodyLeft),tbodyLeft.attr("onclick",tbodyLeft.attr("onclick").replace(/_left/g,"_right")),simpleMdoList.toggleSelectedValue(id,!0)),stateElement.jsonStringify(simpleMdoList.getList()),pub.setCache("sostate_"+soid,simpleMdoList);var tbodyLeft,rowRight,that=this;void 0!==fnCallback&&SuperOffice.Throttle.run(that.soid,1e3,fnCallback),pub.getCache("instantsave")&&SuperOffice.Throttle.run(that.soid,1e3,function(){SuperOffice.PageBuilder.save(that.soid)})},pub.moveFromLeftToRight=function(fnCallback){for(var ids=SuperOffice.SoCheckedListBox(this.soid+"_left").getIdsFromHighlightedRows(),i=0;ithis._knobPos[this._rightKnob[0].id]-width&&(this.setPosition(this._rightKnob,newPos+width),this.onRightKnobPosChanged()),this.setActiveSliderPos()}}onLeftCancelDrag(data){this.setPosition(this._leftKnob,this._leftKnobStartPos),this.setActiveSliderPos(),this.writeDate(this._fromPopupDateLabel,this._fromDate)}onRightDragStart(data){this._toDragDate=this._toDate.clone(),this._rightKnobStartPos=this._rightKnob.getLeft(),this._rightKnobLastPos=this._rightKnobStartPos}onRightDragEnd(data){this._toDate=this._toDragDate.clone(),this.onToDateSelected()}onRightDragMove(data){var newPos=this._rightKnobStartPos+data.getMouseDeltaX(),newPos=1!=this._isRangeMove&&this._canMoveOtherSlider?Math.max(newPos,this._slider.getLeft()+this._leftKnob.getWidth()):Math.max(newPos,this._leftKnob.getLeft()+this._leftKnob.getWidth());if((newPos=Math.min(newPos,this._slider.getLeft()+this._slider.getWidth()-this._rightKnob.getWidth()))!=this._rightKnobLastPos){if(this._snap&&RangeFlags.Year)for(var t=0;tthis._lastMouseDeltaX?(this.onRightDragMove(data),this.setPosition(this._leftKnob,this._knobPos[this._rightKnob[0].id]-this._knobDiff)):(this.onLeftDragMove(data),this.setPosition(this._rightKnob,this._knobPos[this._leftKnob[0].id]+this._knobDiff)),this._lastMouseDeltaX=dx}onRangeCancelDrag(data){this._isRangeMove=!1,this.setPosition(this._activeSlider,this._rangeStartPos),this.onLeftCancelDrag(data),this.onRightCancelDrag(data),this.setActiveSliderPos()}onLeftKnobPosChanged(){this._fromDragDate=this.getDateFromKnob(this._leftKnob,PositionType.Left),this.writeDate(this._fromPopupDateLabel,this._fromDragDate)}onRightKnobPosChanged(){this._toDragDate=this.getDateFromKnob(this._rightKnob),this.writeDate(this._toPopupDateLabel,this._toDragDate)}onFromDateSelected(){this.SelectedFromDate=this._fromDate.clone(),this.onRangeSelected()}onToDateSelected(){this.SelectedToDate=this._toDate.clone(),this.onRangeSelected()}onRangeSelected(){this._properties.read("UpdateCallerElement",!1)&&this.writeDate(this._valueLabel,this._fromDate),this._showOkButton||(this.doCallback(),this._properties.read("CloseAfterRangeSelected",!1)&&this.close(!0))}addAfter(){this.expandRange(this._expandInterval)}addBefore(){this.expandRange(-this._expandInterval)}onExpand(){this.expandRange(this._expandInterval),this.expandRange(-this._expandInterval)}onContract(){this.contractRange(this._expandInterval)}onOk(){this.close(!0)}onCancel(){debug.trace("onCancel","SoDateRange"),this._fromDate=this._initialFromDate.clone(),this._toDate=this._initialToDate.clone(),this.setPosition(this._leftKnob,this.getPosition(this._fromDate,PositionType.Left)),this.setPosition(this._rightKnob,this.getPosition(this._toDate)),this.writeDate(this._fromPopupDateLabel,this._fromDate),this.writeDate(this._toPopupDateLabel,this._toDate),this.close(!1)}expandRange(years){(0this._fromDate&&(this._minDate=this._fromDate.clone(),this._minDate.setMonth(0),this._minDate.setDate(1)),this._maxDate?")+" - "+"?")+"
"+"
")+"
"+"
",this._showExpandBeforeAfterButtons&&(html+="
",sliderLeft=20),this._showExpandContractButtons&&(html+="
"),(this._showOkButton||this._showCancelButton)&&(html+="
"),this._showOkButton&&(html+=""+g_clientOptions.OkTranslated+""),this._showCancelButton&&(html+=""+g_clientOptions.CancelTranslated+""),(this._showOkButton||this._showCancelButton)&&(html+="
"),html=html.replace(/daterange_/g,this._id+"_"),popUp.html(html),$(document.forms[0]).append(popUp),this._popup=$("#"+this._id+"_popupcontainer"),this._slider=$("#"+this._id+"_popupcontainer_slider"),this._activeSlider=$("#"+this._id+"_popupcontainer_slideractive"),this._leftKnob=$("#"+this._id+"_popupcontainer_slideknob1"),this._rightKnob=$("#"+this._id+"_popupcontainer_slideknob2"),this._fromPopupDateLabel=$("#"+this._id+"_popupcontainer_dateFrom"),this._toPopupDateLabel=$("#"+this._id+"_popupcontainer_dateTo"),this);this._showExpandContractButtons&&(this._expand=$("#"+this._id+"_popupcontainer_expand"),this._contract=$("#"+this._id+"_popupcontainer_contract"),$(this._expand).mousedown(function(){that.onExpand()}),$(this._contract).mousedown(function(){that.onContract()})),this._showCancelButton&&(this._cancelButton=$("#"+this._id+"_popupcontainer_cancel"),$(this._cancelButton).mousedown(function(){that.onCancel()})),this._showOkButton&&(this._okButton=$("#"+this._id+"_popupcontainer_ok"),$(this._okButton).mousedown(function(){that.onOk()}),html=10,this._showCancelButton)&&(html+=this._cancelButton.getWidth()+8,this._okButton.setStyle({right:html})),this._popup.setWidth(this._width),this._height=this._showOkButton||this._showCancelButton?this._heightWithOkButton:this._heightNoOkButton,this._slider.setLeft(sliderLeft),this._slider.setWidth(this._width-2*this._slider.getLeft()),this.analyzeConstraints(),this._showExpandBeforeAfterButtons&&(this._addBefore=$("#"+this._id+"_popupcontainer_addbefore"),this._addAfter=$("#"+this._id+"_popupcontainer_addafter"),$(this._addBefore).mousedown(function(){that.addBefore()}),$(this._addAfter).mousedown(function(){that.addAfter()}),this._addBefore.setLeft(this._slider.getLeft()-12),this._addBefore.setTop(this._slider.getTop()-3),this._addAfter.setLeft(this._slider.getLeft()+this._slider.getWidth()+2),this._addAfter.setTop(this._slider.getTop()-3)),this.createMarkers(),JsHelper.DisableSelectTextOnTarget(popUp)}setPopupPosition(){var rect=UIHelper.getClientRectangle(),elemPos=Position.cumulativeOffset(this._elem),left=elemPos[0],elemPos=(left+this._width>rect[0]&&(left-=left+this._width-rect[0]+5),elemPos[1]);elemPos+this._height>rect[1]&&(elemPos-=elemPos+this._height-rect[1]),this._popup.setLeft(left),this._popup.setTop(elemPos)}createMarkers(){this._properties.read("Layout.Markers",RangeFlags.None)&&RangeFlags.Year&&this.createYearMarkers()}createYearMarkers(){void 0!==this._yearMarks&&this.removeYearMarkers();var pos,mark,d=this._minDate.clone(),top=(d.setDate(1),d.setMonth(0),this._slider.getTop()-4);for(this._yearMarks=new Array;d.getFullYear()<=this._maxDate.getFullYear();)d>=this._minDate&&((mark=$(document.createElement("div"))).addClass("yearmark"),mark.setTop(top),mark.setHeight(9),pos=this.getPosition(d),mark.setLeft(pos),$(this._popup).append(mark),this._yearMarks.push({Year:d.getFullYear(),Date:d.clone(),Pos:pos,Elem:mark,Label:null})),d.addYears(1);1this._distanceYearMarks?(labelWidth=this._yearMarks[t].Year+"",label.html(labelWidth.substr(2,2))):label.html(this._yearMarks[t].Year),this._yearMarks[t].Label=label}}removeYearMarkers(){for(var t=0;t"+rowObj.Name+"");row.css({paddingLeft:6*level}),0")).addClass("SoDropDownPopup"),$("#container").append(p)),p},pub.unloadPopupBox=function(){$(popup).fadeOut("",function(){$(this).remove()})},pub.loadPopupBox=function(){var that=this,mainOffset=$.fromSoId(soid).offset(),height=$(document).height()-mainOffset.top-30,left=(popup.css({width:"+=17"}),mainOffset.left);mainOffset.left+popup.width()>$(window).width()&&(left=$(window).width()-(popup.width()+17)),popup.offset({top:mainOffset.top+16,left:left}),console.log("popup.height(): "+popup.height()),console.log("popup.top: "+popup.offset().top),popup.height()+popup.offset().top>height&&popup.height(height),popup.on("mousedown",function(e){return JsHelper.CancelBubble(e)}),$(popup).fadeIn(),$(document).on("mousedown.dropdownpopup",function(){that.unloadPopupBox(),$(document).off("mousedown.dropdownpopup")})},pub},($=>{var methods={init:function(options){this.attr("soid",options.soid),this.css({cursor:"pointer"}),this.on("click",function(){SuperOffice.Controls.SoDropDownControl(options.soid,options).getList()})}};$.fn.dropDown=function(method){return methods[method]?methods[method].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof method&&method?void $.error("Method "+method+" does not exist on jQuery.udefEditor"):methods.init.apply(this,arguments)}})(jQuery),SuperOffice.ErpSyncDefaults=(()=>{var pub={SetRadio:function(toLeft){$("[id*='SoErpSyncDefaults_"+(toLeft?"Left":"Right")+"']").each(function(key,value){value.checked=!0})}};return pub})(),SuperOffice.Controls.SoErpSyncMapping=function(_soid,_data,_headingCaptions,_actorId){var pub=new SuperOffice.Controls.Base(_soid),soid=_soid,elem=$.fromSoId(_soid),data,actorId=_actorId,headingCaptions=_headingCaptions;return void 0!==_data?(data=_data,elem.data("data",_data)):data=null!==elem.data("data")?elem.data("data"):null,pub.init=function(){var container=elem.parent(),container=$("
").appendTo(container);this.renderHeaderRow(container),this.renderDataRows(container),this.actorId=actorId},pub.renderHeaderRow=function(table){for(var row=$("").appendTo(table),i=0;i").appendTo(row),headingCaptions[i])},pub.renderDataRows=function(table){for(var i=0;i").appendTo(table);this.addSearchCheckbox(i,$("
").appendTo(row),data[i].ShowInSearch),this.addLabel(i,$("").appendTo(row),data[i].ErpDisplayName),this.addDirectionButton(i,$("").appendTo(row),data[i].SyncToErp,data[i].SyncToCrm),this.addDropDown(i,$("").appendTo(row),data[i].CrmDisplayName,data[i].ErpFieldId),this.addGuiCheckbox(i,$("").appendTo(row),data[i].ShowInGui)}for(var showInSearchCount=0,selectedIndex=0,ii=0;ii"+text+"")},pub.addDirectionButton=function(index,container,toLeft,toRight){var that,leftBtn=$(""),rightBtn=$("");toLeft&&this.enableBtn(leftBtn),toRight&&this.enableBtn(rightBtn),container.append(leftBtn),container.append(rightBtn),""==data[index].CrmDisplayName||""==data[index].CrmFieldKey?(this.disableBtn(leftBtn,ResourceUtils.GetResourceText("[SR_EIS_MAPPING_CRMFIELD_REQUIRED]")),this.disableBtn(rightBtn,ResourceUtils.GetResourceText("[SR_EIS_MAPPING_CRMFIELD_REQUIRED]"))):(5===data[index].FieldType?""===data[index].ListReference&&this.disableBtn(leftBtn,ResourceUtils.GetResourceText("[SR_EIS_MAPPING_LIST_TYPE]")):2==data[index].Access&&this.disableBtn(leftBtn,ResourceUtils.GetResourceText("[SR_EIS_READONLY_MAPPING]")),that=this,leftBtn.on("click",function(){that.toERPBtn(index)}),rightBtn.on("click",function(){that.toCRMBtn(index)}))},pub.enableBtn=function(btn){btn.addClass("activeBtn"),btn.attr("title","")},pub.unEnableBtn=function(btn){btn.removeClass("activeBtn"),btn.attr("title","")},pub.disableBtn=function(btn,reason){btn.addClass("disableBtn"),btn.attr("title",reason)},pub.addSearchCheckbox=function(index,container,checked,onclick){var that=this,checked=$("").attr("checked",checked);checked.on("click",function(){that.setShowInSearch(index,this.checked)}),container.append(checked)},pub.addGuiCheckbox=function(index,container,checked,onclick){var that=this,checked=$("").attr("checked",checked);checked.on("click",function(){that.setShowInERPTab(index,this.checked)}),container.append(checked)},pub.addDropDown=function(index,container,selVal,extraInfo){var that=this,tmp=$("
"),icon=(tmp.attr("title",selVal),$("
")),text=(tmp.append(icon),$(""+(""!=selVal?selVal:" ")+"")),dropDownContext=(tmp.append(text),eval("({ listName: 'CrmFieldsWithNoSelection',extraInfo:'erpfield_id="+extraInfo+"', onClick: function (elem) {that.setCrmFieldId(elem,"+index+",$(this).data('item') );}})"));dropDownContext.soid=soid+index,tmp.dropDown("init",dropDownContext),container.append(tmp)},pub.toERPBtn=function(index){data[index].SyncToErp=!data[index].SyncToErp,data[index].SyncToErp?this.enableBtn($("#left_"+index)):this.unEnableBtn($("#left_"+index)),this.SaveData()},pub.toCRMBtn=function(index){data[index].SyncToCrm=!data[index].SyncToCrm,data[index].SyncToCrm?this.enableBtn($("#right_"+index)):this.unEnableBtn($("#right_"+index)),this.SaveData()},pub.checkSync=function(index){data[index].SyncToErp||data[index].SyncToCrm||(data[index].CrmDisplayName="",data[index].CrmFieldKey="")},pub.setShowInERPTab=function(index,checked){data[index].ShowInGui=checked,this.SaveData()},pub.setShowInSearch=function(index,checked){data[index].ShowInSearch=checked,this.SaveData()},pub.setCrmFieldId=function(element,index,item){var msg,caption,that;""!==data[index].ListReference?(msg=ResourceUtils.GetResourceText("[SR_ERP_WARNING_CHANGELIST]"),caption=ResourceUtils.GetResourceText("[SR_WARN_CAPTION]"),that=this,UIHelper.GetMainPageWindow().$sodlgm.confirm(UIHelper.GetMainPageWindow().SCIL.Router.createUIContext(),{caption:caption,message:msg,height:256,ok:function(){that.setCrmFieldIdCallback(index,item)}})):this.setCrmFieldIdCallback(index,item)},pub.setCrmFieldIdCallback=function(index,item){data[index].CrmDisplayName=item.Name,0!==item.Id?(data[index].CrmFieldKey=item.ExtraInfo+"",""!==data[index].ListReference&&""===item.Type&&(data[index].SyncToErp=!1)):(data[index].CrmFieldKey="",data[index].SyncToCrm=!1,data[index].SyncToErp=!1),data[index].ListReference=item.Type,this.SaveData(!0)},pub.SetActive=function(active,eisaActorType){var w=UIHelper.GetMainPageWindow(),lockLayer=(w.SendWorkerCommand("NotificationWorker","ShowAlert",{title:w.$rm.getResource("[SR_CHAT_STATUSVAL_4]"),tag:"savingErpSync"}),document.createElement("div"));lockLayer.style.position="absolute",lockLayer.style.inset="0",lockLayer.style.zIndex="9999",lockLayer.style.backgroundColor="#000",lockLayer.style.opacity="0.2",document.body.appendChild(lockLayer),AjaxMethodDispatcher.CallSync("SuperOffice.CRM.Web.Data.AdminErpSyncMappingDataHandler.SetActive","",active,eisaActorType),lockLayer.remove(),w.SendWorkerCommand("NotificationWorker","HideAlert",{tag:"savingErpSync"})},pub.SaveData=function(instantSave){var originalScrollTop,that;$(elem).val(JsonHelper.toJSON(data)),instantSave?(originalScrollTop=$(so("AdminErpSyncMappingFieldsControlGroup_"+actorId)).scrollTop(),SuperOffice.PageBuilder.save(function(){$(so("AdminErpSyncMappingFieldsControlGroup_"+actorId)).scrollTop(originalScrollTop)})):(that=this,SuperOffice.Throttle.run("saveEISMapping",500,function(){AjaxMethodDispatcher.CallASync("","","","","SuperOffice.CRM.Web.Data.AdminErpSyncMappingDataHandler.AsyncSave",data,that.actorId)}))},pub},_this=SoListBox.prototype,_this.Scroll=function(){var selectedValue,layer=$("#"+this._id);0{var pub={getPrimaryKeyFromRowId:function(listboxId,rowId){rowId=rowId.split(";");return document.getElementById(rowId[0]).attributes.primaryKey.value},getMdoTypeFromListBoxRow:function(listboxId,rowId){rowId=rowId.split(";");return document.getElementById(rowId[0]).attributes.mdoItemType.value}};return pub})(),SuperOffice=SuperOffice||{},SuperOffice.Controls=SuperOffice.Controls||{},SuperOffice.Controls.SoMultiLanguageTextBox=SuperOffice.Controls.SoMultiLanguageTextBox||function(context){var parser=getNs("SuperOffice.Util.MultiLanguageStringParser"),that=(this.context=context,this.dataArray={},this.popup,this.animationSpeed=160,this.popUpStack=new Stack,this);$.fromSoId(this.context.Id+"_textbox").on("keyup",function(){that.updateDatasource(that.context.CurrentLanguage,$(this).val())}),this.onKeyDown=function(){},this.onClick=function(){this.showPopup()},this.getPosAndSize=function(elem){var top=$.fromSoId(this.context.Id+"_textbox").offset().top+22,left=$.fromSoId(this.context.Id+"_textbox").offset().left,maxHeight=$("#container").height();return top+elem.height()>maxHeight&&(top=Math.max(maxHeight-elem.height()+10,0)),console.log(top,left,maxHeight),{top:top,left:left,maxHeight:maxHeight-top-20,height:""}},this.showPopup=function(){function keyUp(){$.fromSoId(that.context.Id+"_textbox").val($(this).val())}var otherLanCode,that=this,data=$.fromSoId(this.context.Id+"_datacontainer").val(),data=(this.parseMultiLanguageStringToArray(data),$("#container")),items=(0<$(".MLpopup").length&&this.unloadPopup("popup"),this.popup=$("
"),data.append(this.popup),this.languageContainer=$("
"),this.popup.append(this.languageContainer),this.popup.css({width:$.fromSoId(this.context.Id+"_textbox").width()}),this.context.CurrentLanguage!=this.context.DefaultLanguage&&this.addInputLine(this.languageContainer,this.context.CurrentLanguage,!1,!1,keyUp),this.addInputLine(this.languageContainer,this.context.DefaultLanguage,!1,!1,this.context.CurrentLanguage==this.context.DefaultLanguage?keyUp:null),this.getSortedArray());for(otherLanCode in items)items.hasOwnProperty(otherLanCode)&&items[otherLanCode].lanCode!=this.context.CurrentLanguage&&items[otherLanCode].lanCode!=this.context.DefaultLanguage&&this.addInputLine(this.languageContainer,items[otherLanCode].lanCode,!0,!1);data=$(""),data.on("click",function(e){that.showAvailableLanguage(e)}),this.popup.append(data),this.popup.css(this.getPosAndSize(this.popup)),data=$(this.popup).height();$(this.popup).css({visibility:"visible",height:"1px"}).animate({height:data},this.animationSpeed),this.popUpStack.push("MLpopup"),$(document).on("mousedown.MLpopup",function(e){"MLpopup"==that.popUpStack.top()&&(1<$(".MLpopup").length&&that.unloadPopup("MLpopup",!0),$(".MLpopup").is(":hover")||that.unloadPopup("MLpopup",!0))}),$(window).on("unload",function(){that.unloadPopup("MLpopup",!0)}),$(this.languageContainer).find("input").first().trigger("focus")},this.getSortedArray=function(){var data,items=new Array;for(data in this.dataArray)items.push(this.dataArray[data]);var that=this;return items.sort(function(a,b){a=that.context.AvailableLanguages[a.lanCode],b=that.context.AvailableLanguages[b.lanCode];return a&&b?a.DisplayName>b.DisplayName?1:a.DisplayName");for(data in this.context.AvailableLanguages)data==this.context.CurrentLanguage||data==this.context.DefaultLanguage||this.usedLangauges(data)||data.startsWith("$")||((lanElem=$("
"+this.makeNiceDisplayName(this.context.AvailableLanguages[data].DisplayName)+"
")).addClass("MLpopuplistitem"),lanElem.data("lanCode",data),lanElem.on("click",null,data+"",function(e){that.addInputLine(that.languageContainer,$(this).data("lanCode"),!0,!0),that.unloadPopup("MLpopup2")}),lanPopContainer.append(lanElem),isMoreLanguages=!0);$("#container").append(lanPopContainer),$(".MLadd").on("keydown",function(e){console.log("keydown");var selectedItem=$(lanPopContainer).find(".selectedMLpopuplistitem");40==e.which&&(0==selectedItem.length?$(lanPopContainer).children().first().addClass("selectedMLpopuplistitem"):(selectedItem.next().addClass("selectedMLpopuplistitem"),selectedItem.removeClass("selectedMLpopuplistitem"))),38==e.which&&(0==selectedItem.length?$(lanPopContainer).children().last().addClass("selectedMLpopuplistitem"):(selectedItem.prev().addClass("selectedMLpopuplistitem"),selectedItem.removeClass("selectedMLpopuplistitem"))),13==e.which&&$(lanPopContainer).find(".selectedMLpopuplistitem").trigger("click")});var top=$(".MLadd").offset().top,left=$(".MLadd").offset().left,top=(top+lanPopContainer.height()>$("#container").height()&&(top=$("#container").height()-lanPopContainer.height()-20),lanPopContainer.css({top:top,left:left}),lanPopContainer.height());$(lanPopContainer).css({visibility:"visible",height:"1px"}).animate({height:top},this.animationSpeed),this.popUpStack.push("MLpopup2"),$(document).on("mousedown.MLpopup2",function(e){$(".MLpopup2").is(":hover")||that.unloadPopup("MLpopup2",!0)})},this.usedLangauges=function(lanCode){return null!=this.dataArray[lanCode]},this.unloadPopup=function(classToRemove,useAnimation){useAnimation?$("."+classToRemove).slideUp(this.animationSpeed,function(){$(this).remove()}):$("."+classToRemove).remove(),$(document).off("mousedown."+classToRemove),this.popUpStack.pop()},this.addInputLine=function(parentElement,lanCode,addDelete,resize,onKeyUp){null==this.dataArray[lanCode]&&(this.dataArray[lanCode]={lanCode:lanCode,value:""});var that=this,elemContainer=$("
"),elemCaption=$("
"+this.makeNiceDisplayName(this.context.AvailableLanguages[lanCode].DisplayName)+"
"),elemInput=this.context.MultiLine?$(""):$("");elemInput.data("lanCode",lanCode),elemContainer.append(elemCaption),elemContainer.append(elemInput),addDelete&&((lanCode=$("")).on("click",function(){that.deleteLine(elemInput)}),elemContainer.append(lanCode)),onKeyUp&&elemInput.on("keyup",onKeyUp),elemInput.on("change",function(){console.log($(this).data("lanCode"),$(this).val()),that.updateDatasource($(this).data("lanCode"),$(this).val())}),parentElement.append(elemContainer),elemInput.trigger("focus"),resize&&that.popup.css(that.getPosAndSize(that.popup)),this.toggleAddLanguageLink()},this.toggleAddLanguageLink=function(){var data,isMoreLanguages=!1;for(data in this.context.AvailableLanguages)data==this.context.CurrentLanguage||data==this.context.DefaultLanguage||this.usedLangauges(data)||data.startsWith("$")||(isMoreLanguages=!0);isMoreLanguages?$(".MLadd").show():$(".MLadd").hide()},this.deleteLine=function(elemInput){var lanCode=$(elemInput).data("lanCode");delete this.dataArray[lanCode],this.encodeMultiLanguageString(),$(elemInput).parent().remove(),this.toggleAddLanguageLink(),this.popup.css(this.getPosAndSize(this.popup))},this.updateDatasource=function(lanCode,value){null==this.dataArray[lanCode]&&this.parseMultiLanguageStringToArray($.fromSoId(this.context.Id+"_datacontainer").val()),null==this.dataArray[lanCode]?this.dataArray[lanCode]={lanCode:lanCode,value:value}:this.dataArray[lanCode].value=value,this.encodeMultiLanguageString()},this.parseMultiLanguageStringToArray=function(str){this.dataArray={};for(var curCode,curLang,curStr,langs=Object.keys(this.context.AvailableLanguages),i=0;i"+$("
").text(rowObj.Name).html()+"
");0")).addClass("SoNavigatorSearchPopup"),$("#container").append(p)),p},pub.createSearchBox=function(){var that=this,l=$("
"),searchBox=(popup.append(l),popup.find("#searchBox"));return searchBox.delayedChange.oldVal="",searchBox.delayedChange(function(e){var searchVal=searchBox.val();(0==searchVal.length||1");return l.on("mousedown",function(e){return JsHelper.CancelBubble(e)}),popup.append(l),l},pub.unloadPopupBox=function(){$(popup).fadeOut(100,function(){$(this).remove()}),$(document).off("mousedown.dropdownpopup")},pub.loadPopupBox=function(){var that=this,mainOffset=$.fromSoId(soid).offset(),left=mainOffset.left;mainOffset.left+popup.width()>$(window).width()&&(left=$(window).width()-(popup.width()+17)),popup.offset({top:mainOffset.top+30,left:left+28}),$(popup).fadeIn(100),$(document).on("mousedown.dropdownpopup",function(e){$("#SoDropDownPopup").is(":hover")||that.unloadPopupBox()}),popup.find("#searchBox").trigger("focus")},pub},($=>{$.fn.delayedChange=function(options){var timer,o=jQuery.isFunction(options)?{onChange:options}:options;return o=$.extend({},$.fn.delayedChange.defaultOptions,o),this.each(function(){var element=$(this);element.keyup(function(){clearTimeout(timer),timer=setTimeout(function(){var newVal=element.val(),newVal=$.trim(newVal);element.delayedChange.oldVal!=newVal&&(element.delayedChange.oldVal=newVal,o.onChange.call(this))},o.delay)})})},$.fn.delayedChange.defaultOptions={delay:350,onChange:function(){}},$.fn.delayedChange.oldVal=""})(jQuery),SuperOffice.SplitterGroup=Object.create(Object.prototype),SuperOffice.SplitterGroup.__class=!0,SuperOffice.SplitterGroup.currentTop=0,SuperOffice.SplitterGroup.newTop=0,SuperOffice.SplitterGroup.dragElement=null,SuperOffice.SplitterGroup.prevElements=[],SuperOffice.SplitterGroup.nextElements=[],SuperOffice.SplitterGroup.settings={minPreviousHeight:100,minNextHeight:100},SuperOffice.SplitterGroup.init=function(options){$.extend(this.settings,options);var that=this;this.dragElement=$.fromSoId(options.id),this.defaultOffset=this.dragElement.position().top;for(var i=0;iprevElement[3]&&(e.y.location=prevElement[3]),e.y.location-that.startOffset),prevElement=parseInt(that.dragElement.css("top"),10);that.dragElement.css("top",prevElement+parentElement+"px"),that.dragMove(e,parentElement)},dragstart:function(e){that.startOffset=e.y.startLocation},dragend:function(e){var delta=e.y.location-that.startOffset,top=parseInt(that.dragElement.css("top"),10);that.dragElement.css("top",top+delta+"px"),that.setSplitterPosition(e,{position:{top:that.dragElement.position().top}})}}),PageEventHandler.addEvent(EventType.ONPAGERESIZE,"dragResize",function(){SuperOffice.SplitterGroup.setContainment(that.dragElement)}),0!=this.settings.offset&&(debug.trace("this.settings.offset : "+this.settings.offset,"SoSplitter"),this.isOutsideContainment(that.dragElement,that.settings.offset))&&that.moveSplitter(that.dragElement,Number(that.settings.offset))},SuperOffice.SplitterGroup.isOutsideContainment=function(dragElement,offset){return 0{var pub={Long:6e3,Short:3e3,Wait:-1,Confirm:-2,show:function(text,duration){$(".toast").remove();var toast=$("
");duration==pub.Wait&&toast.append("
"),toast.append(""+text+""),duration==pub.Confirm&&toast.append(""),$("#container").append(toast),0/g,"\n")).replace(/\"/g,'"'),$(this._toolTipLayer).text(tooltipText),this._toolTipLayer.style.whiteSpace="pre-wrap"):$(this._toolTipLayer).html(_DOMPurify.sanitize(tooltipText)),this._toolTipLayer.style.visibility="hidden",document.body.appendChild(this._toolTipLayer),this._toolTipLayer.className="ToolTipLayer",this.checkBoundary(this._toolTipContext.y+14,this._toolTipContext.x+14),""!=this._toolTipLayer.innerHTML&&(this._toolTipLayer.style.visibility="visible")}catch(e){debug.error("CreateToolTip: "+e.message,"Tooltipmanager")}},_this.UnEscapeToolTip=function(tooltip){return unescape(tooltip).replace(/&singlequote;/gi,"'").replace(/\+/g," ")},_this.checkBoundary=function(top,left){var rect=getWindowRectangle(),rightVal=left+this._toolTipLayer.offsetWidth,bottomVal=top+this._toolTipLayer.offsetHeight;rightVal>rect.getX()&&bottomVal>rect.getY()&&(this._toolTipLayer.style.width=Math.min(rect.getX()-20,this._toolTipLayer.offsetWidth)+"px",this._toolTipLayer.style.height=Math.min(rect.getY()-top-10,this._toolTipLayer.offsetHeight)+"px",rightVal=left+this._toolTipLayer.offsetWidth,bottomVal=top+this._toolTipLayer.offsetHeight),this._toolTipLayer.style.maxHeight=rect.getX(),this._toolTipLayer.style.maxWidth=rect.getY(),rightVal>rect.getX()?left-this._toolTipLayer.offsetWidth-10<0&&0rect.getY()?this._toolTipLayer.style.top=Math.max(0,top-this._toolTipLayer.offsetHeight-10)+"px":this._toolTipLayer.style.top=Math.max(0,top)+"px"},_this.GetToolTipText=function(){return AjaxMethodDispatcher.CallSyncReadOnly("SuperOffice.CRM.Web.AjaxMethods.ToolTipText.GetToolTip","",unescape(this._toolTipContext.Text))},_this.RegisterToolTip=function(element,text){text="javascript:ToolTipManager.Show(event, '"+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=16*Math.random()|0;return("x"===c?r:3&r|8).toString(16)})+"', '"+text+"', false);",text=new Function(text);$(element).off("mousemove"),$(element).on("mousemove",text)},SuperOffice.Controls.Udef=function(soid,onMoveCallback,udefFieldsUpdate){var pub={},udefEditorElement=null,udefFieldsUpdateArray=udefFieldsUpdate,onMoveCallbackFunctionName=onMoveCallback||"",self=this,editorScroll={left:0,top:0},snapPixels={x:21,y:21};return pub.soid=soid,(udefEditorElement=$.fromSoId(soid)).data("inited")||udefEditorElement.udefEditor("init",{snapPixels:snapPixels,editorScroll:editorScroll,onMoved:function(udefElements,setAlign){console.log("# moved:"+udefElements.length);for(var fieldArray=jQuery.extend([],udefFieldsUpdateArray),t=0;t{var host=null,initOptions=null,children=null,helper_getAll=function(){return host?host.children("[progid]"):$("justadummyselector")},helper_getSelected=function(){return host?host.children(".udefselected"):$("justadummyselector")},helper_getUnselected=function(){return host?host.children(":not(.udefselected)"):$("justadummyselector")},helper_unSelectAll=function(){null!=host&&host.children().removeClass("udefselected")},helper_storeCurrentPosition=function(udefElements){udefElements.each(function(){var elem=$(this);elem.data("pos",{left:elem.position().left,top:elem.position().top})})},helper_getMaxTopPosition=function(udefElements){return Math.max.apply(udefElements,udefElements.map(function(){return $(this).position().top+$(this).height()}).get())},helper_getMaxRightPosition=function(udefElements){return Math.max.apply(udefElements,udefElements.map(function(){return $(this).position().left+$(this).width()}).get())},helper_getMinTopPosition=function(udefElements){return Math.min.apply(udefElements,udefElements.map(function(){return $(this).position().top}).get())},helper_getMinLeftPosition=function(udefElements){return Math.min.apply(udefElements,udefElements.map(function(){return $(this).position().left}).get())},eventDispatcher_fireOnMoved=function(udefElements,setAlign){initOptions.onMoved&&initOptions.onMoved(udefElements,setAlign);setAlign=helper_getMaxTopPosition(udefElements),host.height()
"),initOptions.onSelectionChanged&&initOptions.onSelectionChanged(helper_getSelected())},eventDispatcher_fireOnDoubleClick=function(){initOptions.onDoubleClick&&initOptions.onDoubleClick(helper_getSelected().first())},methods={init:function(options){var elemId,allUdefElements,maxTop;host.data("inited")||((initOptions=options||{}).snapPixels=initOptions.snapPixels||{x:21,y:21},children=host.children(),host.mousedown(function(event){$(event.target).parent().attr("id")==host.parent().attr("id")&&(event=helper_getSelected().length,helper_unSelectAll(),0event&&udefElement.position().left,udefElement.position().top>minTop)&&udefElement.position().top,hasSelectionChanged&&eventDispatcher_fireOnSelectionChanged(),$(":focus").trigger("blur")),!1}),children.mouseup(function(event){var udefElement=$(this);if(1!=event.which)return!1;g_ctrlDown||(event=helper_getSelected().length,helper_unSelectAll(),host.data("hasdragged")?host.data("currentlyselected").toggleClass("udefselected"):(udefElement.toggleClass("udefselected"),1
"),$("#udefcontainerhost").css({overflow:"auto",position:"absolute",top:"0px",left:"0px",bottom:"40px",right:"0px"}),$("#udefcontainerhost").append($("[udefcontainer]")),host.css({width:"100%",height:"100%"}),host.toggleClass("udefgrid21"),allUdefElements=helper_getAll(),maxTop=helper_getMaxTopPosition(allUdefElements),host.height()