/*!@license * Infragistics.Web.ClientUI Scheduler 19.1.20 * * Copyright (c) 2011-2019 Infragistics Inc. * * http://www.infragistics.com/ * * Depends on: * jquery-1.9.1.js * jquery.ui.core.js * jquery.ui.widget.js * Intl.js * infragistics.templating.js * infragistics.util.js * infragistics.util.jquery.js * infragistics.ui.scroll.js * infragistics.ext_core.js * infragistics.ext_text.js * infragistics.ext_collections.js * infragistics.ext_io.js * infragistics.ext_ui.js * infragistics.ext_collectionsExtended.js * infragistics.ext_threading.js * infragistics.ext_web.js * infragistics.xml.js * infragistics.dv_core.js * infragistics.dv_jquerydom.js * infragistics.datasource.js * infragistics.ui.widget.js * infragistics.scheduler.core.js * infragistics.ui.scheduler.core.js * infragistics.ui.shared.js * infragistics.ui.popover.js * infragistics.ui.validator.js * infragistics.ui.notifier.js * infragistics.ui.editors.js * infragistics.ui.combo.js * * Example to use: * * */ (function(factory){if(typeof define==="function"&&define.amd){define(["./infragistics.ui.widget","./infragistics.datasource","./infragistics.ui.scroll","./infragistics.scheduler.core","./infragistics.ui.scheduler.core"],factory)}else{return factory(jQuery)}})(function($){/*!@license * Infragistics.Web.ClientUI Scheduler localization resources 19.1.20 * * Copyright (c) 2011-2019 Infragistics Inc. * * http://www.infragistics.com/ * */ (function($){$.ig=$.ig||{};$.ig.locale=$.ig.locale||{};$.ig.locale.en=$.ig.locale.en||{};$.ig.SchedulerLocale=$.ig.SchedulerLocale||{};$.ig.locale.en.SchedulerLocale={tag:"en-US",agenda:"Agenda",month:"Month",week:"Week",day:"Day",next:"Next",previous:"Previous",dateRange:"Date Range",todayButton:"Today",nonDivError:"igScheduler can be instantiated only on HTML DIV element.",createNewAppointmentDialogTitle:"Create New Appointment",editAppointmentDialogTitle:"Edit Appointment",appointmentDialogSubjectLabel:"Subject",appointmentDialogLocationLabel:"Location",appointmentDialogFromLabel:"From",appointmentDialogToLabel:"To",appointmentDialogDescriptionLabel:"Description",appointmentDialogCreateButtonLabel:"Create",appointmentDialogSaveButtonLabel:"Save",appointmentDialogCancelButtonLabel:"Cancel",appointmentDialogCreateAppointmentButtonLabel:"Create appointment",dayPopoverTitle:"Create new appointment",appointmentPopoverTitle:"Edit appointment",appointmentPopoverOpenButtonLabel:"Open appointment",appointmentPopoverDeleteButtonLabel:"Delete",deleteAppointmentDialogTitle:"Delete Appointment",deleteAppointmentDialogConfirmation:"Do you want to delete this appointment?",deleteAppointmentDialogDeleteButtonLabel:"Delete",deleteAppointmentDialogCancelButtonLabel:"Cancel",deleteOccurrenceDialogTitle:"Delete Recurring Item",deleteOccurrenceDialogText:"Do you want to delete this occurrence or the entire series?",deleteOccurrenceDialogDeleteButtonLabel:"Delete occurrence",deleteOccurrenceDialogDeleteSeriesLabel:"Delete series",deleteOccurrenceDialogCancelLabel:"Cancel",appointmentDialogResourceLabel:"Resource",invalidIntervalErrorMessage:"The end date you entered occurs before the start date.",dialogCloseButtonText:"Close",countNumericEditorLabel:"Count",recurringEventLabel:"Recurring event",frequencyComboLabel:"Frequency",dateRecurrenceFrequencyDaily:"Daily",dateRecurrenceFrequencyWeekly:"Weekly",dateRecurrenceFrequencyMonthly:"Monthly",dateRecurrenceFrequencyYearly:"Yearly",editAppointmentDialogConfirmation:"Do you want to edit this occurrence or the entire series?",editAppointmentDialogOccurrenceButtonLabel:"Edit occurrence",editAppointmentDialogSeriesButtonLabel:"Edit series",editOccurrenceDialogTitle:"Edit occurrence",editSeriesDialogTitle:"Edit series",editSeriesButtonText:"Edit Recurring item"};$.ig.SchedulerLocale.locale=$.ig.SchedulerLocale.locale||$.ig.locale.en.SchedulerLocale;return $.ig.locale.en})($);$.widget("ui.igScheduler",$.ui.igWidget,{localeWidgetName:"SchedulerLocale",options:{views:["monthView","agendaView","weekView","dayView"],viewMode:null,selectedDate:new Date,enableTodayButton:true,width:"100%",height:"100%",agendaViewSettings:{dateRangeInterval:7},weekViewSettings:{weekViewDisplayMode:"workingDaysOnly",workingHoursDisplayMode:"workingHoursOnly",timeSlotInterval:"fiveMinutes"},dayViewSettings:{timeSlotInterval:"fiveMinutes",dayViewNumberOfDays:1,workingHoursDisplayMode:"workingHoursOnly"},monthViewSettings:{appointmentMode:"auto",isAgendaVisible:false,agendaVisibilityType:"allAppointments",viewSplitOrientation:"auto",isHorizontalSeparatorVisibile:true,isVerticalSeparatorVisibile:false,isWeekdayVisible:true,isWeekNumberVisible:false,isPreviousMonthShown:true,isNextMonthShown:true},appointmentDialogSuppress:false,dataSource:null,resources:null},css:{scheduler:"ui-igscheduler",container:"ui-widget ui-corner-all ui-state-default",header:"ui-igscheduler-header",body:"ui-igscheduler-body",todayButton:"ui-igscheduler-today-button",todayButtonIcon:"ui-icon ui-icon-calendar-day",navigator:"ui-igscheduler-navigator",dateRangeButton:"ui-igscheduler-navigator-date-range-button",disabledDateRangeButton:"ui-igscheduler-navigator-disabled-date-range-button",dateRangeButtonSpan:"date-range-button-text",previousButton:"ui-igscheduler-navigator-previous-button",nextButton:"ui-igscheduler-navigator-next-button",tabsContainer:"ui-igscheduler-tabs-container",tabs:"ui-igscheduler-tabs",monthTabIcon:"ui-icon ui-icon-calendar",agendaTabIcon:"ui-icon ui-icon-note",weekTabIcon:"ui-icon ui-icon-week",dayTabIcon:"ui-icon ui-icon-day",selectedTab:"ui-igscheduler-tabs-selected",sideBySideGroup:"ui-igscheduler-side-by-side-group",dayPopoverContent:"ui-igscheduler-day-popover-content",dayPopoverCreateButton:"ui-igscheduler-day-popover-create-button",appointmentPopoverContent:"ui-igscheduler-appointment-popover-content",appointmentPopoverSubject:"ui-igscheduler-appointment-popover-subject",appointmentPopoverFromTo:"ui-igscheduler-appointment-popover-from-to",appointmentPopoverActions:"ui-igscheduler-appointment-actions",appointmentPopoverDeleteButton:"ui-igscheduler-appointment-popover-delete-button ui-igdanger-btn",appointmentPopoverOpenButton:"ui-igscheduler-appointment-popover-open-button",appointmentDialog:"ui-igscheduler-appointment-dialog",appointmentDialogForm:"ui-igscheduler-appointment-dialog-form",appointmentDialogFormGroup:"ui-igscheduler-appointment-form-group",appointmentDialogSubject:"ui-igscheduler-appointment-dialog-subject",appointmentDialogLocation:"ui-igscheduler-appointment-dialog-location",appointmentDialogFromDate:"ui-igscheduler-appointment-dialog-from-date",appointmentDialogFromDateTimeLabel:"ui-igscheduler-appointment-dialog-from-date-time-label",appointmentDialogFromTime:"ui-igscheduler-appointment-dialog-from-time",appointmentDialogToDate:"ui-igscheduler-appointment-dialog-to-date",appointmentDialogToDateTimeLabel:"ui-igscheduler-appointment-dialog-to-date-time-label",appointmentDialogToTime:"ui-igscheduler-appointment-dialog-to-time",appointmentDialogDescription:"ui-igscheduler-appointment-dialog-description",appointmentDialogCreateButton:"ui-igscheduler-appointment-dialog-create-button",appointmentDialogSaveButton:"ui-igscheduler-appointment-dialog-save-button",appointmentDialogCancelButton:"ui-igscheduler-appointment-dialog-cancel-button",deleteAppointmentDialogConfirmation:"ui-igscheduler-delete-appointment-dialog-confirmation",deleteAppointmentDialogActions:"ui-igscheduler-delete-appointment-dialog-actions",deleteAppointmentDialogCancelButton:"ui-igscheduler-delete-appointment-dialog-cancel-button",deleteAppointmentDialogDeleteButton:"ui-igscheduler-delete-appointment-dialog-delete-button ui-igdanger-btn",deleteOccurrenceDialogText:"ui-igscheduler-delete-occurrence-dialog-text",deleteOccurrenceDialogActions:"ui-igscheduler-delete-occurrence-dialog-actions",deleteOccurrenceDialogDeleteButton:"ui-igscheduler-delete-occurrence-dialog-delete-button ui-igdanger-btn",deleteOccurrenceDialogDeleteSeriesButton:"ui-igscheduler-delete-occurrence-dialog-delete-series-button ui-igdanger-btn",deleteOccurrenceDialogCancelButton:"ui-igscheduler-delete-occurrence-dialog-cancel-button",editAppointmentDialogConfirmation:"ui-igscheduler-edit-appointment-dialog-confirmation",editAppointmentDialogActions:"ui-igscheduler-edit-appointment-dialog-actions",editAppointmentDialogOccurrenceButton:"ui-igscheduler-edit-appointment-dialog-occurrence-button",editAppointmentDialogSeriesButton:"ui-igscheduler-delete-appointment-dialog-series-button",resourcesCombo:"ui-igscheduler-resources-combo",resourcesComboItemColor:"ui-igscheduler-resources-combo-item-color",resourcesComboItemDisplayText:"ui-igscheduler-resources-combo-item-text",recurrenceCheckbox:"ui-igscheduler-recurrence-checkbox"},events:{agendaRangeChanging:"agendaRangeChanging",agendaRangeChanged:"agendaRangeChanged",daySelected:"daySelected",monthChanging:"monthChanging",monthChanged:"monthChanged",rendering:"rendering",rendered:"rendered",weekChanging:"weekChanging",weekChanged:"weekChanged",dayChanging:"dayChanging",dayChanged:"dayChanged",viewChanging:"viewChanging",viewChanged:"viewChanged",appointmentDialogOpening:"appointmentDialogOpening",appointmentDialogOpened:"appointmentDialogOpened",appointmentDialogClosing:"appointmentDialogClosing",appointmentDialogClosed:"appointmentDialogClosed",appointmentCreating:"appointmentCreating",appointmentCreated:"appointmentCreated",appointmentDeleting:"appointmentDeleting",appointmentDeleted:"appointmentDeleted",appointmentEditing:"appointmentEditing",appointmentEdited:"appointmentEdited"},_createWidget:function(){this._superApply(arguments)},_initDataSource:function(ds){var schema,dataSource,scheduleListDataSource;schema=new $.ig.DataSchema("array",{fields:[{name:"id",type:"string"},{name:"resourceId",type:"string"},{name:"subject",type:"string"},{name:"location",type:"string"},{name:"description",type:"string"},{name:"recurrence",type:"string"},{name:"start",type:"date"},{name:"end",type:"date"}]});ds=ds||[];ds=schema.transform(ds);dataSource=new $.ig.DataSource({dataSource:ds}).dataBind();scheduleListDataSource=new $.ig.scheduler.ScheduleListDataSource;scheduleListDataSource.appointmentItemsSource(dataSource);if(this.options.resources!==null){scheduleListDataSource.resourceItemsSource(this.options.resources)}this.options.dataSource=scheduleListDataSource;this.options.dataSource.createAppointmentDataObjectCallback=$.proxy(this._createAppointmentCallback,this)},_create:function(){this._options={resoucesById:{},resourcesComboItemTemplate:""+"${displayName}",tabletBreakpoint:768,mobileBreakpoint:576,$header:undefined,$body:undefined,$scheduler:undefined,$todayButton:undefined,$navigator:undefined,$previousButton:undefined,$dateRangeButton:undefined,$nextButton:undefined,$calendar:undefined,$tabs:undefined,monthFormat:this._getRegionalValue("dateTitleMonthPattern"),agendaFormat:this._getRegionalValue("dateTitleFullPattern"),timeFormat:this._getRegionalValue("timePattern"),$dateRangeButtonTextContainer:undefined,$appointmentDialog:undefined,$appointmentDialogSubject:undefined,$appointmentDialogResourceCombo:undefined,$appointmentDialogLocation:undefined,$appointmentDialogFromDate:undefined,$appointmentDialogFromTime:undefined,$appointmentDialogToDate:undefined,$appointmentDialogToTime:undefined,$appointmentDialogDescription:undefined,$appointmentDialogCreateButton:undefined,$appointmentDialogSaveButton:undefined,$appointmentDialogCancelButton:undefined,$appointmentPopover:undefined,$appointmentPopoverContainer:undefined,$appointmentPopoverSubject:undefined,$appointmentPopoverFromTo:undefined,$appointmentPopoverDeleteButton:undefined,$appointmentPopoverOpenButton:undefined,$dayPopover:undefined,$dayPopoverContainer:undefined,$dayPopoverCreateButton:undefined,appointmentDialogDatePickersOptions:{dateInputFormat:"date",dateDisplayFormat:"date"},appointmentDialogTimePickersOptions:{buttonType:"spin",dateInputFormat:"time",dateDisplayFormat:"time"},appointmentDialogDefaultFromTimeHours:9,appointmentDialogDefaultToTimeHours:18,appointmentDialogSpinMinutesDelta:15,appointmentHalfHourTimeRange:18e5,appointmentDialogWidth:"500px",appointmentDialogMobileWidth:"100%",appointmentDialogPosition:"center",appointmentDialogMobilePosition:"top",preventDayClickedEvent:false,currentAppointment:null,$deleteAppointmentDialog:undefined,$deleteAppointmentDialogCancelButton:undefined,$deleteAppointmentDialogDeleteButton:undefined,$deleteOccurrenceDialog:undefined,$deleteOccurrenceDialogDeleteButton:undefined,$deleteOccurrenceDialogDeleteSeriesButton:undefined,$deleteOccurrenceDialogCancelButton:undefined,$editAppointmentDialog:undefined,$editAppointmentDialogOccurrenceButton:undefined,$editAppointmentDialogSeriesButton:undefined};this._initDataSource(this.options.dataSource);this._saveInitialState();$.datepicker.setDefaults($.datepicker.regional[this.options.language]);this._render();this._storeResourcesColorsById()},_render:function(){this._triggerRendering();this._renderContainer();this._renderHeader();this._renderBody();this._attachEventHandlers();this._triggerRendered()},_renderContainer:function(){if(!this.element.is("div")){throw new Error(this._getLocaleValue("nonDivError"))}this.element.addClass(this.css.scheduler).addClass(this.css.container);if(this.options.width){this.element.css("width",this.options.width)}if(this.options.height){this.element.css("height",this.options.height)}},_renderHeader:function(){this._options.$header=$("
").addClass(this.css.header).appendTo(this.element);this._renderTodayButton();this._renderNavigator();this._renderTabs()},_renderBody:function(){var self=this;this._options.$body=$("
").addClass(this.css.body).appendTo(this.element);this._options.$scheduler=$("
").appendTo(this._options.$body).igSchedulerCore(this._setDefaults());this._options.$scheduler.one("igschedulercorelayoutupdated",function(){self._viewMode(self.options.viewMode);self._selectDate(self.options.selectedDate)})},_renderTodayButton:function(){if(this.options.enableTodayButton){this._options.$todayButton=$("
").addClass(this.css.todayButton).appendTo(this._options.$header);this._options.$todayButton.append($("").addClass(this.css.todayButtonIcon));this._options.$todayButton.append(""+this._getLocaleValue("todayButton")+"")}},_renderNavigator:function(){this._options.$navigator=$("
").addClass(this.css.navigator).appendTo(this._options.$header);this._options.$previousButton=$("
").addClass(this.css.previousButton).attr({title:this._getLocaleValue("previous"),"data-localeid":"previous","data-localeattr":"title"}).appendTo(this._options.$navigator);this._options.$dateRangeButton=$("
").addClass(this.css.dateRangeButton).attr({title:this._getLocaleValue("dateRange"),"data-localeid":"dateRange","data-localeattr":"title"}).appendTo(this._options.$navigator);this._renderCalendar();this._options.$dateRangeButtonTextContainer=$("").addClass(this.css.dateRangeButtonSpan).appendTo(this._options.$dateRangeButton);this._options.$nextButton=$("
").addClass(this.css.nextButton).attr({title:this._getLocaleValue("next"),"data-localeid":"next","data-localeattr":"title"}).appendTo(this._options.$navigator)},_renderCalendar:function(){var pickerOptions,self=this;pickerOptions={onSelect:function(){var date=$(this).datepicker("getDate");self._selectDate(date);self._triggerDaySelected()}};this._options.$calendar=$("").appendTo(this._options.$dateRangeButton).datepicker(pickerOptions);this._options.$calendar.datepicker("setDate",new Date)},_renderTabs:function(){var self=this;this._options.$tabs=$("
").addClass(this.css.tabsContainer).appendTo(this._options.$header);$.each(this.options.views,function(index,value){self._renderTab(value.replace("View",""))})},_renderTab:function(value){var self=this;this._options["$"+value+"ViewButton"]=$("
").addClass(self.css.tabs).appendTo(this._options.$tabs).append($("").addClass(self.css[value+"TabIcon"])).append(""+this._getLocaleValue(value)+"")},_setDefaults:function(){var selDate=this.options.selectedDate,interval=this.options.agendaViewSettings.dateRangeInterval,settings=this.options.monthViewSettings,orientation=this._getSplitOrientation(),coreOptions;this.options.viewMode=this.options.viewMode!==null?this.options.viewMode:this.options.views[0]||"monthView";coreOptions=$.extend(true,{},this.options);coreOptions.width="100%";coreOptions.height="100%";coreOptions.monthViewScrollMode="paged";coreOptions.monthViewNameVisibility="collapsed";coreOptions.cultureName=this._getLocaleValue("tag");coreOptions.agendaViewMinimumDate=selDate;coreOptions.agendaViewMaximumDate=new $.ig.Date.prototype.addDays(selDate,interval);coreOptions.monthViewAgendaVisibility=settings.isAgendaVisible?"visible":"collapsed";coreOptions.agendaViewAppointmentScope=settings.agendaVisibilityType;coreOptions.viewSplitOrientation=orientation;coreOptions.monthViewDayContentDisplayMode=orientation==="vertical"?"activitySubject":"squareIndicator";coreOptions.monthViewHorizontalSeparatorVisibility=settings.isHorizontalSeparatorVisibile?"visible":"collapsed";coreOptions.monthViewVerticalSeparatorVisibility=settings.isVerticalSeparatorVisibile?"visible":"collapsed";coreOptions.monthViewDayOfWeekHeaderVisibility=settings.isWeekdayVisible?"visible":"collapsed";coreOptions.monthViewWeekNumberVisibility=settings.isWeekNumberVisible?"visible":"collapsed";coreOptions.monthViewLeadingDayVisibility=settings.isPreviousMonthShown?"visible":"collapsed";coreOptions.monthViewTrailingDayVisibility=settings.isNextMonthShown?"visible":"collapsed";return coreOptions},_dateRangeButtonText:function(date){var viewMode=this.options.viewMode,pattern;if(viewMode==="monthView"){pattern=this._options.monthFormat}else if(viewMode==="agendaView"||viewMode==="weekView"||viewMode==="dayView"){pattern=this._options.agendaFormat}this._options.$dateRangeButtonTextContainer.text($.datepicker.formatDate(pattern,date))},_tabSwitcher:function(mode,event){var currentSelectedView=this.options.viewMode,noCancel=this._triggerViewChanging(event,mode,currentSelectedView);if(noCancel){switch(mode){case"monthView":this._viewMode("monthView");break;case"agendaView":this._viewMode("agendaView");break;case"weekView":this._viewMode("weekView");break;case"dayView":this._viewMode("dayView");break}this._triggerViewChanged(event,mode)}},_viewMode:function(mode){switch(mode){case"monthView":this._options.$scheduler.igSchedulerCore("option","viewMode","monthView");this.options.viewMode="monthView";this._options.$calendar.datepicker("option","dateFormat",this._options.monthFormat);var minDate=this._options.$scheduler.igSchedulerCore("option","agendaViewMinimumDate");this._selectDate(minDate);this._options.$calendar.datepicker("hide");this._options.$dateRangeButton.removeClass(this.css.dateRangeButton);this._options.$dateRangeButton.addClass(this.css.disabledDateRangeButton);if(this._options.$monthViewButton){this._options.$monthViewButton.addClass(this.css.selectedTab)}if(this._options.$agendaViewButton){this._options.$agendaViewButton.removeClass(this.css.selectedTab)}if(this._options.$weekViewButton){this._options.$weekViewButton.removeClass(this.css.selectedTab)}if(this._options.$dayViewButton){this._options.$dayViewButton.removeClass(this.css.selectedTab)}break;case"agendaView":this._options.$scheduler.igSchedulerCore("option","viewMode","agendaView");this.options.viewMode="agendaView";this._options.$calendar.datepicker("option","dateFormat",this._options.agendaFormat);this._selectDate(this._options.$scheduler.igSchedulerCore("option","selectedDate"));this._options.$dateRangeButton.removeClass(this.css.disabledDateRangeButton);this._options.$dateRangeButton.addClass(this.css.dateRangeButton);if(this._options.$agendaViewButton){this._options.$agendaViewButton.addClass(this.css.selectedTab)}if(this._options.$monthViewButton){this._options.$monthViewButton.removeClass(this.css.selectedTab)}if(this._options.$weekViewButton){this._options.$weekViewButton.removeClass(this.css.selectedTab)}if(this._options.$dayViewButton){this._options.$dayViewButton.removeClass(this.css.selectedTab)}break;case"weekView":this._options.$scheduler.igSchedulerCore("option","viewMode","weekView");this.options.viewMode="weekView";this._setDayWeekViewSettings(this.options.weekViewSettings);this._options.$calendar.datepicker("option","dateFormat",this._options.agendaFormat);this._selectDate(this._options.$scheduler.igSchedulerCore("option","selectedDate"));this._options.$dateRangeButton.removeClass(this.css.disabledDateRangeButton);this._options.$dateRangeButton.addClass(this.css.dateRangeButton);if(this._options.$agendaViewButton){this._options.$agendaViewButton.removeClass(this.css.selectedTab)}if(this._options.$monthViewButton){this._options.$monthViewButton.removeClass(this.css.selectedTab)}if(this._options.$weekViewButton){this._options.$weekViewButton.addClass(this.css.selectedTab)}if(this._options.$dayViewButton){this._options.$dayViewButton.removeClass(this.css.selectedTab)}break;case"dayView":this._options.$scheduler.igSchedulerCore("option","viewMode","dayView");this.options.viewMode="dayView";this._setDayWeekViewSettings(this.options.dayViewSettings);this._options.$calendar.datepicker("option","dateFormat",this._options.agendaFormat);this._selectDate(this._options.$scheduler.igSchedulerCore("option","selectedDate"));this._options.$dateRangeButton.removeClass(this.css.disabledDateRangeButton);this._options.$dateRangeButton.addClass(this.css.dateRangeButton);if(this._options.$agendaViewButton){this._options.$agendaViewButton.removeClass(this.css.selectedTab)}if(this._options.$monthViewButton){this._options.$monthViewButton.removeClass(this.css.selectedTab)}if(this._options.$weekViewButton){this._options.$weekViewButton.removeClass(this.css.selectedTab)}if(this._options.$dayViewButton){this._options.$dayViewButton.addClass(this.css.selectedTab)}break}},_changeTimePeriod:function(event,delta){var newDate,startAgendaRangeDate,agendaRange,noCancel,daysInWeek=7;if(this._options.$scheduler.igSchedulerCore("option","viewMode")==="monthView"){newDate=new Date(this._options.$scheduler.igSchedulerCore("option","selectedDate"));newDate.setMonth(newDate.getMonth()+delta);noCancel=this._triggerMonthChanging(event,newDate);if(noCancel){this._selectDate(newDate);this._triggerMonthChanged(event)}}else if(this._options.$scheduler.igSchedulerCore("option","viewMode")==="agendaView"){agendaRange=this.options.agendaViewSettings.dateRangeInterval;startAgendaRangeDate=this._options.$scheduler.igSchedulerCore("option","agendaViewMinimumDate");startAgendaRangeDate=new Date(startAgendaRangeDate.getFullYear(),startAgendaRangeDate.getMonth(),startAgendaRangeDate.getDate()+delta*agendaRange);noCancel=this._triggerAgendaRangeChanging(event,startAgendaRangeDate);if(noCancel){this._selectDate(startAgendaRangeDate);this._triggerAgendaRangeChanged(event)}}else if(this._options.$scheduler.igSchedulerCore("option","viewMode")==="weekView"){newDate=new Date(this._options.$scheduler.igSchedulerCore("option","selectedDate"));newDate.setDate(newDate.getDate()+daysInWeek*delta);noCancel=this._triggerWeekChanging(event,newDate);if(noCancel){this._selectDate(newDate);this._triggerWeekChanged(event)}}else if(this._options.$scheduler.igSchedulerCore("option","viewMode")==="dayView"){newDate=new Date(this._options.$scheduler.igSchedulerCore("option","selectedDate"));newDate.setDate(newDate.getDate()+delta);noCancel=this._triggerDayChanging(event,newDate);if(noCancel){this._selectDate(newDate);this._triggerDayChanged(event)}}},_selectDate:function(date){var monthDate=this._options.$scheduler.igSchedulerCore("option","selectedDate");if(this.options.selectedDate!==date){this.options.selectedDate=date}this._dateRangeButtonText(date);if(this._options.$calendar.datepicker("getDate")!==date){this._options.$calendar.datepicker("setDate",date)}if(monthDate.getTime()!==date.getTime()){this._options.$scheduler.igSchedulerCore("option","selectedDate",date)}this._options.$scheduler.igSchedulerCore("ensureMonthVisibleInMonthView",date);this._options.$scheduler.igSchedulerCore("ensureDayVisibleInMonthView",date);this._options.$scheduler.igSchedulerCore("ensureDayVisibleInDayOrWeekView",date);this._setOption("agendaViewMinimumDate",date);this._setOption("agendaViewMaximumDate",new $.ig.Date.prototype.addDays(date,this.options.agendaViewSettings.dateRangeInterval))},_attachEventHandlers:function(){this._attachHeaderEventHandlers();this._attachSchedulerEventHandlers();this._attachDocumentEventHandlers()},_attachHeaderEventHandlers:function(){var self=this;this._options.$todayButton.on("click",function(){self._selectDate(new Date)});this._options.$previousButton.on("click",function(event){self._changeTimePeriod(event,-1)});this._options.$dateRangeButton.on("click",function(){var view=self._options.$scheduler.igSchedulerCore("option","viewMode");if(view==="monthView"){return}else{self._options.$calendar.datepicker("show")}});this._options.$nextButton.on("click",function(event){self._changeTimePeriod(event,1)});if(this._options.$monthViewButton){this._options.$monthViewButton.on("click",function(event){self._tabSwitcher("monthView",event)})}if(this._options.$agendaViewButton){this._options.$agendaViewButton.on("click",function(event){self._tabSwitcher("agendaView",event)})}if(this._options.$weekViewButton){this._options.$weekViewButton.on("click",function(event){self._tabSwitcher("weekView",event)})}if(this._options.$dayViewButton){this._options.$dayViewButton.on("click",function(event){self._tabSwitcher("dayView",event)})}},_detachHeaderEventHandlers:function(){this._options.$todayButton.off();this._options.$previousButton.off();this._options.$dateRangeButton.off();this._options.$nextButton.off();if(this._options.$monthViewButton){this._options.$monthViewButton.off()}if(this._options.$agendaViewButton){this._options.$agendaViewButton.off()}if(this._options.$weekViewButton){this._options.$weekViewButton.off()}if(this._options.$dayViewButton){this._options.$dayViewButton.off()}},_attachSchedulerEventHandlers:function(){this._options.$scheduler.on("igschedulercoredayclicked",$.proxy(this._onDayClicked,this));this._options.$scheduler.on("igschedulercoreappointmentselected",$.proxy(this._onAppointmentSelected,this));this._options.$scheduler.on("igschedulercoreappointmentclicked",$.proxy(this._onAppointmentClicked,this));this._options.$scheduler.on("igschedulercoretimeslotclicked",$.proxy(this._onTimeSlotClicked,this))},_detachSchedulerEventHandlers:function(){this._options.$scheduler.off("igschedulercoredayclicked",$.proxy(this._onDayClicked,this));this._options.$scheduler.off("igschedulercoreappointmentselected",$.proxy(this._onAppointmentSelected,this));this._options.$scheduler.off("igschedulercoreappointmentclicked",$.proxy(this._onAppointmentClicked,this));this._options.$scheduler.off("igschedulercoretimeslotclicked",$.proxy(this._onTimeSlotClicked,this))},_attachDocumentEventHandlers:function(){$(document).on("click",$.proxy(this._onDocumentClicked,this));$(window).on("resize",$.proxy(this._onWindowResize,this))},_detachDocumentEventHandlers:function(){$(document).off("click",$.proxy(this._onDocumentClicked,this));$(window).off("resize",$.proxy(this._onWindowResize,this))},_onDayClicked:function(event,args){this._selectDate(args.clickedDate);if(this.options.appointmentDialogSuppress){return}if(this._options.preventDayClickedEvent){this._options.preventDayClickedEvent=false;return}if(this._options.$dayPopover===undefined){this._renderDayPopover()}if(args.clickedDate.getMonth()!==this.options.selectedDate.getMonth()){this._options.$dayPopover.igPopover("hide");return}if(this._options.$appointmentPopover&&this._options.$appointmentPopoverContainer.css("display")!=="none"){this._options.$appointmentPopover.igPopover("hide")}setTimeout(function(self,clickedDate){try{var selectedDayElement=self._options.$scheduler.igSchedulerCore("getElementForDay",clickedDate);self._options.$dayPopover.igPopover("show",$(selectedDayElement))}catch(e){console.log(e)}},100,this,args.clickedDate)},_onAppointmentClicked:function(event,args){if(this.options.appointmentDialogSuppress){return}if(args.viewMode===$.ig.scheduler.SchedulerViewMode.monthView||args.viewMode===$.ig.scheduler.SchedulerViewMode.weekView||args.viewMode===$.ig.scheduler.SchedulerViewMode.dayView){var element,fromTo;this._options.preventDayClickedEvent=true;if(this._options.$appointmentPopover===undefined){this._renderAppointmentPopover()}if(this._options.$appointmentPopoverContainer.css("display")!=="none"){this._options.$appointmentPopover.igPopover("hide")}this._options.currentAppointment=args.appointment;this._options.$appointmentPopoverSubject.text(args.appointment.subject());fromTo=this._formatDateToAMPM(args.appointment.start())+" - "+this._formatDateToAMPM(args.appointment.end());this._options.$appointmentPopoverFromTo.text(fromTo);element=this._options.$scheduler.igSchedulerCore("getElementForActivity",args.appointment,args.viewMode,args.clickedInDate);setTimeout(function(self){try{self._options.$appointmentPopover.igPopover("show",$(element))}catch(e){console.log(e)}},100,this)}},_onAppointmentSelected:function(event,args){var newSelectedDay=args.selectedAppointment.start();this.options.selectedDate=newSelectedDay;this._dateRangeButtonText(newSelectedDay);this._options.$calendar.datepicker("setDate",newSelectedDay)},_onTimeSlotClicked:function(event,args){var element;if(this._options.$dayPopover===undefined){this._renderDayPopover()}setTimeout(function(self){element=self._options.$scheduler.igSchedulerCore("getSelectedTimeSlotElement",args.appointment,args.viewMode,args.clickedInDate);self._selectDate(new Date(args.clickedInDate.getTime()+args.clickedTimeRange.start()));self._options.$dayPopover.igPopover("show",$(element))},100,this)},_openAppointmentDialogForCreating:function(event){var noCancel;if(this._options.$appointmentDialog===undefined){this._renderAppointmentDialog()}this._toggleAppointmentDialogRecurrenceFrequencyRequiredValidaton(this._options.$appointmentDialogRecurrenceCheckbox.igCheckboxEditor("value"));noCancel=this._triggerAppointmentDialogOpening(true,event);if(noCancel){this._options.currentAppointment=undefined;this._clearAppointmentDialogData();this._options.$appointmentDialog.dialog("option","title",this._getLocaleValue("createNewAppointmentDialogTitle"));this._updateAppointmentDialogTitleColor("");this._options.$appointmentDialogSaveButton.hide();this._options.$appointmentDialogCreateButton.show();this._options.$appointmentDialog.dialog("open");this._triggerAppointmentDialogOpened(true,event)}},_openAppointmentDialogForEditing:function(event){var appointment,fromDate,toDate,noCancel,resourceColor=null,recurrenceRoot,recurrenceICalendarString,recurrence;if(this._options.$appointmentDialog===undefined){this._renderAppointmentDialog()}this._toggleAppointmentDialogRecurrenceFrequencyRequiredValidaton(this._options.$appointmentDialogRecurrenceCheckbox.igCheckboxEditor("value"));noCancel=this._triggerAppointmentDialogOpening(false,event);if(noCancel){appointment=this._options.currentAppointment;this._clearAppointmentDialogData();this._options.$appointmentDialogSubject.igTextEditor("value",appointment.subject());this._options.$appointmentDialogLocation.igTextEditor("value",appointment.location());this._options.$appointmentDialog.dialog("option","title",this._getLocaleValue("editAppointmentDialogTitle"));if(appointment.resourceId()!==null){this._options.$appointmentDialogResourceCombo.igCombo("value",appointment.resourceId());resourceColor=this._getResourceColorById(appointment.resourceId())}if(appointment.isRecurrenceRoot()){recurrenceRoot=appointment;recurrenceICalendarString=recurrenceRoot.recurrence();recurrence=$.ig.scheduler.DateRecurrence.fromICalendarString(recurrenceICalendarString);this._options.$appointmentDialogRecurrenceCheckbox.igCheckboxEditor("value",true);this._options.$appointmentDialogRecurrenceCountNumericEditor.igNumericEditor("value",recurrence.count());this._options.$appointmentDialogRecurrenceFrequencyCombo.igCombo("value",recurrence.frequency());this._options.$appointmentDialogRecurrenceOptions.show();this._options.$appointmentDialog.dialog("option","title",this._getLocaleValue("editSeriesDialogTitle"))}if(appointment.recurrenceRoot()!==null){this._showResourceGroupElements(false);this._showRecurrenceGroupElements(false);this._options.$appointmentDialog.dialog("option","title",this._getLocaleValue("editOccurrenceDialogTitle"))}fromDate=appointment.start();toDate=appointment.end();this._setAppointmentDialogFromToDates(fromDate,toDate);this._options.$appointmentDialogDescription.igTextEditor("value",appointment.description());this._updateAppointmentDialogTitleColor(resourceColor);this._options.$appointmentDialogSaveButton.show();this._options.$appointmentDialogCreateButton.hide();this._options.$appointmentDialog.dialog("open");this._triggerAppointmentDialogOpened(false,event)}},_onWindowResize:function(){this._setResponsiveUI()},_setResponsiveUI:function(){var currentOrientation,newOrientation;currentOrientation=this._options.$scheduler.igSchedulerCore("option","viewSplitOrientation"); newOrientation=this._getSplitOrientation();if(currentOrientation!==newOrientation){this._options.$scheduler.igSchedulerCore("option","viewSplitOrientation",newOrientation);this._options.$scheduler.igSchedulerCore("option","monthViewDayContentDisplayMode",newOrientation==="vertical"?"activitySubject":"squareIndicator")}if(this._options.$appointmentDialog){this._options.$appointmentDialog.dialog("option","position",this._getDialogPosition());this._options.$appointmentDialog.dialog("option","width",this._getDialogWidth())}if(this._options.$deleteAppointmentDialog){this._options.$deleteAppointmentDialog.dialog("option","position",this._getDialogPosition());this._options.$deleteAppointmentDialog.dialog("option","width",this._getDialogWidth())}},_getSplitOrientation:function(){var orientation=this.options.monthViewSettings.viewSplitOrientation,containerWidth=this.element.outerWidth();if(orientation==="auto"){if(containerWidth").addClass(this.css.appointmentDialogForm),$subjectLocationContainer=$("
").addClass(this.css.sideBySideGroup);this._options.$appointmentDialog=$appointmentDialogForm.appendTo(this.element).dialog({autoOpen:false,modal:true,width:this._getDialogWidth(),position:this._getDialogPosition(),resizable:false,closeText:this._getLocaleValue("dialogCloseButtonText"),dialogClass:this.css.appointmentDialog,create:function(){$appointmentDialogForm.append($subjectLocationContainer);self._renderAppointmentDialogSubject($subjectLocationContainer);self._renderAppointmentDialogLocation($subjectLocationContainer);self._renderAppointmentDialogFromDateTime($appointmentDialogForm);self._renderAppointmentDialogToDateTime($appointmentDialogForm);self._renderAppointmentDialogResource($appointmentDialogForm);self._renderAppointmentDialogRecurrence($appointmentDialogForm);self._renderAppointmentDialogDescription($appointmentDialogForm);self._renderAppointmentDialogActions($appointmentDialogForm);self._initializeAppointmentDialogFieldsValidator($appointmentDialogForm)},beforeClose:function(event){var isAppointmentNew=self._options.currentAppointment?false:true,noCancel=self._triggerAppointmentDialogClosing(isAppointmentNew,event);if(noCancel){self._options.$appointmentDialog.igValidator("hide");self._options.$appointmentDialogRecurrenceOptions.hide()}else{return false}self._showRecurrenceGroupElements(true);self._showResourceGroupElements(true)},close:function(event){var isAppointmentNew=self._options.currentAppointment?false:true;self._triggerAppointmentDialogClosed(isAppointmentNew,event)},dragStart:function(event){if(self.element.outerWidth()").text(this._getLocaleValue("appointmentDialogSubjectLabel")).attr("data-localeid","appointmentDialogSubjectLabel");this._options.$appointmentDialogSubject=$("").addClass(this.css.appointmentDialogSubject);container.append($subjectContainer.append($subjectLabel).append(this._options.$appointmentDialogSubject));this._options.$appointmentDialogSubject.igTextEditor({placeHolder:this._getLocaleValue("appointmentDialogSubjectLabel")})},_renderAppointmentDialogLocation:function(container){var $locationContainer=$("
").addClass(this.css.appointmentDialogFormGroup),$locationLabel=$("").text(this._getLocaleValue("appointmentDialogLocationLabel")).attr("data-localeid","appointmentDialogLocationLabel");this._options.$appointmentDialogLocation=$("").addClass(this.css.appointmentDialogLocation);container.append($locationContainer.append($locationLabel).append(this._options.$appointmentDialogLocation));this._options.$appointmentDialogLocation.igTextEditor({placeHolder:this._getLocaleValue("appointmentDialogLocationLabel")})},_renderAppointmentDialogFromDateTime:function(container){var self=this,$fromContainer=$("
").addClass(this.css.sideBySideGroup),$fromLabel=$("").addClass(this.css.appointmentDialogFromDateTimeLabel).text(this._getLocaleValue("appointmentDialogFromLabel")).attr("data-localeid","appointmentDialogFromLabel"),$fromDateContainer=$("
").addClass(this.css.appointmentDialogFormGroup),$fromTimeContainer=$("
").addClass(this.css.appointmentDialogFormGroup),fromDateOptions,fromTimeOptions;this._options.$appointmentDialogFromDate=$("").addClass(this.css.appointmentDialogFromDate);this._options.$appointmentDialogFromTime=$("").addClass(this.css.appointmentDialogFromTime);$fromDateContainer.append(this._options.$appointmentDialogFromDate);$fromTimeContainer.append(this._options.$appointmentDialogFromTime);container.append($fromLabel).append($fromContainer.append($fromDateContainer).append($fromTimeContainer));fromDateOptions=$.extend({},{valueChanged:function(){self._triggerValidationForToDate()},language:this.options.language,regional:this.options.language},this._options.appointmentDialogDatePickersOptions);fromTimeOptions=$.extend({},{valueChanged:function(){self._triggerValidationForToDate()},rendered:function(evt,ui){self._overwriteSpinHandlers(ui.owner)},language:this.options.language,regional:this.options.language},this._options.appointmentDialogTimePickersOptions);this._options.$appointmentDialogFromDate.igDatePicker(fromDateOptions);this._options.$appointmentDialogFromTime.igDateEditor(fromTimeOptions)},_triggerValidationForToDate:function(){this._options.$appointmentDialog.igValidator("validate",3)},_renderAppointmentDialogToDateTime:function(container){var self=this,$toContainer=$("
").addClass(this.css.sideBySideGroup),$toLabel=$("").addClass(this.css.appointmentDialogToDateTimeLabel).text(this._getLocaleValue("appointmentDialogToLabel")).attr("data-localeid","appointmentDialogToLabel"),$toDateContainer=$("
").addClass(this.css.appointmentDialogFormGroup),$toTimeContainer=$("
").addClass(this.css.appointmentDialogFormGroup),toDateOptions,toTimeOptions;this._options.$appointmentDialogToDate=$("").addClass(this.css.appointmentDialogToDate);this._options.$appointmentDialogToTime=$("").addClass(this.css.appointmentDialogToTime);$toDateContainer.append(this._options.$appointmentDialogToDate);$toTimeContainer.append(this._options.$appointmentDialogToTime);container.append($toLabel).append($toContainer.append($toDateContainer).append($toTimeContainer));toDateOptions=$.extend({},{language:this.options.language,regional:this.options.language},this._options.appointmentDialogDatePickersOptions);toTimeOptions=$.extend({},{valueChanged:function(){self._triggerValidationForToDate()},rendered:function(evt,ui){self._overwriteSpinHandlers(ui.owner)},language:this.options.language,regional:this.options.language},this._options.appointmentDialogTimePickersOptions);this._options.$appointmentDialogToDate.igDatePicker(toDateOptions);this._options.$appointmentDialogToTime.igDateEditor(toTimeOptions)},_overwriteSpinHandlers:function(editor){var self=this,spinMinutesDelta=this._options.appointmentDialogSpinMinutesDelta,oldSpinEditMode,oldSpinDisplayMode;oldSpinEditMode=editor._spinEditMode;editor._spinEditMode=function(delta,userInteraction){oldSpinEditMode.apply(editor,[delta*self._getDelta(editor,spinMinutesDelta,delta),userInteraction])};oldSpinDisplayMode=editor._spinDisplayMode;editor._spinDisplayMode=function(delta,userInteraction){oldSpinDisplayMode.apply(editor,[delta*spinMinutesDelta,userInteraction])}},_getDelta:function(editor,delta){return editor._getTimePosition().name==="minutes"?delta:1},_renderAppointmentDialogResource:function(container){var $ownerLabel=$("").text(this._getLocaleValue("appointmentDialogResourceLabel")).attr("data-localeid","appointmentDialogResourceLabel"),comboOptions;this._options.$appointmentDialogResourceOwnerContainer=$("
").addClass(this.css.appointmentDialogFormGroup);this._options.$appointmentDialogResourceCombo=$("
").addClass(this.css.resourcesCombo);comboOptions={selectionChanged:$.proxy(this._appointmentDialogResourceComboSelectionChanged,this),itemsRendered:$.proxy(this._onAppointmentDialogResourcesComboItemsRendered,this),textKey:"displayName",valueKey:"id",itemTemplate:this._options.resourcesComboItemTemplate,dataSource:this.options.dataSource.resourceItemsSource(),language:this.options.language};this._options.$appointmentDialogResourceCombo.igCombo(comboOptions);container.append(this._options.$appointmentDialogResourceOwnerContainer.append($ownerLabel).append(this._options.$appointmentDialogResourceCombo))},_appointmentDialogResourceComboSelectionChanged:function(evt,ui){var $colorContainer,color=null;if(ui.items.length>0){$colorContainer=$(ui.items[0].element).find("."+this.css.resourcesComboItemColor);color=$colorContainer.css("background-color")}this._updateAppointmentDialogTitleColor(color)},_renderAppointmentDialogRecurrence:function(container){var $ownerLabel=$("").text(this._getLocaleValue("recurringEventLabel")).attr("data-localeid","recurringEventLabel"),self=this,checkboxOptions;this._options.$appointmentDialogRecurrenceOwnerContainer=$("
").addClass(this.css.appointmentDialogFormGroup);this._options.$appointmentDialogRecurrenceCheckbox=$("
").addClass(this.css.recurrenceCheckbox);checkboxOptions={checked:false,valueChanged:function(evt,ui){if(ui.newValue===true){self._options.$appointmentDialogRecurrenceOptions.show()}else{self._options.$appointmentDialogRecurrenceOptions.hide();self._clearAppointmentDialogRecurrenceData()}self._toggleAppointmentDialogRecurrenceFrequencyRequiredValidaton(ui.newValue)}};this._options.$appointmentDialogRecurrenceCheckbox.igCheckboxEditor(checkboxOptions);container.append(this._options.$appointmentDialogRecurrenceOwnerContainer.append($ownerLabel).append(this._options.$appointmentDialogRecurrenceCheckbox));this._renderAppointmentDialogRecurrenceOptions(container);this._options.$appointmentDialogRecurrenceOptions.hide()},_renderAppointmentDialogRecurrenceOptions:function(container){var $frequencyContainer=$("
").addClass(this.css.appointmentDialogFormGroup),$countContainer=$("
").addClass(this.css.appointmentDialogFormGroup),$frequencyLabel=$("").text(this._getLocaleValue("frequencyComboLabel")).attr("data-localeid","frequencyComboLabel"),$countLabel=$("").text(this._getLocaleValue("countNumericEditorLabel")).attr("data-localeid","countNumericEditorLabel"),recurrenceFrequencyComboOptions,recurrenceCountNumberEditorOptions;this._options.$appointmentDialogRecurrenceOptions=$("
").addClass(this.css.sideBySideGroup);this._options.$appointmentDialogRecurrenceFrequencyCombo=$("
");recurrenceFrequencyComboOptions={textKey:"displayName",valueKey:"id",dataSource:this._getRecurrenceFrequency(),language:this.options.language};this._options.$appointmentDialogRecurrenceCountNumericEditor=$("
");recurrenceCountNumberEditorOptions={dataMode:"int",minValue:1,value:1,buttonType:"spin",language:this.options.language,suppressNotifications:true};this._options.$appointmentDialogRecurrenceFrequencyCombo.igCombo(recurrenceFrequencyComboOptions);this._options.$appointmentDialogRecurrenceCountNumericEditor.igNumericEditor(recurrenceCountNumberEditorOptions);this._options.$appointmentDialogRecurrenceOptions.append($frequencyContainer.append($frequencyLabel).append(this._options.$appointmentDialogRecurrenceFrequencyCombo));this._options.$appointmentDialogRecurrenceOptions.append($countContainer.append($countLabel).append(this._options.$appointmentDialogRecurrenceCountNumericEditor));container.append(this._options.$appointmentDialogRecurrenceOptions)},_getRecurrenceFrequency:function(){return[{id:$.ig.scheduler.DateRecurrenceFrequency.daily,displayName:this._getLocaleValue("dateRecurrenceFrequencyDaily")},{id:$.ig.scheduler.DateRecurrenceFrequency.weekly,displayName:this._getLocaleValue("dateRecurrenceFrequencyWeekly")},{id:$.ig.scheduler.DateRecurrenceFrequency.monthly,displayName:this._getLocaleValue("dateRecurrenceFrequencyMonthly")},{id:$.ig.scheduler.DateRecurrenceFrequency.yearly,displayName:this._getLocaleValue("dateRecurrenceFrequencyYearly")}]},_toggleAppointmentDialogRecurrenceFrequencyRequiredValidaton:function(isRequired){var $appointmentDialog=this._options.$appointmentDialog;$appointmentDialog.igValidator("updateField",5,{required:isRequired})},_renderAppointmentDialogDescription:function(container){var $descriptionContainer=$("
").addClass(this.css.appointmentDialogFormGroup),$descirptionLabel=$("").text(this._getLocaleValue("appointmentDialogDescriptionLabel")).attr("data-localeid","appointmentDialogDescriptionLabel");this._options.$appointmentDialogDescription=$("").addClass(this.css.appointmentDialogDescription);container.append($descriptionContainer.append($descirptionLabel).append(this._options.$appointmentDialogDescription));this._options.$appointmentDialogDescription.igTextEditor({textMode:"multiline",height:100})},_renderAppointmentDialogActions:function(container){var $actionsContainer=$("
").addClass(this.css.appointmentDialogFormGroup);this._options.$appointmentDialogCreateButton=$("").addClass(this.css.appointmentDialogCreateButton).appendTo($actionsContainer).igButton({labelText:this._getLocaleValue("appointmentDialogCreateButtonLabel")}).on("igbuttonclick",$.proxy(this._onCreateAppointmentClicked,this));this._options.$appointmentDialogSaveButton=$("").addClass(this.css.appointmentDialogSaveButton).appendTo($actionsContainer).igButton({labelText:this._getLocaleValue("appointmentDialogSaveButtonLabel")}).on("igbuttonclick",$.proxy(this._onEditAppointmentClicked,this));this._options.$appointmentDialogCancelButton=$("").addClass(this.css.appointmentDialogCancelButton).appendTo($actionsContainer).igButton({labelText:this._getLocaleValue("appointmentDialogCancelButtonLabel")}).on("igbuttonclick",$.proxy(this._onCancelAppointmentClicked,this));container.append($actionsContainer)},_renderDayPopover:function(){var $dayPopoverContent=$("
").addClass(this.css.dayPopoverContent);this._options.$dayPopoverCreateButton=$("").addClass(this.css.dayPopoverCreateButton).appendTo($dayPopoverContent).igButton({labelText:this._getLocaleValue("appointmentDialogCreateAppointmentButtonLabel")}).on("igbuttonclick",$.proxy(this._onDayPopoverCreateButtonClicked,this));this._options.$dayPopover=$("
").appendTo(this.element).igPopover({animationDuration:50,contentTemplate:$dayPopoverContent,headerTemplate:{closeButton:true,title:this._getLocaleValue("dayPopoverTitle")}});this._options.$dayPopoverContainer=$dayPopoverContent.closest(".ui-igpopover")},_renderAppointmentPopover:function(){var $appointmentPopoverContent=$("
").addClass(this.css.appointmentPopoverContent),$appointmentPopoverActions=$("
").addClass(this.css.appointmentPopoverDeleteButton);this._options.$appointmentPopoverSubject=$("
").addClass(this.css.appointmentPopoverSubject).appendTo($appointmentPopoverContent);this._options.$appointmentPopoverFromTo=$("
").addClass(this.css.appointmentPopoverFromTo).appendTo($appointmentPopoverContent);this._options.$appointmentPopoverOpenButton=$("").addClass(this.css.appointmentPopoverOpenButton).appendTo($appointmentPopoverActions).igButton({labelText:this._getLocaleValue("appointmentPopoverOpenButtonLabel")}).on("click",$.proxy(this._onOpenAppointmentClicked,this));this._options.$appointmentPopoverDeleteButton=$("").addClass(this.css.appointmentPopoverDeleteButton).appendTo($appointmentPopoverActions).igButton({labelText:this._getLocaleValue("appointmentPopoverDeleteButtonLabel")}).on("click",$.proxy(this._onDeleteAppointmentClicked,this));$appointmentPopoverContent.append($appointmentPopoverActions);this._options.$appointmentPopover=$("
").appendTo(this.element).igPopover({animationDuration:50,contentTemplate:$appointmentPopoverContent,headerTemplate:{closeButton:true,title:this._getLocaleValue("appointmentPopoverTitle")}});this._options.$appointmentPopoverContainer=$appointmentPopoverContent.closest(".ui-igpopover")},_renderDeleteAppointmentDialog:function(){var $dialogContainer=$("
"),$dialogConfirmation=$("
").addClass(this.css.deleteAppointmentDialogConfirmation).text(this._getLocaleValue("deleteAppointmentDialogConfirmation")).attr("data-localeid","deleteAppointmentDialogConfirmation"),$dialogActions=$("
").addClass(this.css.deleteAppointmentDialogActions);$dialogConfirmation.appendTo($dialogContainer);this._options.$deleteAppointmentDialogDeleteButton=$("").addClass(this.css.deleteAppointmentDialogDeleteButton).appendTo($dialogActions).igButton({labelText:this._getLocaleValue("deleteAppointmentDialogDeleteButtonLabel")}).on("igbuttonclick",$.proxy(this._onConfirmDeletingAppointmentClicked,this));this._options.$deleteAppointmentDialogCancelButton=$("").addClass(this.css.deleteAppointmentDialogCancelButton).appendTo($dialogActions).igButton({labelText:this._getLocaleValue("deleteAppointmentDialogCancelButtonLabel")}).on("igbuttonclick",$.proxy(this._onCancelDeletingAppointmentClicked,this));$dialogContainer.append($dialogActions);this._options.$deleteAppointmentDialog=$dialogContainer.appendTo(this.element).dialog({autoOpen:false,title:this._getLocaleValue("deleteAppointmentDialogTitle"),modal:true,width:this._getDialogWidth(),position:this._getDialogPosition(),resizable:false,closeText:this._getLocaleValue("dialogCloseButtonText")})},_renderDeleteOccurrenceDialog:function(){var $dialogContainer=$("
"),$dialogText=$("
").addClass(this.css.deleteOccurrenceDialogText).text(this._getLocaleValue("deleteOccurrenceDialogText")).attr("data-localeid","deleteOccurrenceDialogText"),$dialogActions=$("
").addClass(this.css.deleteOccurrenceDialogActions);$dialogText.appendTo($dialogContainer);this._options.$deleteOccurrenceDialogDeleteButton=$("").addClass(this.css.deleteOccurrenceDialogDeleteButton).appendTo($dialogActions).igButton({labelText:this._getLocaleValue("deleteOccurrenceDialogDeleteButtonLabel")}).on("igbuttonclick",$.proxy(this._onConfirmDeletingOccurrenceClicked,this));this._options.$deleteOccurrenceDialogDeleteSeriesButton=$("").addClass(this.css.deleteOccurrenceDialogDeleteSeriesButton).appendTo($dialogActions).igButton({labelText:this._getLocaleValue("deleteOccurrenceDialogDeleteSeriesLabel")}).on("igbuttonclick",$.proxy(this._onCofirmDeletingSeriesClicked,this));this._options.$deleteOccurrenceDialogCancelButton=$("").addClass(this.css.deleteOccurrenceDialogCancelButton).appendTo($dialogActions).igButton({labelText:this._getLocaleValue("deleteOccurrenceDialogCancelLabel")}).on("igbuttonclick",$.proxy(this._onCancelDeletingOccurrenceClicked,this));$dialogContainer.append($dialogActions);this._options.$deleteOccurrenceDialog=$dialogContainer.appendTo(this.element).dialog({autoOpen:false,title:this._getLocaleValue("deleteOccurrenceDialogTitle"),modal:true,width:this._getDialogWidth(),position:this._getDialogPosition(),resizable:false,closeText:this._getLocaleValue("dialogCloseButtonText")})},_renderEditAppointmentDialog:function(){var $editDialogContainer=$("
"),$editDialogConfirmation=$("
").addClass(this.css.editAppointmentDialogConfirmation).text(this._getLocaleValue("editAppointmentDialogConfirmation")).attr("data-localeid","editAppointmentDialogConfirmation"),$editDialogActions=$("
").addClass(this.css.editAppointmentDialogActions);$editDialogConfirmation.appendTo($editDialogContainer);this._options.$editAppointmentDialogoccurrenceButton=$("").addClass(this.css.editAppointmentDialogOccurrenceButton).appendTo($editDialogActions).igButton({labelText:this._getLocaleValue("editAppointmentDialogOccurrenceButtonLabel")}).on("igbuttonclick",$.proxy(this._onOccurrenceEditAppointmentClicked,this));this._options.$editAppointmentDialogSeriesButton=$("").addClass(this.css.editAppointmentDialogSeriesButton).appendTo($editDialogActions).igButton({labelText:this._getLocaleValue("editAppointmentDialogSeriesButtonLabel")}).on("igbuttonclick",$.proxy(this._onSeriesEditAppointmentClicked,this));$editDialogContainer.append($editDialogActions);this._options.$editAppointmentDialog=$editDialogContainer.appendTo(this.element).dialog({autoOpen:false,title:this._getLocaleValue("editAppointmentDialogTitle"),modal:true,width:this._getDialogWidth(),position:this._getDialogPosition(),resizable:false,closeText:this._getLocaleValue("editSeriesButtonText")})},_initializeAppointmentDialogFieldsValidator:function(container){var self=this;container.igValidator({onchange:true,onblur:false,fields:[{selector:this._options.$appointmentDialogSubject,required:true},{selector:this._options.$appointmentDialogFromDate,required:true},{selector:this._options.$appointmentDialogFromTime,required:true},{selector:this._options.$appointmentDialogToDate,required:true,custom:{method:function(value){var isTimeSpanValid=self._isTimeSpanValid(value),$editorContainer=self._options.$appointmentDialogToTime.igDateEditor("editorContainer");if(isTimeSpanValid){$editorContainer.removeClass($.ui.igNotifier.prototype.css.errorState)}else{$editorContainer.addClass($.ui.igNotifier.prototype.css.errorState)}return isTimeSpanValid},errorMessage:this._getLocaleValue("invalidIntervalErrorMessage")}},{selector:this._options.$appointmentDialogToTime,required:true},{selector:this._options.$appointmentDialogRecurrenceFrequencyCombo,required:this._options.$appointmentDialogRecurrenceCheckbox.igCheckboxEditor("value")}]})},_isTimeSpanValid:function(toValue){var from=this._getFromValue(),to=this._getToValue(toValue),isFromBeforeTo=true;if(from!==null&&to!==null){isFromBeforeTo=to.getTime()>from.getTime()}return isFromBeforeTo},_getFromValue:function(){return this._getMergedDateAndTime(this._options.$appointmentDialogFromDate.igDatePicker("value"),this._options.$appointmentDialogFromTime.igDateEditor("value"))},_getToValue:function(toValue){return this._getMergedDateAndTime(toValue,this._options.$appointmentDialogToTime.igDateEditor("value"))},_getMergedDateAndTime:function(date,time){if(!date||!time){return null}var dateTime=new Date(date.getFullYear(),date.getMonth(),date.getDate(),time.getHours(),time.getMinutes(),time.getSeconds(),time.getMilliseconds());return dateTime},_onConfirmDeletingAppointmentClicked:function(event){var appointmentId=this._options.currentAppointment.id(),noCancel=this._triggerAppointmentDeleting(this._options.currentAppointment,event);if(noCancel){this.deleteAppointment(this._options.currentAppointment);this._triggerAppointmentDeleted(appointmentId,event);this._options.currentAppointment=null;this._options.$deleteAppointmentDialog.dialog("close")}},_onConfirmDeletingOccurrenceClicked:function(event){var occurrenceId=this._options.currentAppointment.id(),noCancel=this._triggerAppointmentDeleting(this._options.currentAppointment,event);if(noCancel){this.deleteAppointment(this._options.currentAppointment);this._triggerAppointmentDeleted(occurrenceId,event);this._options.currentAppointment=null;this._options.$deleteOccurrenceDialog.dialog("close")}},_onCofirmDeletingSeriesClicked:function(event){var series=this._options.currentAppointment.recurrenceRoot(),seriesId=series.id(),noCancel=this._triggerAppointmentDeleting(series,event);if(noCancel){this.deleteAppointment(series);this._triggerAppointmentDeleted(seriesId,event);this._options.$deleteOccurrenceDialog.dialog("close")}},_onCancelDeletingAppointmentClicked:function(){this._options.currentAppointment=null;this._options.$deleteAppointmentDialog.dialog("close")},_onCancelDeletingOccurrenceClicked:function(){this._options.currentAppointment=null;this._options.$deleteOccurrenceDialog.dialog("close")},_onOccurrenceEditAppointmentClicked:function(event){this._openAppointmentDialogForEditing(event);this._options.$editAppointmentDialog.dialog("close")},_onSeriesEditAppointmentClicked:function(event){this._options.currentAppointment=this._options.currentAppointment.recurrenceRoot();this._openAppointmentDialogForEditing(event);this._options.$editAppointmentDialog.dialog("close")},_onAppointmentDialogResourcesComboItemsRendered:function(event,ui){var resources=ui.dataSource.data(),$appointmentDialogResourceCombo=this._options.$appointmentDialogResourceCombo,resource,comboItem,colorContainer,color;for(var i=0;i=0){ampm=hours>=12?" PM":" AM";hours=hours%12;hours=hours?hours:12}minutes=minutes<10?"0"+minutes:minutes;time=hours+":"+minutes+ampm;return time},_triggerRendering:function(){var args={owner:this,element:this.element};return this._trigger(this.events.rendering,null,args)},_triggerRendered:function(){var args={owner:this,element:this.element};this._trigger(this.events.rendered,null,args)},_triggerViewChanging:function(event,newSelectedView,currentSelectedView){var args={owner:this,element:event.target,currentSelectedView:currentSelectedView,newSelectedView:newSelectedView};return this._trigger(this.events.viewChanging,event,args)},_triggerViewChanged:function(event){var args={owner:this,element:event.target,newSelectedView:this.options.viewMode};this._trigger(this.events.viewChanged,event,args)},_triggerDaySelected:function(){var args={owner:this,element:this.element,date:this.options.selectedDate};this._trigger(this.events.daySelected,null,args)},_triggerMonthChanging:function(event,newSelectedDate){var args={owner:this,element:event.target,currentSelectedDate:this.options.selectedDate,newSelectedDate:newSelectedDate};return this._trigger(this.events.monthChanging,event,args)},_triggerMonthChanged:function(event){var args={owner:this,element:event.target,newSelectedDate:this.options.selectedDate};this._trigger(this.events.monthChanged,event,args)},_triggerAgendaRangeChanging:function(event,newAgendaRangeStartDate){var args={owner:this,element:event.target,dateRangeInterval:this.options.agendaViewSettings.dateRangeInterval,currentAgendaRangeStartDate:this.options.selectedDate,newAgendaRangeStartDate:newAgendaRangeStartDate};return this._trigger(this.events.agendaRangeChanging,event,args)},_triggerAgendaRangeChanged:function(event){var args={owner:this,element:event.target,dateRangeInterval:this.options.agendaViewSettings.dateRangeInterval,newAgendaRangeStartDate:this.options.selectedDate};this._trigger(this.events.agendaRangeChanged,event,args)},_triggerWeekChanging:function(event,newSelectedDate){var args={owner:this,element:event.target,currentSelectedDate:this.options.selectedDate,newSelectedDate:newSelectedDate};return this._trigger(this.events.weekChanging,event,args)},_triggerWeekChanged:function(event){var args={owner:this,element:event.target,newSelectedDate:this.options.selectedDate};this._trigger(this.events.weekChanged,event,args)},_triggerDayChanging:function(event,newSelectedDate){var args={owner:this,element:event.target,currentSelectedDate:this.options.selectedDate,newSelectedDate:newSelectedDate};return this._trigger(this.events.dayChanging,event,args)},_triggerDayChanged:function(event){var args={owner:this,element:event.target,newSelectedDate:this.options.selectedDate};this._trigger(this.events.dayChanged,event,args)},_triggerAppointmentDialogOpening:function(isAppointmentNew,event){var args={owner:this,element:this._options.$appointmentDialog,isAppointmentNew:isAppointmentNew};return this._trigger(this.events.appointmentDialogOpening,event,args)},_triggerAppointmentDialogOpened:function(isAppointmentNew,event){var args={owner:this,element:this._options.$appointmentDialog,isAppointmentNew:isAppointmentNew};this._trigger(this.events.appointmentDialogOpened,event,args)},_triggerAppointmentDialogClosing:function(isAppointmentNew,event){var args={owner:this,element:this._options.$appointmentDialog,isAppointmentNew:isAppointmentNew};return this._trigger(this.events.appointmentDialogClosing,event,args)},_triggerAppointmentDialogClosed:function(isAppointmentNew,event){var args={owner:this,element:this._options.$appointmentDialog,isAppointmentNew:isAppointmentNew};this._trigger(this.events.appointmentDialogClosed,event,args)},_triggerAppointmentCreating:function(appointment,event){var args={owner:this,appointment:appointment};return this._trigger(this.events.appointmentCreating,event,args)},_triggerAppointmentCreated:function(appointment,event){var args={owner:this,appointment:appointment};this._trigger(this.events.appointmentCreated,event,args)},_triggerAppointmentEditing:function(appointment,newAppointment,event){var args={owner:this,appointment:appointment,newAppointment:newAppointment};return this._trigger(this.events.appointmentEditing,event,args)},_triggerAppointmentEdited:function(appointment,event){var args={owner:this,appointment:appointment};this._trigger(this.events.appointmentEdited,event,args)},_triggerAppointmentDeleting:function(appointment,event){var args={owner:this,appointment:appointment};return this._trigger(this.events.appointmentDeleting,event,args)},_triggerAppointmentDeleted:function(appointmentId,event){var args={owner:this,appointmentId:appointmentId};this._trigger(this.events.appointmentDeleted,event,args)},_setOption:function(key,value){this._super(key,value);switch(key){case"viewMode":this._viewMode(value);break;case"selectedDate":this._selectDate(value);break;case"agendaViewSettings":this._setAgendaViewSettings(value);break;case"monthViewSettings":this._setMonthViewSettings(value);break;case"weekViewSettings":this._setDayWeekViewSettings(value);break;case"dayViewSettings":this._setDayWeekViewSettings(value);break;case"width":this.element.css("width",value);break;case"height":this.element.css("height",value);break;case"appointmentDialogSuppress":this.options.appointmentDialogSuppress=value;break;case"dataSource":this._initDataSource(value);this._options.$scheduler.igSchedulerCore("option",key,this.options.dataSource);break;default:this._options.$scheduler.igSchedulerCore("option",key,value)}},changeLocale:function(){this._super(this.todayButton());this._super(this._options.$navigator);this._super(this._options.$tabs);if(this._options.$appointmentDialog!==undefined){if(this._options.currentAppointment===undefined){this._options.$appointmentDialog.dialog("option","title",this._getLocaleValue("createNewAppointmentDialogTitle"))}else{this._options.$appointmentDialog.dialog("option","title",this._getLocaleValue("editAppointmentDialogTitle"))}this._super(this._options.$appointmentDialog);this._options.$appointmentDialog.dialog("option","closeText",this._getLocaleValue("dialogCloseButtonText"));this._options.$appointmentDialogSubject.igTextEditor("option","placeHolder",this._getLocaleValue("appointmentDialogSubjectLabel"));this._options.$appointmentDialogLocation.igTextEditor("option","placeHolder",this._getLocaleValue("appointmentDialogLocationLabel"));this._options.$appointmentDialogCreateButton.igButton("option","labelText",this._getLocaleValue("appointmentDialogCreateButtonLabel"));this._options.$appointmentDialogSaveButton.igButton("option","labelText",this._getLocaleValue("appointmentDialogSaveButtonLabel"));this._options.$appointmentDialogCancelButton.igButton("option","labelText",this._getLocaleValue("appointmentDialogCancelButtonLabel"));this._options.$appointmentDialogFromDate.igDatePicker("option","language",this.options.language);this._options.$appointmentDialogFromTime.igDateEditor("option","language",this.options.language);this._options.$appointmentDialogToDate.igDatePicker("option","language",this.options.language);this._options.$appointmentDialogToTime.igDateEditor("option","language",this.options.language);this._options.$appointmentDialogResourceCombo.igCombo("option","language",this.options.language);this._options.$appointmentDialogRecurrenceFrequencyCombo.igCombo("option","language",this.options.language);this._options.$appointmentDialogRecurrenceFrequencyCombo.igCombo("option","dataSource",this._getRecurrenceFrequency());this._options.$appointmentDialogRecurrenceCountNumericEditor.igNumericEditor("option","language",this.options.language)}if(this._options.$dayPopoverContainer!==undefined){this._destroyDayPopover();this._renderDayPopover()}if(this._options.$appointmentPopoverContainer!==undefined){this._destroyAppointmentPopover();this._renderAppointmentPopover()}if(this._options.$deleteAppointmentDialog!==undefined){this._super(this._options.$deleteAppointmentDialog);this._options.$deleteAppointmentDialogCancelButton.igButton("option","labelText",this._getLocaleValue("deleteAppointmentDialogCancelButtonLabel"));this._options.$deleteAppointmentDialogDeleteButton.igButton("option","labelText",this._getLocaleValue("deleteAppointmentDialogDeleteButtonLabel"));this._options.$deleteAppointmentDialog.dialog({title:this._getLocaleValue("deleteAppointmentDialogTitle"),closeText:this._getLocaleValue("dialogCloseButtonText")})}},_setAgendaViewSettings:function(settings){var date=this.options.selectedDate,newValue,name;for(name in settings){newValue=settings[name];switch(name){case"dateRangeInterval":this._options.$scheduler.igSchedulerCore("option","agendaViewMinimumDate",date);this._options.$scheduler.igSchedulerCore("option","agendaViewMaximumDate",new $.ig.Date.prototype.addDays(date,newValue));break}}},_setMonthViewSettings:function(settings){var newValue,name;for(name in settings){newValue=settings[name];switch(name){case"isHorizontalSeparatorVisibile":this._options.$scheduler.igSchedulerCore("option","monthViewHorizontalSeparatorVisibility",newValue?"visible":"collapsed");break;case"isVerticalSeparatorVisibile":this._options.$scheduler.igSchedulerCore("option","monthViewVerticalSeparatorVisibility",newValue?"visible":"collapsed");break;case"isWeekdayVisible":this._options.$scheduler.igSchedulerCore("option","monthViewDayOfWeekHeaderVisibility",newValue?"visible":"collapsed");break;case"isWeekNumberVisible":this._options.$scheduler.igSchedulerCore("option","monthViewWeekNumberVisibility",newValue?"visible":"collapsed");break;case"isPreviousMonthShown":this._options.$scheduler.igSchedulerCore("option","monthViewLeadingDayVisibility",newValue?"visible":"collapsed");break;case"isNextMonthShown":this._options.$scheduler.igSchedulerCore("option","monthViewTrailingDayVisibility",newValue?"visible":"collapsed");break}}},_setDayWeekViewSettings:function(settings){var newValue,name;for(name in settings){newValue=settings[name];switch(name){case"dayViewNumberOfDays":this._options.$scheduler.igSchedulerCore("option","dayViewNumberOfDays",newValue);break;case"weekViewDisplayMode":this._options.$scheduler.igSchedulerCore("option","weekViewDisplayMode",newValue);break;case"timeSlotInterval":this._options.$scheduler.igSchedulerCore("option","timeSlotInterval",newValue);break;case"workingHoursDisplayMode":this._options.$scheduler.igSchedulerCore("option","workingHoursDisplayMode",newValue)}}},_saveInitialState:function(){var index,element=this.element[0],attr;if(this.element.children().length>0){this._initialDOMContent=this.element.children().clone(true);this._removeAttributes();this.element.off();this.element.empty()}this._initialAttributes=[];attr=element.attributes;for(index=0;index