/*! espocrm 2026-02-05 */ define("views/admin/layouts/base",["exports","view"],function(e,t){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;t=(a=t,a&&a.__esModule?a:{default:a});var a;class s extends t.default{scope;type;events={'click button[data-action="save"]':function(){this.actionSave()},'click button[data-action="cancel"]':function(){this.cancel()},'click button[data-action="resetToDefault"]':function(){this.confirm(this.translate("confirmation","messages"),()=>{this.resetToDefault()})},'click button[data-action="remove"]':function(){this.actionDelete()}};buttonList=[{name:"save",label:"Save",style:"primary"},{name:"cancel",label:"Cancel"}];dataAttributes=null;dataAttributesDefs=null;dataAttributesDynamicLogicDefs=null;setup(){this.buttonList=_.clone(this.buttonList);this.events=_.clone(this.events);this.scope=this.options.scope;this.type=this.options.type;this.realType=this.options.realType;this.setId=this.options.setId;this.em=this.options.em;var e=this.getMetadata().get(["clientDefs",this.scope,"additionalLayouts",this.type])??{};this.typeDefs=e;this.dataAttributeList=Espo.Utils.clone(e.dataAttributeList||this.dataAttributeList);this.isCustom=!!e.isCustom;this.isCustom&&this.em&&this.buttonList.push({name:"remove",label:"Remove"});this.isCustom||this.buttonList.push({name:"resetToDefault",label:"Reset to Default"})}actionSave(){this.disableButtons();Espo.Ui.notify(this.translate("saving","messages"));this.save(this.enableButtons.bind(this))}disableButtons(){this.$el.find(".button-container button").attr("disabled","disabled")}enableButtons(){this.$el.find(".button-container button").removeAttr("disabled")}setConfirmLeaveOut(e){this.getRouter().confirmLeaveOut=e}setIsChanged(){this.isChanged=!0;this.setConfirmLeaveOut(!0)}setIsNotChanged(){this.isChanged=!1;this.setConfirmLeaveOut(!1)}save(e){var t=this.fetch();if(!this.validate(t))return this.enableButtons(),!1;this.getHelper().layoutManager.set(this.scope,this.type,t,()=>{Espo.Ui.success(this.translate("Saved"));this.setIsNotChanged();"function"==typeof e&&e();this.getHelper().broadcastChannel.postMessage("update:layout")},this.setId).catch(()=>this.enableButtons())}resetToDefault(){this.getHelper().layoutManager.resetToDefault(this.scope,this.type,()=>{this.loadLayout(()=>{this.setIsNotChanged();this.prepareLayout().then(()=>this.reRender())})},this.options.setId)}prepareLayout(){return Promise.resolve()}reset(){this.render()}fetch(){}unescape(e){if(null===e)return"";let t={"&":"&","<":"<",">":">",""":'"',"'":"'"};var a=new RegExp("("+_.keys(t).join("|")+")","g");return(""+e).replace(a,e=>t[e])}getEditAttributesModalViewOptions(e){return{name:e.name,scope:this.scope,attributeList:this.dataAttributeList,attributeDefs:this.dataAttributesDefs,dynamicLogicDefs:this.dataAttributesDynamicLogicDefs,attributes:e,languageCategory:this.languageCategory,headerText:" "}}openEditDialog(e){let i=e.name;var t=this.getEditAttributesModalViewOptions(e);this.createView("editModal","views/admin/layouts/modals/edit-attributes",t,s=>{s.render();this.listenToOnce(s,"after:save",e=>{this.trigger("update-item",i,e);var t,a=$("#layout ul > li[data-name='"+i+"']");for(t in e){a.attr("data-"+t,e[t]);a.data(t,e[t]);a.find("."+t+"-value").text(e[t])}s.close();this.setIsChanged()})})}cancel(){this.loadLayout(()=>{this.setIsNotChanged();this.em?this.trigger("cancel"):this.prepareLayout().then(()=>this.reRender())})}loadLayout(e){}validate(e){return!0}actionDelete(){this.confirm(this.translate("confirmation","messages")).then(()=>{this.disableButtons();Espo.Ui.notifyWait();Espo.Ajax.postRequest("Layout/action/delete",{scope:this.scope,name:this.type}).then(()=>{Espo.Ui.success(this.translate("Removed"),{suppress:!0});this.trigger("after-delete")}).catch(()=>{this.enableButtons()})})}}e.default=s});define("views/admin/layouts/rows",["exports","views/admin/layouts/base"],function(e,t){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;t=(a=t,a&&a.__esModule?a:{default:a});var a;class s extends t.default{template="admin/layouts/rows";dataAttributeList=null;dataAttributesDefs={};editable=!1;data(){return{scope:this.scope,type:this.type,buttonList:this.buttonList,enabledFields:this.enabledFields,disabledFields:this.disabledFields,layout:this.rowLayout,dataAttributeList:this.dataAttributeList,dataAttributesDefs:this.dataAttributesDefs,editable:this.editable}}setup(){this.itemsData={};super.setup();this.events['click a[data-action="editItem"]']=e=>{var t=$(e.target).closest("li").data("name");this.editRow(t)};this.on("update-item",(e,t)=>{this.itemsData[e]=Espo.Utils.cloneDeep(t)});Espo.loader.require("res!client/css/misc/layout-manager-rows.css",e=>{this.$style=$("