Quellcode durchsuchen

Merge branch 'dev' of rav.triplestart.com:jmudaka/stagfe2 into dev

Josh vor 4 Jahren
Ursprung
Commit
ed7294f8e4

+ 23 - 1
public/js/yemi.js

@@ -308,7 +308,8 @@ var initMoes = function() {
                             hideMoeFormMask();
                             $(realForm).toggle(100);
                         }else{
-                            if($(realForm).is('form')) $(realForm)[0].reset();
+                            // keep data in moes, don't force reset
+                            // if($(realForm).is('form')) $(realForm)[0].reset();
                             showMoeFormMask();
                             setTimeout(function() {
                                 $('[moe]>form:not([show]):visible').hide();
@@ -388,6 +389,11 @@ var initMoes = function() {
                     return;
                 }
 
+                // check and trigger onbeforesubmit
+                if($(form).is('[onbeforesubmit]')) {
+                    window[$(form).attr('onbeforesubmit')].call($(realForm)[0]);
+                }
+
                 // submit
                 moe.isProcessing = true;
                 var data = {};
@@ -954,3 +960,19 @@ $(function () {
         });
     });
 });
+
+// catch ESC and discard any visible moes
+$(document).ready(function () {
+    $(document)
+        .off('keydown.moe-escape')
+        .on('keydown.moe-escape', function (e) {
+            if(e.which === 27) {
+                let visibleMoes = $('[moe] [url]:not([show]):visible');
+                if (visibleMoes.length) {
+                    hideMoeFormMask();
+                    visibleMoes.hide();
+                    return false;
+                }
+            }
+        });
+});

+ 27 - 22
resources/views/app/patient/appointment-calendar.blade.php

@@ -567,34 +567,15 @@
                                                 }
                                             }
                                             successCallback(displayEvents);
-                                            $('.fc .availability').each(function () {
-                                                $(this).parent('.fc-timegrid-event-harness').css('pointer-events', 'none');
-                                            });
-
-                                            @if($currentAppointment)
-                                            if(!self.editHonored) {
-                                                window.setTimeout(function() {
-                                                    let allEvents = self.calendar.getEvents();
-                                                    if(allEvents) {
-                                                        let currentEvent = allEvents.filter(function(_ev) {
-                                                            return _ev.extendedProps.appointmentUid === '{{ $currentAppointment->uid }}';
-                                                        });
-                                                        if(currentEvent) currentEvent = currentEvent[0];
-                                                        if(currentEvent) {
-                                                            self.selectedEvent = currentEvent;
-                                                            self.showEditAppointmentModal();
-                                                            self.editHonored = true;
-                                                        }
-                                                    }
-                                                }, 250);
-                                            }
-                                            @endif
                                         }
                                         else {
                                             failureCallback('Unable to refresh appointments!');
                                         }
                                     }, 'json');
                                 },
+                                eventDidMount: function(view) {
+                                    self.afterRenderingEvents();
+                                },
                                 eventClassNames: function(arg) {
                                     let classes = [];
                                     if (arg.event.extendedProps.clientOnly) {
@@ -652,6 +633,30 @@
                             });
                             this.calendar.render();
                         },
+                        afterRenderingEvents: function() {
+                            let self = this;
+                            $('.fc .availability').each(function () {
+                                $(this).parent('.fc-timegrid-event-harness').css('pointer-events', 'none');
+                            });
+                            @if($currentAppointment)
+                            if(!self.editHonored) {
+                                window.setTimeout(function() {
+                                    let allEvents = self.calendar.getEvents();
+                                    if(allEvents) {
+                                        let currentEvent = allEvents.filter(function(_ev) {
+                                            return _ev.extendedProps.appointmentUid === '{{ $currentAppointment->uid }}';
+                                        });
+                                        if(currentEvent) currentEvent = currentEvent[0];
+                                        if(currentEvent) {
+                                            self.selectedEvent = currentEvent;
+                                            self.showEditAppointmentModal();
+                                            self.editHonored = true;
+                                        }
+                                    }
+                                }, 250);
+                            }
+                            @endif
+                        },
                         dateStr: function(_dateTime) {
                             return _dateTime.getFullYear() + "-" +
                                 ("0"+(_dateTime.getMonth()+1)).slice(-2) + "-" +

+ 6 - 3
resources/views/app/patient/settings.blade.php

@@ -6,7 +6,7 @@
         <span class="text-secondary mx-2">|</span>
         <div moe wide>
             <a start show><i class="fa fa-edit"></i> Edit Address</a>
-            <form url="/api/client/editAddress" class="mcp-theme-1">
+            <form url="/api/client/editAddress" class="mcp-theme-1" onbeforesubmit="setSettingsMailingAddress">
                 <input type="hidden" name="uid" value="{{$patient->uid}}">
 
                 <p class="mb-2 font-weight-bold">Home Address</p>
@@ -35,8 +35,8 @@
                                     $patient->home_address_state == $patient->mailing_address_state &&
                                     $patient->home_address_zip == $patient->mailing_address_zip);
                     @endphp
-                    <input type="checkbox" onchange="copyHomeToMailingAndReadOnly(this.checked)" {{ $isSame ? 'checked' : '' }}>
-                    <span class="ml-2">Same as home addess</span>
+                    <input type="checkbox" id="settingsSameAsHome" onchange="copyHomeToMailingAndReadOnly(this.checked)" {{ $isSame ? 'checked' : '' }}>
+                    <span class="ml-2">Same as home address</span>
                 </label>
                 <div class="mb-2">
                     <input type="text" class="form-control form-control-sm" name="mailingAddressLine1" placeholder="Address Line 1" value="{{ $patient->mailing_address_line1 }}">
@@ -211,6 +211,9 @@
     </span>
 
     <script>
+        window.setSettingsMailingAddress = function() {
+            copyHomeToMailingAndReadOnly($('#settingsSameAsHome').is(':checked'));
+        }
         window.copyHomeToMailingAndReadOnly = function(_same) {
             if(_same) {
                 $('[name="mailingAddressLine1"]').val($('[name="homeAddressLine1"]').val()).prop('readonly', true);

+ 6 - 2
resources/views/app/patients.blade.php

@@ -71,7 +71,9 @@
                         <td>
                             <table class="table table-sm border-0 my-0">
                                 <tbody>
+                                <?php $numAppts = 0; ?>
                                 @foreach($patient->upcomingAppointments as $appointment)
+                                    @if($appointment->status !== 'CANCELLED' && $appointment->status !== 'ABANDONED')
                                     <tr>
                                         <td class="text-black p-0 border-0">
                                             <div class="pb-0">
@@ -83,11 +85,13 @@
                                             </div>
                                         </td>
                                     </tr>
+                                    <?php $numAppts++; ?>
+                                    @endif
                                 @endforeach
-                                @if(!$patient->upcomingAppointments || count($patient->upcomingAppointments) === 0)
+                                @if(!$numAppts)
                                     <tr>
                                         <td class="text-secondary p-0 border-0">
-                                            No appointments
+                                            No upcoming appointments
                                         </td>
                                     </tr>
                                 @endif

+ 12 - 0
resources/views/layouts/template.blade.php

@@ -290,6 +290,18 @@
                         closeStagPopup();
                     }
                 });
+                // catch ESC and discard any visible popups
+                $(document)
+                    .off('keydown.stag-popup-escape')
+                    .on('keydown.stag-popup-escape', function (e) {
+                        if(e.which === 27) {
+                            let visiblePopups = $('.stag-popup.show');
+                            if (visiblePopups.length) {
+                                closeStagPopup();
+                                return false;
+                            }
+                        }
+                    });
             }
             addMCInitializer('stag-popups', window.initStagPopupEvents);
         })();

+ 2 - 2
routes/api.php

@@ -14,6 +14,6 @@ use Illuminate\Support\Facades\Route;
 |
 */
 
-Route::middleware('auth:api')->get('/user', function (Request $request) {
+/*Route::middleware('auth:api')->get('/user', function (Request $request) {
     return $request->user();
-});
+});*/