Forráskód Böngészése

Updates Notes & filters

Samson Mutunga 3 éve
szülő
commit
ca411ef02c

+ 8 - 4
app/Http/Controllers/McpController.php

@@ -139,11 +139,15 @@ class McpController extends Controller
 
     public function notes(Request $request)
     {
-        $notes = Note::paginate(5);
-
-        // SELECT * FROM note WHERE client_id IN (SELECT id FROM client WHERE mcp_pro_id = :me.id);
+        $filters = $request->all();
+        $notes = Note::query();
+        $notes = $notes->where('hcp_pro_id', $this->performer->pro->id);
+        $this->filterMultiQuery($request, $notes, 'effective_time', 'date_category', 'date_value_1', 'date_value_2');
+        $this->filterSimpleQuery($request, $notes, 'new_or_fu_or_na', 'new_or_fu_or_na');   
+        $notes = $notes->orderBy('created_at', 'DESC')->paginate(20);
+        
 
-        return view('app.mcp.notes', compact('notes'));
+        return view('app.mcp.notes', compact('notes','filters'));
     }
 
     public function appointments(Request $request)

+ 2 - 2
resources/views/app/mcp/appointments.blade.php

@@ -19,7 +19,7 @@
                 <thead class="bg-light">
                     <tr>
                         <th class="px-3 border-0">Date & Time</th>
-                        <th class="px-3 border-0">Pro</th>
+                        <th class="px-3 border-0">Patient</th>
                         <th class="px-3 border-0">Title</th>
                         <th class="px-3 border-0">Description</th>
                         <th class="px-3 border-0">Status</th>
@@ -34,7 +34,7 @@
                                 {{friendlier_date_time($appointment->raw_date . ' ' . $appointment->raw_start_time)}}
                             </a>
                         </td>
-                        <td class="px-2">{{ $appointment->pro->displayName() }}</pre>
+                        <td class="px-2">{{ $appointment->client->displayName() }}</pre>
                         </td>
                         <td class="px-2">{{ $appointment->title }}</td>
                         <td class="px-2">{{ $appointment->description }}</td>

+ 44 - 11
resources/views/app/mcp/notes.blade.php

@@ -18,25 +18,58 @@
             <table class="table table-condensed p-0 m-0">
                 <thead class="bg-light">
                     <tr>
-                        <th class="px-3 border-0">Date</th>
+                        <th class="px-3 border-0">Effective Date</th>
                         <th class="px-3 border-0">Patient</th>
-                        <th class="px-3 border-0">ICD</th>
-                        <th class="px-3 border-0">Status</th>
+                        <th class="px-3 border-0">New Patient / FU</th>
+
+                        <th class="px-3 border-0">HCP</th>
+
+                        <th class="px-3 border-0">HCP Signed</th>
+                        <th class="px-3 border-0">&nbsp;</th>
                     </tr>
                 </thead>
                 <tbody>
-                    @foreach($notes as $note)
-                    <tr>
-                        <td>{{-- date --}} -</td>
-                        <td>{{-- patient --}} - </td>
-                        <td>{{-- ICD --}} - </td>
-                        <td>{{-- Status --}} - </td>
+                    @foreach ($notes as $note)
+                    <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
+                        <td class="px-2">
+                            <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold">
+                                {{ friendly_date_time($note->effective_dateest, false) }}
+                            </a>
+                            @if(!!$note->visitTemplate)
+                            <span class="text-info font-weight-bold">*</span>
+                            @endif
+                            <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
+                        </td>
+                        <td class="px-2">
+                            {{ $note->client->displayName() }}
+                        </td>
+
+                        <td class="px-2">
+                            {{ $note->new_or_fu_or_na === 'NEW' ? 'New Patient' : $note->new_or_fu_or_na }}
+                        </td>
+
+                        <td class="px-2">
+                            {{$note->hcpPro ? $note->hcpPro->name_display: '-'}}
+                        </td>
+
+                        <td class="px-2">
+                            {!! $note->hcpPro && $note->is_signed_by_hcp ? '<b class="text-success">Yes</b>' : 'No' !!}
+                        </td>
+                        <td class="px-2">
+                            <div class="position-relative c-pointer text-center stag-tooltip">
+                                <i class="fa fa-info-circle"></i>
+                                <div class="position-absolute bg-white border rounded p-2 stag-tooltip-content">
+                                    <div class="text-nowrap small text-left pb-1">Created on <b>{{ friendly_date_time($note->created_at, true) }}</b></div>
+                                    <div class="text-nowrap small text-left">Created by <b>{{ $note->createdSession->pro->displayName() }}</b></div>
+                                </div>
+                            </div>
+                        </td>
                     </tr>
                     @endforeach
 
                     @if(count($notes) === 0)
                     <tr>
-                        <td colspan="5">No records found!</td>
+                        <td colspan="6">No records found!</td>
                     </tr>
                     @endif
                 </tbody>
@@ -48,4 +81,4 @@
         </div>
     </div>
 </div>
-@endsection
+@endsection

+ 25 - 14
resources/views/app/mcp/notes_filters.blade.php

@@ -33,14 +33,11 @@
 	<!-- STATUS -->
 	<div class="col-md-2">
 		<div class="form-group">
-			<label>Status:</label>
-			<select name="status" class="form-control input-sm" v-model="filters.status">
-				<option value="ALL">All</option>
+			<label>New/FU:</label>
+			<select name="new_or_fu_or_na" class="form-control input-sm" v-model="filters.new_or_fu_or_na">
+				<option value="">All</option>
 				<option value="NEW">New</option>
-				<option value="SIGNED">Signed</option>
-				<option value="VERIFIED">Verified</option>
-				<option value="PROCESSED">Processed</option>
-				<option value="CANCELLED">Cancelled</option>
+				<option value="FU">FU</option>
 			</select>
 		</div>
 	</div>
@@ -48,11 +45,25 @@
 	<div class="col-md-2">
 		<div class="form-group d-flex">
 			<label>&nbsp;</label>
-			<button type="submit" class="btn btn-primary btn-sm mr-2 mw-100px">Apply Filters</button>
-			<a href="{{ route('mcp.patients') }}" class="btn btn-danger btn-sm text-white mw-100px">Clear Filters</a>
+			<button type="submit"  v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2 mw-100px">Apply Filters</button>
+			<a href="#" v-on:click.prevent="fastLoad('{{route('mcp.notes')}}')" class="btn btn-danger btn-sm text-white mw-100px">Clear Filters</a>
 		</div>
 	</div>
 </form>
+<?php
+$loadedFilters = $filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'new_or_fu_or_na'
+];
+for ($i=0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
 
 <script>
 	(function() {
@@ -61,12 +72,13 @@
 				el: '#mcp-notes-filters',
 				delimiters: ['@{{', '}}'],
 				data: {
-					filters: {
-						date_category: "<?= $date_category ?? '' ?>",
-						status: "<?= $status ?? '' ?>"
-					}
+					filters: <?= json_encode($loadedFilters) ?>
 				},
 				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("mcp.notes") }}?' + $('#mcp-notes-filters').serialize());
+						return false;
+					},
 					init: function() {
 
 					}
@@ -76,7 +88,6 @@
 				},
 			});
 
-
 		}
 		addMCInitializer('mcp-notes-filters', init, '#mcp-notes-filters');
 	})();