File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/js/calendar/sectioninterface/dist/sectioninterface.bundle.min.js
Back
this.BX=this.BX||{};(function(e,t,s,i,n,a,o,c,r){"use strict";let l=e=>e,d,h,p,u;class g extends i.EventEmitter{constructor(e={}){super();this.DOM={};this.isCreated=false;this.setEventNamespace("BX.Calendar.SectionInterface.EditForm");this.DOM.outerWrap=e.wrap;this.sectionAccessTasks=e.sectionAccessTasks;this.sectionManager=e.sectionManager;this.closeCallback=e.closeCallback;this.BX=o.Util.getBX();this.keyHandlerBinded=this.keyHandler.bind(this)}show(e={}){this.section=e.section;this.create();this.showAccess=e.showAccess!==false;this.allowChangeName=e.allowChangeName!==false;if(this.showAccess){this.DOM.accessLink.style.display="";this.DOM.accessWrap.style.display=""}else{this.DOM.accessLink.style.display="none";this.DOM.accessWrap.style.display="none"}a.Event.bind(document,"keydown",this.keyHandlerBinded);a.Dom.addClass(this.DOM.outerWrap,"show");if(e.section){if(e.section.color){this.setColor(e.section.color)}this.setAccess(e.section.access||e.section.data.ACCESS||{});if(e.section.name){this.DOM.sectionTitleInput.value=e.section.name}}if(this.allowChangeName){BX.focus(this.DOM.sectionTitleInput);if(this.DOM.sectionTitleInput.value!==""){this.DOM.sectionTitleInput.select()}}else{a.Dom.addClass(this.DOM.sectionTitleInput,"--disabled");this.DOM.sectionTitleInput.disabled=true}this.isOpenedState=true}close(){this.isOpenedState=false;a.Event.unbind(document,"keydown",this.keyHandlerBinded);a.Dom.removeClass(this.DOM.outerWrap,"show");if(a.Type.isFunction(this.closeCallback)){this.closeCallback()}}isOpened(){return this.isOpenedState}create(){this.wrap=this.DOM.outerWrap.querySelector(".calendar-form-content");if(this.wrap){a.Dom.clean(this.wrap)}else{this.wrap=this.DOM.outerWrap.appendChild(a.Dom.create("DIV",{props:{className:"calendar-form-content"}}))}this.DOM.formFieldsWrap=this.wrap.appendChild(a.Dom.create("DIV",{props:{className:"calendar-list-slider-widget-content"}})).appendChild(a.Dom.create("DIV",{props:{className:"calendar-list-slider-widget-content-block"}}));this.DOM.sectionTitleInput=this.DOM.formFieldsWrap.appendChild(a.Dom.create("DIV",{props:{className:"calendar-field-container calendar-field-container-string"}})).appendChild(a.Dom.create("DIV",{props:{className:"calendar-field-block"}})).appendChild(a.Dom.create("INPUT",{attrs:{type:"text",placeholder:a.Loc.getMessage("EC_SEC_SLIDER_SECTION_TITLE")},props:{className:"calendar-field calendar-field-string"}}));this.DOM.optionsWrap=this.DOM.formFieldsWrap.appendChild(a.Dom.create("DIV",{props:{className:"calendar-list-slider-new-calendar-options-container"}}));this.initSectionColorSelector();this.initAccessController();this.buttonsWrap=this.DOM.formFieldsWrap.appendChild(a.Dom.create("DIV",{props:{className:"calendar-list-slider-btn-container"}}));this.saveBtn=new BX.UI.Button({text:a.Loc.getMessage("EC_SEC_SLIDER_SAVE"),className:"ui-btn ui-btn-success",events:{click:this.save.bind(this)}});this.saveBtn.renderTo(this.buttonsWrap);new BX.UI.Button({text:a.Loc.getMessage("EC_SEC_SLIDER_CANCEL"),className:"ui-btn ui-btn-link",events:{click:this.checkClose.bind(this)}}).renderTo(this.buttonsWrap);this.isCreated=true}keyHandler(e){if(e.keyCode===o.Util.getKeyCode("escape")){this.checkClose()}else if(e.keyCode===o.Util.getKeyCode("enter")){this.save()}}checkClose(){this.close()}save(){this.saveBtn.setWaiting(true);this.sectionManager.saveSection(this.DOM.sectionTitleInput.value,this.color,this.access,{section:this.section}).then((()=>{this.saveBtn.setWaiting(false);this.close()}))}initSectionColorSelector(){this.DOM.colorContWrap=this.DOM.optionsWrap.appendChild(a.Dom.create("DIV",{props:{className:"calendar-list-slider-new-calendar-option-color"},html:a.Loc.getMessage("EC_SEC_SLIDER_COLOR")}));this.colorIcon=this.DOM.colorContWrap.appendChild(a.Dom.create("SPAN",{props:{className:"calendar-list-slider-new-calendar-option-color-selected"}}));this.colorChangeLink=this.DOM.colorContWrap.appendChild(a.Dom.create("SPAN",{props:{className:"calendar-list-slider-new-calendar-option-color-change"},html:a.Loc.getMessage("EC_SEC_SLIDER_CHANGE")}));a.Event.bind(this.colorIcon,"click",this.showSimplePicker.bind(this));a.Event.bind(this.colorChangeLink,"click",this.showSimplePicker.bind(this))}showSimplePicker(e){const t=a.Runtime.clone(o.Util.getDefaultColorList(),true);const s=a.Dom.create("DIV",{props:{className:"calendar-simple-color-wrap calendar-field-container-colorpicker-square"}});const i=s.appendChild(a.Dom.create("DIV",{events:{click:BX.delegate(this.simplePickerClick,this)}}));const n=s.appendChild(a.Dom.create("DIV",{props:{className:"calendar-simple-color-more-link-wrap"}}));const c=n.appendChild(a.Dom.create("SPAN",{props:{className:"calendar-simple-color-more-link"},html:a.Loc.getMessage("EC_COLOR"),events:{click:BX.delegate(this.showFullPicker,this)}}));this.simplePickerColorWrap=i;this.colors=[];if(!t.includes(this.color)){t.push(this.color)}for(let e=0;e<t.length;e++){this.colors.push({color:t[e],node:i.appendChild(a.Dom.create("SPAN",{props:{className:"calendar-field-colorpicker-color-item"},style:{backgroundColor:t[e]},attrs:{"data-bx-calendar-color":t[e]},html:'<span class="calendar-field-colorpicker-color"></span>'}))})}this.lastActiveNode=this.colors[BX.util.array_search(this.color,t)||0].node;a.Dom.addClass(this.lastActiveNode,"active");this.simpleColorPopup=BX.PopupWindowManager.create("simple-color-popup-"+o.Util.getRandomInt(),this.colorIcon,{autoHide:true,closeByEsc:true,offsetTop:0,offsetLeft:9,lightShadow:true,content:s,cacheable:false});this.simpleColorPopup.setAngle({offset:10});this.simpleColorPopup.show(true)}simplePickerClick(e){const t=o.Util.findTargetNode(e.target||e.srcElement,this.DOM.outerWrap);if(a.Type.isElementNode(t)){const e=t.getAttribute("data-bx-calendar-color");if(e!==null){if(this.lastActiveNode){a.Dom.removeClass(this.lastActiveNode,"active")}a.Dom.addClass(t,"active");this.lastActiveNode=t;this.setColor(e)}}}showFullPicker(){if(this.simpleColorPopup){this.simpleColorPopup.close()}if(!this.fullColorPicker){this.fullColorPicker=new BX.ColorPicker({bindElement:this.colorIcon,onColorSelected:BX.delegate((function(e){this.setColor(e)}),this),popupOptions:{cacheable:false,zIndex:this.zIndex,events:{onPopupClose:BX.delegate((function(){}),this)}}})}this.fullColorPicker.open()}setColor(e){this.colorIcon.style.backgroundColor=e;this.color=e}setAccess(e){let t=0;for(let s in e){if(e.hasOwnProperty(s)){t++}}this.accessRowsCount=t;this.access=e;for(let t in e){if(e.hasOwnProperty(t)){this.insertAccessRow(o.Util.getAccessName(t),t,e[t])}}this.checkAccessTableHeight()}initAccessController(){this.buildAccessController();if(this.sectionManager&&this.sectionManager.calendarType==="group"){this.initDialogGroup()}else{this.initDialogStandard()}this.initAccessSelectorPopup()}initAccessSelectorPopup(){a.Event.bind(this.DOM.accessWrap,"click",(e=>{const t=o.Util.findTargetNode(e.target||e.srcElement,this.DOM.outerWrap);if(a.Type.isElementNode(t)){if(t.getAttribute("data-bx-calendar-access-selector")!==null){const e=t.getAttribute("data-bx-calendar-access-selector");if(this.accessControls[e]){this.showAccessSelectorPopup({node:this.accessControls[e].removeIcon,setValueCallback:t=>{if(this.accessTasks[t]&&this.accessControls[e]){this.accessControls[e].valueNode.innerHTML=a.Text.encode(this.accessTasks[t].title);this.access[e]=t}}})}}else if(t.getAttribute("data-bx-calendar-access-remove")!==null){const e=t.getAttribute("data-bx-calendar-access-remove");if(this.accessControls[e]){a.Dom.remove(this.accessControls[e].rowNode);this.accessControls[e]=null;delete this.access[e]}}}}))}buildAccessController(){this.DOM.accessLink=this.DOM.optionsWrap.appendChild(a.Tag.render(d||(d=l`<div class="calendar-list-slider-new-calendar-option-more">${0}</div>`),a.Loc.getMessage("EC_SEC_SLIDER_ACCESS")));this.DOM.accessWrap=this.DOM.formFieldsWrap.appendChild(a.Tag.render(h||(h=l` <div class="calendar-list-slider-access-container"> <div class="calendar-list-slider-access-inner-wrap"> ${0} </div> <div class="calendar-list-slider-new-calendar-options-container"> ${0} </div> </div>`),this.DOM.accessTable=a.Tag.render(p||(p=l` <table class="calendar-section-slider-access-table"></table> `)),this.DOM.accessButton=a.Tag.render(u||(u=l` <span class="calendar-list-slider-new-calendar-option-add"> ${0} </span>`),a.Loc.getMessage("EC_SEC_SLIDER_ACCESS_ADD"))));this.accessControls={};this.accessTasks=this.sectionAccessTasks;a.Event.bind(this.DOM.accessLink,"click",(()=>{if(a.Dom.hasClass(this.DOM.accessWrap,"shown")){a.Dom.removeClass(this.DOM.accessWrap,"shown")}else{a.Dom.addClass(this.DOM.accessWrap,"shown")}this.checkAccessTableHeight()}))}initDialogStandard(){a.Event.bind(this.DOM.accessButton,"click",(()=>{this.entitySelectorDialog=new n.Dialog({targetNode:this.DOM.accessButton,context:"CALENDAR",preselectedItems:[],enableSearch:true,events:{"Item:onSelect":this.handleEntitySelectorChanges.bind(this),"Item:onDeselect":this.handleEntitySelectorChanges.bind(this)},popupOptions:{targetContainer:document.body},entities:[{id:"user"},{id:"project"},{id:"department",options:{selectMode:"usersAndDepartments"}},{id:"meta-user",options:{"all-users":true}}]});this.entitySelectorDialog.show()}))}initDialogGroup(){a.Event.bind(this.DOM.accessButton,"click",(()=>{this.entitySelectorDialog=new n.Dialog({targetNode:this.DOM.accessButton,context:"CALENDAR",preselectedItems:[],enableSearch:true,events:{"Item:onSelect":this.handleEntitySelectorChanges.bind(this),"Item:onDeselect":this.handleEntitySelectorChanges.bind(this)},popupOptions:{targetContainer:document.body},entities:[{id:"user"},{id:"department",options:{selectMode:"usersAndDepartments"}},{id:"meta-user",options:{"all-users":true}}],tabs:[{id:"groupAccess",title:this.sectionManager.ownerName}],items:[{id:"SG"+this.sectionManager.ownerId+"_"+"A",entityId:"group",tabs:"groupAccess",title:a.Loc.getMessage("EC_ACCESS_GROUP_ADMIN")},{id:"SG"+this.sectionManager.ownerId+"_"+"E",entityId:"group",tabs:"groupAccess",title:a.Loc.getMessage("EC_ACCESS_GROUP_MODERATORS")},{id:"SG"+this.sectionManager.ownerId+"_"+"K",entityId:"group",tabs:"groupAccess",title:a.Loc.getMessage("EC_ACCESS_GROUP_MEMBERS")}]});this.entitySelectorDialog.show()}))}handleEntitySelectorChanges(){const e=this.entitySelectorDialog.getSelectedItems();this.entitySelectorDialog.hide();if(a.Type.isArray(e)){e.forEach((e=>{let t;if(e.entityId==="group"){t=this.sectionManager.ownerName+": "+e.title.text}else{t=e.title.text}const s=o.Util.convertEntityToAccessCode(e);o.Util.setAccessName(s,t);this.insertAccessRow(t,s)}))}a.Runtime.debounce((()=>{this.entitySelectorDialog.destroy()}),400)()}insertAccessRow(e,t,s){if(!this.accessControls[t]){if(s===undefined){for(let e in this.sectionAccessTasks){if(this.sectionAccessTasks.hasOwnProperty(e)&&this.sectionAccessTasks[e].name==="calendar_view"){s=e;break}}}const i=a.Dom.adjust(this.DOM.accessTable.insertRow(-1),{props:{className:"calendar-section-slider-access-table-row"}}),n=a.Dom.adjust(i.insertCell(-1),{props:{className:"calendar-section-slider-access-table-cell"},html:'<span class="calendar-section-slider-access-title">'+a.Text.encode(e)+":</span>"}),o=a.Dom.adjust(i.insertCell(-1),{props:{className:"calendar-section-slider-access-table-cell"},attrs:{"data-bx-calendar-access-selector":t}}),c=o.appendChild(a.Dom.create("SPAN",{props:{className:"calendar-section-slider-access-container"}})),r=c.appendChild(a.Dom.create("SPAN",{text:this.accessTasks[s]?this.accessTasks[s].title:"",props:{className:"calendar-section-slider-access-value"}})),l=c.appendChild(a.Dom.create("SPAN",{props:{className:"calendar-section-slider-access-remove"},attrs:{"data-bx-calendar-access-remove":t}}));this.access[t]=s;this.accessControls[t]={rowNode:i,titleNode:n,valueNode:r,removeIcon:l}}}checkAccessTableHeight(){if(this.checkTableTimeout){this.checkTableTimeout=clearTimeout(this.checkTableTimeout)}this.checkTableTimeout=setTimeout((()=>{if(a.Dom.hasClass(this.DOM.accessWrap,"shown")){if(this.DOM.accessWrap.offsetHeight-this.DOM.accessTable.offsetHeight<36){this.DOM.accessWrap.style.maxHeight=parseInt(this.DOM.accessTable.offsetHeight)+100+"px"}}else{this.DOM.accessWrap.style.maxHeight=""}}),300)}showAccessSelectorPopup(e){if(this.accessPopupMenu&&this.accessPopupMenu.popupWindow&&this.accessPopupMenu.popupWindow.isShown()){return this.accessPopupMenu.close()}const t=this;const s=[];for(let i in this.accessTasks){if(this.accessTasks.hasOwnProperty(i)){s.push({text:this.accessTasks[i].title,onclick:function(s){return function(){e.setValueCallback(s);t.accessPopupMenu.close()}}(i)})}}this.accessPopupMenu=this.BX.PopupMenu.create("section-access-popup"+o.Util.randomInt(),e.node,s,{closeByEsc:true,autoHide:true,offsetTop:-5,offsetLeft:0,angle:true,cacheable:false});this.accessPopupMenu.show()}}let C=e=>e,S,E,m,D,f,M,L,T,_;class k{constructor(e={}){this.DOM={};this.isCreated=false;this.interfaceType="users";this.DOM.outerWrap=e.wrap;this.trackingUsers=e.trackingUsers||[];this.trackingUserIdList=this.trackingUsers.map((e=>parseInt(e.ID)));this.trackingGroupIdList=[];this.CHECKED_CLASS="calendar-list-slider-item-checkbox-checked";this.selectorId="add-tracking"+o.Util.getRandomInt();this.closeCallback=e.closeCallback;this.superposedSections=a.Type.isArray(e.superposedSections)?e.superposedSections:[];this.selected={};this.superposedSections.forEach((e=>{this.selected[e.id]=true}),this);this.isCreated=false;this.keyHandlerBinded=this.keyHandler.bind(this)}show(){if(!this.isCreated){this.create()}a.Dom.addClass(this.DOM.outerWrap,"show");this.checkInnerWrapHeight();a.Event.bind(document,"keydown",this.keyHandlerBinded);this.updateSectionList();this.firstTrackingUserIdList=a.Runtime.clone(this.trackingUserIdList);this.isOpenedState=true}close(){a.Event.unbind(document,"keydown",this.keyHandlerBinded);this.isOpenedState=false;a.Dom.removeClass(this.DOM.outerWrap,"show");this.DOM.outerWrap.style.cssText="";if(a.Type.isFunction(this.closeCallback)){this.closeCallback()}}isOpened(){return this.isOpenedState}create(){if(!this.DOM.innerWrap){this.DOM.innerWrap=this.DOM.outerWrap.appendChild(a.Tag.render(S||(S=C`<div></div>`)))}this.selectorWrap=this.DOM.innerWrap.appendChild(a.Dom.create("DIV",{props:{className:"calendar-list-slider-selector-wrap"}}));this.userTagSelector=new n.TagSelector({dialogOptions:{width:320,context:"CALENDAR",preselectedItems:this.trackingUsers.map((e=>["user",parseInt(e.ID)])),events:{"Item:onSelect":this.handleUserSelectorChanges.bind(this),"Item:onDeselect":this.handleUserSelectorChanges.bind(this)},entities:[{id:"user"}]}});this.userTagSelector.renderTo(this.selectorWrap);this.sectionsWrap=this.DOM.innerWrap.appendChild(a.Tag.render(E||(E=C`<div class="calendar-list-slider-sections-wrap"></div>`)));this.createButtons();this.isCreated=true}createButtons(){this.DOM.innerWrap.appendChild(a.Tag.render(m||(m=C`<div class="calendar-list-slider-btn-container"> <button class="ui-btn ui-btn-sm ui-btn-primary" onclick="${0}" >${0}</button> <button class="ui-btn ui-btn-link" onclick="${0}" >${0}</button> </div>`),this.save.bind(this),a.Loc.getMessage("EC_SEC_SLIDER_SAVE"),this.close.bind(this),a.Loc.getMessage("EC_SEC_SLIDER_CANCEL")))}handleUserSelectorChanges(){const e=this.userTagSelector.getDialog().getSelectedItems();this.trackingUserIdList=[];e.forEach((e=>{if(e.entityId==="user"){this.trackingUserIdList.push(e.id)}}));this.updateSectionList()}save(){BX.ajax.runAction("calendar.api.calendarajax.setTrackingSections",{data:{userIdList:this.trackingUserIdList,sections:this.prepareTrackingSections(),type:this.interfaceType}}).then((e=>{location.reload()}),(e=>{o.Util.displayError(e.errors)}));this.close()}prepareTrackingSections(){let e=this.getSelectedSections();for(let t in this.sectionIndex){if(this.sectionIndex.hasOwnProperty(t)&&this.sectionIndex[t].checkbox){if(a.Dom.hasClass(this.sectionIndex[t].checkbox,this.CHECKED_CLASS)){if(!e.includes(parseInt(t))){e.push(parseInt(t))}}else if(e.includes(parseInt(t))){e=e.filter((e=>parseInt(e)!==parseInt(t)))}}}return e}getSelectedSections(){const e=[];this.superposedSections.forEach((t=>{if(this.interfaceType==="users"&&t.type==="user"&&this.trackingUserIdList&&!this.trackingUserIdList.includes(t.ownerId)){return}e.push(parseInt(t.id))}),this);return e}updateSectionList(e){if(this.updateSectionLoader){a.Dom.remove(this.updateSectionLoader)}this.updateSectionLoader=this.sectionsWrap.appendChild(a.Dom.adjust(o.Util.getLoader(),{style:{height:"140px"}}));if(this.updateSectionTimeout){this.updateSectionTimeout=clearTimeout(this.updateSectionTimeout)}if(e!==false){this.updateSectionTimeout=setTimeout((()=>{this.updateSectionList(false)}),300);return}this.checkInnerWrapHeight();BX.ajax.runAction("calendar.api.calendarajax.getTrackingSections",{data:{userIdList:this.trackingUserIdList,type:"users"}}).then((e=>{a.Dom.clean(this.sectionsWrap);this.sectionIndex={};this.checkInnerWrapHeight();e.data.users.forEach((t=>{const s=e.data.sections.filter((function(e){return parseInt(e.OWNER_ID)===parseInt(t.ID)}));this.sectionsWrap.appendChild(a.Tag.render(D||(D=C` <div> <span class="calendar-list-slider-card-section-title-text"> ${0} </span> </div> `),a.Text.encode(t.FORMATTED_NAME)));if(s.length>0){this.createSectionBlock({sectionList:s,wrap:this.sectionsWrap})}else{this.sectionsWrap.appendChild(a.Tag.render(f||(f=C` <div> <span class="calendar-list-slider-card-section-title-text"> ${0} </span> </div> `),a.Loc.getMessage("EC_SEC_SLIDER_NO_SECTIONS")))}}))}),(e=>{o.Util.displayError(e.errors)}))}createSectionBlock(e={}){let t=false;if(a.Type.isArray(e.sectionList)&&e.sectionList.length&&a.Type.isElementNode(e.wrap)){let t;e.wrap.appendChild(a.Tag.render(M||(M=C` <div class="calendar-list-slider-widget-content"> <div class="calendar-list-slider-widget-content-block"> ${0} </div> </div> `),t=a.Tag.render(L||(L=C`<ul class="calendar-list-slider-container"></ul>`))));a.Event.bind(t,"click",this.sectionClick.bind(this));e.sectionList.forEach((e=>{const s=e.ID.toString();let i;const n=t.appendChild(a.Tag.render(T||(T=C` <li class="calendar-list-slider-item" data-bx-calendar-section="${0}"> ${0} <div class="calendar-list-slider-item-name">${0}</div> </li> `),s,i=a.Tag.render(_||(_=C` <div class="calendar-list-slider-item-checkbox" style="background: ${0}"></div> `),e.COLOR),a.Text.encode(e.NAME)));this.sectionIndex[s]={item:n,checkbox:i};if(this.selected[s]||!a.Type.isArray(this.firstTrackingUserIdList)||!this.firstTrackingUserIdList.includes(parseInt(e.OWNER_ID))){a.Dom.addClass(i,this.CHECKED_CLASS)}}))}return t}sectionClick(e){const t=o.Util.findTargetNode(e.target||e.srcElement,this.DOM.outerWrap);if(a.Type.isElementNode(t)){if(t.getAttribute("data-bx-calendar-section")!==null){const e=t.getAttribute("data-bx-calendar-section");if(this.sectionIndex[e]&&this.sectionIndex[e].checkbox){if(a.Dom.hasClass(this.sectionIndex[e].checkbox,this.CHECKED_CLASS)){a.Dom.removeClass(this.sectionIndex[e].checkbox,this.CHECKED_CLASS)}else{a.Dom.addClass(this.sectionIndex[e].checkbox,this.CHECKED_CLASS)}}}}}keyHandler(e){if(e.keyCode===o.Util.getKeyCode("escape")){this.close()}else if(e.keyCode===o.Util.getKeyCode("enter")){this.save()}}checkInnerWrapHeight(){if(this.checkHeightTimeout){this.checkHeightTimeout=clearTimeout(this.checkHeightTimeout)}this.checkHeightTimeout=setTimeout((()=>{if(a.Dom.hasClass(this.DOM.outerWrap,"show")){if(this.DOM.outerWrap.offsetHeight-this.DOM.innerWrap.offsetHeight<36){this.DOM.outerWrap.style.maxHeight=parseInt(this.DOM.innerWrap.offsetHeight)+200+"px"}}else{this.DOM.outerWrap.style.maxHeight=""}}),300)}}let I=e=>e,O,b;class w extends k{constructor(e={}){super(e);this.interfaceType="groups";this.trackingGroupIdList=e.trackingGroups||[]}create(){if(!this.DOM.innerWrap){this.DOM.innerWrap=this.DOM.outerWrap.appendChild(a.Tag.render(O||(O=I`<div></div>`)))}this.selectorWrap=this.DOM.innerWrap.appendChild(a.Dom.create("DIV",{props:{className:"calendar-list-slider-selector-wrap"}}));this.groupTagSelector=new n.TagSelector({dialogOptions:{width:320,context:"CALENDAR",preselectedItems:this.trackingGroupIdList.map((e=>["project",e])),events:{"Item:onSelect":this.handleGroupSelectorChanges.bind(this),"Item:onDeselect":this.handleGroupSelectorChanges.bind(this)},entities:[{id:"project"}]}});this.groupTagSelector.renderTo(this.selectorWrap);this.sectionsWrap=this.DOM.innerWrap.appendChild(a.Tag.render(b||(b=I`<div class="calendar-list-slider-sections-wrap"></div>`)));this.createButtons();this.isCreated=true}handleGroupSelectorChanges(){const e=this.groupTagSelector.getDialog().getSelectedItems();this.trackingGroupIdList=[];e.forEach((e=>{if(e.entityId==="project"){this.trackingGroupIdList.push(e.id)}}));this.updateSectionList()}updateSectionList(){if(this.updateSectionLoader){a.Dom.remove(this.updateSectionLoader)}this.updateSectionLoader=this.sectionsWrap.appendChild(a.Dom.adjust(o.Util.getLoader(),{style:{height:"140px"}}));if(this.updateSectionTimeout){this.updateSectionTimeout=clearTimeout(this.updateSectionTimeout)}this.checkInnerWrapHeight();BX.ajax.runAction("calendar.api.calendarajax.getTrackingSections",{data:{groupIdList:this.trackingGroupIdList,type:"groups"}}).then((e=>{a.Dom.clean(this.sectionsWrap);this.sectionIndex={};this.checkInnerWrapHeight();this.createSectionBlock({sectionList:e.data.sections,wrap:this.sectionsWrap})}),(e=>{o.Util.displayError(e.errors)}))}getSelectedSections(){const e=[];this.superposedSections.forEach((t=>{if(this.interfaceType==="groups"&&t.type==="group"&&this.trackingGroupIdList&&!this.trackingGroupIdList.includes(t.ownerId)){return}e.push(parseInt(t.id))}),this);return e}}let v=e=>e,y,A,x;class N extends k{constructor(e={}){super(e);this.trackingGroups=e.trackingGroups||[];this.interfaceType="company";this.selectGroups=true;this.selectUsers=false;this.addLinkMessage=a.Loc.getMessage("EC_SEC_SLIDER_SELECT_GROUPS")}show(){if(!this.isCreated){this.create()}this.updateSectionList();this.isOpenedState=true;a.Dom.addClass(this.DOM.outerWrap,"show")}create(){if(!this.DOM.innerWrap){this.DOM.innerWrap=this.DOM.outerWrap.appendChild(a.Tag.render(y||(y=v`<div></div>`)))}this.sectionsWrap=this.DOM.innerWrap.appendChild(a.Tag.render(A||(A=v`<div class="calendar-list-slider-sections-wrap"></div>`)));this.createButtons();this.isCreated=true}updateSectionList(){if(this.updateSectionLoader){a.Dom.remove(this.updateSectionLoader)}this.updateSectionLoader=this.sectionsWrap.appendChild(a.Dom.adjust(o.Util.getLoader(),{style:{height:"140px"}}));if(this.updateSectionTimeout){this.updateSectionTimeout=clearTimeout(this.updateSectionTimeout)}BX.ajax.runAction("calendar.api.calendarajax.getTrackingSections",{data:{type:"company"}}).then((e=>{a.Dom.clean(this.sectionsWrap);this.sectionIndex={};this.checkInnerWrapHeight();if(a.Type.isArray(e.data.sections)&&e.data.sections.length){this.createSectionBlock({sectionList:e.data.sections,wrap:this.sectionsWrap})}else{this.sectionsWrap.appendChild(a.Tag.render(x||(x=v` <div> <span class="calendar-list-slider-card-section-title-text"> ${0} </span> </div> `),a.Loc.getMessage("EC_SEC_SLIDER_NO_SECTIONS")))}}),(e=>{o.Util.displayError(e.errors)}));this.checkInnerWrapHeight()}save(){BX.ajax.runAction("calendar.api.calendarajax.setTrackingSections",{data:{sections:this.prepareTrackingSections()}}).then((e=>{location.reload()}),(e=>{o.Util.displayError(e.errors)}));this.close()}getSelectedSections(){const e=[];this.superposedSections.forEach((t=>{e.push(parseInt(t.id))}),this);return e}}let B=e=>e,W,P,U,R,H,X,F,G,$,V,Y,j,K,q,z,J,Q,Z,ee,te,se,ie,ne,ae,oe,ce,re;class le extends i.EventEmitter{constructor({calendarContext:e,readonly:t,sectionManager:s}){super();this.name="sectioninterface";this.uid=null;this.DOM={};this.SLIDER_WIDTH=400;this.SLIDER_DURATION=80;this.sliderId="calendar:section-slider";this.denyClose=false;this.deletedSectionsIds=[];this.setEventNamespace("BX.Calendar.SectionInterface");this.sectionManager=s;this.calendarContext=e;this.readonly=t;this.BX=o.Util.getBX();this.deleteSectionHandlerBinded=this.deleteSectionHandler.bind(this);this.refreshSectionListBinded=this.refreshSectionList.bind(this);this.keyHandlerBinded=this.keyHandler.bind(this);if(this.calendarContext!==null){if(this.calendarContext.util.config.accessNames){var i,n,a;o.Util.setAccessNames((i=this.calendarContext)==null?void 0:(n=i.util)==null?void 0:(a=n.config)==null?void 0:a.accessNames)}}}show(){this.BX.SidePanel.Instance.open(this.sliderId,{contentCallback:this.createContent.bind(this),width:this.SLIDER_WIDTH,animationDuration:this.SLIDER_DURATION,events:{onCloseByEsc:this.escHide.bind(this),onClose:this.hide.bind(this),onCloseComplete:this.destroy.bind(this),onLoad:this.onLoadSlider.bind(this)}});this.addEventEmitterSubscriptions();a.Event.bind(document,"keydown",this.keyHandlerBinded)}addEventEmitterSubscriptions(){this.BX.Event.EventEmitter.subscribe("BX.Calendar.Section:delete",this.deleteSectionHandlerBinded);this.BX.Event.EventEmitter.subscribe("BX.Calendar.Section:pull-delete",this.deleteSectionHandlerBinded);this.BX.Event.EventEmitter.subscribe("BX.Calendar.Section:edit",this.refreshSectionListBinded);this.BX.Event.EventEmitter.subscribe("BX.Calendar.Section:pull-reload-data",this.refreshSectionListBinded)}destroyEventEmitterSubscriptions(){this.BX.Event.EventEmitter.unsubscribe("BX.Calendar.Section:delete",this.deleteSectionHandlerBinded);this.BX.Event.EventEmitter.unsubscribe("BX.Calendar.Section:pull-delete",this.deleteSectionHandlerBinded);this.BX.Event.EventEmitter.unsubscribe("BX.Calendar.Section:edit",this.refreshSectionListBinded);this.BX.Event.EventEmitter.unsubscribe("BX.Calendar.Section:pull-reload-data",this.refreshSectionListBinded)}escHide(e){if(e&&e.getSlider&&e.getSlider().getUrl()===this.sliderId&&this.denyClose){e.denyAction()}}hide(e){if(e&&e.getSlider&&e.getSlider().getUrl()===this.sliderId){this.closeForms();this.destroyEventEmitterSubscriptions();a.Event.unbind(document,"keydown",this.keyHandlerBinded)}}close(){BX.SidePanel.Instance.close()}destroy(e){if(e&&e.getSlider&&e.getSlider().getUrl()===this.sliderId){this.destroyEventEmitterSubscriptions();a.Event.unbind(document,"keydown",this.keyHandlerBinded);o.Util.getBX().Event.EventEmitter.unsubscribe("BX.Calendar.Section:delete",this.deleteSectionHandlerBinded);o.Util.getBX().Event.EventEmitter.unsubscribe("BX.Calendar.Section:pull-delete",this.deleteSectionHandlerBinded);BX.removeCustomEvent("SidePanel.Slider:onCloseComplete",BX.proxy(this.destroy,this));BX.SidePanel.Instance.destroy(this.sliderId);delete this.DOM.localSectionListWrap;this.deletedSectionsIds=[];if(this.sectionActionMenu){this.sectionActionMenu.close()}if(this.trackingTypesForm){delete this.trackingTypesForm}if(this.trackingUsersForm){delete this.trackingUsersForm}if(this.trackingGroupsForm){delete this.trackingGroupsForm}}}createContent(){this.DOM.outerWrap=a.Tag.render(W||(W=B` <div class="calendar-list-slider-wrap"></div> `));this.DOM.titleWrap=this.DOM.outerWrap.appendChild(a.Tag.render(P||(P=B` <div class="calendar-list-slider-title-container"> <div class="calendar-list-slider-title"> ${0} </div> </div> `),a.Loc.getMessage("EC_SECTION_BUTTON")));const e=this.calendarContext||o.Util.getCalendarContext();if(e&&!this.readonly){this.DOM.sectionFormWrap=this.DOM.outerWrap.appendChild(a.Tag.render(U||(U=B` <div class="calendar-list-slider-card-widget calendar-list-slider-form-wrap"> <div class="calendar-list-slider-card-widget-title"> <span class="calendar-list-slider-card-widget-title-text"> ${0} </span> </div> </div> `),a.Loc.getMessage("EC_SEC_SLIDER_NEW_SECTION")))}if(e&&!this.readonly&&(!e.util.isUserCalendar()||e.util.userIsOwner())){this.createAddButton();this.DOM.trackingGroupsFormWrap=this.DOM.outerWrap.appendChild(a.Tag.render(R||(R=B` <div class="calendar-list-slider-card-widget calendar-list-slider-form-wrap"> <div class="calendar-list-slider-card-widget-title"> <span class="calendar-list-slider-card-widget-title-text"> ${0} </span> </div> </div> `),a.Loc.getMessage("EC_SEC_SLIDER_POPUP_MENU_ADD_GROUP")));this.DOM.trackingUsersFormWrap=this.DOM.outerWrap.appendChild(a.Tag.render(H||(H=B` <div class="calendar-list-slider-card-widget calendar-list-slider-form-wrap"> <div class="calendar-list-slider-card-widget-title"> <span class="calendar-list-slider-card-widget-title-text"> ${0} </span> </div> </div> `),a.Loc.getMessage("EC_SEC_SLIDER_POPUP_MENU_ADD_USER")));this.DOM.trackingTypesFormWrap=this.DOM.outerWrap.appendChild(a.Tag.render(X||(X=B` <div class="calendar-list-slider-card-widget calendar-list-slider-form-wrap"> <div class="calendar-list-slider-card-widget-title"> <span class="calendar-list-slider-card-widget-title-text"> ${0} </span> </div> </div> `),a.Loc.getMessage("EC_SEC_SLIDER_POPUP_MENU_ADD_COMP")))}this.createSectionList();return this.DOM.outerWrap}onLoadSlider(e){this.slider=e.getSlider();this.sliderId=this.slider.getUrl();this.DOM.content=this.slider.layout.content}createSectionList(){this.sliderSections=this.sectionManager.getSections().filter((e=>!this.deletedSectionsIds.find((t=>t===e.id))));if(a.Type.isElementNode(this.DOM.sectonListOuterWrap)){a.Dom.remove(this.DOM.sectonListOuterWrap)}this.DOM.sectonListOuterWrap=this.DOM.outerWrap.appendChild(a.Tag.render(F||(F=B`<div></div>`)));a.Event.bind(this.DOM.sectonListOuterWrap,"click",this.sectionClickHandler.bind(this));this.createLocalSectionsList();this.createExternalSectionsList()}createLocalSectionsList(){this.DOM.localSectionListWrap=this.DOM.sectonListOuterWrap.appendChild(this.getSectionListWrap(this.getLocalSectionListTitle()));this.createSectionsBlock({wrap:this.DOM.localSectionListWrap,sectionList:this.sliderSections.filter((e=>e.externalTypeIsLocal()&&e.belongsToView()||e.isPseudo()))});this.createCompanySectionList();this.createUsersSectionList();this.createGroupsSectionList()}createExternalSectionsList(){const e=this.sliderSections.filter((e=>!e.externalTypeIsLocal()&&e.belongsToView()));this.DOM.extSectionListWrap=[];e.forEach((e=>{const t=this.getSectionListWrapForSection(e);this.createSectionUnit({section:e,wrap:t})}))}getSectionListWrapForSection(e){var t;let s=e.getExternalType();if(e.isGoogle()){s="google"}if(e.data["IS_EXCHANGE"]){s="exchange"}const i=c.SectionManager.getSectionExternalConnection(e,s);const n=this.calendarContext||o.Util.getCalendarContext();e.data.CAL_DAV_CON=(i==null?void 0:(t=i.addParams)==null?void 0:t.id)||null;let r=s+(i?i.getId():"-disconnected");if(!a.Type.isElementNode(this.DOM.extSectionListWrap[r])){const t=this.DOM.sectonListOuterWrap.appendChild(this.getSectionListWrap(this.getExternalConnectionBlockTitle({type:s,connection:i})));t.appendChild(a.Tag.render(G||(G=B` <div class="calendar-list-slider-widget-content"> <div class="calendar-list-slider-widget-content-block"> ${0} </div> </div> `),this.DOM.extSectionListWrap[r]=a.Tag.render($||($=B`<ul class="calendar-list-slider-container"/>`))));if(!i&&n&&n.util.userIsOwner()&&!e.isArchive()&&(!e.isExchange()||!n.util.config.bExchange&&e.isExchange())){t.querySelector(".calendar-list-slider-widget-content-block").appendChild(a.Tag.render(V||(V=B` <div data-bx-calendar-open-sync="Y" class="calendar-list-slider-card-widget-bottom-button"> <span class="calendar-list-slider-link"> ${0} </span> </div>`),a.Loc.getMessage("EC_SEC_SLIDER_ADJUST_SYNC")));t.querySelector(".calendar-list-slider-card-widget-title").appendChild(a.Tag.render(Y||(Y=B` <span class="calendar-list-slider-card-widget-title-text calendar-list-title-disabled" > ${0} </span>`),a.Loc.getMessage("EC_SEC_SLIDER_SYNC_DISABLED")))}else if(e.isArchive()){const e=t.querySelector(".calendar-list-slider-card-widget-title").appendChild(a.Tag.render(j||(j=B` <div class="ui-icon ui-icon-common-question calendar-list-slider-archive-hint" data-hint="${0}"> <i></i> </div> `),a.Loc.getMessage("EC_SEC_SLIDER_TYPE_ARCHIVE_HELPER")));if(a.Type.isDomNode(e)){o.Util.initHintNode(e)}}}return this.DOM.extSectionListWrap[r]}getExternalConnectionBlockTitle({type:e,connection:t}){let s="";const i=t?t.getConnectionAccountName()||t.getConnectionName():null;switch(e){case"google":if(i){s=a.Loc.getMessage("EC_SEC_SLIDER_TYPE_GOOGLE",{"#CONNECTION_NAME#":i})}else{s=a.Loc.getMessage("EC_SEC_SLIDER_TYPE_GOOGLE_DIS")}break;case"office365":if(i){s=a.Loc.getMessage("EC_SEC_SLIDER_TYPE_OFFICE365",{"#CONNECTION_NAME#":i})}else{s=a.Loc.getMessage("EC_SEC_SLIDER_TYPE_OFFICE365_DIS")}break;case"icloud":if(i){s=a.Loc.getMessage("EC_SEC_SLIDER_TYPE_ICLOUD",{"#CONNECTION_NAME#":i})}else{s=a.Loc.getMessage("EC_SEC_SLIDER_TYPE_ICLOUD_DIS")}break;case"caldav":if(i){if(t.getType()==="yandex"){s=a.Loc.getMessage("EC_SEC_SLIDER_TYPE_YANDEX",{"#CONNECTION_NAME#":i})}else{s=a.Loc.getMessage("EC_SEC_SLIDER_TYPE_CALDAV",{"#CONNECTION_NAME#":i})}}else{s=a.Loc.getMessage("EC_SEC_SLIDER_TYPE_DEFAULT")}break;case"exchange":s=a.Loc.getMessage("EC_CAL_SYNC_EXCHANGE");break;case"archive":s=a.Loc.getMessage("EC_SEC_SLIDER_TYPE_ARCHIVE");break;default:s=a.Loc.getMessage("EC_SEC_SLIDER_TYPE_DEFAULT")}return s}createCompanySectionList(){const e=this.sliderSections.filter((function(e){return e.isCompanyCalendar()&&!e.belongsToView()}));if(e.length>0){this.DOM.localSectionListWrap.appendChild(a.Tag.render(K||(K=B` <div class="calendar-list-slider-card-section-title"> <span class="calendar-list-slider-card-section-title-text">${0}</span> </div> `),a.Loc.getMessage("EC_SEC_SLIDER_TITLE_COMP_CAL")));this.createSectionsBlock({wrap:this.DOM.localSectionListWrap,sectionList:this.sliderSections.filter((e=>e.isCompanyCalendar()))})}}createUsersSectionList(){this.calendarContext.util.getSuperposedTrackedUsers().forEach((e=>{const t=this.sliderSections.filter((t=>!t.belongsToView()&&t.type==="user"&&t.data.OWNER_ID===e.ID));if(t.length>0){this.DOM.localSectionListWrap.appendChild(a.Tag.render(q||(q=B` <div class="calendar-list-slider-card-section-title"> <span class="calendar-list-slider-card-section-title-text">${0}</span> </div> `),a.Text.encode(e.FORMATTED_NAME)));this.createSectionsBlock({wrap:this.DOM.localSectionListWrap,sectionList:t})}}),this)}createGroupsSectionList(){const e=this.sliderSections.filter((e=>!e.belongsToView()&&e.type==="group"));if(e.length>0){this.DOM.localSectionListWrap.appendChild(a.Tag.render(z||(z=B` <div class="calendar-list-slider-card-section-title"> <span class="calendar-list-slider-card-section-title-text">${0}</span> </div> `),a.Loc.getMessage("EC_SEC_SLIDER_TITLE_GROUP_CAL")));this.createSectionsBlock({wrap:this.DOM.localSectionListWrap,sectionList:e})}}getSectionListWrap(e){return a.Tag.render(J||(J=B` <div class="calendar-list-slider-card-widget"> <div class="calendar-list-slider-card-widget-title"> <span class="calendar-list-slider-card-widget-title-text"> ${0} </span> </div> </div> `),e)}getLocalSectionListTitle(){if(this.sectionManager.calendarType==="user"){return a.Loc.getMessage("EC_SEC_SLIDER_MY_CALENDARS_LIST")}else if(this.sectionManager.calendarType==="group"){return a.Loc.getMessage("EC_SEC_SLIDER_GROUP_CALENDARS_LIST")}else{return a.Loc.getMessage("EC_SEC_SLIDER_TYPE_CALENDARS_LIST")}}createAddButton(){if(this.calendarContext.util.config.perm&&this.calendarContext.util.config.perm.edit_section){const e=this.DOM.titleWrap.appendChild(a.Tag.render(Q||(Q=B` <span class="ui-btn-split ui-btn-light-border" style="margin-right: 0"></span> `)));this.DOM.addButton=e.appendChild(a.Tag.render(Z||(Z=B` <span class="ui-btn-main">${0}</span> `),a.Loc.getMessage("EC_ADD")));this.DOM.addButtonMore=e.appendChild(a.Tag.render(ee||(ee=B` <span class="ui-btn-extra"></span> `)));a.Event.bind(this.DOM.addButtonMore,"click",this.showAddButtonPopup.bind(this));a.Event.bind(this.DOM.addButton,"click",this.showEditSectionForm.bind(this))}}showAddButtonPopup(){if(this.addBtnMenu&&this.addBtnMenu.popupWindow&&this.addBtnMenu.popupWindow.isShown()){return this.addBtnMenu.close()}const e=[new s.MenuItem({text:a.Loc.getMessage("EC_SEC_SLIDER_POPUP_NEW_TITLE"),delimiter:true}),{html:a.Loc.getMessage("EC_SEC_SLIDER_POPUP_NEW_MENU"),onclick:()=>{this.addBtnMenu.close();this.showEditSectionForm()}},new s.MenuItem({text:a.Loc.getMessage("EC_SEC_SLIDER_POPUP_EXIST_TITLE"),delimiter:true}),{html:a.Loc.getMessage("EC_SEC_SLIDER_POPUP_MENU_ADD_COMP"),onclick:()=>{this.addBtnMenu.close();this.showTrackingTypesForm()}},{html:a.Loc.getMessage("EC_SEC_SLIDER_POPUP_MENU_ADD_USER"),onclick:()=>{this.addBtnMenu.close();this.showTrackingUsersForm()}},{html:a.Loc.getMessage("EC_SEC_SLIDER_POPUP_MENU_ADD_GROUP"),onclick:()=>{this.addBtnMenu.close();this.showTrackingGroupsForm()}}];this.addBtnMenu=this.BX.PopupMenu.create("add-btn-"+o.Util.getRandomInt(),this.DOM.addButtonMore,e,{closeByEsc:true,autoHide:true,zIndex:this.zIndex,offsetTop:0,offsetLeft:15,angle:true,cacheable:false});this.addBtnMenu.show()}createSectionsBlock({sectionList:e,wrap:t}){if(a.Type.isArray(e)){const s=t.appendChild(a.Tag.render(te||(te=B`<div class="calendar-list-slider-widget-content"></div>`))).appendChild(a.Tag.render(se||(se=B`<div class="calendar-list-slider-widget-content-block"></div>`))).appendChild(a.Tag.render(ie||(ie=B`<ul class="calendar-list-slider-container"></ul>`)));e.forEach((e=>{this.createSectionUnit({section:e,wrap:s})}))}}createSectionUnit({section:e,wrap:t}){if(!e.DOM){e.DOM={}}const s=e.id.toString();const i=t.appendChild(a.Tag.render(ne||(ne=B` <li class="calendar-list-slider-item" data-bx-calendar-section="${0}"></li> `),s));const n=i.appendChild(a.Tag.render(ae||(ae=B` <div class="calendar-list-slider-item-checkbox ${0}" style="background-color: ${0}"></div> `),e.isShown()?"calendar-list-slider-item-checkbox-checked":"",e.color));const o=i.appendChild(a.Tag.render(oe||(oe=B` <div class="calendar-list-slider-item-name" title="${0}">${0}</div> `),a.Text.encode(e.name),a.Text.encode(e.name)));e.DOM.item=i;e.DOM.checkbox=n;e.DOM.title=o;e.DOM.actionCont=i.appendChild(a.Tag.render(ce||(ce=B` <div class="calendar-list-slider-item-actions-container" data-bx-calendar-section-menu="${0}"> <span class="calendar-list-slider-item-context-menu"></span> </div> `),s))}sectionClickHandler(e){const t=o.Util.findTargetNode(e.target||e.srcElement,this.DOM.outerWrap);if(t&&t.getAttribute){if(t.getAttribute("data-bx-calendar-section-menu")!==null){let e=t.getAttribute("data-bx-calendar-section-menu");e=e==="tasks"?e:parseInt(e);this.showSectionMenu(this.sectionManager.getSection(e),t)}else if(t.getAttribute("data-bx-calendar-section")!==null){this.switchSection(this.sectionManager.getSection(t.getAttribute("data-bx-calendar-section")))}else if(t.getAttribute("data-bx-calendar-open-sync")!==null){this.calendarContext.syncInterface.openSyncPanel()}}}findCheckBoxNodes(e){return this.DOM.sectonListOuterWrap.querySelectorAll(".calendar-list-slider-item[data-bx-calendar-section='"+e+"'] .calendar-list-slider-item-checkbox")}switchSection(e){const t=this.findCheckBoxNodes(e.id);for(let s=0;s<t.length;s++){if(e.isShown()){a.Dom.removeClass(t[s],"calendar-list-slider-item-checkbox-checked")}else{a.Dom.addClass(t[s],"calendar-list-slider-item-checkbox-checked")}}if(e.isShown()){e.hide()}else{e.show()}this.calendarContext.reload()}switchOnSection(e){const t=this.findCheckBoxNodes(e.id);for(let s=0;s<t.length;s++){if(!e.isShown()){a.Dom.addClass(t[s],"calendar-list-slider-item-checkbox-checked")}}if(!e.isShown()){e.show()}}switchOffSection(e){const t=this.findCheckBoxNodes(e.id);for(let s=0;s<t.length;s++){if(e.isShown()){a.Dom.removeClass(t[s],"calendar-list-slider-item-checkbox-checked")}}if(e.isShown()){e.hide()}}showSectionMenu(e,s){const i=[];const n=s.closest("[data-bx-calendar-section]");if(a.Type.isElementNode(n)){a.Dom.addClass(n,"active")}if(e.canDo("view_time")){i.push({text:a.Loc.getMessage("EC_SEC_LEAVE_ONE"),onclick:()=>{this.sectionActionMenu.close();this.showOnlyOneSection(e,this.sectionManager.sections)}})}if(!e.isPseudo()&&e.getLink()&&!e.belongsToView()){i.push({text:a.Loc.getMessage("EC_SEC_OPEN_LINK"),href:e.getLink()})}if(!this.readonly&&e.canDo("edit_section")&&!e.isPseudo()){i.push({text:a.Loc.getMessage("EC_SEC_EDIT"),onclick:()=>{this.sectionActionMenu.close();this.showEditSectionForm({section:e})}})}if(e.isSuperposed()&&!e.belongsToView()){i.push({text:a.Loc.getMessage("EC_SEC_HIDE"),onclick:()=>{this.hideSuperposedHandler(e);this.sectionActionMenu.close()}})}if(e.canBeConnectedToOutlook()&&e.data["EXTERNAL_TYPE"]==="local"){i.push({text:a.Loc.getMessage("EC_SEC_CONNECT_TO_OUTLOOK"),onclick:()=>{this.sectionActionMenu.close();e.connectToOutlook();this.close()}})}if(!e.isPseudo()&&e.data.EXPORT&&e.data.EXPORT.LINK&&e.data["EXTERNAL_TYPE"]==="local"){i.push({text:a.Loc.getMessage("EC_ACTION_EXPORT"),onclick:()=>{this.sectionActionMenu.close();const s={sectionLink:e.data.EXPORT.LINK,calendarPath:this.calendarContext.util.config.path};if(t.IcalSyncPopup.checkPathes(s)){t.IcalSyncPopup.createInstance(s).show()}else{t.IcalSyncPopup.showPopupWithPathesError()}}})}let c=undefined;let r=undefined;if(e.data.CAL_DAV_CON&&e.belongsToView()&&this.calendarContext.syncInterface){[c,r]=this.calendarContext.syncInterface.getProviderById(e.data.CAL_DAV_CON)}if(e.canDo("edit_section")&&e.belongsToView()&&!e.isPseudo()&&(!e.isGoogle()&&!r||e.data["EXTERNAL_TYPE"]==="local"||!r)){i.push({text:a.Loc.getMessage("EC_SEC_DELETE"),onclick:()=>{this.sectionActionMenu.close();this.showSectionConfirm("delete",e)}})}if(e.canDo("edit_section")&&r){if(e.isGoogle()||e.isIcloud()||e.isOffice365()||e.isCalDav()){i.push({text:a.Loc.getMessage("EC_ACTION_EXTERNAL_ADJUST"),onclick:()=>{this.sectionActionMenu.close();if(c){c.openActiveConnectionSlider(r)}}})}if(e.isGoogle()||e.isIcloud()||e.isOffice365()){i.push({text:a.Loc.getMessage("EC_ACTION_HIDE"),onclick:()=>{this.sectionActionMenu.close();this.showSectionConfirm("hideSync",e)}})}else if(e.isCalDav()){i.push({text:a.Loc.getMessage("EC_ACTION_HIDE"),onclick:()=>{this.sectionActionMenu.close();this.showSectionConfirm("hideExternal",e)}})}}if(e.isPseudo()&&e.taskSectionBelongToUser()){i.push({text:a.Loc.getMessage("EC_SEC_EDIT"),onclick:()=>{this.sectionActionMenu.close();this.showEditSectionForm({section:e})}});i.push({text:a.Loc.getMessage("EC_SEC_TASK_HIDE"),onclick:()=>{this.sectionActionMenu.close();BX.userOptions.save("calendar","user_settings","showTasks","N");a.Dom.addClass(e.DOM.item,"calendar-list-slider-item-disappearing");setTimeout((()=>{a.Dom.clean(e.DOM.item,true);BX.reload()}),300)}})}if(i&&i.length>0){this.sectionActionMenu=top.BX.PopupMenu.create("section-menu-"+o.Util.getRandomInt(),s,i,{closeByEsc:true,autoHide:true,zIndex:this.zIndex,offsetTop:0,offsetLeft:9,angle:true,cacheable:false});this.sectionActionMenu.show();this.sectionActionMenu.popupWindow.subscribe("onClose",(()=>{if(a.Type.isElementNode(n)){a.Dom.removeClass(n,"active")}this.allowSliderClose()}));this.denySliderClose()}}denySliderClose(){this.denyClose=true}allowSliderClose(){this.denyClose=false}closeForms(){if(this.addBtnMenu){this.addBtnMenu.close()}if(this.editSectionForm){this.editSectionForm.close()}if(this.trackingUsersForm){this.trackingUsersForm.close()}if(this.trackingGroupsForm){this.trackingGroupsForm.close()}if(this.trackingTypesForm){this.trackingTypesForm.close()}}showEditSectionForm(e={}){this.closeForms();const t=this.DOM.sectionFormWrap.querySelector(".calendar-list-slider-card-widget-title-text");this.editSectionForm=new g({wrap:this.DOM.sectionFormWrap,sectionAccessTasks:this.sectionManager.getSectionAccessTasks(),sectionManager:this.sectionManager,closeCallback:()=>{this.allowSliderClose()}});let s=true;if(e.section&&(!e.section.belongsToView()||e.section.isPseudo())){t.innerHTML=a.Loc.getMessage("EC_SEC_SLIDER_EDIT_SECTION_PERSONAL");s=false}else if(e.section&&e.section.id){t.innerHTML=a.Loc.getMessage("EC_SEC_SLIDER_EDIT_SECTION");s=e.section.hasPermission("access")}else{t.innerHTML=a.Loc.getMessage("EC_SEC_SLIDER_NEW_SECTION")}this.editSectionForm.show({showAccess:s,allowChangeName:e.section?!e.section.isPrimaryForConnection():true,section:e.section||{color:o.Util.getRandomColor(),access:this.sectionManager.getDefaultSectionAccess()}});this.denySliderClose()}showTrackingTypesForm(){this.closeForms();if(!this.trackingTypesForm){this.trackingTypesForm=new N({wrap:this.DOM.trackingTypesFormWrap,superposedSections:this.sectionManager.getSuperposedSectionList(),closeCallback:()=>{this.allowSliderClose()}})}this.trackingTypesForm.show();this.denySliderClose()}showTrackingUsersForm(){this.closeForms();if(!this.trackingUsersForm){this.trackingUsersForm=new k({wrap:this.DOM.trackingUsersFormWrap,trackingUsers:this.calendarContext.util.getSuperposedTrackedUsers(),superposedSections:this.sectionManager.getSuperposedSectionList(),closeCallback:()=>{this.allowSliderClose()}})}this.trackingUsersForm.show();this.denySliderClose()}showTrackingGroupsForm(){this.closeForms();if(!this.trackingGroupsForm){const e=this.sectionManager.getSuperposedSectionList();const t=this.calendarContext.util.getSuperposedTrackedGroups();e.forEach((e=>{if(e.getType()==="group"&&!t.includes(e.getOwnerId())){t.push(e.getOwnerId())}}));this.trackingGroupsForm=new w({wrap:this.DOM.trackingGroupsFormWrap,trackingGroups:t,superposedSections:e,closeCallback:()=>{this.allowSliderClose()}})}this.trackingGroupsForm.show();this.denySliderClose()}deleteSectionHandler(e){if(e&&e instanceof this.BX.Event.BaseEvent){const t=e.getData();const s=parseInt(t.sectionId,10);this.sliderSections.forEach(((e,t)=>{if(parseInt(e.id)===s){this.sectionManager.deleteSectionHandler(s);this.deletedSectionsIds.push(s);const i=this.DOM.sectonListOuterWrap.querySelectorAll(`.calendar-list-slider-item[data-bx-calendar-section='${s}']`);i.forEach((e=>{a.Dom.addClass(e,"calendar-list-slider-item-disappearing")}));if(!e.externalTypeIsLocal()){const s=this.getSectionListWrapForSection(e);this.sliderSections=BX.util.deleteFromArray(this.sliderSections,t);setTimeout((()=>{i.forEach((e=>{a.Dom.remove(e)}));if(!s.querySelector("li.calendar-list-slider-item")){a.Dom.remove(s.closest(".calendar-list-slider-card-widget"))}}),300)}}}),this);this.closeForms()}}hideSuperposedHandler(e){const t=this.sectionManager.getSuperposedSectionList();const s=[];let i;for(i=0;i<t.length;i++){if(parseInt(e.id)!==parseInt(t[i].id)){s.push(parseInt(t[i].id))}}BX.ajax.runAction("calendar.api.calendarajax.setTrackingSections",{data:{sections:s}}).then((e=>{BX.reload()}),(e=>{o.Util.displayError(e.errors)}))}refreshSectionList(){this.createSectionList()}showOnlyOneSection(e,t){for(let s of t){if(s.id===e.id){this.switchOnSection(s)}else{this.switchOffSection(s)}}this.calendarContext.reload()}keyHandler(e){if(e.keyCode===o.Util.getKeyCode("enter")&&this.DOM.confirmSectionPopup&&this.currentConfirmMode&&this.currentSection){if(this.currentConfirmMode==="delete"){this.removeSection(this.currentSection)}else if(this.currentConfirmMode==="hideSync"){this.hideSyncSection(this.currentSection)}else if(this.currentConfirmMode==="hideExternal"){this.hideExternalSection(this.currentSection)}}}showSectionConfirm(e,t){this.currentSection=t;this.currentConfirmMode=e;const s=this.getConfirmCallback();const i=this.getOkCaption();this.DOM.confirmSectionPopup=new r.MessageBox({message:this.getSectionConfirmContent(),minHeight:120,minWidth:280,maxWidth:300,buttons:BX.UI.Dialogs.MessageBoxButtons.OK_CANCEL,onOk:s,onCancel:()=>{this.DOM.confirmSectionPopup.close()},okCaption:i,popupOptions:{events:{onPopupClose:()=>{delete this.DOM.confirmSectionPopup;delete this.currentSection;delete this.currentConfirmMode}},closeByEsc:true,padding:0,contentPadding:0,animation:"fading-slide"}});this.DOM.confirmSectionPopup.show()}getConfirmCallback(){if(this.currentConfirmMode==="delete"){return()=>{this.removeSection(this.currentSection)}}else if(this.currentConfirmMode==="hideSync"){return()=>{this.hideSyncSection(this.currentSection)}}else if(this.currentConfirmMode==="hideExternal"){return()=>{this.hideExternalSection(this.currentSection)}}}getOkCaption(){if(this.currentConfirmMode==="delete"){return a.Loc.getMessage("EC_SEC_DELETE")}else if(this.currentConfirmMode==="hideSync"||this.currentConfirmMode==="hideExternal"){return a.Loc.getMessage("EC_CAL_SYNC_DISCONNECT")}}getSectionConfirmContent(){let e="";if(this.currentConfirmMode==="delete"){e=a.Loc.getMessage("EC_SEC_DELETE_CONFIRM")}else if(this.currentConfirmMode==="hideSync"||this.currentConfirmMode==="hideExternal"){e=a.Loc.getMessage("EC_CAL_GOOGLE_HIDE_CONFIRM")}return a.Tag.render(re||(re=B` <div class="calendar-list-slider-messagebox-text">${0}</div> `),e)}removeSection(e){e.remove();this.DOM.confirmSectionPopup.close()}hideSyncSection(e){e.hideSyncSection();this.DOM.confirmSectionPopup.close()}hideExternalSection(e){e.hideExternalCalendarSection();this.DOM.confirmSectionPopup.close()}}e.SectionInterface=le})(this.BX.Calendar=this.BX.Calendar||{},BX.Calendar.Sync.Interface,BX.Main,BX.Event,BX.UI.EntitySelector,BX,BX.Calendar,BX.Calendar,BX.UI.Dialogs); //# sourceMappingURL=sectioninterface.bundle.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.27 |
proxy
|
phpinfo
|
Settings