Current Path : /var/www/html/clients/e-nkama.ru/e-nkama_bitrix/bitrix/js/calendar/ |
Current File : /var/www/html/clients/e-nkama.ru/e-nkama_bitrix/bitrix/js/calendar/cal-events.min.js |
(function(e){e.JSECEvent=function(e){this.oEC=e};JSECEvent.prototype={Get:function(e){for(i=0,l=this.oEC.arEvents.length;i<l;i++)if(this.oEC.arEvents[i].ID==e)return this.oEC.arEvents[i]},IsMeeting:function(e){return this.oEC.allowMeetings&&e&&!!e.IS_MEETING},Attendees:function(e){var t={};if(e&&e.ID&&this.oEC.arAttendees[e.ID])t=this.oEC.arAttendees[e.ID];return t},View:function(t){if(t)this.oEC.HighlightEvent_M(t,false,true);this.oEC.DefaultAction();BX.onCustomEvent(this.oEC,"onBeforeCalendarEventView",[this.oEC,t]);if(this.oEC.DefaultAction()){if(t["~TYPE"]=="tasks"&&e.taskIFramePopup&&t.ID>0)taskIFramePopup.view(parseInt(t.ID));else this.oEC.ShowViewEventPopup(t);BX.onCustomEvent(this.oEC,"onAfterCalendarEventView",[this.oEC,t])}},Edit:function(t){if(t.oEvent)this.oEC.HighlightEvent_M(t.oEvent,false,true);this.oEC.DefaultAction();BX.onCustomEvent(this.oEC,"onBeforeCalendarEventEdit",[this.oEC,t]);if(this.oEC.DefaultAction()){if((!t.oEvent&&t.bTasks||t.oEvent&&t.oEvent["~TYPE"]=="tasks"&&t.oEvent.ID>0)&&e.taskIFramePopup){if(t.oEvent)taskIFramePopup.edit(parseInt(t.oEvent.ID));else taskIFramePopup.add()}else this.oEC.ShowEditEventPopup(t);BX.onCustomEvent(this.oEC,"onAfterCalendarEventView",[this.oEC,t])}},Delete:function(e){if(e)this.oEC.HighlightEvent_M(e,false,true);if(!e||!e.ID)return false;this.oEC.DefaultAction();BX.onCustomEvent(this.oEC,"onBeforeCalendarEventDelete",[this.oEC,e]);if(this.oEC.DefaultAction()){if(e["~TYPE"]=="tasks"){}else{var t=false;if(this.IsAttendee(e)&&!this.IsHost(e)){t=true;if(!confirm(EC_MESS.DelMeetingGuestConfirm))return false}if(this.IsHost(e)&&!t){t=true;if(!confirm(EC_MESS.DelMeetingConfirm))return false}if((!e.IS_MEETING||this.IsHost(e))&&!t){t=true;if(!confirm(EC_MESS.DelEventConfirm))return false}var i=this;if(this.IsAttendee(e)&&!this.IsHost(e)){return this.SetMeetingStatus(true,{eventId:bxInt(e.ID),comment:""})}else{this.oEC.Request({postData:this.oEC.GetReqData("delete",{id:bxInt(e.ID),name:e.NAME,calendar:bxInt(e.SECT_ID)}),errorText:EC_MESS.DelEventError,handler:function(t){if(t)i.UnDisplay(e)}})}}BX.onCustomEvent(this.oEC,"onAfterCalendarEventDelete",[this.oEC])}return true},SetColor:function(e){var t,i=this,s=e.SECT_ID,o,n;function a(e){var t={};if(i.oEC.arSectionsInd[e]&&i.oEC.arSections[i.oEC.arSectionsInd[e]])t=i.oEC.arSections[i.oEC.arSectionsInd[e]];if(!t.TEXT_COLOR&&t.COLOR)t.TEXT_COLOR=i.oEC.ColorIsDark(t.COLOR)?"#FFFFFF":"#000000";return t}if(e["~TYPE"]=="tasks"){o=this.oEC.taskBgColor;n=this.oEC.taskTextColor}else{if(e.USER_MEETING&&!this.IsHost(e)){o=e.USER_MEETING.COLOR;n=e.USER_MEETING.TEXT_COLOR;if(!o)o=e.COLOR;if(!n)n=e.TEXT_COLOR;if(!o){t=a(s);if(t.COLOR){o=this.oEC.oSections[s].COLOR;n=this.oEC.oSections[s].TEXT_COLOR}}if((!o||!n)&&this.oEC.arSections.length){s=this.oEC.GetMeetingSection();t=a(s);if(s){if(!o&&t.COLOR)o=t.COLOR;if(!n&&t.TEXT_COLOR)n=t.TEXT_COLOR}}}else if(s){o=e.COLOR;n=e.TEXT_COLOR;t=a(s);if(!o&&t.COLOR)o=t.COLOR;if(!n&&t.TEXT_COLOR)n=t.TEXT_COLOR}}if(!o)o="#CEE669";e.displayColor=o;e.bDark=this.oEC.ColorIsDark(o);if(!n)n=e.bDark?"#FFFFFF":"#000000";e.displayTextColor=n;return e},SaveUserFields:function(e,t){if(e&&e.event_id&&t>0){e.event_id.value=parseInt(t);var i=this.oEC.GetReqData("").reqId;var s=this;if(e.reqId)e.reqId.value=i;BX.ajax.submit(e,function(){var e=top.BXCRES[i];if(e&&e["refresh"])s.ReloadAll(false)})}},GetQuestIcon:function(e){if(!this.IsBlinked(e))return"";return'<b title="'+EC_MESS.NotConfirmed+'" class="bxec-stat-q">?</b>'},IsTask:function(e){return e["~TYPE"]=="tasks"},IsHost:function(e,t){if(!t)t=this.oEC.userId;return e.IS_MEETING&&(e.MEETING_STATUS=="H"||e.ID==e.PARENT_ID&&t==e.MEETING_HOST)},IsAttendee:function(e,t){if(!t)t=this.oEC.userId;if(e.IS_MEETING){return true}return false},IsCrm:function(e){return e.UF_CRM_CAL_EVENT&&e.UF_CRM_CAL_EVENT!=""},IsBlinked:function(e){return e.IS_MEETING&&e.MEETING_STATUS=="Q"},IsRecursive:function(e){return!!(e.RRULE&&e.RRULE.FREQ&&e.RRULE.FREQ!="NONE")},Blink:function(e,t,i){if(!this.IsAttendee(e)||this.IsHost(e))return;if(!e||!e.display)return;if(i)t=this.IsBlinked(e);if(t&&this.oEC.userSettings.blink){var s=this;e._blinkInterval=setInterval(function(){s.BlinkInterval(e)},550)}else if(!t&&e._blinkInterval){e._blinkInterval=!!clearInterval(e._blinkInterval);var o,n,a="bxec-event-blink";if(e.oParts){n=e.oParts.length;for(o=0;o<n;o++)if(e.oParts[o])BX.removeClass(e.oParts[o],a)}if(e.oDaysT){if(e.oDaysT.week)BX.removeClass(e.oDaysT.week,a);if(e.oDaysT.day)BX.removeClass(e.oDaysT.day,a)}if(e.oTLParts){if(e.oTLParts.week){len2=e.oTLParts.week.length;for(o=0;o<len2;o++)if(e.oTLParts.week[o])BX.removeClass(e.oTLParts.week[o],a)}if(e.oTLParts.day){len2=e.oTLParts.day.length;for(o=0;o<len2;o++)if(e.oTLParts.day[o])BX.removeClass(e.oTLParts.day[o],a)}}}},BlinkInterval:function(e){if(!this.oEC.userSettings.blink)return this.Blink(e,false,false);var t,i,s="bxec-event-blink",o=this.oEC.activeTabId;if(o=="month"){if(e.oParts){i=e.oParts.length;for(t=0;t<i;t++)if(e.oParts[t])BX.toggleClass(e.oParts[t],s)}}else{if(e.oDaysT&&e.oTLParts){if(e.oDaysT[o])BX.toggleClass(e.oDaysT[o],s);if(e.oTLParts[o]){i=e.oTLParts[o].length;for(t=0;t<i;t++)if(e.oTLParts[o][t])BX.toggleClass(e.oTLParts[o][t],s)}}}},SetMeetingStatus:function(e,t){if(!e&&!confirm(EC_MESS.DelMeetingGuestConfirm))return false;var i={},s=t?t.eventId:0;if(!s&&this.oEC.oViewEventDialog){i=this.oEC.oViewEventDialog.CAL.oEvent;s=this.oEC.oViewEventDialog.CAL.oEvent.ID}if(typeof t=="undefined"){t={eventId:s,comment:""}}var o=this;this.oEC.Request({postData:this.oEC.GetReqData("set_meeting_status",{event_id:parseInt(t.eventId),status:e?"Y":"N",status_comment:t.comment||""}),handler:function(s){if(s){if(!o.oEC.userSettings.showDeclined&&!o.IsHost(i)&&!e){o.UnDisplay(o.Get(t.eventId))}else if(e){o.ReloadAll(false)}}return true}});return true},SmartId:function(e){var t=e.PARENT_ID||e.ID;if(this.IsRecursive(e))t+=e.DATE_FROM;if(e["~TYPE"]=="tasks")t+="task";return t},ReloadAll:function(e){if(this._reloadTimeout)clearTimeout(this._reloadTimeout);var t=this;this.oEC.arLoadedEventsId={};this.oEC.arLoadedParentId={};this.oEC.arLoadedMonth={};this.oEC.arEvents=[];this.oEC.SetTabNeedRefresh("month",true);this.oEC.SetTabNeedRefresh("week",true);this.oEC.SetTabNeedRefresh("day",true);if(e===false)this.oEC.LoadEvents();else this._reloadTimeout=setTimeout(function(){t.oEC.LoadEvents()},600)},Save:function(e){var t=parseInt(this.oEC.activeDate.month,10),i=this.oEC.activeDate.year;var s=this.oEC.GetReqData("edit_event",{id:e.id||0,name:e.name,desc:e.desc||"",date_from:e.date_from,date_to:e.date_to,default_tz:e.default_tz,sections:[e.calendar],location:e.location||{OLD:"",NEW:"",CHANGED:""},month:t+1,year:i,skip_time:e.skip_time||"N"});this.oEC.arLoadedMonth={};if(e.RRULE&&e.RRULE)s.rrule=e.RRULE;if(e.remind)s.remind=[{type:e.remind_type,count:e.remind_count}];if(this.oEC.allowMeetings){s.is_meeting=e.isMeeting||"";if(e.isMeeting){s.meeting=e.meeting||{};if(e.guests)s.guest=e.guests.length>0?e.guests:[0]}}s.color=e.color||"";s.text_color=e.text_color||"";if(e.accessibility)s.accessibility=e.accessibility;if(e.importance)s.importance=e.importance;if(e.private_event)s.private_event=e.private_event;var o=this;this.oEC.Request({postData:s,errorText:EC_MESS.EventSaveError,handler:function(s){if(s.id&&e.UFForm)o.SaveUserFields(e.UFForm,s.id);o.UnDisplay(s.id,false);o.oEC.HandleEvents(s.events,s.attendees);o.oEC.arLoadedMonth[t+"."+i]=true;if(s.deletedEventId>0)o.UnDisplay(s.deletedEventId,false);o.Display();return true}})},Display:function(){this.oEC.SetTabNeedRefresh(this.oEC.activeTabId);if(this.oEC.activeTabId=="month"){this.oEC.DisplayEventsMonth(true)}else{this.oEC.DeSelectTime(this.oEC.activeTabId);this.oEC.ReBuildEvents(this.oEC.activeTabId)}},UnDisplay:function(e,t){var i;if(typeof e=="object"&&e.ID)i=e.ID;else if(e>0)i=e;var s,o={},n,a=[];for(n=0;n<this.oEC.arEvents.length;n++){s=this.oEC.arEvents[n];if(s&&(s.ID!=i||s["~TYPE"]=="tasks")){o[this.SmartId(s)]=true;a.push(s)}else this.Blink(this.oEC.arEvents[n],false)}this.oEC.arEvents=a;this.oEC.arLoadedEventsId=o;if(t!==false)this.Display()},SetMeetingParams:function(e){var t=this.oEC.oEditEventDialog;var i=this.oEC.GetReqData("set_meeting_params",{event_id:t.CAL.oEvent.ID,accessibility:t.CAL.DOM.Accessibility.value});if(this.oEC.allowReminders&&t.CAL.DOM.RemCheck.checked){var s=t.CAL.DOM.RemCount.value||"";s=s.replace(/,/g,".");s=s.replace(/[^\d|\.]/g,"");i.remind=[{type:t.CAL.DOM.RemType.value,count:s}]}this.oEC.Request({postData:i,handler:function(e){t.CAL.oEvent.USER_MEETING.REMIND=i.remind||[];t.CAL.oEvent.USER_MEETING.ACCESSIBILITY=i.accessibility}});if(e.callback&&typeof e.callback=="function")e.callback()},CanDo:function(e,t,i){if(!e)return false;if(!i)i=this.oEC.userId;if(t=="edit"||t=="delete"){if(this.bReadOnly)return false;if(e.SECT_ID){var s=this.oEC.oSections[e.SECT_ID];if(s){if(s.SUPERPOSED&&(s.OWNER_ID!=this.oEC.ownerId||s.CAL_TYPE!=this.oEC.type))return false;if(s.PERM)return!!s.PERM.edit}}}return false},BuildActions:function(e){var t,i=e.oEvent,s=i["~TYPE"]=="tasks",o=0,n=BX.create("DIV",{props:{className:"bxec-event-actions"}}),a=n.appendChild(BX.create("DIV",{props:{className:e.bTimeline?"bxec-icon-cont-tl":"bxec-icon-cont"}}));if((!this.IsMeeting(i)||this.IsMeeting(i)&&this.IsHost(i))&&(this.CanDo(i,"edit")||s&&i.CAN_EDIT)&&(!i.PRIVATE_EVENT||this.oEC.Personal())){t=a.appendChild(BX.create("I",{props:{className:"bxec-event-but bxec-ev-edit-icon",title:s?EC_MESS.TaskEdit:EC_MESS.EditEvent}}));t.setAttribute("data-bx-event-action","edit");o++;if(this.IsAttendee(i)&&!this.IsHost(i)){if(i.MEETING_STATUS!="N"){t=a.appendChild(BX.create("I",{props:{className:"bxec-event-but bxec-ev-del-icon",title:EC_MESS.DelEncounter}}));t.setAttribute("data-bx-event-action","del");o++}}else if(!s){t=a.appendChild(BX.create("I",{props:{className:"bxec-event-but bxec-ev-del-icon",title:EC_MESS.DelEvent}}));t.setAttribute("data-bx-event-action","del");o++}}if(o!=2){a.style.height="18px";a.style.width=18*o+"px";a.style.left="-"+18*o+"px"}e.cont.appendChild(n)},GetLabelStyle:function(e){var t="",i=e.IMPORTANCE;if(i&&i!="normal")t=' style="'+(i=="high"?"font-weight: bold;":"color: #535353;")+'"';return t},PreHandle:function(e){if(e.DATE_FROM&&e.DATE_TO){e.dateFrom=BX.parseDate(e.DATE_FROM);e.dateTo=BX.parseDate(e.DATE_TO);if(e.dateFrom&&e.dateTo){e.DT_FROM_TS=e.dateFrom.getTime();e.DT_TO_TS=e.dateTo.getTime();if(e.DT_SKIP_TIME!=="Y"){e.DT_FROM_TS-=(e["~USER_OFFSET_FROM"]||0)*1e3;e.DT_TO_TS-=(e["~USER_OFFSET_TO"]||0)*1e3}}}return e}}})(window); //# sourceMappingURL=cal-events.map.js