Pārlūkot izejas kodu

Merge branch 'dev-sam' into dev-vj

Vijayakrishnan 3 gadi atpakaļ
vecāks
revīzija
3bc92360dd

+ 41 - 0
app/Http/Controllers/Controller.php

@@ -91,4 +91,45 @@ class Controller extends BaseController
             'message' => $message
         ];
     }
+
+    public function filterMultiQuery(Request $request, $query, $columnName, $keyName, $valueName1, $valueName2) {
+        switch($request->input($keyName)) {
+            case 'EXACTLY':
+                if($request->input($valueName1)) {
+                    $query->where($columnName, $request->input($valueName1));
+                }
+                break;
+            case 'LESS_THAN':
+                if($request->input($valueName1)) {
+                    $query->where($columnName, '<', $request->input($valueName1));
+                }
+                break;
+            case 'GREATER_THAN':
+                if($request->input($valueName1)) {
+                    $query->where($columnName, '>', $request->input($valueName1));
+                }
+                break;
+            case 'BETWEEN':
+                if($request->input($valueName1) && $request->input($valueName2)) {
+                    $query
+                        ->where($columnName, '>=', $request->input($valueName1))
+                        ->where($columnName, '<=', $request->input($valueName2));
+                }
+                break;
+            case 'NOT_BETWEEN':
+                if($request->input($valueName1) && $request->input($valueName2)) {
+                    $query
+                        ->where(function ($q) use ($request, $columnName, $valueName1, $valueName2) {
+                            $q->where($columnName, '<', $request->input($valueName1))
+                                ->orWhere($columnName, '>', $request->input($valueName2));
+                        });
+                }
+                break;
+        }
+    }
+    public function filterSimpleQuery(Request $request, $query, $columnName, $valueName) {
+        if($request->input($valueName)) {
+            $query->where($columnName, $request->input($valueName));
+        }
+    }
 }

+ 16 - 41
app/Http/Controllers/McpController.php

@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\File;
 use App\Models\Bill;
 use App\Models\ClientSMS;
+use App\Models\AccountInvite;
 
 use Illuminate\Support\Facades\Http;
 use PDF;
@@ -96,47 +97,6 @@ class McpController extends Controller
         return view('app.mcp.patients', compact('patients', 'filters'));
     }
 
-    private function filterSimpleQuery(Request $request, $query, $columnName, $valueName) {
-        if($request->input($valueName)) {
-            $query->where($columnName, $request->input($valueName));
-        }
-    }
-    private function filterMultiQuery(Request $request, $query, $columnName, $keyName, $valueName1, $valueName2) {
-        switch($request->input($keyName)) {
-            case 'EXACTLY':
-                if($request->input($valueName1)) {
-                    $query->where($columnName, $request->input($valueName1));
-                }
-                break;
-            case 'LESS_THAN':
-                if($request->input($valueName1)) {
-                    $query->where($columnName, '<', $request->input($valueName1));
-                }
-                break;
-            case 'GREATER_THAN':
-                if($request->input($valueName1)) {
-                    $query->where($columnName, '>', $request->input($valueName1));
-                }
-                break;
-            case 'BETWEEN':
-                if($request->input($valueName1) && $request->input($valueName2)) {
-                    $query
-                        ->where($columnName, '>=', $request->input($valueName1))
-                        ->where($columnName, '<=', $request->input($valueName2));
-                }
-                break;
-            case 'NOT_BETWEEN':
-                if($request->input($valueName1) && $request->input($valueName2)) {
-                    $query
-                        ->where(function ($q) use ($request, $columnName, $valueName1, $valueName2) {
-                            $q->where($columnName, '<', $request->input($valueName1))
-                                ->orWhere($columnName, '>', $request->input($valueName2));
-                        });
-                }
-                break;
-        }
-    }
-
     public function notes(Request $request)
     {
         $filters = $request->all();
@@ -239,6 +199,21 @@ class McpController extends Controller
         return view('app.mcp.client_messages', compact('clientMessages', 'filters'));
     }
 
+    public function patients_accounts_invites(Request $request){
+        $filters = $request->all();
+
+        $accountInvites = AccountInvite::select('account_invite.*')
+                            ->join('client', 'client.id', '=', 'account_invite.for_client_id');
+        $accountInvites = $accountInvites->where('client.mcp_pro_id', $this->performer->pro->id);
+
+        $this->filterMultiQuery($request, $accountInvites, 'account_invite.created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $this->filterSimpleQuery($request, $accountInvites, 'account_invite.status', 'status');
+
+        $accountInvites = $accountInvites->orderBy('created_at', 'DESC')->paginate(20);
+
+        return view('app.mcp.patients-accounts-invites', compact('accountInvites', 'filters'));
+    }
+
     public function new_patients_awaiting_visit(Request $request){
         $data = [
             'records' => Client::where('mcp_pro_id', $this->performer->pro->id)

+ 21 - 0
app/Http/Controllers/PracticeManagementController.php

@@ -32,6 +32,7 @@ use App\Models\Shipment;
 use App\Models\SupplyOrder;
 use App\Models\Team;
 use App\Models\Ticket;
+use App\Models\AccountInvite;
 use App\Models\ClientMeasurementDaysPerMonth;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Http;
@@ -2002,4 +2003,24 @@ ORDER BY c.name_last, c.name_first
         return view('app.practice-management.my-teams', compact('teams'));
     }
 
+    public function patientsAccountsInvites(Request $request){
+        $filters = $request->all();
+
+        $accountInvites = AccountInvite::select('account_invite.*')
+                            ->join('client', 'client.id', '=', 'account_invite.for_client_id');
+        if($this->performer->pro->pro_type !== 'ADMIN'){
+            $accountInvites = $accountInvites->where('client.mcp_pro_id', $this->performer->pro->id);
+        }
+
+        $this->filterMultiQuery($request, $accountInvites, 'account_invite.created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $this->filterSimpleQuery($request, $accountInvites, 'account_invite.status', 'status');
+
+        $accountInvites = $accountInvites->orderBy('created_at', 'DESC')->paginate(20);
+
+        return view('app.practice-management.patients-accounts-invites', compact('accountInvites','filters'));
+    }
+
+
+    
+
 }

+ 4 - 0
app/Models/AccountInvite.php

@@ -14,4 +14,8 @@ class AccountInvite extends Model
     {
         return 'access_token';
     }
+
+    public function client() {
+        return $this->hasOne(Client::class, 'id', 'for_client_id');
+    }
 }

+ 5 - 0
app/Models/ClientMemo.php

@@ -18,4 +18,9 @@ class ClientMemo extends Model
         return $this->hasMany(ClientMemoUpdate::class, 'client_memo_id', 'id')->orderBy('created_at', 'DESC');
     }
 
+    public function stamp(): HasOne
+    {
+        return $this->hasOne(Stamp::class, 'client_memo_id', 'id');
+    }
+
 }

+ 11 - 0
app/Models/Stamp.php

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

+ 109 - 0
resources/views/app/mcp/patients-accounts-invites-filters.blade.php

@@ -0,0 +1,109 @@
+<style>
+	#patients-accounts-invites-filters label {
+		font-weight: bold;
+	}
+
+	#patients-accounts-invites-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container {
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 15px;
+	}
+</style>
+<form id="patients-accounts-invites-filters" method="GET" action="{{ route('practice-management.patientsAccountsInvites') }}" class="filter-container" v-cloak>
+	<!-- DATE	 -->
+	<div>
+		<div class="form-group">
+			<label>Date:</label>
+			<select name="date_category" class="form-control input-sm" v-model="filters.date_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.date_category" class="mt-2">
+				<div>
+					<input name="date_value_1" v-model="filters.date_value_1" type="date" class="form-control input-sm"/>
+				</div>
+				<div v-show="filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="date_value_2" v-model="filters.date_value_2" type="date" class="form-control input-sm"/>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- STATUS -->
+	<div>
+		<div class="form-group">
+			<label>Status:</label>
+			<select name="status" class="form-control input-sm" v-model="filters.status">
+				<option value="">All</option>
+				<option value="ACCEPTED">Accepted</option>
+				<option value="PENDING">Pending</option>
+				<option value="REJECTED">Rejected</option>
+				<option value="CANCELLED">Cancelled</option>
+			</select>
+		</div>
+	</div>
+
+	<div>
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class="d-flex">
+				<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{ route('practice-management.patientsAccountsInvites') }}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+<?php
+$loadedFilters = $filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'status'
+];
+for ($i = 0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+<script>
+	(function() {
+		function init() {
+			window.apapp = new Vue({
+				el: '#patients-accounts-invites-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("practice-management.patientsAccountsInvites") }}?' + $('#patients-accounts-invites-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('patients-accounts-invites-filters', init, '#patients-accounts-invites-filters');
+	})();
+</script>

+ 90 - 0
resources/views/app/mcp/patients-accounts-invites.blade.php

@@ -0,0 +1,90 @@
+@extends ('layouts/template')
+
+@section('content')
+
+<div class="p-3 mcp-theme-1">
+    <div class="card">
+
+        <div class="card-header px-3 py-2 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-user"></i>
+                Accounts Invites ({{ $accountInvites->total() }})
+            </strong>
+        </div>
+        <div class="card-body p-0">
+        <div class="p-3">
+                @include('app.practice-management.patients-accounts-invites-filters')
+            </div>
+            <table class="table table-sm table-condensed p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="px-2 text-secondary border-bottom-0">Created At</th>
+                        <th class="px-2 text-secondary border-bottom-0">Client</th>
+                        <th class="px-2 text-secondary border-bottom-0">Name</th>
+                        <th class="px-2 text-secondary border-bottom-0">Email</th>
+                        <th class="px-2 text-secondary border-bottom-0">Cell Number</th>
+                        <th class="px-2 text-secondary border-bottom-0">Status</th>
+                        <th class="px-2 text-secondary border-bottom-0">&nbsp;</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($accountInvites as $accountInvite)
+                    <tr>
+                        <td class="px-2">
+                            {{ friendlier_date_time($accountInvite->created_at) }}
+                            @if($accountInvite->status === 'CANCELLED')
+                            <span class="text-sm text-secondary">(CANCELLED)</span>
+                            @endif
+                        </td>
+                        <td class="px-2">{{ $accountInvite->client->displayName() }}</td>
+                        <td class="px-2">{{ $accountInvite->first_name }} {{ $accountInvite->last_name }}</pre>
+                        </td>
+                        <td class="px-2">{{ $accountInvite->to_email_address }}</td>
+                        <td class="px-2">{{ $accountInvite->cell_number }}</td>
+                        <td class="px-2">{{ $accountInvite->status }} <span class="text-sm text-secondary">(Updated: {{friendlier_date_time($accountInvite->status_updated_at)}})</span>
+                            @if($accountInvite->status_memo)
+                            <div class="py-1 font-italic text-secondary text-sm">{{$accountInvite->status_memo}}</div>
+                            @endif
+                        </td>
+                        <td class="px-2">
+                            <div class="d-flex">
+                                @if($accountInvite->status === 'PENDING')
+                                <span moe class="ml-1" relative>
+                                    <a class="" href="" show start>Cancel</a>
+                                    <form url="/api/accountInvite/markAsCancelled" right>
+                                        <input type="hidden" name="uid" value="{{$accountInvite->uid}}">
+                                        <p>Cancel this invite?</p>
+                                        <div class="mb-0">
+                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </span>
+                                @endif
+                                @if($accountInvite->status == 'CANCELLED')
+                                <span moe class="ml-1" relative>
+                                    <a class="" href="" show start>Undo Cancel</a>
+                                    <form url="/api/accountInvite/undoMarkAsCancelled" right>
+                                        <input type="hidden" name="uid" value="{{$accountInvite->uid}}">
+                                        <p>Un-cancel this invite?</p>
+                                        <div class="mb-0">
+                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </span>
+                                @endif
+                            </div>
+                        </td>
+                    </tr>
+                    @endforeach
+                </tbody>
+            </table>
+            <div class="ml-2 mt-2">
+                {{ $accountInvites->appends(request()->input())->links() }}
+            </div>
+        </div>
+    </div>
+</div>
+
+@endsection

+ 1 - 1
resources/views/app/patient/accounts.blade.php

@@ -161,7 +161,7 @@
                         </td>
                         <td class="px-2">
                             <div class="d-flex">
-                                @if($accountInvite->status !== 'PENDING')
+                                @if($accountInvite->status === 'PENDING')
                                     <span moe class="ml-1" relative>
                                         <a class="" href="" show start>Cancel</a>
                                         <form url="/api/accountInvite/markAsCancelled" right>

+ 40 - 24
resources/views/app/patient/dashboard.blade.php

@@ -536,13 +536,14 @@
                         <table class="table table-striped table-sm table-bordered mb-0">
                             @if($patient->memos && count($patient->memos))
                                 <thead>
-                                <tr>
+                                <tr class="text-nowrap">
                                     <th class="px-2 text-secondary">Category</th>
-                                    <th class="px-2 text-secondary w-75">Summary</th>
+                                    <th class="px-2 text-secondary w-50">Summary</th>
                                     <th class="px-2 text-secondary">Created</th>
                                     @if($performer->pro->pro_type === 'ADMIN')
                                     <th class="px-2 text-secondary">Admins Only</th>
                                     @endif
+                                    <th class="px-2 text-secondary">Ack. by MCP</th>
                                     <th class="px-2 text-secondary delete-column">&nbsp;</th>
                                 </tr>
                                 </thead>
@@ -554,27 +555,29 @@
                                         <td class="px-2">
                                             <pre class="m-0 break-spaces">{{ $memo->content }}</pre>
                                             @if($performer->pro->pro_type == 'ADMIN')
-                                            <div moe>
-                                                <a start show>Show Changelog</a>
-                                                <div action="" url>
-                                                    <table class="table table-condensed table-striped table-sm">
-                                                        <thead>
-                                                        <th>Category</th>
-                                                        <th>Summary</th>
-                                                        <th>Created</th>
-                                                        
-                                                        </thead>
-                                                        <tbody>
-                                                        @foreach($memo->updates as $update)
-                                                            <tr>
-                                                                <td>{{$update->category}}</td>
-                                                                <td>{{$update->content}}</td>
-                                                                <td><strong>{{$update->createdBy->proname_first}} {{$update->createdBy->pro->name_last}}</strong><br/>{{ friendly_date_time($update->created_at) }}</td>
-                                                               
-                                                            </tr>
-                                                        @endforeach
-                                                        </tbody>
-                                                    </table>
+                                            <div class="d-flex justify-content-end align-items-center">
+                                                <div moe>
+                                                    <a start show><i class="fas fa-archive"></i> Show Changelog</a>
+                                                    <div action="" url>
+                                                        <table class="table table-condensed table-striped table-sm">
+                                                            <thead>
+                                                            <th>Category</th>
+                                                            <th>Summary</th>
+                                                            <th>Created</th>
+                                                            
+                                                            </thead>
+                                                            <tbody>
+                                                            @foreach($memo->updates as $update)
+                                                                <tr>
+                                                                    <td>{{$update->category}}</td>
+                                                                    <td>{{$update->content}}</td>
+                                                                    <td><strong>{{$update->createdBy->proname_first}} {{$update->createdBy->pro->name_last}}</strong><br/>{{ friendly_date_time($update->created_at) }}</td>
+                                                                
+                                                                </tr>
+                                                            @endforeach
+                                                            </tbody>
+                                                        </table>
+                                                    </div>
                                                 </div>
                                             </div>
                                             @endif
@@ -586,8 +589,21 @@
                                             {{ friendly_date_time($memo->created_at) }}
                                         </td>
                                         @if($performer->pro->pro_type === 'ADMIN' )
-                                        <td class="px-2 text-secondary">{{$memo->is_admin_only?'Yes':'No'}}</td>
+                                        <td class="px-2 text-secondary">
+                                            @if($memo->is_admin_only)
+                                                <span class="text-success"><i class="fas fa-lock"></i> YES</span>
+                                            @else
+                                                <span><i class="fas fa-unlock"></i> NO</span>
+                                            @endif
+                                        </td>
                                         @endif
+                                        <td class="px-2">
+                                            @if($memo->mcp_stamp_id)
+                                            <span class="text-success">YES <i class="fas fa-info-circle c-pointer" data-toggle="tooltip" data-placement="bottom" title="{{ friendly_date_time($memo->stamp->created_at) }}"></i></span>
+                                            @else
+                                            <span class="text-secondary">NO</span>
+                                            @endif
+                                        </td>
                                         <td class="px-2 text-center delete-column">
                                             <div moe wide relative class="mr-2">
                                                 <a class="on-hover-opaque" start show title="Edit">

+ 1 - 1
resources/views/app/patient/measurements.blade.php

@@ -26,7 +26,7 @@
                         <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>
-                        </div>Me
+                        </div>
                     </form>
                 </div>
                 <span class="mx-2 text-secondary">|</span>

+ 109 - 0
resources/views/app/practice-management/patients-accounts-invites-filters.blade.php

@@ -0,0 +1,109 @@
+<style>
+	#patients-accounts-invites-filters label {
+		font-weight: bold;
+	}
+
+	#patients-accounts-invites-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container {
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 15px;
+	}
+</style>
+<form id="patients-accounts-invites-filters" method="GET" action="{{ route('practice-management.patientsAccountsInvites') }}" class="filter-container" v-cloak>
+	<!-- DATE	 -->
+	<div>
+		<div class="form-group">
+			<label>Date:</label>
+			<select name="date_category" class="form-control input-sm" v-model="filters.date_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.date_category" class="mt-2">
+				<div>
+					<input name="date_value_1" v-model="filters.date_value_1" type="date" class="form-control input-sm"/>
+				</div>
+				<div v-show="filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="date_value_2" v-model="filters.date_value_2" type="date" class="form-control input-sm"/>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- STATUS -->
+	<div>
+		<div class="form-group">
+			<label>Status:</label>
+			<select name="status" class="form-control input-sm" v-model="filters.status">
+				<option value="">All</option>
+				<option value="ACCEPTED">Accepted</option>
+				<option value="PENDING">Pending</option>
+				<option value="REJECTED">Rejected</option>
+				<option value="CANCELLED">Cancelled</option>
+			</select>
+		</div>
+	</div>
+
+	<div>
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class="d-flex">
+				<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{ route('practice-management.patientsAccountsInvites') }}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+<?php
+$loadedFilters = $filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'status'
+];
+for ($i = 0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+<script>
+	(function() {
+		function init() {
+			window.apapp = new Vue({
+				el: '#patients-accounts-invites-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("practice-management.patientsAccountsInvites") }}?' + $('#patients-accounts-invites-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('patients-accounts-invites-filters', init, '#patients-accounts-invites-filters');
+	})();
+</script>

+ 90 - 0
resources/views/app/practice-management/patients-accounts-invites.blade.php

@@ -0,0 +1,90 @@
+@extends ('layouts/template')
+
+@section('content')
+
+<div class="p-3 mcp-theme-1">
+    <div class="card">
+
+        <div class="card-header px-3 py-2 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-user"></i>
+                Accounts Invites ({{ $accountInvites->total() }})
+            </strong>
+        </div>
+        <div class="card-body p-0">
+        <div class="p-3">
+                @include('app.practice-management.patients-accounts-invites-filters')
+            </div>
+            <table class="table table-sm table-condensed p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="px-2 text-secondary border-bottom-0">Created At</th>
+                        <th class="px-2 text-secondary border-bottom-0">Client</th>
+                        <th class="px-2 text-secondary border-bottom-0">Name</th>
+                        <th class="px-2 text-secondary border-bottom-0">Email</th>
+                        <th class="px-2 text-secondary border-bottom-0">Cell Number</th>
+                        <th class="px-2 text-secondary border-bottom-0">Status</th>
+                        <th class="px-2 text-secondary border-bottom-0">&nbsp;</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($accountInvites as $accountInvite)
+                    <tr>                        
+                        <td class="px-2">
+                            {{ friendlier_date_time($accountInvite->created_at) }}
+                            @if($accountInvite->status === 'CANCELLED')
+                            <span class="text-sm text-secondary">(CANCELLED)</span>
+                            @endif
+                        </td>
+                        <td class="px-2">{{ $accountInvite->client->displayName() }}</td>
+                        <td class="px-2">{{ $accountInvite->first_name }} {{ $accountInvite->last_name }}</pre>
+                        </td>
+                        <td class="px-2">{{ $accountInvite->to_email_address }}</td>
+                        <td class="px-2">{{ $accountInvite->cell_number }}</td>
+                        <td class="px-2">{{ $accountInvite->status }} <span class="text-sm text-secondary">(Updated: {{friendlier_date_time($accountInvite->status_updated_at)}})</span>
+                            @if($accountInvite->status_memo)
+                            <div class="py-1 font-italic text-secondary text-sm">{{$accountInvite->status_memo}}</div>
+                            @endif
+                        </td>
+                        <td class="px-2">
+                            <div class="d-flex">
+                                @if($accountInvite->status === 'PENDING')
+                                <span moe class="ml-1" relative>
+                                    <a class="" href="" show start>Cancel</a>
+                                    <form url="/api/accountInvite/markAsCancelled" right>
+                                        <input type="hidden" name="uid" value="{{$accountInvite->uid}}">
+                                        <p>Cancel this invite?</p>
+                                        <div class="mb-0">
+                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </span>
+                                @endif
+                                @if($accountInvite->status == 'CANCELLED')
+                                <span moe class="ml-1" relative>
+                                    <a class="" href="" show start>Undo Cancel</a>
+                                    <form url="/api/accountInvite/undoMarkAsCancelled" right>
+                                        <input type="hidden" name="uid" value="{{$accountInvite->uid}}">
+                                        <p>Un-cancel this invite?</p>
+                                        <div class="mb-0">
+                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </span>
+                                @endif
+                            </div>
+                        </td>
+                    </tr>
+                    @endforeach
+                </tbody>
+            </table>
+            <div class="ml-2 mt-2">
+                {{ $accountInvites->appends(request()->input())->links() }}
+            </div>
+        </div>
+    </div>
+</div>
+
+@endsection

+ 107 - 101
resources/views/layouts/patient.blade.php

@@ -369,6 +369,7 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 											data-patient-uid="{{$patient->uid}}"
 											style="background-image:<?=$thumbnail?>"><?=$initials?></div>
 											<i class=chart>[#{{$patient->chart_number}}]</i>
+											<i class="fas fa-info-circle text-primary" data-toggle="tooltip" data-placement="right" title="Joined <?=$memberSince?>"></i>
 										</div>
 										<div class=separators>
 											<div>{{friendly_date_time($patient->dob, false,null, true)}} ({{$patient->age_in_years}}
@@ -414,46 +415,28 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 											</div>
 										</div>
 										<div class="screen-only">
-										<div class=separators>
-											<div>Joined <?=$memberSince?></div>
-											<div><label>MCP:</label> {{$mcpName}}
-												@if($patient->has_mcp_done_onboarding_visit !== 'YES' && $pro->pro_type == 'ADMIN')
-													<div moe class="ml-2 hide-inside-popup">
-														<a start show><i class="fa fa-edit"></i></a>
-														<form url="/api/client/putMcp" class="mcp-theme-1">
-															<input type="hidden" name="uid" value="{{$patient->uid}}">
-															<div class="mb-2">
-																<label class="text-secondary text-sm">MCP Pro</label>
-																<select name="mcpProUid" provider-search data-pro-uid="{{ @$patient->mcp->uid }}"
-																		class="form-control form-control-sm">
-																	<option value=""> --select--</option>
-																	@foreach($pros as $iPro)
-																		<option
-																			value="{{$iPro->uid}}" {{ $patient->mcp && $iPro->uid === $patient->mcp->uid ? 'selected' : '' }}>{{$iPro->displayName()}}</option>
-																	@endforeach
-																</select>
-															</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>
-													@if($patient->mcp)
+											<div class=separators>											
+												<div>
+													<label>MCP:</label> {{$mcpName}}
+													@if($patient->has_mcp_done_onboarding_visit !== 'YES' && $pro->pro_type == 'ADMIN')
 														<div moe class="ml-2 hide-inside-popup">
-															<a start show><i class="fa fa-times"></i></a>
-															<form url="/api/client/removeMcp" class="mcp-theme-1">
+															<a start show><i class="fa fa-edit"></i></a>
+															<form url="/api/client/putMcp" class="mcp-theme-1">
 																<input type="hidden" name="uid" value="{{$patient->uid}}">
 																<div class="mb-2">
-																	<label class="text-secondary text-sm">Remove MCP Pro</label>
-
+																	<label class="text-secondary text-sm">MCP Pro</label>
+																	<select name="mcpProUid" provider-search data-pro-uid="{{ @$patient->mcp->uid }}"
+																			class="form-control form-control-sm">
+																		<option value=""> --select--</option>
+																		@foreach($pros as $iPro)
+																			<option
+																				value="{{$iPro->uid}}" {{ $patient->mcp && $iPro->uid === $patient->mcp->uid ? 'selected' : '' }}>{{$iPro->displayName()}}</option>
+																		@endforeach
+																	</select>
 																</div>
 																<div>
-																	<button submit class="btn btn-sm btn-primary mr-1">Submit
+																	<button submit class="btn btn-sm btn-primary mr-1">
+																		Submit
 																	</button>
 																	<button cancel class="btn btn-sm btn-default border">
 																		Cancel
@@ -461,75 +444,94 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 																</div>
 															</form>
 														</div>
+														@if($patient->mcp)
+															<div moe class="ml-2 hide-inside-popup">
+																<a start show><i class="fa fa-times"></i></a>
+																<form url="/api/client/removeMcp" class="mcp-theme-1">
+																	<input type="hidden" name="uid" value="{{$patient->uid}}">
+																	<div class="mb-2">
+																		<label class="text-secondary text-sm">Remove MCP Pro</label>
+
+																	</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>
+														@endif
 													@endif
-												@endif
-											</div>
-										</div>
-										<div>
-											@if($patient->has_mcp_done_onboarding_visit !== 'YES')
-												<span class="text-dark d-inline-flex align-items-center">
-													<span class="mr-2">
-														<i class="fa fa-exclamation-triangle"></i>
-														MCP Onboarding Visit Pending
+													</div>
+												<div>
+												@if($patient->has_mcp_done_onboarding_visit !== 'YES')
+													<span class="text-dark d-inline-flex align-items-center">
+														<span class="mr-2">
+															<i class="fa fa-exclamation-triangle"></i>
+															MCP Onboarding Visit Pending
+														</span>
 													</span>
-												</span>
-												<span moe class="hide-inside-popup">
-													<a start show><i class="fa fa-edit"></i></a>
-													<form url="/api/client/updateMcpOnboardingVisitInfo" class="mcp-theme-1">
-														<input type="hidden" name="uid" value="{{$patient->uid}}">
-														<div class="mb-2">
-															<select name="hasMcpDoneOnboardingVisit"
-																	class="form-control form-control-sm"
-																	onchange="toggleDisabledAsNeeded(this, 'YES', 'if-visit-done')">
-																<option value="">-- Select Status --</option>
-																<option value="YES" {{ $patient->has_mcp_done_onboarding_visit === 'YES' ? 'selected' : '' }}>YES</option>
-																<option value="NO" {{ $patient->has_mcp_done_onboarding_visit === 'NO' ? 'selected' : '' }}>NO</option>
-																<option value="UNKNOWN" {{ $patient->has_mcp_done_onboarding_visit === 'UNKNOWN' ? 'selected' : '' }}>UNKNOWN</option>
-															</select>
-														</div>
-														<div class="mb-2">
-															<input type="date"
-																   class="if-visit-done form-control form-control-sm" disabled
-																   name="mcpOnboardingVisitDate" value="{{ date('Y-m-d') }}"
-																   max="{{ date('Y-m-d') }}">
-														</div>
-														<div class="mb-2">
-															<select name="mcpOnboardingVisitNoteUid" disabled
-																	class="form-control form-control-sm if-visit-done"
-																	onchange="if(this.value === '-- create --') createNewNote('{{$patient->uid}}', '{{$pro->uid}}', '{{date('Y-m-d')}}');">
-																<option value="">-- Visit Note --</option>
-																<?php $notes = \App\Models\Note::where('client_id', $patient->id)->get() ?>
-																@foreach ($notes as $note)
-																	@if(!empty($note->title) && $note->client_id === $patient->id && !$note->is_cancelled)
-																		<option
-																			{{ $patient->mcp_onboarding_visit_note_id === $note->id ? 'selected' : '' }}
-																			value="{{$note->uid}}">{{$note->hcpPro->displayName()}} ({{friendly_date_time($note->effective_dateest, false)}})</option>
-																	@endif
-																@endforeach
-																{{--<option value="-- create --">-- Create Note --</option>--}}
-															</select>
-														</div>
-														<div class="mb-2 if-note-outside-system">
-															<textarea class="form-control form-control-sm"
-																	  name="reasonOnboardingVisitNoteOutsideSystem"
-																	  placeholder="Visit note outside the system reason"
-																	  spellcheck="false" data-gramm="false"></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>
-												</span>
-											@else
-												<span class="text-dark d-inline-flex align-items-center">
-													<span class="mr-2 text-secondary">
-														<i class="fa fa-check text-sm"></i>
-														MCP Onboarding Visit Completed
+													<span moe class="hide-inside-popup">
+														<a start show><i class="fa fa-edit"></i></a>
+														<form url="/api/client/updateMcpOnboardingVisitInfo" class="mcp-theme-1">
+															<input type="hidden" name="uid" value="{{$patient->uid}}">
+															<div class="mb-2">
+																<select name="hasMcpDoneOnboardingVisit"
+																		class="form-control form-control-sm"
+																		onchange="toggleDisabledAsNeeded(this, 'YES', 'if-visit-done')">
+																	<option value="">-- Select Status --</option>
+																	<option value="YES" {{ $patient->has_mcp_done_onboarding_visit === 'YES' ? 'selected' : '' }}>YES</option>
+																	<option value="NO" {{ $patient->has_mcp_done_onboarding_visit === 'NO' ? 'selected' : '' }}>NO</option>
+																	<option value="UNKNOWN" {{ $patient->has_mcp_done_onboarding_visit === 'UNKNOWN' ? 'selected' : '' }}>UNKNOWN</option>
+																</select>
+															</div>
+															<div class="mb-2">
+																<input type="date"
+																	class="if-visit-done form-control form-control-sm" disabled
+																	name="mcpOnboardingVisitDate" value="{{ date('Y-m-d') }}"
+																	max="{{ date('Y-m-d') }}">
+															</div>
+															<div class="mb-2">
+																<select name="mcpOnboardingVisitNoteUid" disabled
+																		class="form-control form-control-sm if-visit-done"
+																		onchange="if(this.value === '-- create --') createNewNote('{{$patient->uid}}', '{{$pro->uid}}', '{{date('Y-m-d')}}');">
+																	<option value="">-- Visit Note --</option>
+																	<?php $notes = \App\Models\Note::where('client_id', $patient->id)->get() ?>
+																	@foreach ($notes as $note)
+																		@if(!empty($note->title) && $note->client_id === $patient->id && !$note->is_cancelled)
+																			<option
+																				{{ $patient->mcp_onboarding_visit_note_id === $note->id ? 'selected' : '' }}
+																				value="{{$note->uid}}">{{$note->hcpPro->displayName()}} ({{friendly_date_time($note->effective_dateest, false)}})</option>
+																		@endif
+																	@endforeach
+																	{{--<option value="-- create --">-- Create Note --</option>--}}
+																</select>
+															</div>
+															<div class="mb-2 if-note-outside-system">
+																<textarea class="form-control form-control-sm"
+																		name="reasonOnboardingVisitNoteOutsideSystem"
+																		placeholder="Visit note outside the system reason"
+																		spellcheck="false" data-gramm="false"></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>
 													</span>
-												</span>
-											@endif
-										</div>
+												@else
+													<span class="text-dark d-inline-flex align-items-center">
+														<span class="mr-2 text-secondary">
+															<i class="fa fa-check text-sm"></i>
+															MCP Onboarding Visit Completed
+														</span>
+													</span>
+												@endif
+											</div>
+											</div>
+										
 										<div>
 											<label>Physician:</label> {{$patient->pcp ? $patient->pcp->displayName() : '-' }}
 											@if($pro->pro_type == 'ADMIN')
@@ -932,6 +934,10 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 				if(localStorage.sidebarMenuScrollTop) {
 					$('#sidebarMenu').scrollTop(+localStorage.sidebarMenuScrollTop);
 				}
+
+				$(function () {
+					$('[data-toggle="tooltip"]').tooltip();
+				});
 			}
 			addMCInitializer('sidebarMenu', init, '#sidebarMenu')
 		}).call(window);

+ 2 - 0
resources/views/layouts/template.blade.php

@@ -180,6 +180,7 @@
                             <a class="dropdown-item" href="{{ route('practice-management.statTrees.list') }}">Stat Trees</a>
 
                             <a class="dropdown-item" href="/practice-management/rates/all">Payment Rates</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.patientsAccountsInvites') }}">Patients Accounts Invites</a>
 
                         @elseif($pro->is_enrolled_as_mcp)
 
@@ -196,6 +197,7 @@
                             <a class="dropdown-item" href="{{ route('mcp.reports') }}">Reports</a>
                             <a class="dropdown-item" href="{{ route('mcp.supply_orders') }}">Supply Orders</a>
                             <a class="dropdown-item" href="{{ route('mcp.client_messages') }}">Messages</a>
+                            <a class="dropdown-item" href="{{ route('mcp.patients_accounts_invites') }}">Patients Accounts Invites</a>
 
                         @elseif($pro && $pro->isDefaultNA())
 

+ 3 - 0
routes/web.php

@@ -82,6 +82,8 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('reports', 'McpController@reports')->name('reports');
         Route::get('supply-orders', 'McpController@supply_orders')->name('supply_orders');
         Route::get('client-messages', 'McpController@client_messages')->name('client_messages');
+        Route::get('patients-accounts-invites', 'McpController@patients_accounts_invites')->name('patients_accounts_invites');
+
 
         Route::get('new-patients-awaiting-visit', 'McpController@new_patients_awaiting_visit')->name('new_patients_awaiting_visit');
         Route::get('notes-pending-signature', 'McpController@notes_pending_signature')->name('notes_pending_signature');
@@ -174,6 +176,7 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('get-next-note/{mode}', 'PracticeManagementController@getNextNote')->name('get-next-note');
 
         Route::get('my-teams', 'PracticeManagementController@myTeams')->name('my-teams');
+        Route::get('patients-accounts-invites', 'PracticeManagementController@patientsAccountsInvites')->name('patientsAccountsInvites');
 
         Route::middleware('pro.auth.admin')->group(function () {