diff --git a/UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox b/UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox index d4adaf255..2dc5c79fd 100644 --- a/UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox +++ b/UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox @@ -303,7 +303,7 @@ + ng-disabled="eventForm.$invalid || eventForm.$submitted"> diff --git a/UI/WebServerResources/js/Scheduler/Component.service.js b/UI/WebServerResources/js/Scheduler/Component.service.js index fb1645133..34ca4fe54 100644 --- a/UI/WebServerResources/js/Scheduler/Component.service.js +++ b/UI/WebServerResources/js/Scheduler/Component.service.js @@ -565,11 +565,15 @@ this.repeat.frequency = 'never'; if (angular.isUndefined(this.repeat.interval)) this.repeat.interval = 1; - if (angular.isUndefined(this.repeat.month)) - this.repeat.month = { occurrence: '1', day: 'SU', type: 'bymonthday' }; if (angular.isUndefined(this.repeat.monthdays)) // TODO: initialize this.repeat.monthdays with month day of start date this.repeat.monthdays = []; + else if (this.repeat.monthdays.length > 0) + this.repeat.month = { type: 'bymonthday' }; + if (angular.isUndefined(this.repeat.month)) + this.repeat.month = {}; + if (angular.isUndefined(this.repeat.month.occurrence)) + angular.extend(this.repeat.month, { occurrence: '1', day: 'SU' }); if (angular.isUndefined(this.repeat.months)) // TODO: initialize this.repeat.months with month of start date this.repeat.months = []; @@ -607,7 +611,7 @@ _this.sendAppointmentNotifications = Component.$Preferences.defaults.SOGoAppointmentSendEMailNotifications; }); } - else { + else if (angular.isUndefined(data.$hasAlarm)) { this.$hasAlarm = angular.isDefined(data.alarm); } @@ -639,10 +643,10 @@ Component.prototype.hasCustomRepeat = function() { var b = angular.isDefined(this.repeat) && (this.repeat.interval > 1 || - this.repeat.days && this.repeat.days.length > 0 || - this.repeat.monthdays && this.repeat.monthdays.length > 0 || - this.repeat.months && this.repeat.months.length > 0 || - this.repeat.month && this.repeat.month.day); + angular.isDefined(this.repeat.days) && this.repeat.days.length > 0 || + angular.isDefined(this.repeat.monthdays) && this.repeat.monthdays.length > 0 || + angular.isDefined(this.repeat.months) && this.repeat.months.length > 0 || + angular.isDefined(this.repeat.month) && angular.isDefined(this.repeat.month.type)); return b; }; @@ -1257,7 +1261,7 @@ var component = {}; angular.forEach(this, function(value, key) { if (key != 'constructor' && - key[0] != '$' && + (key == '$hasAlarm' || key[0] != '$') && key != 'blocks') { component[key] = angular.copy(value); } diff --git a/UI/WebServerResources/js/Scheduler/ComponentController.js b/UI/WebServerResources/js/Scheduler/ComponentController.js index 26e780a50..fab1f2268 100644 --- a/UI/WebServerResources/js/Scheduler/ComponentController.js +++ b/UI/WebServerResources/js/Scheduler/ComponentController.js @@ -122,8 +122,8 @@ c.$reply().then(function() { $rootScope.$emit('calendars:list'); - $mdDialog.hide(); Alarm.getAlarms(); + $mdDialog.hide(); }); } @@ -217,6 +217,7 @@ vm.categories = {}; vm.showRecurrenceEditor = vm.component.$hasCustomRepeat; vm.toggleRecurrenceEditor = toggleRecurrenceEditor; + vm.recurrenceMonthDaysAreRequired = recurrenceMonthDaysAreRequired; vm.showAttendeesEditor = false; vm.toggleAttendeesEditor = toggleAttendeesEditor; //vm.searchText = null; @@ -263,6 +264,11 @@ vm.showAttendeesEditor = !vm.showAttendeesEditor; } + function recurrenceMonthDaysAreRequired() { + return vm.component.repeat.frequency == 'monthly' && + vm.component.repeat.month.type == 'bymonthday'; + } + // Autocomplete cards for attendees function cardFilter($query) { AddressBook.$filterAll($query); @@ -308,8 +314,11 @@ Alarm.getAlarms(); $mdDialog.hide(); }, function(response) { - if (response.status == CalendarSettings.ConflictHTTPErrorCode) + if (response.status == CalendarSettings.ConflictHTTPErrorCode && + _.isObject(response.data.message)) vm.attendeeConflictError = response.data.message; + else + edit(form); }); } }