Explorar el Código

Inc. reports <-> note linkage

Vijayakrishnan hace 3 años
padre
commit
49db473913

+ 4 - 0
app/Models/IncomingReport.php

@@ -19,4 +19,8 @@ class IncomingReport extends Model
     public function client(){
         return $this->hasOne(Client::class, 'id', 'client_id');
     }
+
+    public function note() {
+        return $this->hasOne(Note::class, 'id', 'note_id');
+    }
 }

+ 12 - 3
resources/views/app/patient/incoming-reports.blade.php

@@ -10,6 +10,9 @@
                       method="post"
                       enctype="multipart/form-data">
                     <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+                    @if(request()->input('noteUid'))
+                        <input type="hidden" name="noteUid" value="{{ request()->input('noteUid') }}">
+                    @endif
                     <div class="mb-2">
                         <label for="" class="text-sm text-secondary mb-1">Category</label>
                         <input type="text" class="form-control form-control-sm" name="category"
@@ -69,12 +72,18 @@
                     <tbody>
                     @foreach($patient->incomingReports as $document)
                         <tr class="{{$document->is_entry_error ? 'entry-error' : ''}} {{@$currentReport->uid === $document->uid ? 'bg-aliceblue' : ''}}">
-                            <td class="px-2">{{ friendly_date_time($document->created_at, false) }}</td>
+                            <td class="px-2">
+                                {{ friendly_date_time($document->created_at, false) }}
+                                @if(request()->input('noteUid') && $document->note && $document->note->uid === request()->input('noteUid'))
+                                    <div class="mt-1 text-info text-sm">Created on this note</div>
+                                @endif
+                            </td>
                             <td class="px-2">
                                 {{$document->hcp ? $document->hcp->displayName() : '-'}}
                             </td>
                             <td class="px-2">
-                                <a mc-initer="incoming-reports" href="{{route('patients.view.incoming-reports', ['patient' => $patient, 'currentReport' => $document])}}"
+                                <a mc-initer="incoming-reports"
+                                   href="{{route('patients.view.incoming-reports', ['patient' => $patient, 'currentReport' => $document])}}{{request()->input('noteUid') ? '?noteUid=' . request()->input('noteUid') : ''}}"
                                    class="{{@$currentReport->uid === $document->uid ? 'font-weight-bold' : ''}}">
                                     {{ $document->title ? $document->title : '(not set)' }}
                                 </a>
@@ -205,7 +214,7 @@
                                 @endif
                             @endif
                         </div>
-                        <a class="ml-auto" mc-initer="incoming-reports" href="{{route('patients.view.incoming-reports', ['patient' => $patient, 'currentReport' => null])}}">
+                        <a class="ml-auto" mc-initer="incoming-reports" href="{{route('patients.view.incoming-reports', ['patient' => $patient, 'currentReport' => null])}}{{request()->input('noteUid') ? '?noteUid=' . request()->input('noteUid') : ''}}">
                             <i class="fa fa-times-circle on-hover-opaque"></i>
                         </a>
                     </div>

+ 1 - 1
resources/views/app/patient/note/dashboard.blade.php

@@ -2385,7 +2385,7 @@
                                  mc-initer="incoming-reports"
                                  title="Incoming Reports"
                                  popup-style="wide overflow-visible"
-                                 href="/patients/view/{{$patient->uid}}/incoming-reports">
+                                 href="/patients/view/{{$patient->uid}}/incoming-reports?noteUid={{$note->uid}}">
                                 <span>Inc. Reports</span>
                             </div>
                         </div>