|
@@ -315,14 +315,15 @@
|
|
onDateChange: function (_newDate) {
|
|
onDateChange: function (_newDate) {
|
|
let self = this;
|
|
let self = this;
|
|
window.setTimeout(() => {
|
|
window.setTimeout(() => {
|
|
- let dayValue = $('.pro-dashboard-inline-calendar td.day.active').first().text();
|
|
|
|
- if(dayValue.length === 1) dayValue = '0' + dayValue;
|
|
|
|
- self.selectedDate = _newDate.substr(0, 8) + dayValue;
|
|
|
|
|
|
+ // let dayValue = $('.pro-dashboard-inline-calendar td.day.active').first().text();
|
|
|
|
+ // if(dayValue.length === 1) dayValue = '0' + dayValue;
|
|
|
|
+ // self.selectedDate = _newDate.substr(0, 8) + dayValue;
|
|
|
|
+ self.selectedDate = _newDate;
|
|
showMask();
|
|
showMask();
|
|
self.loadEvents(self.selectedDate, function() {
|
|
self.loadEvents(self.selectedDate, function() {
|
|
hideMask();
|
|
hideMask();
|
|
Vue.nextTick(() => {
|
|
Vue.nextTick(() => {
|
|
- self.highlightDatesWithEvents(self.datesWithEvents);
|
|
|
|
|
|
+ // self.highlightDatesWithEvents(self.datesWithEvents);
|
|
initFastLoad($('.appointments-tab'));
|
|
initFastLoad($('.appointments-tab'));
|
|
});
|
|
});
|
|
});
|
|
});
|
|
@@ -394,7 +395,7 @@
|
|
form.hide();
|
|
form.hide();
|
|
},
|
|
},
|
|
loadEventDates: function(_refDate = false) {
|
|
loadEventDates: function(_refDate = false) {
|
|
- let today = new Date(_refDate ? +_refDate : '{{date('Y-m-d')}}'),
|
|
|
|
|
|
+ let today = new Date(_refDate ? _refDate : '{{date('Y-m-d')}}'),
|
|
firstOfMonth = new Date(today.getFullYear(), today.getMonth(), 1),
|
|
firstOfMonth = new Date(today.getFullYear(), today.getMonth(), 1),
|
|
lastOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
|
|
lastOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
|
|
|
|
|
|
@@ -405,7 +406,9 @@
|
|
this.formatDate(firstOfMonth) + '/' +
|
|
this.formatDate(firstOfMonth) + '/' +
|
|
this.formatDate(lastOfMonth), (_data) => {
|
|
this.formatDate(lastOfMonth), (_data) => {
|
|
this.datesWithEvents = _data;
|
|
this.datesWithEvents = _data;
|
|
- this.highlightDatesWithEvents(this.datesWithEvents);
|
|
|
|
|
|
+ console.log(this.datesWithEvents);
|
|
|
|
+ this.calendarElem.datepicker('refresh');
|
|
|
|
+ // this.highlightDatesWithEvents(this.datesWithEvents);
|
|
|
|
|
|
this.currentMonth = firstOfMonth.getMonth();
|
|
this.currentMonth = firstOfMonth.getMonth();
|
|
this.currentYear = firstOfMonth.getFullYear();
|
|
this.currentYear = firstOfMonth.getFullYear();
|
|
@@ -499,20 +502,35 @@
|
|
let self = this;
|
|
let self = this;
|
|
this.calendarElem = $('.pro-dashboard-inline-calendar');
|
|
this.calendarElem = $('.pro-dashboard-inline-calendar');
|
|
this.calendarElem.datepicker({
|
|
this.calendarElem.datepicker({
|
|
- format: 'yyyy-mm-dd'
|
|
|
|
|
|
+ dateFormat: 'yy-mm-dd',
|
|
|
|
+ onSelect: function(_date) {
|
|
|
|
+ self.onDateChange(_date);
|
|
|
|
+ },
|
|
|
|
+ onChangeMonthYear: function(_year, _month) {
|
|
|
|
+ let date = _year + '-' + (_month < 10 ? '0' : '') + _month + '-05';
|
|
|
|
+ self.loadEventDates(date);
|
|
|
|
+ },
|
|
|
|
+ beforeShowDay: function(d) {
|
|
|
|
+ if(self.datesWithEvents && self.datesWithEvents.indexOf(self.formatDate(d)) !== -1) {
|
|
|
|
+ return [true, 'has-events'];
|
|
|
|
+ }
|
|
|
|
+ return [true, 'no-events'];
|
|
|
|
+ }
|
|
});
|
|
});
|
|
- this.calendarElem
|
|
|
|
- .on('changeDate', function () {
|
|
|
|
- self.onDateChange(self.calendarElem.datepicker('getFormattedDate'));
|
|
|
|
- })
|
|
|
|
- .on('changeMonth', function () {
|
|
|
|
- window.setTimeout(function() {
|
|
|
|
- let ts = $('td.day[data-date]').first().closest('tr').find('td.day[data-date]').last().attr('data-date');
|
|
|
|
- if(ts) {
|
|
|
|
- self.loadEventDates(ts);
|
|
|
|
- }
|
|
|
|
- }, 10);
|
|
|
|
- });
|
|
|
|
|
|
+ // this.calendarElem
|
|
|
|
+ // .on('changeDate', function () {
|
|
|
|
+ // self.onDateChange(self.calendarElem.datepicker('getFormattedDate'));
|
|
|
|
+ // })
|
|
|
|
+ // .on('changeMonth', function () {
|
|
|
|
+ // window.setTimeout(function() {
|
|
|
|
+ // let ts = $('td.day[data-date]').first().closest('tr').find('td.day[data-date]').last().attr('data-date');
|
|
|
|
+ // if(ts) {
|
|
|
|
+ // self.loadEventDates(ts);
|
|
|
|
+ // }
|
|
|
|
+ // }, 10);
|
|
|
|
+ // });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
$('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
|
|
$('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
|
|
initMoes();
|
|
initMoes();
|