Samson Mutunga 1 год назад
Родитель
Сommit
5f6bc5dbe0

+ 5 - 2
app/Http/Controllers/NoteController.php

@@ -16,6 +16,7 @@ use Illuminate\Support\Facades\Http;
 use App\Models\Note;
 use App\Models\Client;
 use App\Models\CompanyPro;
+use App\Models\CompanyProView;
 use App\Models\Section;
 use App\Models\SectionTemplate;
 use App\Models\Segment;
@@ -91,12 +92,14 @@ class NoteController extends Controller
             $companyProIDInts[] = $cpId->company_pro_id;
         }
 
-        $companyPros = CompanyPro::whereIn('id', $companyProIDInts)->get();
+        $companyPros = CompanyPro::whereIn('id', $companyProIDInts)->with('documents')->get();
+
+        $noteHcpCompanyPros = CompanyProView::where('pro_id', $note->hcp_pro_id)->where('is_active', true)->get();
 
         return view('app.patient.note.dashboard', compact('patient', 'note',
             'allSections',
             'companyPros',
-            'supplyOrdersOnNote', 'otherOpenSupplyOrders'));
+            'supplyOrdersOnNote', 'otherOpenSupplyOrders', 'noteHcpCompanyPros'));
     }
 
     private function filterClientDocuments($documents){

+ 12 - 0
app/Models/CompanyProView.php

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

+ 4 - 1
resources/views/app/patient/note/custom-visit-with-layout.blade.php

@@ -1,7 +1,10 @@
 <?php
     $segmentMap = [];
     foreach($note->segments as $segment):
-        $segmentMap[$segment->segmentTemplate->internal_name] = $segment;
+        if($segment->segmentTemplate){
+            $segmentMap[$segment->segmentTemplate->internal_name] = $segment;
+        }
+        
     endforeach;
 
     function renderVisitTemplateNode($node, $segMap) {

+ 3 - 1
resources/views/app/patient/note/custom-visit.blade.php

@@ -1,7 +1,9 @@
 <?php
     $segmentMap = [];
     foreach($note->segments as $segment):
-        $segmentMap[$segment->segmentTemplate->internal_name] = $segment;
+        if($segment->segmentTemplate){
+           $segmentMap[$segment->segmentTemplate->internal_name] = $segment; 
+        }        
     endforeach;
 
     function renderVisitTemplateNode($note, $node, $pos, $segMap) {

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

@@ -31,7 +31,7 @@
         echo '<div class="note-tree-node">' .
             '<a native target="_top" ' .
             'data-segment-uid="' . $segment->uid . '" ' .
-            'data-segment-internal-name="' . $segment->segmentTemplate->internal_name . '" ' .
+            'data-segment-internal-name="' . $segment->segmentTemplate ? $segment->segmentTemplate->internal_name : '' . '" ' .
             'href="#" ' .
             'class="' . ($segment->display_title === 'MedRisk Vigilence' || $segment->subheading === 'Lifestyle' ? 'd-none' : '') . '">' . $segment->display_title . '</a>' .
             '</div>';

+ 1 - 1
resources/views/app/patient/note/note-segment-list-print-v2.blade.php

@@ -3,7 +3,7 @@
     $previousHeading = null;
     $previousSubHeading = null;
     $segments = $note->segments->filter(function ($_x) {
-        $ok = !!$_x->is_active && $_x->segmentTemplate->internal_name !== 'medrisk_vigilence' && strpos($_x->segmentTemplate->internal_name, 'lifestyle_') !== 0;
+        $ok = !!$_x->is_active && $_x->segmentTemplate && $_x->segmentTemplate->internal_name !== 'medrisk_vigilence' && strpos($_x->segmentTemplate->internal_name, 'lifestyle_') !== 0;
         if ($ok) {
             $content = $_x->summary_html;
             if ($_x->accepted_suggestion_summary_html) {

+ 1 - 1
resources/views/app/patient/note/note-segment-list-print-v3.blade copy.php

@@ -3,7 +3,7 @@
     $previousHeading = null;
     $previousSubHeading = null;
     $segments = $note->segments->filter(function ($_x) {
-        $ok = !!$_x->is_active && $_x->segmentTemplate->internal_name !== 'medrisk_vigilence' && strpos($_x->segmentTemplate->internal_name, 'lifestyle_') !== 0;
+        $ok = !!$_x->is_active && $_x->segmentTemplate && $_x->segmentTemplate->internal_name !== 'medrisk_vigilence' && strpos($_x->segmentTemplate->internal_name, 'lifestyle_') !== 0;
         if ($ok) {
             $content = $_x->summary_html;
             if ($_x->accepted_suggestion_summary_html) {

+ 1 - 1
resources/views/app/patient/note/note-segment-list-print-v3.blade.php

@@ -3,7 +3,7 @@
     $previousHeading = null;
     $previousSubHeading = null;
     $segments = $note->segments->filter(function ($_x) {
-        $ok = !!$_x->is_active && $_x->segmentTemplate->internal_name !== 'medrisk_vigilence' && strpos($_x->segmentTemplate->internal_name, 'lifestyle_') !== 0;
+        $ok = !!$_x->is_active && $_x->segmentTemplate && $_x->segmentTemplate->internal_name !== 'medrisk_vigilence' && strpos($_x->segmentTemplate->internal_name, 'lifestyle_') !== 0;
         if ($ok) {
             $content = $_x->summary_html;
             if ($_x->accepted_suggestion_summary_html) {

+ 1 - 1
resources/views/app/patient/note/note-segment-list-print.blade.php

@@ -3,7 +3,7 @@
     $previousHeading = null;
     $previousSubHeading = null;
 	$segments = $note->segments->filter(function($_x) {
-		$ok = !!$_x->is_active && $_x->segmentTemplate->internal_name !== 'medrisk_vigilence' && strpos($_x->segmentTemplate->internal_name, 'lifestyle_') !== 0;
+		$ok = !!$_x->is_active && $_x->segmentTemplate && $_x->segmentTemplate->internal_name !== 'medrisk_vigilence' && strpos($_x->segmentTemplate->internal_name, 'lifestyle_') !== 0;
         if($ok) {
             $content = $_x->summary_html;
             if ($_x->accepted_suggestion_summary_html) {

+ 1 - 0
resources/views/app/patient/note/note-segment-list-single-col.blade.php

@@ -3,6 +3,7 @@ $previousHeading = null;
 $previousSubHeading = null;
 ?>
 @foreach($segments as $segment)
+    @if($segment->segmentTemplate) @continue @endif
     @if($segment->segmentTemplate->internal_name !== 'medrisk_vigilence')
         <?php
         if ($segment->heading !== $previousHeading) {

+ 1 - 0
resources/views/app/patient/note/note-segment-list-slim.blade.php

@@ -7,6 +7,7 @@
     $previousSubHeading = null;
     ?>
     @foreach($note->segmentsLeft as $segment)
+        @if(!$segment->segmentTemplate) @continue @endif
         <?php
         if ($segment->heading !== $previousHeading) {
             if (!empty($previousHeading)) {

+ 1 - 0
resources/views/app/patient/note/note-segment-list.blade.php

@@ -7,6 +7,7 @@
     $previousSubHeading = null;
     ?>
     @foreach($note->segmentsLeft as $segment)
+        @if(!$segment->segmentTemplate) @continue @endif
         <?php
         if ($segment->heading !== $previousHeading) {
             if (!empty($previousHeading)) {

+ 2 - 2
resources/views/app/patient/note/partials/cpp-bills-claims-container.blade.php

@@ -30,8 +30,8 @@
                                     <select name="hcpCompanyProUid" class="form-control form-control-sm">
                                         <option value="">-- select --</option>
                                         @if($note->hcpPro)
-                                            @foreach($note->hcpPro->companyPros as $companyPro)
-                                                <option value="{{$companyPro->uid}}">{{$companyPro->pro->displayName() . ' / ' . $companyPro->company->name}}</option>
+                                            @foreach($noteHcpCompanyPros as $companyPro)
+                                                <option value="{{$companyPro->uid}}">{{$companyPro->pro_display_name . ' / ' . $companyPro->company_name}}</option>
                                             @endforeach
                                         @endif
                                     </select>

+ 3 - 0
resources/views/app/patient/note/pdf.blade.php

@@ -140,6 +140,9 @@
 
     // find and store handle to specific segments
     foreach($note->segments as $segment) {
+        if(!$segment->segmentTemplate){
+            continue;
+        } 
         switch($segment->segmentTemplate->internal_name) {
             case 'plan_allergies':
                 $allergiesSegment = $segment;

+ 4 - 4
resources/views/app/patient/note/segment-always-open.blade.php

@@ -1,5 +1,5 @@
 <?php
-$iName = $segment->segmentTemplate->internal_name;
+$iName = $segment->segmentTemplate ? $segment->segmentTemplate->internal_name;: '';
 $wizardPowered = [
     'omega_medications',
     'omega_problems',
@@ -11,7 +11,7 @@ $wizardPowered = [
 <div class="border-bottom note-section visit-segment outline-0 {{$note->is_signed_by_hcp ? 'events-none' : (in_array($iName, $wizardPowered) !== FALSE ? 'edit-trigger' : 'edit')}}"
      data-segment-uid="{{ $segment->uid }}"
      data-segment-template-uid="{{ $segment->segmentTemplate->uid }}"
-     data-segment-template-name="{{ $segment->segmentTemplate->internal_name }}">
+     data-segment-template-name="{{ $iName }}">
 
     <div class="bg-white text-dark px-2 py-1">
         <div class="d-flex align-items-baseline">
@@ -39,13 +39,13 @@ $wizardPowered = [
             @endif
 
             {{-- if segment has log feature, link --}}
-            @if($pro->pro_type === 'ADMIN' && file_exists(resource_path("views/app/patient/segment-templates/{$segment->segmentTemplate->internal_name}/log.blade.php")))
+            @if($pro->pro_type === 'ADMIN' && file_exists(resource_path("views/app/patient/segment-templates/{$iName}/log.blade.php")))
                 <a native="" target="_blank"
                    class="c-pointer ml-2 text-decoration-none"
                    open-in-stag-popup=""
                    title="{{$segment->display_title}} - Change Log"
                    popup-style="medium"
-                   href="/note-segment-view/{{$patient->uid}}/{{$note->uid}}/{{$segment->uid}}/<?= $segment->segmentTemplate->internal_name ?>/log">
+                   href="/note-segment-view/{{$patient->uid}}/{{$note->uid}}/{{$segment->uid}}/<?= $iName ?>/log">
                     <i class="fas fa-history on-hover-opaque"></i>
                 </a>
             @endif

+ 2 - 2
resources/views/app/patient/note/segment-print-v3.blade.php

@@ -1,9 +1,9 @@
-<?php $iName = $segment->segmentTemplate->internal_name; ?>
+<?php $iName = $segment->segmentTemplate ? $segment->segmentTemplate->internal_name : ''; ?>
 <?php $isLSSegment = strpos($iName, 'lifestyle_') === 0; ?>
 <div class="note-section visit-segment mb-3 {{strpos($iName, 'lifestyle_') === 0 && $iName !== 'lifestyle_general' ? 'zero-height' : ''}}"
      data-segment-uid="{{ $segment->uid }}"
      data-segment-template-uid="{{ $segment->segmentTemplate->uid }}"
-     data-segment-template-name="{{ $segment->segmentTemplate->internal_name }}">
+     data-segment-template-name="{{ $iName }}">
 
     <div class="d-flex align-items-baseline">
         <span class="font-weight-bold d-flex align-items-center {{$isLSSegment || $iName === 'medrisk_vigilence' ? '' : 'xxxmb-2'}}" style="">