Explorar el Código

added appointment confirmation page

Josh hace 4 años
padre
commit
b4081e9182

+ 13 - 0
app/Http/Controllers/GuestController.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Models\Appointment;
 use App\Models\CareMonth;
 use App\Models\CareMonthEntry;
 use App\Models\Client;
@@ -50,4 +51,16 @@ class GuestController extends Controller
         );
     }
 
+    public function appointmentConfirmation(Request $request, $appointmentUid )
+    {
+        $appointment = Appointment::where('uid', $appointmentUid)->first();
+        abort_if(!count($appointment->confirmationRequests), 404, 'No confirmation requests on this appointment.');
+        abort_if(!$appointment, 404, 'Invalid url');
+        abort_if($appointment->status == 'CANCELLED', 404, 'Appointment has been cancelled');
+        abort_if($appointment->status == 'COMPLETED', 404, 'Appointment has been completed'); 
+        abort_if($appointment->status == 'ABANDONED', 404, 'Appointment has been abandoned');
+       
+       return view('app.guest.appointment-confirmation', compact('appointment'));
+    }
+
 }

+ 4 - 0
app/Models/Appointment.php

@@ -17,4 +17,8 @@ class Appointment extends Model
     public function pro() {
         return $this->hasOne(Pro::class, 'id', 'pro_id');
     }
+
+    public function confirmationRequests() {
+        return $this->hasMany(AppointmentConfirmationRequest::class, 'appointment_id', 'id');
+    }
 }

+ 13 - 0
app/Models/AppointmentConfirmationRequest.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Relations\HasOne;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class AppointmentConfirmationRequest extends Model
+{
+    protected $table = 'appointment_confirmation_request';
+
+}

+ 4 - 0
resources/views/app/guest/appointment-confirmation.blade.php

@@ -0,0 +1,4 @@
+@extends ('layouts.guest_template')
+@section('content')
+<h1>Appointment Confirmation</h1>
+@endsection

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

@@ -21,6 +21,7 @@
                 <tr>
                     <th class="px-3 border-0">#</th>
                     <th class="border-0">Name</th>
+                    <th class="border-0">Created At</th>
                     <th class="border-0">DOB</th>
                     <th class="border-0">Sex</th>
                     <th class="border-0">MCN</th>
@@ -43,6 +44,7 @@
                             <span title="MCP Onboarding Visit Pending"><i class="fa fa-exclamation-triangle"></i></span>
                             @endif
                         </td>
+                        <td>{{friendly_date_time($patient->created_at)}}</td>
                         <td>{{ friendly_date_time($patient->dob, false) }}</td>
                         <td>{{ $patient->sex === 'M' ? 'Male' : ($patient->sex === 'F' ? 'Female' : '-') }}</td>
                         <td>

+ 1 - 0
routes/web.php

@@ -41,6 +41,7 @@ Route::post('/set_security_questions', 'HomeController@postSetSecurityQuestions'
 
 Route::get("/guest/section/{accessToken}", 'GuestController@section')->name('guest_section_access');
 Route::get("/guest/handout/{handoutClientUid}", 'GuestController@handout')->name('guest_handout_access');
+Route::get("/appointment-confirmation/{appointmentUid}", 'GuestController@appointmentConfirmation')->name('appointment_confirmation');
 
 Route::middleware('pro.auth')->group(function () {