Selaa lähdekoodia

Client single - appointments manage

Vijayakrishnan Krishnan 4 vuotta sitten
vanhempi
commit
93b88cf9ca
2 muutettua tiedostoa jossa 110 lisäystä ja 1 poistoa
  1. 5 0
      app/Models/Client.php
  2. 105 1
      resources/views/app/patient/dashboard.blade.php

+ 5 - 0
app/Models/Client.php

@@ -78,4 +78,9 @@ class Client extends Model
         return false;
     }
 
+    public function appointments() {
+        return $this->hasMany(Appointment::class, 'client_id', 'id')
+            ->orderBy('start_time', 'desc');
+    }
+
 }

+ 105 - 1
resources/views/app/patient/dashboard.blade.php

@@ -53,7 +53,111 @@
         <div class="row">
             <div class="col-6">
 
-            {{-- vitals --}}
+                {{-- appointments --}}
+                <div class="mt-2 pb-1">
+                    <div class="d-flex align-items-center mb-2 py-2 border-top border-bottom">
+                        <h6 class="my-0 font-weight-bold text-secondary">Appointments</h6>
+                        <span class="mx-2 text-secondary">|</span>
+                        <span moe>
+                            <a start show>Add</a>
+                            <form url="/api/appointment/create" class="mcp-theme-1">
+                                <input type="hidden" name="clientUid" value="{{$patient->uid}}">
+                                <input type="hidden" name="title" value="MCP Appointment">
+                                <div class="mb-2">
+                                    <label class="text-secondary text-sm">Pro</label>
+                                    <select name="proUid" class="form-control form-control-sm">
+                                        <option value=""> --select-- </option>
+                                        @foreach($pros as $iPro)
+                                            <option value="{{$iPro->uid}}" {{ $iPro->uid === $pro->uid ? 'selected' : '' }}>{{$iPro->displayName()}}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                <div class="mb-2">
+                                    <label class="text-secondary text-sm">Date</label>
+                                    <input type="date" name="date" min="{{ date('Y-m-d') }}" value="{{ date('Y-m-d') }}"
+                                           class="form-control form-control-sm">
+                                </div>
+                                <div class="mb-2">
+                                    <label class="text-secondary text-sm">Start Time</label>
+                                    <input type="time" name="startTime" class="form-control form-control-sm">
+                                </div>
+                                <div class="mb-2">
+                                    <label class="text-secondary text-sm">End Time</label>
+                                    <input type="time" name="endTime" class="form-control form-control-sm">
+                                </div>
+                                <div>
+                                    <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                </div>
+                            </form>
+                        </span>
+                    </div>
+                    <table class="table table-sm border-0 m-0">
+                        <tbody>
+                        @foreach($patient->appointments as $appointment)
+                            <tr>
+                                <td class="text-black p-0 border-0">
+                                    <div class="pb-0">
+                                        <span relative moe>
+                                            <a class="on-hover-opaque" start show title="Update">
+                                                <i class="font-size-11 fa fa-edit text-primary"></i>
+                                            </a>
+                                            <form url="/api/appointment/update">
+                                                <input type="hidden" name="uid" value="{{ $appointment->uid }}">
+                                                <input type="hidden" name="title" value="MCP Appointment">
+                                                <div class="mb-2">
+                                                    <label class="text-secondary text-sm">Pro</label>
+                                                    <select name="proUid" class="form-control form-control-sm">
+                                                        <option value=""> --select-- </option>
+                                                        @foreach($pros as $iPro)
+                                                            <option <?= $appointment->pro->uid === $iPro->uid ? 'selected' : '' ?>
+                                                                    value="{{$iPro->uid}}">{{$iPro->displayName()}}</option>
+                                                        @endforeach
+                                                    </select>
+                                                </div>
+                                                <div class="mb-2">
+                                                    <label class="text-secondary text-sm">Date</label>
+                                                    <input autofocus type="date" name="date" min="{{ date('Y-m-d') }}"
+                                                           value="{{ date("Y-m-d", strtotime($appointment->start_time)) }}" class="form-control form-control-sm">
+                                                </div>
+                                                <div class="mb-2">
+                                                    <label class="text-secondary text-sm">Start Time</label>
+                                                    <input type="time" name="startTime" class="form-control form-control-sm"
+                                                           value="{{ date("H:i:s", strtotime($appointment->start_time)) }}">
+                                                </div>
+                                                <div class="mb-2">
+                                                    <label class="text-secondary text-sm">End Time</label>
+                                                    <input type="time" name="endTime" class="form-control form-control-sm"
+                                                           value="{{ date("H:i:s", strtotime($appointment->end_time)) }}">
+                                                </div>
+                                                <div>
+                                                    <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+                                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                                </div>
+                                            </form>
+                                        </span>
+                                        {{ friendly_date_time($appointment->start_time, false) }}, {{ friendly_time($appointment->start_time) }}
+                                        &nbsp;/&nbsp;
+                                        {{--<span class="d-inline-block ml- 2 text-secondary">{{ $appointment->title }}</span>
+                                        &nbsp;/&nbsp;--}}
+                                        <b class="mr-1">{{$appointment->pro->displayName()}}</b>
+                                        <span class="text-secondary text-sm">({{ $appointment->status }})</span>
+                                    </div>
+                                </td>
+                            </tr>
+                        @endforeach
+                        @if(!$patient->appointments || count($patient->appointments) === 0)
+                            <tr>
+                                <td class="text-secondary p-0 border-0">
+                                    No appointments
+                                </td>
+                            </tr>
+                        @endif
+                        </tbody>
+                    </table>
+                </div>
+
+                {{-- vitals --}}
                 <div class="mt-2 pb-1">
                     <div class="d-flex align-items-center mb-2 py-2 border-top border-bottom">
                         <h6 class="my-0 font-weight-bold text-secondary">Vitals</h6>