Your IP : 18.217.97.131
(function(e){function t(e){this.calendar=e}t.prototype={show:function(e){var t;this.params=e;this.entryTime=e.entryTime;this.attendees=[];this.attendeesCodesList=false;this.attendeesIndex={};this.attendeesCodes={};this.allowInvite=true;this.notify=true;if(this.calendar.ownerUser){this.attendees.push(this.calendar.ownerUser);this.attendeesIndex[this.calendar.ownerUser.id]=true;this.attendeesCodes["U"+this.calendar.ownerUser.id]="users"}this.attendees.push(this.calendar.currentUser);this.attendeesIndex[this.calendar.currentUser.id]=true;this.attendeesCodes["U"+this.calendar.currentUser.id]="users";var i,a,n=-152,s=390,l=420,r=8,o=BX.pos(e.entryNode),d=BX.GetWindowSize();if(o.right+s+r<d.innerWidth){i="left";a=o.width+r}else{i="right";a=-s-r}if(d.scrollTop+d.innerHeight-(o.bottom+l+n)<-35){i=false}t=BX.PopupWindowManager.create(this.calendar.id+"-simple-add-popup",e.bindNode||e.entryNode,{autoHide:true,closeByEsc:true,offsetTop:n,offsetLeft:a,closeIcon:true,width:s,titleBar:true,draggable:true,resizable:false,lightShadow:true,content:this.createContent(),overlay:{opacity:1},buttons:[new BX.PopupWindowButton({text:BX.message("JS_CORE_WINDOW_SAVE")+" (ENTER)",className:"popup-window-button-accept",events:{click:BX.delegate(this.save,this)}}),new BX.PopupWindowButton({text:BX.message("JS_CORE_WINDOW_CANCEL"),events:{click:BX.delegate(this.close,this)}})]});if(i!==false){t.setAngle({offset:130,position:i})}BX.addClass(t.titleBar,"calendar-add-popup-titlebar");BX.removeClass(t.popupContainer,"popup-window-with-titlebar");BX.removeClass(t.closeIcon,"popup-window-titlebar-close-icon");t.show(true);this.popup=t;if(t.overlay&&t.overlay.element){this.overlay=t.overlay.element;BX.addClass(t.overlay.element,"calendar-popup-overlay");setTimeout(BX.delegate(function(){BX.addClass(t.overlay.element,"calendar-popup-overlay-dark");t.overlay=null},this),1)}this.popupButtonsContainer=t.buttonsContainer;BX.addClass(t.contentContainer,"calendar-add-popup-wrap");t.popupContainer.style.minHeight=t.popupContainer.offsetHeight-20+"px";this.nameField.input.focus();this.nameField.input.select();BX.bind(document,"keydown",BX.proxy(this.keyHandler,this));BX.addCustomEvent(t,"onPopupClose",BX.proxy(this.close,this));this.calendar.disableKeyHandler();setTimeout(BX.delegate(function(){this.calendar.disableKeyHandler()},this),100)},save:function(t){if(!t)t={};if(t.checkBusyUsers!==false&&this.calendar.util.isMeetingsEnabled()){var i=this.getBusyUserList();if(i&&i.length>0){if(!this.busyUsersDialog)this.busyUsersDialog=new e.BXEventCalendar.BusyUsersDialog(this.calendar);this.busyUsersDialog.show({users:i,saveCallback:BX.delegate(function(){var e,a=[];for(e=0;e<i.length;e++){a.push(i[e].id)}this.excludeUsers=a.join(",");t.checkBusyUsers=false;this.save(t)},this)});return}}if(this.params.section.id){var a=this.calendar.sectionController.getSection(this.params.section.id);if(a){a.show()}}this.calendar.entryController.saveEntry(this.getPopupData());if(this.params.saveCallback&&typeof this.params.saveCallback=="function")this.params.saveCallback();this.close()},close:function(){this.calendar.enableKeyHandler();if(this.popup){BX.removeCustomEvent(this.popup,"onPopupClose",BX.proxy(this.close,this));this.popup.destroy()}if(this.overlay){BX.removeClass(this.overlay,"calendar-popup-overlay-dark");setTimeout(BX.delegate(function(){BX.remove(this.overlay)},this),300)}BX.removeCustomEvent("OnDestinationAddNewItem",BX.proxy(this.checkPlannerState,this));BX.removeCustomEvent("OnDestinationUnselect",BX.proxy(this.checkPlannerState,this));BX.removeCustomEvent("OnDestinationUnselect",BX.proxy(this.clearSecondSlideHeight,this));BX.removeCustomEvent("OnCalendarPlannerSelectorChanged",BX.proxy(this.onCalendarPlannerSelectorChanged,this));if(this.plannerId){BX.onCustomEvent("OnCalendarPlannerDoUninstall",[{plannerId:this.plannerId}])}if(this.params.closeCallback&&typeof this.params.closeCallback=="function")this.params.closeCallback();BX.unbind(document,"keydown",BX.proxy(this.keyHandler,this))},getPopupData:function(){var e=[];this.attendees.forEach(function(t){e.push(t.id)});var t=this.calendar.util.parseTime(this.dateTimeField.fromTimeInput.value),i=this.calendar.util.parseTime(this.dateTimeField.toTimeInput.value),a=new Date(this.entryTime.from.getTime()),n=new Date(this.entryTime.from.getTime());a.setHours(t.h,t.m,0);n.setHours(i.h,i.m,0);if(!this.attendeesCodesList&&this.attendeesCodes){this.attendeesCodesList=[];for(var s in this.attendeesCodes){if(this.attendeesCodes.hasOwnProperty(s)){this.attendeesCodesList.push(s)}}}return{name:this.nameField.input.value,from:a,to:n,dateFrom:this.calendar.util.formatDateTime(a),dateTo:this.calendar.util.formatDateTime(n),defaultTz:this.timezoneField&&this.timezoneField.select?this.timezoneField.select.value:this.calendar.util.getUserOption("timezoneName"),section:this.params.section.id,location:this.locationSelector.getTextValue(),locationValue:this.locationSelector.getValue(),remind:this.reminderValues||false,attendees:e,attendeesCodes:this.attendeesCodes,attendeesCodesList:this.attendeesCodesList,meetingNotify:this.notify,allowInvite:this.allowInvite,excludeUsers:this.excludeUsers||""}},createContent:function(){this.mainSlide=BX.create("DIV",{props:{className:"calendar-add-popup-main-slide"}});this.secondSlide=false;this.nameField=this.createField("string-select",this.mainSlide);this.nameField.input=this.nameField.innerWrap.appendChild(BX.create("INPUT",{props:{className:"calendar-field calendar-field-string"},attrs:{value:this.params.entryName,placeholder:BX.message("EC_ENTRY_NAME"),type:"text"},events:{click:BX.proxy(this.nameInputClick,this),keyup:BX.proxy(this.entryNameChanged,this),blur:BX.proxy(this.entryNameChanged,this),change:BX.proxy(this.entryNameChanged,this)}}));this.createSectionSelector();this.createDateTimeField();this.createReminderField();this.createlocationField();if(this.calendar.util.isMeetingsEnabled()){this.createPlannerField()}this.fullFormField=this.createField("container-text",this.mainSlide);this.fullFormField.link=this.fullFormField.innerWrap.appendChild(BX.create("SPAN",{props:{className:"calendar-text-link"},text:BX.message("EC_FULL_FORM_LABEL"),events:{click:this.params.fullFormCallback}}));this.mainSlide.appendChild(BX.create("HR",{props:{className:"calendar-filed-separator"}}));this.sliderContainer=BX.create("DIV",{props:{className:"calendar-add-popup-slider-container"},children:[this.mainSlide]});return this.sliderContainer},nameInputClick:function(){this.nameField.input.select();BX.unbind(this.nameField.input,"click",BX.proxy(this.nameInputClick,this))},prepareSecondSlide:function(e){this.closeSecondSlideCallback=e.closeCallback||null;if(this.secondSlide){BX.cleanNode(this.secondSlide)}else{this.secondSlide=this.sliderContainer.appendChild(BX.create("DIV",{props:{className:"calendar-add-popup-second-slide"}}))}this.backButton=this.secondSlide.appendChild(BX.create("DIV",{props:{className:"calendar-add-popup-second-slide-header"}})).appendChild(BX.create("SPAN",{props:{className:"calendar-add-popup-second-slide-back-btn"},html:BX.message("EC_SIMPLE_FORM_BACK")}));BX.bind(this.backButton,"click",BX.proxy(this.closeSecondSlide,this));BX.bind(document,"keyup",BX.proxy(function(e){if(e.keyCode==27){this.closeSecondSlide()}},this));this.popup.setClosingByEsc(false);this.popupButtonsContainer.style.display="none";this.resizeSecondSlide();setTimeout(BX.delegate(function(){BX.addClass(this.popup.contentContainer,"calendar-add-popup-wrap-second-tab-active")},this),0)},closeSecondSlide:function(){if(this.closeSecondSlideCallback)this.closeSecondSlideCallback();BX.unbind(document,"keyup",BX.proxy(function(e){if(e.keyCode==27){this.closeSecondSlide()}},this));BX.removeClass(this.popup.contentContainer,"calendar-add-popup-wrap-second-tab-active");this.popupButtonsContainer.style.display="";this.clearSecondSlideHeight();this.popup.setClosingByEsc(true);if(this.resizeTimeout)this.resizeTimeout=clearTimeout(this.resizeTimeout);BX.cleanNode(this.secondSlide)},resizeSecondSlide:function(){if(this.secondSlide){var e=this.secondSlide.scrollHeight;if(e!=parseInt(this.popup.contentContainer.style.minHeight)){this.secondSlide.style.minHeight=e+"px";this.sliderContainer.style.minHeight=e+"px"}this.resizeTimeout=setTimeout(BX.proxy(this.resizeSecondSlide,this),100)}},clearSecondSlideHeight:function(){if(this.secondSlide)this.secondSlide.style.minHeight="";if(this.sliderContainer)this.sliderContainer.style.minHeight=""},createField:function(e,t){if(!e)e="string";var i=BX.create("DIV",{props:{className:"calendar-field-container calendar-field-container-"+e}}),a=i.appendChild(BX.create("DIV",{props:{className:"calendar-field-block"}}));if(t)t.appendChild(i);return{outerWrap:i,innerWrap:a}},createSectionSelector:function(){this.sectionField={select:this.nameField.innerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-field calendar-field-select calendar-field-tiny"}}))};this.sectionField.innerValue=this.sectionField.select.appendChild(BX.create("DIV",{props:{className:"calendar-field-select-icon"},style:{backgroundColor:this.params.section.color}}));BX.bind(this.sectionField.select,"click",i);var e=this,t=this.calendar.sectionController.getSectionListForEdit();function i(){if(e.sectionMenu&&e.sectionMenu.popupWindow&&e.sectionMenu.popupWindow.isShown()){return e.sectionMenu.close()}var i,a=[],n;for(i=0;i<t.length;i++){a.push({id:"bx-calendar-section-"+t[i].id,text:BX.util.htmlspecialchars(t[i].name),color:t[i].color,className:"calendar-add-popup-section-menu-item",onclick:function(t){return function(){e.params.section=e.calendar.sectionController.getSection(t);e.calendar.util.setUserOption("lastUsedSection",e.params.section.id);e.sectionField.innerValue.style.backgroundColor=e.params.section.color;e.sectionMenu.close();if(e.params.changeSectionCallback&&typeof e.params.changeSectionCallback=="function"){e.params.changeSectionCallback(e.params.section)}}}(t[i].id)})}e.sectionMenu=BX.PopupMenu.create("sectionMenu"+e.calendar.id,e.sectionField.select,a,{closeByEsc:true,autoHide:true,zIndex:1200,offsetTop:0,offsetLeft:40,angle:true});e.sectionMenu.popupWindow.contentContainer.style.overflow="auto";e.sectionMenu.popupWindow.contentContainer.style.maxHeight="300px";e.sectionMenu.show();for(i=0;i<e.sectionMenu.menuItems.length;i++){if(e.sectionMenu.menuItems[i].layout.item){n=e.sectionMenu.menuItems[i].layout.item.querySelector(".menu-popup-item-icon");if(n){n.style.backgroundColor=e.sectionMenu.menuItems[i].color}}}BX.addClass(e.sectionField.select,"active");e.popup.setAutoHide(false);BX.addCustomEvent(e.sectionMenu.popupWindow,"onPopupClose",function(){e.popup.setAutoHide(true);BX.removeClass(e.sectionField.select,"active");BX.PopupMenu.destroy("sectionMenu"+e.calendar.id);e.sectionMenu=null})}},createDateTimeField:function(){var t=this,i=this.calendar.util.formatTime(this.entryTime.from.getHours(),this.entryTime.from.getMinutes()),a=this.calendar.util.formatTime(this.entryTime.to.getHours(),this.entryTime.to.getMinutes());this.dateTimeField={outerWrap:this.mainSlide.appendChild(BX.create("DIV",{props:{className:"calendar-field-container calendar-field-container-datetime"}}))};this.dateTimeField.dateWrap=this.dateTimeField.outerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-field-block calendar-field-block-prefix"},text:this.calendar.util.formatDateUsable(this.entryTime.from,false)}));this.dateTimeField.fromTimeInputWrap=this.dateTimeField.outerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-field-block calendar-field-block-left"}}));this.dateTimeField.fromTimeInput=this.dateTimeField.fromTimeInputWrap.appendChild(BX.create("INPUT",{attrs:{value:i,placeholder:BX.message("EC_TIME_FROM_PLACEHOLDER"),type:"text"},props:{className:"calendar-field calendar-field-datetime-menu"}}));this._fromDateValue=this.entryTime.from;this.dateTimeField.outerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-field-block calendar-field-block-between"}}));this.dateTimeField.toTimeInputWrap=this.dateTimeField.outerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-field-block calendar-field-block-right"}}));this.dateTimeField.toTimeInput=this.dateTimeField.toTimeInputWrap.appendChild(BX.create("INPUT",{attrs:{value:a,placeholder:BX.message("EC_TIME_TO_PLACEHOLDER"),type:"text"},props:{className:"calendar-field calendar-field-datetime-menu"}}));this.dateTimeField.fromTime=new e.BXEventCalendar.SelectInput({input:this.dateTimeField.fromTimeInput,value:this.calendar.util.adaptTimeValue(t.calendar.util.parseTime(t.dateTimeField.fromTimeInput.value)),values:this.calendar.util.getSimpleTimeList(),onChangeCallback:BX.proxy(function(){var e=this.calendar.util.parseTime(this.dateTimeField.fromTimeInput.value),t=this.calendar.util.parseTime(this.dateTimeField.toTimeInput.value),i=new Date(this.entryTime.from.getTime()),a=new Date(this.entryTime.from.getTime());i.setHours(e.h,e.m,0);a.setHours(t.h,t.m,0);if(this._fromDateValue){this.entryTime.to=new Date(i.getTime()+(a.getTime()-this._fromDateValue.getTime()||36e5));this.dateTimeField.toTimeInput.value=this.calendar.util.formatTime(this.entryTime.to.getHours(),this.entryTime.to.getMinutes())}this.entryTime.from=i;this._fromDateValue=i;if(this.params.timeNode){this.params.timeNode.innerHTML=this.calendar.util.formatTime(e.h,e.m)}if(this.params.changeTimeCallback&&typeof this.params.changeTimeCallback=="function"){this.params.changeTimeCallback(e,t)}},this)});this.dateTimeField.toTime=new e.BXEventCalendar.SelectInput({input:this.dateTimeField.toTimeInput,value:this.calendar.util.adaptTimeValue(this.calendar.util.parseTime(this.dateTimeField.toTimeInput.value)),values:this.calendar.util.getSimpleTimeList()});if(!this.calendar.util.getUserOption("timezoneName")){this.timezoneField=this.createField("container-string",this.mainSlide);this.timezoneField.innerWrap.appendChild(BX.create("LABEL",{props:{className:"calendar-timezone-label"},text:BX.message("EC_ASK_TZ")}));this.timezoneField.select=this.timezoneField.innerWrap.appendChild(BX.create("SELECT",{props:{className:"calendar-field calendar-field-select"},events:{change:function(){t.calendar.util.setUserOption("timezoneName",t.timezoneField.select.value)}}}));var n,s=this.calendar.util.getTimezoneList();for(n in s){if(s.hasOwnProperty(n))this.timezoneField.select.options.add(new Option(s[n].title,n,false,false))}this.timezoneField.select.value=this.calendar.util.getUserOption("timezoneDefaultName")||"";this.timezoneField.innerWrap.appendChild(BX.create("SPAN",{props:{title:BX.message("EC_EVENT_TZ_DEF_HINT"),className:"calendar-event-quest"},html:"?"}));BX.addClass(this.timezoneField.innerWrap,"calendar-field-timezone")}},setDateTimeValues:function(e,t){if(e&&t&&this.dateTimeField&&this.dateTimeField.dateWrap){this.dateTimeField.dateWrap.innerHTML=this.calendar.util.formatDateUsable(e);this.dateTimeField.fromTimeInput.value=this.calendar.util.formatTime(e.getHours(),e.getMinutes());this.dateTimeField.toTimeInput.value=this.calendar.util.formatTime(t.getHours(),t.getMinutes());this.entryTime.from=e;this.entryTime.to=t;this._fromDateValue=e;if(this.params.timeNode)this.params.timeNode.innerHTML=this.dateTimeField.fromTimeInput.value}},createReminderField:function(){this.reminderValues=[];this.reminderField=this.createField("container-text",this.mainSlide);this.reminderField.innerCont=this.reminderField.innerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-text"},text:BX.message("EC_REMIND_LABEL")+":"}));var t=this;this.reminderField.reminder=new e.BXEventCalendar.ReminderSelector({id:"reminder-"+this.calendar.id,selectedValues:[this.calendar.util.getUserOption("defaultReminder",15)],values:this.calendar.util.getRemindersList(),valuesContainerNode:this.reminderField.innerCont.appendChild(BX.create("SPAN")),addButtonNode:this.reminderField.innerCont.appendChild(BX.create("SPAN",{props:{className:"calendar-notification-btn-container calendar-notification-btn-add"},html:'<span class="calendar-notification-icon"></span>'})),changeCallack:function(e){t.reminderValues=e},showPopupCallBack:function(){t.popup.setAutoHide(false)},hidePopupCallBack:function(){t.popup.setAutoHide(true)}})},createlocationField:function(){this.locationField={outerWrap:this.mainSlide.appendChild(BX.create("DIV",{props:{className:"calendar-field-container calendar-field-container-select"}}))};this.locationSelector=new e.BXEventCalendar.LocationSelector(this.calendar.id+"-simple-slider-location",{value:this.entry?this.entry.location:"",wrapNode:this.locationField.outerWrap,getControlContentCallback:BX.delegate(function(){this.prepareSecondSlide({closeCallback:BX.proxy(this.locationSelector.saveValues,this.locationSelector)});this.secondSlide.appendChild(BX.create("DIV",{props:{className:"calendar-title-text"},text:BX.message("EC_MEETING_ROOM_LIST_TITLE")}));return this.secondSlide},this)},this.calendar)},createPlannerField:function(){this.plannerField=this.createField("container-members",this.mainSlide);this.plannerField.innerWrapAttendeesWrap=this.plannerField.innerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-members-selected"},html:"<span>"+BX.message("EC_ATTENDEES_LABEL")+":</span>"}));this.plannerField.currentAttendeesWrap=this.plannerField.innerWrapAttendeesWrap.appendChild(BX.create("SPAN",{props:{className:"calendar-attendees-list"}}));this.showAttendees();this.plannerField.plannerLink=this.plannerField.innerWrapAttendeesWrap.appendChild(BX.create("SPAN",{props:{className:"calendar-members-change-link"},html:BX.message("EC_ATTENDEES_EDIT"),events:{click:BX.delegate(this.showPlannerSlide,this)}}))},showAttendees:function(){BX.cleanNode(this.plannerField.currentAttendeesWrap);var e,t,i=3,a=this.attendees.length,n=5;if(a>0){if(a>n){a=i}for(e=0;e<a;e++){t=this.attendees[e]||{};this.plannerField.currentAttendeesWrap.appendChild(BX.create("IMG",{attrs:{id:"simple_popup_"+t.id,src:t.smallAvatar||"","bx-tooltip-user-id":t.id},props:{className:"calendar-member"}}))}if(a<this.attendees.length){this.plannerField.currentAttendeesWrap.appendChild(BX.create("SPAN",{text:BX.message("EC_ATTENDEES_MORE").replace("#COUNT#",this.attendees.length-a)}))}}},showPlannerSlide:function(){this.popup.setAutoHide(false);this.prepareSecondSlide({closeCallback:BX.proxy(this.hidePlannerSlide,this)});this.attendeesSelector=new e.BXEventCalendar.DestinationSelector(this.calendar.id+"-simple-popup-destination",{wrapNode:this.secondSlide,itemsSelected:this.attendeesCodes||this.calendar.util.getSocnetDestinationConfig("itemsSelected"),calendar:this.calendar});this.loader=BX.adjust(this.calendar.util.getLoader(),{style:{height:"180px"}});this.secondSlide.appendChild(this.loader);this.initPlannerControl();this.meetingOptionsWrap=this.secondSlide.appendChild(BX.create("DIV",{props:{className:"calendar-add-popup-meeting-options-wrap"},style:{display:"none"}}));this.notifyField=this.createField("container-checkbox",this.meetingOptionsWrap);this.notifyField.label=this.notifyField.innerWrap.appendChild(BX.create("LABEL",{props:{className:"calendar-field-checkbox-label"},html:BX.message("EC_NOTIFY_STATUS_LABEL")}));this.notifyField.checkbox=this.notifyField.label.appendChild(BX.create("INPUT",{attrs:{type:"checkbox"},props:{className:"calendar-field-checkbox"}}));this.notifyField.checkbox.checked=this.notify},hidePlannerSlide:function(){this.popup.setAutoHide(true);if(this.allowInviteField){this.allowInvite=!!this.allowInviteField.checkbox.checked}if(this.notifyField){this.notify=!!this.notifyField.checkbox.checked}this.destroyDestinationControls()},entryNameChanged:function(){var e=this.nameField.input.value||BX.message("EC_ENTRY_NAME");if(this.params.nameNode){this.params.nameNode.innerHTML=BX.util.htmlspecialchars(e)}if(this.params.changeNameCallback&&typeof this.params.changeNameCallback=="function")this.params.changeNameCallback(e)},initPlannerControl:function(){this.plannerId=this.calendar.id+"-simple-planner";this.plannerShown=false;this.plannerWrap=this.secondSlide.appendChild(BX.create("DIV",{props:{className:"calendar-add-popup-planner-wrap"}}));BX.addCustomEvent("OnDestinationAddNewItem",BX.proxy(this.checkPlannerState,this));BX.addCustomEvent("OnDestinationUnselect",BX.proxy(this.checkPlannerState,this));BX.addCustomEvent("OnDestinationUnselect",BX.proxy(this.clearSecondSlideHeight,this));BX.addCustomEvent("OnCalendarPlannerSelectorChanged",BX.proxy(this.onCalendarPlannerSelectorChanged,this));if(!this.requestPlanner){this.requestPlanner=true;BX.ajax.get(this.calendar.util.getActionUrl(),{action:"get_planner",sessid:BX.bitrix_sessid(),bx_event_calendar_request:"Y",reqId:Math.round(Math.random()*1e6),planner_id:this.plannerId},BX.delegate(function(e){if(this.loader)BX.remove(this.loader);e=BX.util.trim(e);this.plannerWrap.innerHTML=e;this.requestPlanner=false;this.checkPlannerState()},this))}},onCalendarPlannerSelectorChanged:function(e){if(this.calendar.util.getDayCode(this.entryTime.from)!==this.calendar.util.getDayCode(e.dateFrom)&&this.params.changeDateCallback){this.params.changeDateCallback(e.dateFrom);if(this.popup.angle){this.popup.setAngle(false)}}this.setDateTimeValues(e.dateFrom,e.dateTo)},destroyDestinationControls:function(){if(BX.SocNetLogDestination){if(BX.SocNetLogDestination.isOpenDialog())BX.SocNetLogDestination.closeDialog();if(BX.SocNetLogDestination.popupWindow)BX.SocNetLogDestination.popupWindow.close();BX.SocNetLogDestination.closeSearch()}BX.removeCustomEvent("OnDestinationAddNewItem",BX.proxy(this.checkPlannerState,this));BX.removeCustomEvent("OnDestinationUnselect",BX.proxy(this.checkPlannerState,this));BX.removeCustomEvent("OnDestinationUnselect",BX.proxy(this.clearSecondSlideHeight,this));BX.removeCustomEvent("OnCalendarPlannerSelectorChanged",BX.proxy(this.OnCalendarPlannerSelectorChanged,this))},plannerIsShown:function(){return this.plannerWrap&&BX.hasClass(this.plannerWrap,"calendar-add-popup-show-planner")},checkPlannerState:function(){var e={codes:this.attendeesSelector.getCodes(),from:this.calendar.util.formatDate(this.entryTime.from.getTime()-this.calendar.util.dayLength*3),to:this.calendar.util.formatDate(this.entryTime.from.getTime()+this.calendar.util.dayLength*10),location:this.locationSelector.getTextValue()};this.attendeesCodes=this.attendeesSelector.getAttendeesCodes();this.attendeesCodesList=this.attendeesSelector.getAttendeesCodesList(this.attendeesCodes);this.updatePlanner(e)},updatePlanner:function(e){if(!e)e={};this.plannerLoadedlocation=e.location||"";var t=this,i=0;this.calendar.request({data:{action:"update_planner",codes:e.codes||[],cur_event_id:i,date_from:e.dateFrom||e.from||"",date_to:e.dateTo||e.to||"",timezone:this.timezoneField&&this.timezoneField.select?this.timezoneField.select.value:this.calendar.util.getUserOption("timezoneName"),location:this.plannerLoadedlocation,entries:e.entrieIds||false,add_cur_user_to_list:"N"},handler:function(i){var a,n=[],s={},l=false,r=!!(e.entries||i.entries&&i.entries.length>0);for(a=0;a<i.entries.length;a++){if(i.entries[a].type=="user"){n.push({id:i.entries[a].id,name:i.entries[a].name,avatar:i.entries[a].avatar,smallAvatar:i.entries[a].smallAvatar||i.entries[a].avatar,url:i.entries[a].url});s[i.entries[a].id]=true;if(!t.attendeesIndex[i.entries[a].id])l=true}}if(!l){for(var o in t.attendeesIndex){if(t.attendeesIndex.hasOwnProperty(o)&&!s[o]){l=true;break}}}if(l){t.attendees=n;t.showAttendees()}if(r){var d={show:r&&!t.plannerIsShown()};if(e.entries){i.entries=e.entries;d.scaleFrom=e.from;d.scaleTo=e.to}d.loadedDataFrom=e.from;d.loadedDataTo=e.to;d.data={entries:i.entries,accessibility:i.accessibility};d.focusSelector=e.focusSelector==undefined?false:e.focusSelector;t.refreshPlannerState(d)}else if(!r&&t.plannerIsShown()){t.hidePlanner()}}})},refreshPlannerState:function(e){if(!e||typeof e!=="object")e={};this.plannerData=e.data;var t=this.calendar.util.getWorkTime(),i={changeFromFullDay:{scaleType:"1hour",timelineCellWidth:40},shownScaleTimeFrom:t.start,shownScaleTimeTo:t.end,width:this.plannerWrap.offsetWidth||400,minWidth:this.plannerWrap.offsetWidth||400,entriesListWidth:50,showEntiesHeader:false,showEntryName:false},a=this.plannerIsShown();if(e.focusSelector==undefined)e.focusSelector=true;if(!a&&!e.data){this.checkPlannerState()}else{if(e.show){BX.addClass(this.plannerWrap,"calendar-add-popup-show-planner");this.meetingOptionsWrap.style.display="";if(!a&&e.show){e.focusSelector=true}}var n=this.calendar.util.parseTime(this.dateTimeField.fromTimeInput.value),s=this.calendar.util.parseTime(this.dateTimeField.toTimeInput.value),l=new Date(this.entryTime.from.getTime()),r=new Date(this.entryTime.from.getTime());l.setHours(n.h,n.m,0);r.setHours(s.h,s.m,0);BX.onCustomEvent("OnCalendarPlannerDoUpdate",[{plannerId:this.plannerId,config:i,focusSelector:e.focusSelector,selector:{from:l,to:r,fullDay:false,animation:true,updateScaleLimits:true},data:e.data||false,loadedDataFrom:e.loadedDataFrom,loadedDataTo:e.loadedDataTo,show:!!e.show}])}},getBusyUserList:function(){var e,t=[];if(this.plannerData){for(e in this.plannerData.entries){if(this.plannerData.entries.hasOwnProperty(e)&&this.plannerData.entries[e].id&&this.plannerData.entries[e].status!="h"&&this.plannerData.entries[e].strictStatus&&!this.plannerData.entries[e].currentStatus){t.push(this.plannerData.entries[e])}}}return t},hidePlanner:function(){this.meetingOptionsWrap.style.display="none";this.plannerWrap.style.opacity=0;this.plannerWrap.style.height=0;this.plannerWrap.style.overflow="hidden";BX.removeClass(this.plannerWrap,"calendar-add-popup-show-planner")},keyHandler:function(e){if(e.keyCode==this.calendar.util.KEY_CODES["enter"]){this.save()}}};if(e.BXEventCalendar){e.BXEventCalendar.SimpleAddPopup=t}else{BX.addCustomEvent(e,"onBXEventCalendarInit",function(){e.BXEventCalendar.SimpleAddPopup=t})}})(window);
//# sourceMappingURL=calendar-simple-popup.map.js