Răsfoiți Sursa

Merge branch 'dev' of rav.triplestart.com:jmudaka/stagfe2 into dev

= 3 ani în urmă
părinte
comite
2bdc0166b8

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

@@ -31,6 +31,7 @@ use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\File;
 use App\Models\Measurement;
+use App\Models\ClientReviewRequest;
 
 use Illuminate\Support\Facades\Http;
 use PDF;
@@ -293,6 +294,11 @@ class PatientController extends Controller
         return view('app.patient.outgoing-sms-log', compact('patient'));
     }
 
+    public function reviewRequests(Request $request, Client $patient){
+        $reviewRequests = ClientReviewRequest::where('client_id', $patient->id)->orderBy('created_at', 'DESC')->paginate(50);
+        return view('app.patient.review-requests.list', compact('patient', 'reviewRequests'));
+    }
+
     public function smsNumbers(Request $request, Client $patient )
     {
         return view('app.patient.sms-numbers', compact('patient'));

+ 23 - 0
app/Models/ClientReviewRequest.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Models;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class ClientReviewRequest extends Model
+{
+    protected $table = 'client_review_request';
+
+    public function pro() {
+        return $this->hasOne(Pro::class, 'id', 'pro_id');
+    }
+
+    public function client() {
+        return $this->hasOne(Client::class, 'id', 'client_id');
+    }
+
+    public function createdBySession() {
+        return $this->hasOne(AppSession::class, 'id', 'created_by_session_id');
+    }
+
+}

+ 23 - 15
resources/views/app/patient/handouts-list.blade.php

@@ -13,25 +13,22 @@
         <span class="mx-2 text-secondary">|</span>
         <div moe>
             <a start show class="">Add</a>
-            <form url="/api/handoutClient/create" style="width: 500px;">
+            <form url="/api/handoutClient/create" id="handoutForm" style="width: 500px;">
                 <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
                 @if(@$note)
                 <input type="hidden" name="noteUid" value="{{ $note->uid }}">
                 @endif
-                <div id="handoutSelectComponent" class="mb-2" v-cloak>
+                <div id="handoutSelectComponent" v-cloak class="mb-2">
                     <input type="hidden" name="handoutUid" :value="selectedHandoutUid" />
-                    <input type="search" class="form-control" placeholder="Search Handout" @keyup="filterHandouts" />
+                    <input type="search" v-model="search" class="form-control" placeholder="Search Handout" @keyup="filterHandouts" />
                     <div class="mt-3" style="max-height: 430px;overflow-y: auto;overflow-x:hidden;">
-                        <div class="row">
+                        <div class="row" style="max-height:300px;">
                             <div v-for="handout in handoutsList" class="col-md-4 mb-2 handout" :class="selectedHandoutUid == handout.uid ? 'selected':''" @click="selectedHandoutUid = handout.uid">
-                                <div class="d-flex flex-column h-100 border rounded p-2 handout-detail">
+                                <a class="d-flex flex-column h-100 border rounded p-2 handout-detail c-pointer pdf-viewer-trigger" native target="_blank" :href="'/api/handout/download/'+handout.uid" title="View">
                                     <i v-if="selectedHandoutUid == handout.uid" class="fas fa-check-circle"></i>
                                     <img :src="'/api/handout/download-thumbnail/'+handout.uid" :alt="handout.display_name" onerror="if (this.src != '/img/pdf.png') this.src = '/img/pdf.png';">
-                                    <h6 class="mt-2 mb-0 text-center">@{{ handout.display_name }}</h6>
-
-                                    <a class="c-pointer preview pdf-viewer-trigger" native target="_blank" :href="'/api/handout/download/'+handout.uid" title="View">Preview PDF</a>
-
-                                </div>
+                                    <h6 class="mt-auto pt-1 mb-0 text-center">@{{ handout.display_name }}</h6>
+                                </a>
                             </div>
                         </div>
                     </div>
@@ -39,7 +36,7 @@
                 </div>
                 <div class="d-flex align-items-center">
                     <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                    <button class="btn btn-sm btn-default mr-2 border" on-handout-close cancel>Cancel</button>
                 </div>
             </form>
         </div>
@@ -103,14 +100,14 @@
             handoutsList: [],
             selectedHandoutUid: null,
             search: null,
-            preview: null,
+            preview: null
         },
         methods: {
             togglePreview: function(handoutUid) {
                 this.preview = handoutUid;
                 if (!handoutUid) {
-                    
-                }                
+
+                }
             },
             filterHandouts: function(evt) {
                 var self = this;
@@ -136,12 +133,23 @@
                 self.handoutsList = data;
 
             },
+            onClose: function() {
+              var self = this;
+              $('[on-handout-close]').click(function(){
+                self.selectedHandoutUid = null;
+                self.search = null;
+                self.handoutsList = self.handouts;
+                $('[stag-popup-key="pdf-viewer"]').removeClass('show');
+              });
+            },
             init: function() {
                 this.handoutsList = this.handouts;
+                this.onClose();
             }
         },
         mounted: function() {
             this.init();
+
         }
     });
-</script>
+</script>

+ 68 - 0
resources/views/app/patient/review-requests/list.blade.php

@@ -0,0 +1,68 @@
+@extends ('layouts.patient')
+@section('inner-content')
+<div class="">
+    <div class="d-flex align-items-center pb-2">
+        <h4 class="font-weight-bold mb-0 mr-3">Review Requests</h4>
+        @include('app.patient.review-requests.partials.create')
+    </div>
+    <table class="table table-striped table-sm table-bordered">
+        <thead class="bg-light">
+            <tr>
+                <th class="border-0 text-secondary text-nowrap">Created At</th>
+                <th class="border-0 text-secondary">Scoped Month Start Date</th>
+                <th class="border-0 text-secondary">Access Start Date</th>
+                <th class="border-0 text-secondary">Access End Date</th>
+                <th class="border-0 text-secondary">Pro</th>
+                <th class="border-0 text-secondary">Created By</th>
+                <th  class="border-0 text-secondary">Is Active</th>
+                <th  class="border-0 text-secondary">Status</th>
+                <th  class="border-0 text-secondary"></th>
+            </tr>
+        </thead>
+        <tbody>
+            @foreach($reviewRequests as $rr)
+            <tr>
+                <td class="text-nowrap">{{ friendly_date_time($rr->created_at) }}</td>
+                <td>{{ friendly_date($rr->scoped_month_start_date) }}</td>
+                <td>{{ friendly_date($rr->access_start_date) }}</td>
+                <td>{{ friendly_date($rr->access_end_date) }}</td>
+                <td>{{ $rr->pro->displayName() }}</td>
+                <td>{{ $rr->createdBySession->pro->displayName() }}</td>
+                <td>
+                    @if($rr->is_active)
+                        <span class="text-success mr-2">YES 
+                            @if($rr->reactivation_memo)
+                                <i class="fas fa-info-circle text-muted" title="{{ $rr->reactivation_memo }}"></i>
+                            @endif
+                        </span>
+                        @include('app.patient.review-requests.partials.deactivate')
+                    @else
+                        <span class="text-secondary mr-2">NO
+                        @if($rr->deactivation_memo)
+                                <i class="fas fa-info-circle text-muted" title="{{ $rr->deactivation_memo }}"></i>
+                            @endif
+                        </span>
+                        @include('app.patient.review-requests.partials.activate')
+                    @endif
+                </td>
+                <td>
+                    <span class="mr-2">{{ $rr->status ?? '--' }} 
+                        @if($rr->status_memo )
+                            <i class="fas fa-info-circle text-muted" title="{{ $rr->status_memo }}"></i>
+                        @endif
+                    </span>
+                    @include('app.patient.review-requests.partials.update-status')
+                </td>
+                <td>
+                @include('app.patient.review-requests.partials.edit')
+                </td>
+            </tr>
+            @endforeach
+        </tbody>
+    </table>
+    <div class="p-3">
+        {{$reviewRequests->withQueryString()->links()}}
+    </div>
+</div>
+
+@endsection

+ 16 - 0
resources/views/app/patient/review-requests/partials/activate.blade.php

@@ -0,0 +1,16 @@
+<div moe relative>
+    <a start show class="text-success">Activate</a>
+    <form url="/api/clientReviewRequest/reactivate" class="mcp-theme-1" right>
+        <input type="hidden" name="uid" value="{{ $rr->uid }}">
+
+        <div class="mb-2">
+            <label class="mb-1">Are you sure?</label>
+            <textarea name="memo" class="form-control"></textarea>
+        </div>
+
+        <div>
+            <button submit class="btn btn-sm btn-success mr-1">Activate</button>
+            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+        </div>
+    </form>
+</div>

+ 28 - 0
resources/views/app/patient/review-requests/partials/create.blade.php

@@ -0,0 +1,28 @@
+<div moe wide>
+    <a start show class="btn btn-primary text-white btn-sm mr-2"><i class="fas fa-plus"></i> Review Request</a>
+    <form url="/api/clientReviewRequest/create" class="mcp-theme-1">
+        <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+        
+        <div class="mb-2">
+            <label class="font-weight-bold mb-1">Pro</label>
+            <select provider-search name="proUid" class="form-control input-sm"></select>
+        </div>
+        <div class="mb-2">
+            <label class="font-weight-bold mb-1">Scoped Month Start Date</label>
+            <input type="date" class="form-control" name="scopedMonthStartDate" value="{{ date('Y-m-01') }}" />
+        </div>
+        <div class="mb-2">
+            <label class="font-weight-bold mb-1">Access Start Date</label>
+            <input type="date" class="form-control" name="accessStartDate" value="" />
+        </div>
+        <div class="mb-2">
+            <label class="font-weight-bold mb-1">Access End Date</label>
+            <input type="date" class="form-control" name="accessEndDate" value="" />
+        </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>
+</div>

+ 16 - 0
resources/views/app/patient/review-requests/partials/deactivate.blade.php

@@ -0,0 +1,16 @@
+<div moe relative>
+    <a start show class="text-danger">Deactivate</a>
+    <form url="/api/clientReviewRequest/deactivate" class="mcp-theme-1" right>
+        <input type="hidden" name="uid" value="{{ $rr->uid }}">
+
+        <div class="mb-2">
+            <label class="mb-1">Are you sure?</label>
+            <textarea name="memo" class="form-control"></textarea>
+        </div>
+
+        <div>
+            <button submit class="btn btn-sm btn-danger mr-1">Deactivate</button>
+            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+        </div>
+    </form>
+</div>

+ 31 - 0
resources/views/app/patient/review-requests/partials/edit.blade.php

@@ -0,0 +1,31 @@
+<div moe wide relative>
+	<a start show class="ml-2">Edit</a>
+	<form url="/api/clientReviewRequest/update" class="mcp-theme-1" right>
+		<input type="hidden" name="uid" value="{{ $rr->uid }}">
+        <div class="mb-2">Scoped Month Start Date
+            <label class="font-weight-bold mb-1">Pro</label>
+            <select provider-search name="proUid" class="form-control input-sm">
+                @if($rr->pro)
+                    <option value="{{ $rr->pro->uid }}" selected>{{ $rr->pro->displayName() }}</option>
+                @endif
+            </select>
+        </div>
+        <div class="mb-2">
+            <label class="font-weight-bold mb-1">Scoped Month Start Date</label>
+            <input type="date" class="form-control" name="scopedMonthStartDate" value="{{ $rr->scoped_month_start_date }}" />
+        </div>
+        <div class="mb-2">
+            <label class="font-weight-bold mb-1">Access Start Date</label>
+            <input type="date" class="form-control" name="accessStartDate" value="{{ $rr->access_start_date }}" />
+        </div>
+        <div class="mb-2">
+            <label class="font-weight-bold mb-1">Access End Date</label>
+            <input type="date" class="form-control" name="accessEndDate" value="{{ $rr->access_end_date }}" />
+        </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>
+</div>

+ 20 - 0
resources/views/app/patient/review-requests/partials/update-status.blade.php

@@ -0,0 +1,20 @@
+<div moe relative>
+    <a start show class="text-primary"><i class="fas fa-edit"></i></a>
+    <form url="/api/clientReviewRequest/update-status" class="mcp-theme-1" right>
+        <input type="hidden" name="uid" value="{{ $rr->uid }}">
+
+        <div class="mb-2">
+            <label class="mb-1">Status</label>
+            <input type="text" name="status" class="form-control" value="{{ $rr->status }}" />
+        </div>
+        <div class="mb-2">
+            <label class="mb-1">Memo</label>
+            <textarea name="memo" class="form-control">{{ $rr->status_memo }}</textarea>
+        </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>
+</div>

+ 1 - 1
resources/views/app/practice-management/handouts.blade.php

@@ -31,7 +31,7 @@
                     </div>
                     <div class="mb-2">
                         <label class="mb-1 text-secondary text-sm">PDF</label>
-                        <input type="file" class="form-control form-control-sm"
+                        <input type="file" accept="application/pdf" class="form-control form-control-sm"
                                name="pdfFile">
                     </div>
                     <div class="form-group m-0">

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

@@ -250,6 +250,9 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 					<li class="nav-item">
 						<a class="nav-link {{ strpos($routeName, 'patients.view.accounts') === 0 ? 'active' : '' }}" href="{{ route('patients.view.accounts', $patient) }}">Linked Accounts</a>
 					</li>
+					<li class="nav-item">
+						<a class="nav-link {{ $routeName === 'patients.view.review-requests' ? 'active' : '' }}" href="{{ route('patients.view.review-requests', ['patient' => $patient]) }}">Review Requests</a>
+					</li>
 				</ul>
 				<div class="mt-3 mcp-theme-1">
 					@yield('left-nav-content')

+ 1 - 0
routes/web.php

@@ -499,6 +499,7 @@ Route::middleware('pro.auth')->group(function () {
             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('review-requests', 'PatientController@reviewRequests')->name('review-requests');
             Route::get('sms-numbers', 'PatientController@smsNumbers')->name('sms-numbers');
             Route::get('immunizations', 'PatientController@immunizations')->name('immunizations');
             Route::get('allergies', 'PatientController@allergies')->name('allergies');