Преглед изворни кода

Respect the order in config > note_rhs_segments

Vijayakrishnan пре 3 година
родитељ
комит
5da0211dc9
1 измењених фајлова са 23 додато и 24 уклоњено
  1. 23 24
      resources/views/app/patient/note/note-segment-list-rhs.blade.php

+ 23 - 24
resources/views/app/patient/note/note-segment-list-rhs.blade.php

@@ -2,31 +2,30 @@
     <?php
     $previousHeading = null;
     $previousSubHeading = null;
+	$rhsSegments = config('app.note_rhs_segments');
     ?>
-    @foreach($note->segments as $segment)
-        @if(in_array($segment->segmentTemplate->internal_name, config('app.note_rhs_segments')))
-        <?php
-        if ($segment->heading !== $previousHeading) {
-            if (!empty($previousHeading)) {
-                echo '</div></div>'; // <!-- end the previous parent section -->
-            }
-            if (!empty($segment->heading)) {
-
-	?>
-	<div class="note-content-node note-content-heading">
-		<div class="py-2 px-3 border-bottom font-size-16 font-weight-bold bg-light text-secondary {{ $previousHeading ? 'mt-4 border-top' : '' }}">
-			{{ $segment->heading }}
-		</div>
-		<div class="note-content-children ml-5 border-left">
-			<!-- open new node -->
-        <?php
-	    }
-            $previousHeading = $segment->heading;
-        }
-        ?>
-        <div>
-            @include('app.patient.note.segment')
-        </div>
+    @foreach($rhsSegments as $segmentIName)
+		<?php $segment = $note->getSegmentByInternalName($segmentIName); ?>
+		@if(!!$segment)
+		<?php
+		if ($segment->heading !== $previousHeading) {
+			if (!empty($previousHeading)) {
+				echo '</div></div>'; // <!-- end the previous parent section -->
+			}
+			if (!empty($segment->heading)) {
+			?>
+			<div class="note-content-node note-content-heading">
+				<div class="py-2 px-3 border-bottom font-size-16 font-weight-bold bg-light text-secondary {{ $previousHeading ? 'mt-4 border-top' : '' }}">
+					{{ $segment->heading }}
+				</div>
+				<div class="note-content-children ml-5 border-left">
+				<!-- open new node -->
+			<?php
+			}
+			$previousHeading = $segment->heading;
+		}
+		?>
+        <div>@include('app.patient.note.segment')</div>
         @endif
     @endforeach
     <?php