Parcourir la source

added isms log for patient

= il y a 3 ans
Parent
commit
9ac566698e

+ 5 - 0
app/Http/Controllers/PatientController.php

@@ -285,6 +285,11 @@ class PatientController extends Controller
         return view('app.patient.sms', compact('patient'));
     }
 
+    public function outgoingSmsLog(Request $request, Client $patient )
+    {
+        return view('app.patient.outgoing-sms-log', compact('patient'));
+    }
+
     public function smsNumbers(Request $request, Client $patient )
     {
         return view('app.patient.sms-numbers', compact('patient'));

+ 6 - 0
app/Models/Client.php

@@ -321,6 +321,12 @@ class Client extends Model
             ->orderBy('created_at', 'desc');
     }
 
+    public function ismses()
+    {
+        return $this->hasMany(Isms::class, 'client_id', 'id')
+            ->orderBy('created_at', 'desc');
+    }
+
     public function documents()
     {
         return $this->hasMany(ClientDocument::class, 'client_id', 'id')

+ 11 - 0
app/Models/Isms.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace App\Models;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class Isms extends Model
+{
+    protected $table = 'isms';
+
+}

+ 29 - 0
resources/views/app/patient/outgoing-sms-log.blade.php

@@ -0,0 +1,29 @@
+@extends ('layouts.patient')
+@section('inner-content')
+    <div class="">
+        <div class="d-flex align-items-center pb-2">
+            <h4 class="font-weight-bold m-0">Outgoing SMS Messages</h4>
+        </div>
+        <table class="table table-striped table-sm table-bordered">
+            <thead class="bg-light">
+            <tr>
+                <th class="border-0 text-secondary text-nowrap">Date &amp; Time</th>
+                <th class="border-0 text-secondary w-25">From</th>
+                <th class="border-0 text-secondary w-25">To</th>
+                <th class="border-0 text-secondary w-50">Content</th>               
+            </tr>
+            </thead>
+            <tbody>
+            @foreach($patient->ismses as $sms)
+                <tr class="{{$sms->created_at > $patient->last_sms_sent_to_client_at && $sms->is_reply_needed == 'YES' ? 'bg-warning': ''}}">
+                    <td class="text-nowrap">{{ friendly_date_time($sms->created_at) }}</td>
+                    <td>{{ $sms->from_number }}</td>
+                    <td>{{ $sms->to_number }}</td>
+                    <td>{{ $sms->message }}</td>
+                </tr>
+            @endforeach
+            </tbody>
+        </table>
+    </div>
+    
+@endsection

+ 1 - 0
resources/views/app/patient/sms.blade.php

@@ -93,4 +93,5 @@
             </tbody>
         </table>
     </div>
+    
 @endsection

+ 4 - 0
resources/views/layouts/patient.blade.php

@@ -227,6 +227,10 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 							<a class="nav-link {{ strpos($routeName, 'patients.view.sms-numbers') === 0 ? 'active' : '' }}"
 							   href="{{ route('patients.view.sms-numbers', ['patient' => $patient]) }}">SMS Numbers</a>
 						</li>
+						<li class="nav-item">
+							<a class="nav-link {{ $routeName === 'patients.view.outgoing-sms-log' ? 'active' : '' }}"
+							   href="{{ route('patients.view.outgoing-sms-log', ['patient' => $patient]) }}">Outgoing SMS Log</a>
+						</li>
 						<li class="nav-item">
 							<a class="nav-link {{ strpos($routeName, 'patients.view.documents') === 0 ? 'active' : '' }}"
 							   href="{{ route('patients.view.documents', ['patient' => $patient]) }}">Documents</a>

+ 1 - 0
routes/web.php

@@ -437,6 +437,7 @@ Route::middleware('pro.auth')->group(function () {
             Route::get('history', 'PatientController@history')->name('history');
             Route::get('memos', 'PatientController@memos')->name('memos');
             Route::get('sms', 'PatientController@sms')->name('sms');
+            Route::get('outgoing-sms-log', 'PatientController@outgoingSmsLog')->name('outgoing-sms-log');
             Route::get('sms-numbers', 'PatientController@smsNumbers')->name('sms-numbers');
             Route::get('immunizations', 'PatientController@immunizations')->name('immunizations');
             Route::get('allergies', 'PatientController@allergies')->name('allergies');