Selaa lähdekoodia

Merge branch 'dev-sam' into dev-vj

Vijayakrishnan 3 vuotta sitten
vanhempi
commit
1fcdd6fc9a

+ 34 - 2
app/Http/Controllers/McpController.php

@@ -29,7 +29,7 @@ use Illuminate\Support\Facades\File;
 use App\Models\Bill;
 use App\Models\ClientSMS;
 use App\Models\AccountInvite;
-
+use App\Models\ClientMemo;
 use Illuminate\Support\Facades\Http;
 use PDF;
 
@@ -77,7 +77,7 @@ class McpController extends Controller
 
         $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2');
         $this->filterSimpleQuery($request, $patients, 'sex', 'sex');
-        $this->filterMultiQuery($request, $patients, 'usual_bmi', 'bmi_category', 'bmi_value_1', 'bmi_value_2');
+        $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2');
         $this->filterMultiQuery($request, $patients, 'most_recent_weight_at', 'last_weighed_in_category', 'last_weighed_in_value_1', 'last_weighed_in_value_2');
         $this->filterMultiQuery($request, $patients, 'most_recent_bp_at', 'last_bp_category', 'last_bp_value_1', 'last_bp_value_2');
 
@@ -134,6 +134,38 @@ class McpController extends Controller
         return view('app.mcp.bills', compact('bills', 'filters'));
     }
 
+    public function clients_bdt_devices(Request $request){
+        $filters = $request->all();
+        
+        $devices = ClientBDTDevice::select('client_bdt_device.*')
+        ->join('client', 'client.id', '=', 'client_bdt_device.client_id')
+        ->where('client.mcp_pro_id', $this->performer->pro->id);
+
+        $this->filterMultiQuery($request, $devices, 'client_bdt_device.created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $status = $request->get('status');
+        if($status){
+            if($status === 'ACTIVE') $devices = $devices->where('client_bdt_device.is_active', true);
+            if($status === 'DEACTIVATED') $devices = $devices->where('client_bdt_device.is_active', false);
+        }
+        $devices = $devices->orderBy('created_at', 'DESC')->paginate(20);
+
+        return view('app.mcp.clients_bdt_devices', compact('devices', 'filters'));
+    }
+
+    public function memos(Request $request){
+        $filters = $request->all();
+        
+        $memos = ClientMemo::select('client_memo.*')
+        ->join('client', 'client.id', '=', 'client_memo.client_id')
+        ->where('client.mcp_pro_id', $this->performer->pro->id);
+
+        $this->filterMultiQuery($request, $memos, 'client_memo.created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $this->filterSimpleQuery($request, $memos, 'category', 'category');
+        $memos = $memos->orderBy('created_at', 'DESC')->paginate(20);
+
+        return view('app.mcp.memos', compact('memos', 'filters'));
+    }
+
     public function erx_and_orders(Request $request)
     {
         $filters = $request->all();

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

@@ -34,6 +34,8 @@ use App\Models\Team;
 use App\Models\Ticket;
 use App\Models\AccountInvite;
 use App\Models\ClientMeasurementDaysPerMonth;
+use App\Models\ClientBDTDevice;
+use App\Models\ClientMemo;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Http;
 use PDF;
@@ -2020,6 +2022,42 @@ ORDER BY c.name_last, c.name_first
         return view('app.practice-management.patients-accounts-invites', compact('accountInvites','filters'));
     }
 
+    public function clientsBdtDevices(Request $request){
+        $filters = $request->all();
+        
+        $devices = ClientBDTDevice::select('client_bdt_device.*')
+        ->join('client', 'client.id', '=', 'client_bdt_device.client_id');
+
+        if($this->performer->pro->pro_type !== 'ADMIN'){
+            $devices = $devices->where('client.mcp_pro_id', $this->performer->pro->id);
+        }
+
+        $this->filterMultiQuery($request, $devices, 'client_bdt_device.created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $status = $request->get('status');
+        if($status){
+            if($status === 'ACTIVE') $devices = $devices->where('client_bdt_device.is_active', true);
+            if($status === 'DEACTIVATED') $devices = $devices->where('client_bdt_device.is_active', false);
+        }
+        $devices = $devices->orderBy('created_at', 'DESC')->paginate(20);
+        return view('app.practice-management.clients_bdt_devices', compact('devices','filters'));
+    }
+
+    public function memos(Request $request){
+        $filters = $request->all();
+        
+        $memos = ClientMemo::select('client_memo.*')
+        ->join('client', 'client.id', '=', 'client_memo.client_id');
+
+        if($this->performer->pro->pro_type !== 'ADMIN'){
+            $memos = $memos->where('client.mcp_pro_id', $this->performer->pro->id);
+        }
+
+        $this->filterMultiQuery($request, $memos, 'client_memo.created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $this->filterSimpleQuery($request, $memos, 'category', 'category');
+        $memos = $memos->orderBy('created_at', 'DESC')->paginate(20);
+
+        return view('app.practice-management.memos', compact('memos', 'filters'));
+    }
 
     
 

+ 5 - 0
app/Models/ClientMemo.php

@@ -14,6 +14,11 @@ class ClientMemo extends Model
         return $this->hasOne(AppSession::class, 'id', 'created_by_session_id');
     }
 
+    public function client(): HasOne
+    {
+        return $this->hasOne(Client::class, 'id', 'client_id');
+    }
+
     public function updates(): HasMany{
         return $this->hasMany(ClientMemoUpdate::class, 'client_memo_id', 'id')->orderBy('created_at', 'DESC');
     }

+ 85 - 0
resources/views/app/mcp/clients_bdt_devices.blade.php

@@ -0,0 +1,85 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-3 py-2 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-weight"></i>
+                Clients BDT Devices
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.mcp.clients_bdt_devices_filters')
+            </div>
+            <table class="table table-condensed p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="px-3 border-0">IMEI</th>
+                        <th class="px-3 border-0">Client</th>
+                        <th class="px-3 border-0">Created</th>
+                        <th class="px-3 border-0">Category</th>
+                        <th class="px-3 border-0">Last Measurement</th>
+                        <th class="px-3 border-0">Status</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($devices as $device)
+                    <tr>
+                        <td class="px-2">
+                            <pre class="m-0">{{ $device->device->imei }}</pre>
+                        </td>
+                        <td>
+                            <a target="_blank" native href="{{route('patients.view.dashboard', $device->client)}}">
+                                {{$device->client->displayName()}}
+                            </a>
+                        </td>
+                        <td class="px-2 text-nowrap">{{ friendly_date_time($device->device->created_at) }}</td>
+                        <td class="px-2">{{ $device->device->category }}</td>
+                        <td class="px-2 d-flex align-items-center">
+                            <?php $lastMeasurement = $device->lastDeviceMeasurement(); ?>
+                            @if($lastMeasurement)
+                            @if($lastMeasurement->is_cellular_zero)
+                            <i class="font-size-11 fa fa-rss"></i>
+                            @elseif($lastMeasurement->label === 'BP')
+                            {{ $lastMeasurement->sbp_mm_hg }} / {{ $lastMeasurement->dbp_mm_hg }}
+                            @elseif($lastMeasurement->label === 'Wt. (lbs.)')
+                            {{ round($lastMeasurement->numeric_value, 2) }} lbs
+                            @else
+                            {{ $lastMeasurement->value }}
+                            @endif
+                            <div class="ml-2">
+                                <i class="far fa-calendar-check"></i> <span class="text-secondary">{{ friendly_date_time($lastMeasurement->created_at) }}</span>
+                            </div>
+                            @else
+                            <small class="text-muted">-</small>
+                            @endif
+                        </td>
+                        <td>
+                            @if($device->is_active)
+                                <span class="text-success">Active</span>
+                            @else
+                                <span class="text-danger">Deactivated</span>
+                            @endif
+                        </td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($devices) === 0)
+                    <tr>
+                        <td colspan="6">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+
+            </table>
+            <div class="ml-2 mt-2">
+                {{ $devices->appends(request()->input())->links() }}
+            </div>
+        </div>
+    </div>
+</div>
+@endsection

+ 107 - 0
resources/views/app/mcp/clients_bdt_devices_filters.blade.php

@@ -0,0 +1,107 @@
+<style>
+	#mcp-clients-bdt-devices-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-clients-bdt-devices-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="mcp-clients-bdt-devices-filters" method="GET" action="{{ route('mcp.clients_bdt_devices') }}" 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="ACTIVE">active</option>
+				<option value="DEACTIVATED">Deactivated</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('mcp.clients_bdt_devices')}}')" 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: '#mcp-clients-bdt-devices-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("mcp.clients_bdt_devices") }}?' + $('#mcp-clients-bdt-devices-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('mcp-clients-bdt-devices-filters', init, '#mcp-clients-bdt-devices-filters');
+	})();
+</script>

+ 95 - 0
resources/views/app/mcp/memos.blade.php

@@ -0,0 +1,95 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-3 py-2 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-notes-medical"></i>
+                Memos
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.mcp.memos_filters')
+            </div>
+            <table class="table table-condensed p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="px-3 border-0">Category</th>
+                        <th class="px-3 border-0">Patient</th>
+                        <th class="px-3 border-0 w-25">Summary</th>
+                        <th class="px-3 border-0">Created</th>
+                        <th class="px-3 border-0 delete-column">&nbsp;</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($memos as $memo)
+                    <tr>
+                        <td class="px-2">{{ $memo->category }}</td>
+                        <td>
+                            <a target="_blank" native href="{{route('patients.view.dashboard', $memo->client)}}">
+                                {{$memo->client->displayName()}}
+                            </a>
+                        </td>
+                        <td class="px-2">
+                            <pre class="m-0 break-spaces">{{ $memo->content }}</pre>
+                        </td>
+                        <td class="px-2">{{ friendly_date_time($memo->created_at) }}</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">
+                                    <i class="font-size-11 fa fa-edit"></i>
+                                </a>
+                                <form url="/api/clientMemo/update" right>
+                                    <input type="hidden" name="uid" value="{{ $memo->uid }}">
+                                    <div class="mb-2">
+                                        <select class="form-control form-control-sm" name="category" required>
+                                            <option value="">-- select --</option>
+                                            <option {{ $memo->category === "Incoming Call" ? "selected" : "" }} value="Incoming Call">Incoming Call</option>
+                                            <option {{ $memo->category === "Outgoing Call" ? "selected" : "" }} value="Outgoing Call">Outgoing Call</option>
+                                            <option {{ $memo->category === "Call Unspecified" ? "selected" : "" }} value="Call Unspecified">Call Unspecified</option>
+                                            <option {{ $memo->category === "Other" ? "selected" : "" }} value="Other">Other</option>
+                                        </select>
+                                    </div>
+                                    <div class="mb-2">
+                                        <textarea class="form-control form-control-sm" name="content" rows="5" placeholder="Content"><?= $memo->content ?></textarea>
+                                    </div>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-primary mr-2" type="button" submit>Save</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" type="button" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                            <div moe relative>
+                                <a start show class="on-hover-opaque"><i class="fa fa-trash-alt text-danger"></i></a>
+                                <form url="/api/clientMemo/cancel" right>
+                                    <input type="hidden" name="uid" value="{{ $memo->uid }}">
+                                    <p class="small">Are you sure you want to cancel this memo?</p>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-danger mr-2" submit>Delete</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                        </td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($memos) === 0)
+                    <tr>
+                        <td colspan="4">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+
+            </table>
+            <div class="ml-2 mt-2">
+                {{ $memos->appends(request()->input())->links() }}
+            </div>
+        </div>
+    </div>
+</div>
+@endsection

+ 110 - 0
resources/views/app/mcp/memos_filters.blade.php

@@ -0,0 +1,110 @@
+<style>
+	#mcp-memos-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-memos-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="mcp-memos-filters" method="GET" action="{{ route('mcp.memos') }}" 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>Category:</label>
+			<select name="category" class="form-control input-sm" v-model="filters.category">
+				<option value="">All</option>
+				<option value="Incoming Call">Incoming Call</option>
+				<option value="Outgoing Call">Outgoing Call</option>
+				<option value="Call Unspecified">Call Unspecified</option>
+				<option value="Other">Other</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('mcp.memos')}}')" 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',
+	'category'
+];
+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: '#mcp-memos-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("mcp.memos") }}?' + $('#mcp-memos-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+		}
+		addMCInitializer('mcp-memos-filters', init, '#mcp-memos-filters');
+	})();
+</script>

+ 10 - 1
resources/views/app/mcp/patients-table.blade.php

@@ -30,7 +30,16 @@
 			<td class="text-nowrap">{{ friendly_date_time($patient->dob, false) }}</td>
 			<td>{{ $patient->age_in_years ?  $patient->age_in_years : '-' }}</td>
 			<td>{{ $patient->sex }}</td>
-			<td>{{ $patient->usual_bmi }}</td>
+			<td>
+				<div class="d-flex flex-column">
+					@if($patient->usual_bmi_min && $patient->usual_bmi_max)
+						<small class="text-muted">BMI (Usual): <b>{{ $patient->usual_bmi_min }}</b> {{ $patient->usual_bmi_min_category }} to <b>{{ $patient->usual_bmi_max }}</b> {{ $patient->usual_bmi_max_category }}</small>
+					@endif
+					@if($patient->ideal_bmi)
+						<small class="text-muted">BMI (Ideal) <b>{{ $patient->ideal_bmi }}</b> {{ $patient->ideal_bmi_category }}</small>
+					@endif
+				</div>
+			</td>
 			<td>
 				<?php $coverageStatus = $patient->getPrimaryCoverageStatus(); ?>
 				<div class="text-nowrap">

+ 90 - 0
resources/views/app/practice-management/clients_bdt_devices.blade.php

@@ -0,0 +1,90 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-3 py-2 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-weight"></i>
+                Clients BDT Devices
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.practice-management.clients_bdt_devices_filters')
+            </div>
+            <table class="table table-condensed p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="px-3 border-0">IMEI</th>
+                        <th class="px-3 border-0">Client</th>
+                        <th class="px-3 border-0">MCP</th>
+                        <th class="px-3 border-0">Created</th>
+                        <th class="px-3 border-0">Category</th>
+                        <th class="px-3 border-0">Last Measurement</th>
+                        <th class="px-3 border-0">Status</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($devices as $device)
+                    <?php 
+                    $mcpName = $device->client->mcp ? implode(', ', array_filter([$device->client->mcp->name_last, $device->client->mcp->name_first])) : null;
+                    ?>
+                    <tr>
+                        <td class="px-2">
+                            <pre class="m-0">{{ $device->device->imei }}</pre>
+                        </td>
+                        <td>
+                            <a target="_blank" native href="{{route('patients.view.dashboard', $device->client)}}">
+                                {{$device->client->displayName()}}
+                            </a>
+                        </td>
+                        <td>{{ $mcpName }}</td>
+                        <td class="px-2 text-nowrap">{{ friendly_date_time($device->device->created_at) }}</td>
+                        <td class="px-2">{{ $device->device->category }}</td>
+                        <td class="px-2 d-flex align-items-center">
+                            <?php $lastMeasurement = $device->lastDeviceMeasurement(); ?>
+                            @if($lastMeasurement)
+                            @if($lastMeasurement->is_cellular_zero)
+                            <i class="font-size-11 fa fa-rss"></i>
+                            @elseif($lastMeasurement->label === 'BP')
+                            {{ $lastMeasurement->sbp_mm_hg }} / {{ $lastMeasurement->dbp_mm_hg }}
+                            @elseif($lastMeasurement->label === 'Wt. (lbs.)')
+                            {{ round($lastMeasurement->numeric_value, 2) }} lbs
+                            @else
+                            {{ $lastMeasurement->value }}
+                            @endif
+                            <div class="ml-2">
+                                <i class="far fa-calendar-check"></i> <span class="text-secondary">{{ friendly_date_time($lastMeasurement->created_at) }}</span>
+                            </div>
+                            @else
+                            <small class="text-muted">-</small>
+                            @endif
+                        </td>
+                        <td>
+                            @if($device->is_active)
+                                <span class="text-success">Active</span>
+                            @else
+                                <span class="text-danger">Deactivated</span>
+                            @endif
+                        </td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($devices) === 0)
+                    <tr>
+                        <td colspan="7">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+
+            </table>
+            <div class="ml-2 mt-2">
+                {{ $devices->appends(request()->input())->links() }}
+            </div>
+        </div>
+    </div>
+</div>
+@endsection

+ 107 - 0
resources/views/app/practice-management/clients_bdt_devices_filters.blade.php

@@ -0,0 +1,107 @@
+<style>
+	#mcp-clients-bdt-devices-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-clients-bdt-devices-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="mcp-clients-bdt-devices-filters" method="GET" action="{{ route('practice-management.clientsBdtDevices') }}" 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="ACTIVE">active</option>
+				<option value="DEACTIVATED">Deactivated</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.clientsBdtDevices')}}')" 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: '#mcp-clients-bdt-devices-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("practice-management.clientsBdtDevices") }}?' + $('#mcp-clients-bdt-devices-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('mcp-clients-bdt-devices-filters', init, '#mcp-clients-bdt-devices-filters');
+	})();
+</script>

+ 100 - 0
resources/views/app/practice-management/memos.blade.php

@@ -0,0 +1,100 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-3 py-2 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-notes-medical"></i>
+                Memos
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.practice-management.memos_filters')
+            </div>
+            <table class="table table-condensed p-0 m-0">
+                <thead class="bg-light">
+                    <tr>
+                        <th class="px-3 border-0">Category</th>
+                        <th class="px-3 border-0">Patient</th>
+                        <th class="px-3 border-0">MCP</th>
+                        <th class="px-3 border-0 w-25">Summary</th>
+                        <th class="px-3 border-0">Created</th>
+                        <th class="px-3 border-0 delete-column">&nbsp;</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach($memos as $memo)
+                    <?php 
+                    $mcpName = $memo->client->mcp ? implode(', ', array_filter([$memo->client->mcp->name_last, $memo->client->mcp->name_first])) : null;
+                    ?>
+                    <tr>
+                        <td class="px-2">{{ $memo->category }}</td>
+                        <td>
+                            <a target="_blank" native href="{{route('patients.view.dashboard', $memo->client)}}">
+                                {{$memo->client->displayName()}}
+                            </a>
+                        </td>
+                        <td class="px-2">{{ $mcpName }}</td>
+                        <td class="px-2">
+                            <pre class="m-0 break-spaces">{{ $memo->content }}</pre>
+                        </td>
+                        <td class="px-2">{{ friendly_date_time($memo->created_at) }}</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">
+                                    <i class="font-size-11 fa fa-edit"></i>
+                                </a>
+                                <form url="/api/clientMemo/update" right>
+                                    <input type="hidden" name="uid" value="{{ $memo->uid }}">
+                                    <div class="mb-2">
+                                        <select class="form-control form-control-sm" name="category" required>
+                                            <option value="">-- select --</option>
+                                            <option {{ $memo->category === "Incoming Call" ? "selected" : "" }} value="Incoming Call">Incoming Call</option>
+                                            <option {{ $memo->category === "Outgoing Call" ? "selected" : "" }} value="Outgoing Call">Outgoing Call</option>
+                                            <option {{ $memo->category === "Call Unspecified" ? "selected" : "" }} value="Call Unspecified">Call Unspecified</option>
+                                            <option {{ $memo->category === "Other" ? "selected" : "" }} value="Other">Other</option>
+                                        </select>
+                                    </div>
+                                    <div class="mb-2">
+                                        <textarea class="form-control form-control-sm" name="content" rows="5" placeholder="Content"><?= $memo->content ?></textarea>
+                                    </div>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-primary mr-2" type="button" submit>Save</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" type="button" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                            <div moe relative>
+                                <a start show class="on-hover-opaque"><i class="fa fa-trash-alt text-danger"></i></a>
+                                <form url="/api/clientMemo/cancel" right>
+                                    <input type="hidden" name="uid" value="{{ $memo->uid }}">
+                                    <p class="small">Are you sure you want to cancel this memo?</p>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-danger mr-2" submit>Delete</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                        </td>
+                    </tr>
+                    @endforeach
+
+                    @if(count($memos) === 0)
+                    <tr>
+                        <td colspan="5">No records found!</td>
+                    </tr>
+                    @endif
+                </tbody>
+
+            </table>
+            <div class="ml-2 mt-2">
+                {{ $memos->appends(request()->input())->links() }}
+            </div>
+        </div>
+    </div>
+</div>
+@endsection

+ 110 - 0
resources/views/app/practice-management/memos_filters.blade.php

@@ -0,0 +1,110 @@
+<style>
+	#mcp-memos-filters label {
+		font-weight: bold;
+	}
+
+	#mcp-memos-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="mcp-memos-filters" method="GET" action="{{ route('practice-management.memos') }}" 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>Category:</label>
+			<select name="category" class="form-control input-sm" v-model="filters.category">
+				<option value="">All</option>
+				<option value="Incoming Call">Incoming Call</option>
+				<option value="Outgoing Call">Outgoing Call</option>
+				<option value="Call Unspecified">Call Unspecified</option>
+				<option value="Other">Other</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.memos')}}')" 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',
+	'category'
+];
+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: '#mcp-memos-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("practice-management.memos") }}?' + $('#mcp-memos-filters').serialize());
+						return false;
+					},
+					init: function() {
+
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+			});
+		}
+		addMCInitializer('mcp-memos-filters', init, '#mcp-memos-filters');
+	})();
+</script>

+ 4 - 1
resources/views/layouts/template.blade.php

@@ -181,6 +181,8 @@
 
                             <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>
+                            <a class="dropdown-item" href="{{ route('practice-management.clientsBdtDevices') }}">Clients BDT Devices</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.memos') }}">Memos</a>
 
                         @elseif($pro->is_enrolled_as_mcp)
 
@@ -191,6 +193,7 @@
                             <a class="dropdown-item" href="{{ route('practice-management.proCalendar') }}">Calendar</a>
 
                             <a class="dropdown-item" href="{{ route('mcp.notes') }}">Notes</a>
+                            <a class="dropdown-item" href="{{ route('mcp.memos') }}">Memos</a>
                             <a class="dropdown-item" href="{{ route('mcp.appointments') }}">Appointments</a>
                             <a class="dropdown-item" href="{{ route('mcp.bills') }}">Bills</a>
                             <a class="dropdown-item" href="{{ route('mcp.erx_and_orders') }}">ERx & Orders</a>
@@ -198,7 +201,7 @@
                             <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>
-
+                            <a class="dropdown-item" href="{{ route('mcp.clients_bdt_devices') }}">Clients BDT Devices</a>
                         @elseif($pro && $pro->isDefaultNA())
 
                             <a class="dropdown-item" href="/practice-management/my-teams">My Teams</a>

+ 5 - 1
routes/web.php

@@ -82,7 +82,9 @@ 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('clients-bdt-devices', 'McpController@clients_bdt_devices')->name('clients_bdt_devices');
         Route::get('patients-accounts-invites', 'McpController@patients_accounts_invites')->name('patients_accounts_invites');
+        Route::get('memos', 'McpController@memos')->name('memos');
 
 
         Route::get('new-patients-awaiting-visit', 'McpController@new_patients_awaiting_visit')->name('new_patients_awaiting_visit');
@@ -177,7 +179,9 @@ Route::middleware('pro.auth')->group(function () {
 
         Route::get('my-teams', 'PracticeManagementController@myTeams')->name('my-teams');
         Route::get('patients-accounts-invites', 'PracticeManagementController@patientsAccountsInvites')->name('patientsAccountsInvites');
-
+        Route::get('clients-bdt-devices', 'PracticeManagementController@clientsBdtDevices')->name('clientsBdtDevices');
+        Route::get('memos', 'PracticeManagementController@memos')->name('memos');
+        
         Route::middleware('pro.auth.admin')->group(function () {
 
             // BILLING REPORT