Jelajahi Sumber

Client calendar UI updates

Vijayakrishnan 3 tahun lalu
induk
melakukan
1e891561ad

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

@@ -4,6 +4,11 @@
 
     <?php
 
+    $oPro = false;
+    if(request()->input('opUid')) {
+        $oPro = \App\Models\Pro::where('uid', request()->input('opUid'))->first();
+    }
+
     function adjustBrightness($hex, $steps) {
         $steps = max(-255, min(255, $steps));
         $hex = str_replace('#', '', $hex);
@@ -130,7 +135,7 @@
             <div class="ml-auto d-inline-flex align-items-center">
                 <label class="mr-2 my-0 text-secondary">Show</label>
                 <select id="eventTypes"
-                        class="form-control form-control-sm w-180"
+                        class="form-control form-control-sm"
                         v-model="eventTypes"
                         v-on:change="refreshEvents()">
                     <option value="APPOINTMENTS">Active Appointments</option>
@@ -163,6 +168,9 @@
                 <select id="eventPros" name="proUid"
                         class="form-control form-control-sm flex-grow-1" multiple
                         v-model="proIds">
+                    @if($oPro)
+                        <option value="{{$oPro->id}}">{{$oPro->displayName()}}</option>
+                    @endif
                 </select>
             </form>
             <hr class="my-2">
@@ -685,10 +693,6 @@
             <?php
             $patient->nameStr = $patient->displayName();
             $clientObject = json_encode($patient);
-            $oPro = false;
-            if(request()->input('opUid')) {
-                $oPro = \App\Models\Pro::where('uid', request()->input('opUid'))->first();
-            }
             ?>
 
             function init() {
@@ -696,7 +700,7 @@
                     el: '#calendarApp-{{$patient->id}}',
                     data: {
                         client: {!! json_encode($patient) !!},
-                        eventTypes: '{{ $currentAppointment ? 'BOTH_ALL' : 'BOTH' }}',
+                        eventTypes: '{{ $currentAppointment ? 'BOTH_ALL' : 'APPOINTMENTS' }}',
                         calendar: null,
                         proIds: ['{{ $currentAppointment ? $currentAppointment->pro_id : ($oPro ? $oPro->id : $pro->id) }}'],
                         lastSelectedProUid: '',
@@ -1470,10 +1474,13 @@
                             });
                         }
                         if(localStorage.stagCalendarProIds) {
-                            this.proIds = JSON.parse(localStorage.stagCalendarProIds);
-                            Vue.nextTick(function() {
-                                $('#eventPros').trigger('change');
-                            });
+                            let lsProIds = JSON.parse(localStorage.stagCalendarProIds);
+                            if(lsProIds && lsProIds.length) {
+                                this.proIds = lsProIds;
+                                Vue.nextTick(function () {
+                                    $('#eventPros').trigger('change');
+                                });
+                            }
                         }
                         @endif
 

+ 5 - 1
resources/views/layouts/patient.blade.php

@@ -32,7 +32,11 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 					</li>
 					@endif
 					<li class="nav-item">
-						<a class="nav-link {{ strpos($routeName, 'patients.view.calendar') === 0 ? 'active' : '' }}" href="{{ route('patients.view.calendar', ['patient' => $patient]) }}">Calendar</a>
+						@if($pro->pro_type === 'ADMIN' && $patient->mcp)
+							<a class="nav-link {{ strpos($routeName, 'patients.view.calendar') === 0 ? 'active' : '' }}" href="{{ route('patients.view.calendar', ['patient' => $patient]) }}?opUid={{$patient->mcp->uid}}">Calendar</a>
+						@else
+							<a class="nav-link {{ strpos($routeName, 'patients.view.calendar') === 0 ? 'active' : '' }}" href="{{ route('patients.view.calendar', ['patient' => $patient]) }}">Calendar</a>
+						@endif
 					</li>
 					<li class="nav-item">
 						<a class="nav-link {{ strpos($routeName, 'patients.view.appointments') === 0 ? 'active' : '' }}" href="{{ route('patients.view.appointments', ['patient' => $patient, 'forPro' => 'all', 'status' => 'all']) }}">Appointments</a>