Просмотр исходного кода

Merge branch 'dev' into dev-vj

Vijayakrishnan 4 лет назад
Родитель
Сommit
e7c6df5ec3
2 измененных файлов с 15 добавлено и 12 удалено
  1. 2 1
      app/Http/Controllers/HomeController.php
  2. 13 11
      resources/views/app/dashboard.blade.php

+ 2 - 1
app/Http/Controllers/HomeController.php

@@ -489,7 +489,8 @@ WHERE measurement.label NOT IN ('SBP', 'DBP')
         $performerProID = $performer->pro->id;
         $isAdmin = ($performer->pro->pro_type === 'ADMIN');
 
-        $appointments = Appointment::where("start_time", '>=', $from)->where("start_time", '<=', $to.' 23:59:00+00');
+        // $appointments = Appointment::where("start_time", '>=', $from)->where("start_time", '<=', $to.' 23:59:00+00');
+        $appointments = Appointment::where("raw_date", '=', $from);
 
         if(!$isAdmin) {
             $appointments = $appointments->where("pro_id", $performerProID);

+ 13 - 11
resources/views/app/dashboard.blade.php

@@ -320,15 +320,19 @@
                     },
                     onDateChange: function (_newDate) {
                         let self = this;
-                        self.selectedDate = _newDate;
-                        showMask();
-                        this.loadEvents(self.selectedDate, function() {
-                            hideMask();
-                            Vue.nextTick(() => {
-                                this.highlightDatesWithEvents(this.datesWithEvents);
-                                initFastLoad($('.appointments-tab'));
+                        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;
+                            showMask();
+                            self.loadEvents(self.selectedDate, function() {
+                                hideMask();
+                                Vue.nextTick(() => {
+                                    self.highlightDatesWithEvents(self.datesWithEvents);
+                                    initFastLoad($('.appointments-tab'));
+                                });
                             });
-                        });
+                        }, 25);
                     },
                     selectToday: function () {
                         $('.pro-dashboard-inline-calendar table td[data-date]').removeClass('active');
@@ -421,9 +425,7 @@
                     },
                     loadEvents: function(_date, _callback) {
                         let self = this;
-                        $.get('/pro-dashboard-events/' +
-                            this.formatDate(_date) + '/' +
-                            this.formatDate(_date), function(_data) {
+                        $.get('/pro-dashboard-events/' + _date + '/' + _date, function(_data) {
                             self.events = _data;
                             self.numEventsForDate = (_data && _data.length) ? 1 : 0;
                             _callback.call(self);