Просмотр исходного кода

plan/intake nutrition - summary html

Vijayakrishnan 3 лет назад
Родитель
Сommit
79770ad75a

+ 1 - 0
public/js/stag-popup.js

@@ -34,6 +34,7 @@ function submitStagPopup(_form) {
     return false;
 }
 function closeStagPopup(_noEvent = false) {
+    hideMoeFormMask();
     if(!stagPopupsQueue.length) return false;
     let popup = stagPopupsQueue[stagPopupsQueue.length - 1];
     let closeAll = !!popup.attr('close-all-with-self');

+ 0 - 4
resources/views/app/patient/segment-templates/intake_nutrition/edit.blade.php

@@ -1,4 +0,0 @@
-<?php
-$category = 'ROS';
-$endPoint = 'upsertNoteSingleton';
-include resource_path('views/app/patient/segment-templates/_simple_text_segment/edit.php');

+ 54 - 2
resources/views/app/patient/segment-templates/intake_nutrition/summary.blade.php

@@ -1,3 +1,55 @@
 <?php
-$category = 'ROS';
-include resource_path('views/app/patient/segment-templates/_simple_text_segment/summary.php');
+
+use App\Models\Point;
+
+/** @var \App\Models\Client $patient */
+
+$highSugarBeverages = Point::getOnlyPointOfCategory($patient, 'HIGH_SUGAR_BEVERAGES');
+$waterIntake = Point::getOnlyPointOfCategory($patient, 'WATER_INTAKE');
+$fastFood = Point::getOnlyPointOfCategory($patient, 'FAST_FOOD');
+$snacks = Point::getOnlyPointOfCategory($patient, 'SNACKS');
+$vegetables = Point::getOnlyPointOfCategory($patient, 'VEGETABLES');
+$portionSizes = Point::getOnlyPointOfCategory($patient, 'PORTION_SIZES');
+$dailyIntakeCarbohydrates = Point::getOnlyPointOfCategory($patient, 'DAILY_INTAKE_CARBOHYDRATES');
+$dailyIntakeCalories = Point::getOnlyPointOfCategory($patient, 'DAILY_INTAKE_CALORIES');
+
+$points = [
+    ["category" => 'HIGH_SUGAR_BEVERAGES', "name" => 'High Sugar Beverages', "point" => $highSugarBeverages],
+    ["category" => 'WATER_INTAKE', "name" => 'Water Intake', "point" => $waterIntake],
+    ["category" => 'FAST_FOOD', "name" => 'Fast Food', "point" => $fastFood],
+    ["category" => 'SNACKS', "name" => 'Snacks', "point" => $snacks],
+    ["category" => 'VEGETABLES', "name" => 'Vegetables', "point" => $vegetables],
+    ["category" => 'PORTION_SIZES', "name" => 'Portion Sizes', "point" => $portionSizes],
+    ["category" => 'DAILY_INTAKE_CARBOHYDRATES', "name" => 'Daily Intake Carbohydrates', "point" => $dailyIntakeCarbohydrates],
+    ["category" => 'DAILY_INTAKE_CALORIES', "name" => 'Daily Intake Calories', "point" => $dailyIntakeCalories],
+];
+?>
+
+<?php foreach ($points as $p): ?>
+<?php $point = $p['point']; ?>
+<?php if(!!$point): ?>
+<?php $review = $point->lastChildReview; ?>
+<?php if ($review && @($review->data)) $review->data = json_decode($review->data); ?>
+<div class="mb-2">
+    <div class="d-flex align-items-baseline">
+        <b><?= $p['name'] ?></b>
+    </div>
+    <?php if(!!$review): ?>
+    <div class="pl-3 mt-1 d-flex align-items-baseline">
+        <span class="text-secondary font-weight-bold mr-2">Subjective:</span>
+        <div>
+            <?php if($p['category'] === 'FAST_FOOD'): ?>
+                <div class="mb-1"><span class="text-sm">Meals per week:</span> <?= @$review->data->mealsPerWeek ? strip_tags($review->data->mealsPerWeek) : '' ?></div>
+                <div class="mb-1"><span class="text-sm">Self-prepared meals per week:</span> <?= @$review->data->selfPrepMealsPerWeek ? strip_tags($review->data->selfPrepMealsPerWeek) : '' ?></div>
+            <?php elseif ($p['category'] === 'SNACKS'): ?>
+                <div class="mb-1"><span class="text-sm">Unhealthy snacks:</span> <?= @$review->data->unhealthySnacks ? strip_tags($review->data->unhealthySnacks) : '' ?></div>
+                <div class="mb-1"><span class="text-sm">Healthy snacks:</span> <?= @$review->data->healthySnacks ? strip_tags($review->data->healthySnacks) : '' ?></div>
+            <?php else: ?>
+                <span>{!! $review->data->value ? strip_tags($review->data->value) : '-' !!}</span>
+            <?php endif; ?>
+        </div>
+    </div>
+    <?php endif; ?>
+</div>
+<?php endif; ?>
+<?php endforeach; ?>

+ 0 - 4
resources/views/app/patient/segment-templates/plan_nutrition/edit.blade.php

@@ -1,4 +0,0 @@
-<?php
-$category = 'ROS';
-$endPoint = 'upsertNoteSingleton';
-include resource_path('views/app/patient/segment-templates/_simple_text_segment/edit.php');

+ 44 - 2
resources/views/app/patient/segment-templates/plan_nutrition/summary.blade.php

@@ -1,3 +1,45 @@
 <?php
-$category = 'ROS';
-include resource_path('views/app/patient/segment-templates/_simple_text_segment/summary.php');
+
+use App\Models\Point;
+
+/** @var \App\Models\Client $patient */
+
+$highSugarBeverages = Point::getOnlyPointOfCategory($patient, 'HIGH_SUGAR_BEVERAGES');
+$waterIntake = Point::getOnlyPointOfCategory($patient, 'WATER_INTAKE');
+$fastFood = Point::getOnlyPointOfCategory($patient, 'FAST_FOOD');
+$snacks = Point::getOnlyPointOfCategory($patient, 'SNACKS');
+$vegetables = Point::getOnlyPointOfCategory($patient, 'VEGETABLES');
+$portionSizes = Point::getOnlyPointOfCategory($patient, 'PORTION_SIZES');
+$dailyIntakeCarbohydrates = Point::getOnlyPointOfCategory($patient, 'DAILY_INTAKE_CARBOHYDRATES');
+$dailyIntakeCalories = Point::getOnlyPointOfCategory($patient, 'DAILY_INTAKE_CALORIES');
+
+$points = [
+    ["category" => 'HIGH_SUGAR_BEVERAGES', "name" => 'High Sugar Beverages', "point" => $highSugarBeverages],
+    ["category" => 'WATER_INTAKE', "name" => 'Water Intake', "point" => $waterIntake],
+    ["category" => 'FAST_FOOD', "name" => 'Fast Food', "point" => $fastFood],
+    ["category" => 'SNACKS', "name" => 'Snacks', "point" => $snacks],
+    ["category" => 'VEGETABLES', "name" => 'Vegetables', "point" => $vegetables],
+    ["category" => 'PORTION_SIZES', "name" => 'Portion Sizes', "point" => $portionSizes],
+    ["category" => 'DAILY_INTAKE_CARBOHYDRATES', "name" => 'Daily Intake Carbohydrates', "point" => $dailyIntakeCarbohydrates],
+    ["category" => 'DAILY_INTAKE_CALORIES', "name" => 'Daily Intake Calories', "point" => $dailyIntakeCalories],
+];
+?>
+
+<?php foreach ($points as $p): ?>
+<?php $point = $p['point']; ?>
+<?php if(!!$point): ?>
+<?php $plan = $point->lastChildPlan; ?>
+<?php if($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
+<div class="mb-2">
+    <div class="d-flex align-items-baseline">
+        <b><?= $p['name'] ?></b>
+    </div>
+    <?php if(!!$plan): ?>
+    <div class="pl-3 mt-1 d-flex align-items-baseline">
+        <span class="text-secondary font-weight-bold mr-2">Plan:</span>
+        <span>{!! $plan->data->value ? strip_tags($plan->data->value) : '-' !!}</span>
+    </div>
+    <?php endif; ?>
+</div>
+<?php endif; ?>
+<?php endforeach; ?>