Your IP : 18.119.164.250


Current Path : /home/bitrix/ext_www/crm.klimatlend.ua/bitrix/js/calendar/entry/dist/
Upload File :
Current File : /home/bitrix/ext_www/crm.klimatlend.ua/bitrix/js/calendar/entry/dist/entry.bundle.min.js

this.BX=this.BX||{};(function(e,t,i,a,n,s,r){"use strict";var o=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"getNewEntry",value:function n(s){var r={};var o=e.getNewEntryTime(new Date);r.ID=null;r.NAME=e.getNewEntryName();r.dateFrom=o.from;r.dateTo=o.to;r.SECT_ID=i.CalendarSectionManager.getNewEntrySectionId();r.REMIND=[{type:"min",count:15}];r.ATTENDEES_CODES=["U"+a.Util.getCurrentUserId()];return new t.Entry({data:r})}},{key:"getNewEntryTime",value:function e(t,i){t=a.Util.getUsableDateTime(t);return{from:t,to:new Date(t.getTime()+(i||3600)*1e3)}}},{key:"getNewEntryName",value:function t(){return e.newEntryName||r.Loc.getMessage("CALENDAR_DEFAULT_ENTRY_NAME")}},{key:"setNewEntryName",value:function t(i){e.newEntryName=i}},{key:"showEditEntryNotification",value:function t(i){a.Util.showNotification(r.Loc.getMessage("CALENDAR_SAVE_EVENT_NOTIFICATION"),[{title:r.Loc.getMessage("CALENDAR_EVENT_DO_VIEW"),events:{click:function t(a,n,s){e.openViewSlider(i);n.close()}}}])}},{key:"showNewEntryNotification",value:function t(i){a.Util.showNotification(r.Loc.getMessage("CALENDAR_NEW_EVENT_NOTIFICATION"),[{title:r.Loc.getMessage("CALENDAR_EVENT_DO_VIEW"),events:{click:function t(a,n,s){e.openViewSlider(i);n.close()}}}])}},{key:"openEditSlider",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var i=a.Util.getBX();if(i.Calendar&&i.Calendar.SliderLoader){new i.Calendar.SliderLoader(t.entry?"EDIT"+t.entry.id:"NEW",{entry:t.entry||null,type:t.type,ownerId:t.ownerId,userId:t.userId}).show()}}},{key:"openViewSlider",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!r.Type.isNull(t)){var n=a.Util.getBX();if(n.Calendar&&n.Calendar.SliderLoader){new n.Calendar.SliderLoader(t,{entryDateFrom:i.from,timezoneOffset:i.timezoneOffset}).show()}}}},{key:"deleteEntry",value:function e(i){if(i instanceof t.Entry){BX.addCustomEvent("BX.Calendar.Entry:beforeDelete",function(){if(a.Util.getBX().SidePanel.Instance){a.Util.getBX().SidePanel.Instance.close()}});BX.addCustomEvent("BX.Calendar.Entry:delete",function(){a.Util.getBX().reload()});i.delete()}}},{key:"setMeetingStatus",value:function e(t,i){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!r.Type.isPlainObject(n)){n={}}n.recursionMode=n.recursionMode||false;if(i==="N"&&!n.confirmed){if(t.isRecursive()){this.showConfirmStatusDialog(t);return false}else if(!confirm(r.Loc.getMessage("EC_DECLINE_MEETING_CONFIRM"))){return false}}BX.ajax.runAction("calendar.api.calendarajax.setMeetingStatus",{data:{entryId:t.id,entryParentId:t.parentId,status:i,recursionMode:n.recursionMode,currentDateDrom:a.Util.formatDate(t.from)}}).then(function(e){BX.Event.EventEmitter.emit("BX.Calendar.Entry:onChangeMeetingStatus",new r.Event.BaseEvent({data:{entry:t,status:i,recursionMode:n.recursionMode,currentDateDrom:t.from}}))}.bind(this))}},{key:"showConfirmStatusDialog",value:function t(i){if(!this.confirmDeclineDialog){this.confirmDeclineDialog=new n.ConfirmStatusDialog}this.confirmDeclineDialog.show();this.confirmDeclineDialog.unsubscribeAll("onDecline");this.confirmDeclineDialog.subscribe("onDecline",function(t){if(t instanceof r.Event.BaseEvent){e.setMeetingStatus(i,"N",{recursionMode:t.getData().recursionMode,confirmed:true})}})}},{key:"showConfirmEditDialog",value:function e(t){if(!this.confirmEditDialog){this.confirmEditDialog=new n.ConfirmEditDialog}this.confirmEditDialog.show();if(r.Type.isFunction(t.callback)){this.confirmEditDialog.unsubscribeAll("onEdit");this.confirmEditDialog.subscribe("onEdit",function(e){if(e instanceof r.Event.BaseEvent){t.callback(e.getData())}})}}},{key:"getCompactViewForm",value:function t(){if(!e.compactEntryForm){e.compactEntryForm=new s.CompactEventForm}return e.compactEntryForm}},{key:"openCompactViewForm",value:function t(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};e.getCompactViewForm().showInViewMode(i)}},{key:"openCompactEditForm",value:function t(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};e.getCompactViewForm().showInEditMode(i)}},{key:"getEntryInstance",value:function i(a,n){var s=null;if(a instanceof t.Entry){s=a}else{if(r.Type.isObject(a)&&r.Type.isObject(a.data)){s=new t.Entry({data:a.data,userIndex:n})}else if(r.Type.isObject(a)){s=new t.Entry({data:a,userIndex:n})}else{s=e.getNewEntry()}}return s}}]);return e}();babelHelpers.defineProperty(o,"newEntryName","");var u=function(){function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);this.prepareData(t.data);this.parts=[];if(t.userIndex){this.setUserIndex(t.userIndex)}}babelHelpers.createClass(e,[{key:"prepareData",value:function e(t){this.data=t;this.id=this.data.ID||0;if(!this.data.DT_SKIP_TIME){this.data.DT_SKIP_TIME=this.data.SKIP_TIME?"Y":"N"}this.fullDay=this.data.DT_SKIP_TIME==="Y";this.parentId=this.data.PARENT_ID||0;this.accessibility=this.data.ACCESSIBILITY||"busy";this.important=this.data.IMPORTANCE==="high";this.private=!!this.data.PRIVATE_EVENT;this.setSectionId(this.data.SECT_ID);this.name=this.data.NAME;if(!this.data.DT_LENGTH){this.data.DT_LENGTH=this.data.DURATION||0}if(this.fullDay&&!this.data.DT_LENGTH){this.data.DT_LENGTH=86400}if(!r.Type.isString(this.data.DATE_FROM)&&!r.Type.isString(this.data.DATE_TO)&&r.Type.isDate(this.data.dateFrom)&&r.Type.isDate(this.data.dateTo)){this.from=this.data.dateFrom;this.to=this.data.dateTo;this.data.DT_LENGTH=Math.round((this.to.getTime()-this.from.getTime())/1e3);this.data.DURATION=this.data.DT_LENGTH;if(this.fullDay){this.data.DATE_FROM=a.Util.formatDate(this.from.getTime());this.data.DATE_TO=a.Util.formatDate(this.to.getTime())}else{this.data.DATE_FROM=a.Util.formatDateTime(this.from.getTime());this.data.DATE_TO=a.Util.formatDateTime(this.to.getTime())}}else{if(this.isTask()){this.from=BX.parseDate(this.data.DATE_FROM)||new Date;this.to=BX.parseDate(this.data.DATE_TO)||this.from}else{this.from=BX.parseDate(this.data.DATE_FROM)||new Date;this.to=new Date(this.from.getTime()+(this.data.DT_LENGTH-(this.fullDay?1:0))*1e3)}}if(this.fullDay){this.from.setHours(0,0,0,0);this.to.setHours(0,0,0,0)}if(!this.data.ATTENDEES_CODES&&!this.isTask()){if(this.data.CAL_TYPE==="user"&&this.data.OWNER_ID){this.data.ATTENDEES_CODES=["U"+this.data.OWNER_ID]}else if(this.data.CREATED_BY){this.data.ATTENDEES_CODES=["U"+this.data.CREATED_BY]}}this.startDayCode=this.from;this.endDayCode=this.to;if(!r.Type.isArray(this.data.REMIND)&&r.Type.isArray(this.data.remind)){this.data.REMIND=[];this.data.remind.forEach(function(e){this.data.REMIND.push({type:"min",count:e})},this);delete this.data.remind}}},{key:"getAttendeesCodes",value:function e(){return this.data.ATTENDEES_CODES}},{key:"getAttendees",value:function e(){if(!this.attendeeList&&r.Type.isArray(this.data["ATTENDEE_LIST"])){this.attendeeList=[];var t=this.getUserIndex();this.data["ATTENDEE_LIST"].forEach(function(e){if(t[e.id]){var i=BX.clone(t[e.id]);i.STATUS=e.status;i.ENTRY_ID=e.entryId;this.attendeeList.push(i)}},this)}return this.attendeeList||[]}},{key:"setUserIndex",value:function e(t){this.userIndex=t}},{key:"getUserIndex",value:function e(){return this.userIndex}},{key:"cleanParts",value:function e(){this.parts=[]}},{key:"startPart",value:function e(t){t.partIndex=this.parts.length;this.parts.push(t);return this.parts[t.partIndex]}},{key:"registerPartNode",value:function e(t,i){t.params=i}},{key:"checkPartIsRegistered",value:function e(t){return r.Type.isPlainObject(t.params)}},{key:"getPart",value:function e(t){return this.parts[t]||false}},{key:"getWrap",value:function e(t){return this.parts[t||0].params.wrapNode}},{key:"getSectionName",value:function e(){}},{key:"getDescription",value:function e(t){if(this.data.DESCRIPTION&&this.data["~DESCRIPTION"]&&r.Type.isFunction(t)){setTimeout(function(){t(this.data["~DESCRIPTION"])}.bind(this),50)}}},{key:"applyViewRange",value:function e(t){var i=t.start.getTime(),a=t.end.getTime(),n=this.from.getTime(),s=this.to.getTime();if(s<i||n>a)return false;if(n<i){this.displayFrom=t.start;this.startDayCode=this.displayFrom}if(s>a){this.displayTo=t.end;this.endDayCode=this.displayTo}return true}},{key:"isPersonal",value:function e(){}},{key:"isMeeting",value:function e(){return!!this.data.IS_MEETING}},{key:"isResourcebooking",value:function e(){return this.data.EVENT_TYPE==="#resourcebooking#"}},{key:"isTask",value:function e(){return this.data["~TYPE"]==="tasks"}},{key:"isFullDay",value:function e(){return this.fullDay}},{key:"isLongWithTime",value:function e(){return!this.fullDay&&a.Util.getDayCode(this.from)!==a.Util.getDayCode(this.to)}},{key:"isExpired",value:function e(){return this.to.getTime()<(new Date).getTime()}},{key:"isExternal",value:function e(){return false}},{key:"isSelected",value:function e(){return!!this.selected}},{key:"isCrm",value:function e(){return!!this.data.UF_CRM_CAL_EVENT}},{key:"isFirstReccurentEntry",value:function e(){return(this.data.DATE_FROM_TS_UTC===Math.floor(BX.parseDate(this.data["~DATE_FROM"]).getTime()/1e3)*1e3||BX.parseDate(this.data["DATE_FROM"]).getTime()===BX.parseDate(this.data["~DATE_FROM"]).getTime())&&!this.data.RECURRENCE_ID}},{key:"isRecursive",value:function e(){return!!this.data.RRULE}},{key:"getMeetingHost",value:function e(){return parseInt(this.data.MEETING_HOST)}},{key:"getRrule",value:function e(){return this.data.RRULE}},{key:"hasRecurrenceId",value:function e(){return this.data.RECURRENCE_ID}},{key:"wasEverRecursive",value:function e(){return this.data.RRULE||this.data.RECURRENCE_ID}},{key:"deselect",value:function e(){this.selected=false}},{key:"select",value:function e(){this.selected=true}},{key:"deleteParts",value:function e(){if(r.Type.isArray(this.parts)){this.parts.forEach(function(e){if(e.params){if(e.params.wrapNode){e.params.wrapNode.style.opacity=0}}},this);setTimeout(function(){this.parts.forEach(function(e){if(e.params){if(e.params.wrapNode){BX.remove(e.params.wrapNode)}}},this)}.bind(this),300)}}},{key:"getUniqueId",value:function e(){var t=this.data.PARENT_ID||this.data.PARENT_ID;if(this.isRecursive())t+="|"+this.data.DT_FROM_TS;if(this.data["~TYPE"]==="tasks")t+="|"+"task";return t}},{key:"getCurrentStatus",value:function e(){var t=a.Util.getCurrentUserId(),i=false,n,s;if(this.isMeeting()){if(t===parseInt(this.data.CREATED_BY)||t===parseInt(this.data.MEETING_HOST)){i=this.data.MEETING_STATUS}else if(t===parseInt(this.data.MEETING_HOST)){i=this.data.MEETING_STATUS}else if(r.Type.isArray(this.data["ATTENDEE_LIST"])){for(n=0;n<this.data["ATTENDEE_LIST"].length;n++){s=this.data["ATTENDEE_LIST"][n];if(parseInt(this.data["ATTENDEE_LIST"][n].id)===t){i=this.data["ATTENDEE_LIST"][n].status;break}}}}return i||"Q"}},{key:"getReminders",value:function e(){var t=[];if(this.data&&this.data.REMIND){this.data.REMIND.forEach(function(e){switch(e.type){case"min":t.push(e.count);break;case"hour":t.push(parseInt(e.count)*60);break;case"day":t.push(parseInt(e.count)*60*24);break;case"daybefore":t.push(e);break;case"date":if(!r.Type.isDate(e.value)){e.value=a.Util.parseDate(e.value)}if(r.Type.isDate(e.value)){t.push(e)}break}})}return t}},{key:"getLengthInDays",value:function e(){var t=new Date(this.from.getFullYear(),this.from.getMonth(),this.from.getDate(),0,0,0),i=new Date(this.to.getFullYear(),this.to.getMonth(),this.to.getDate(),0,0,0);return Math.round((i.getTime()-t.getTime())/a.Util.getDayLength())+1}},{key:"getName",value:function e(){return this.name||this.defaultNewName}},{key:"getColor",value:function e(){return this.data.COLOR}},{key:"getType",value:function e(){return this.data.CAL_TYPE}},{key:"getOwnerId",value:function e(){return this.data.OWNER_ID}},{key:"delete",value:function e(t){t=r.Type.isPlainObject(t)?t:{};var i=t.recursionMode||false;if(this.wasEverRecursive()&&!t.confirmed){return this.showConfirmDeleteDialog({entry:this})}else{if(!t.confirmed&&!confirm(BX.message("EC_DELETE_EVENT_CONFIRM"))){return false}BX.onCustomEvent("BX.Calendar.Entry:beforeDelete",[{entryId:this.id,recursionMode:i}]);this.deleteParts();BX.ajax.runAction("calendar.api.calendarajax.deleteCalendarEntry",{data:{entryId:this.id,recursionMode:t.recursionMode||false}}).then(function(e){BX.onCustomEvent("BX.Calendar.Entry:delete",[{entryId:this.id,recursionMode:i}])}.bind(this))}}},{key:"deleteThis",value:function e(){var t="this";if(this.isRecursive()){BX.onCustomEvent("BX.Calendar.Entry:beforeDelete",[{entryId:this.id,recursionMode:t}]);BX.ajax.runAction("calendar.api.calendarajax.excludeRecursionDate",{data:{entryId:this.id,excludeDate:this.data.DATE_FROM}}).then(function(e){BX.onCustomEvent("BX.Calendar.Entry:delete",[{entryId:this.id,recursionMode:t}])}.bind(this))}else if(this.hasRecurrenceId()){this.delete({confirmed:true,recursionMode:"this"})}}},{key:"deleteNext",value:function e(){var t="next";if(this.isRecursive()&&this.isFirstReccurentEntry()){this.deleteAll()}else{BX.onCustomEvent("BX.Calendar.Entry:beforeDelete",[{entryId:this.id,recursionMode:t}]);BX.ajax.runAction("calendar.api.calendarajax.changeRecurciveEntryUntil",{data:{entryId:this.id,untilDate:a.Util.formatDate(this.from.getTime()-a.Util.getDayLength())}}).then(function(e){BX.onCustomEvent("BX.Calendar.Entry:delete",[{entryId:this.id,recursionMode:t}])}.bind(this))}}},{key:"deleteAll",value:function e(){return this.delete({confirmed:true,recursionMode:"all"})}},{key:"showConfirmDeleteDialog",value:function e(t){if(!this.confirmDeleteDialog){this.confirmDeleteDialog=new n.ConfirmDeleteDialog({entry:t.entry})}this.confirmDeleteDialog.show()}},{key:"save",value:function e(){}},{key:"getLocation",value:function e(){return this.data.LOCATION}},{key:"setTimezone",value:function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;if(r.Type.isString(t)){this.data.TZ_FROM=t;if(r.Type.isNull(i)){this.data.TZ_TO=t}}if(r.Type.isString(i)){this.data.TZ_TO=i}}},{key:"getTimezoneFrom",value:function e(){return this.data.TZ_FROM}},{key:"getTimezoneTo",value:function e(){return this.data.TZ_TO}},{key:"setSectionId",value:function e(t){this.data.SECT_ID=this.sectionId=this.isTask()?"tasks":parseInt(t)}}]);return e}();e.EntryManager=o;e.Entry=u})(this.BX.Calendar=this.BX.Calendar||{},BX.Calendar,BX.Calendar,BX.Calendar,BX.Calendar.Controls,BX.Calendar,BX);
//# sourceMappingURL=entry.bundle.map.js