Vijayakrishnan před 4 roky
rodič
revize
eab568c780

+ 5 - 0
.idea/php.xml

@@ -95,6 +95,11 @@
       <path value="$PROJECT_DIR$/vendor/psr/simple-cache" />
       <path value="$PROJECT_DIR$/vendor/filp/whoops" />
       <path value="$PROJECT_DIR$/vendor/psy/psysh" />
+      <path value="$PROJECT_DIR$/vendor/symfony/string" />
+      <path value="$PROJECT_DIR$/vendor/symfony/polyfill-php80" />
+      <path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-grapheme" />
+      <path value="$PROJECT_DIR$/vendor/symfony/deprecation-contracts" />
+      <path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-normalizer" />
     </include_path>
   </component>
   <component name="PhpProjectSharedConfiguration" php_language_level="7.2" />

+ 9 - 1
app/Http/Controllers/ProController.php

@@ -2,6 +2,8 @@
 
 namespace App\Http\Controllers;
 
+use App\Models\Appointment;
+use App\Models\ClientMemo;
 use App\Models\Meeting;
 use App\Models\MeetingParticipant;
 use Illuminate\Http\Request;
@@ -12,7 +14,13 @@ class ProController extends Controller
 {
 
     public function dashboard(Request $request){
-        return view('pro.dashboard', ['sessionKey' => $request->cookie('sessionKey')]);
+        $memos = ClientMemo::where('is_cancelled', false)->orderBy('created_at', 'desc')->get();
+        $appointments = Appointment::orderBy('created_at', 'desc')->get();
+        return view('pro.dashboard', [
+            'sessionKey' => $request->cookie('sessionKey'),
+            'memos' => $memos,
+            'appointments' => $appointments,
+        ]);
     }
 
     public function index(){

+ 19 - 0
app/Models/Appointment.php

@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Appointment extends Model
+{
+
+    protected $table = "appointment";
+
+    public function client(){
+        return $this->belongsTo(Client::class, 'client_id', 'id');
+    }
+
+    public function pro(){
+        return $this->belongsTo(Pro::class, 'pro_id', 'id');
+    }
+}

+ 4 - 0
app/Models/Client.php

@@ -9,6 +9,10 @@ class Client extends Model
 
     protected $table = "client";
 
+    public function displayName() {
+        return $this->name_last . ', '. $this->name_first;
+    }
+
     public function notes()
     {
         return $this->hasMany(Note::class, 'client_id', 'id');

+ 15 - 0
app/Models/ClientMemo.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ClientMemo extends Model
+{
+
+    protected $table = "client_memo";
+
+    public function client(){
+        return $this->belongsTo(Client::class, 'client_id', 'id');
+    }
+}

+ 5 - 1
app/Models/Pro.php

@@ -9,4 +9,8 @@ class Pro extends Model
 
     protected $table = "pro";
 
-}
+    public function displayName() {
+        return $this->name_display;
+    }
+
+}

+ 51 - 1
resources/views/pro/dashboard.blade.php

@@ -2,6 +2,56 @@
 
 @section('content')
 
-    <h2 class="p-3">Coming soon ...</h2>
+    <h2 class="p-3">{{ date('Y-m-d') }}</h2>
+
+    <div class="px-3">
+        <div class="row mx-0">
+            <div class="col-6">
+                <h4>Appointments</h4>
+                <table class="table table-striped">
+                    <thead>
+                        <tr class="bg-white">
+                            <th class="border py-1 px-2">Date/Time</th>
+                            <th class="border py-1 px-2">Patient</th>
+                            <th class="border py-1 px-2">Pro</th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                    @foreach($appointments as $appointment)
+                        <tr>
+                            <td class="border py-1 px-2">{{ friendly_date_time($appointment->start_time) }}</td>
+                            <td class="border py-1 px-2">{{ $appointment->client->displayName() }}</td>
+                            <td class="border py-1 px-2">{{ $appointment->pro->displayName() }}</td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+            </div>
+            <div class="col-6">
+                <h4>Memos</h4>
+                <table class="table table-striped">
+                    <thead>
+                        <tr class="bg-white">
+                            <th class="border py-1 px-2">Date/Time</th>
+                            <th class="border py-1 px-2">Patient</th>
+                            <th class="border py-1 px-2">Category</th>
+                            <th class="border py-1 px-2 w-50">Content</th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                    @foreach($memos as $memo)
+                        <tr>
+                            <td class="border py-1 px-2">{{ friendly_date_time($memo->created_at) }}</td>
+                            <td class="border py-1 px-2 text-nowrap">{{ $memo->client->displayName() }}</td>
+                            <td class="border py-1 px-2">{{ $memo->category }}</td>
+                            <td class="border py-1 px-2">{{ $memo->content }}</td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+
 
 @endsection