Sfoglia il codice sorgente

Calendar v2 drag and drop [wip]

Vijayakrishnan 4 anni fa
parent
commit
b3c39b2762

+ 4 - 3
app/Http/Controllers/AppointmentController.php

@@ -32,12 +32,13 @@ class AppointmentController extends Controller
         $events = [];
         foreach ($appointments as $appointment) {
             $events[] = [
-                "title" => '[' . $appointment->pro->initials() . '] ' . $appointment->client->displayName(),
+                "title" => '(' . $appointment->pro->initials() . ') ' . $appointment->client->displayName(),
                 "appointmentUid" => $appointment->uid,
                 "clientUid" => $appointment->client->uid,
                 "proUid" => $appointment->pro->uid,
-                "start" => $this->convertToTimezone($appointment->start_time, $timeZone), // TODO: convert to $timeZone
-                "end" => $this->convertToTimezone($appointment->end_time, $timeZone), // TODO: convert to $timeZone
+                "start" => $this->convertToTimezone($appointment->start_time, $timeZone),
+                "end" => $this->convertToTimezone($appointment->end_time, $timeZone),
+                "editable" => true
             ];
         }
         return json_encode($events);

+ 3 - 10
resources/views/app/patient/appointment-calendar.blade.php

@@ -217,7 +217,7 @@
                         right: 'dayGridMonth,timeGridWeek,timeGridDay'
                     },
                     initialDate: '{{ date('Y-m-d') }}',
-                    editable: false,
+                    editable: true,
                     navLinks: true,
                     dayMaxEvents: false,
                     events: function(info, successCallback, failureCallback) {
@@ -266,15 +266,8 @@
                         $('.appt-form [name="date"]').val(info.dateStr.substr(0, 10));
                         $('.apply-appt-button').prop('disabled', false);
                     },
-                    eventContent: function(arg) {
-
-                    },
-                    eventClassNames: function(arg) {
-                        {{--@if($appointment && $appointment->uid)
-                            if(arg.event.extendedProps.appointmentUid === '{{ $appointment->uid }}') {
-                                return ['stag-current-appt'];
-                            }
-                        @endif--}}
+                    eventDrop: function(info) {
+                        console.log(info)
                     }
                 });
                 calendarObject.render();