Explorar el Código

Visit UI - goals - functionality update (wip)

Vijayakrishnan hace 3 años
padre
commit
cd382e132b

+ 26 - 6
resources/views/app/patient/segment-templates/intake_goals/edit.blade.php

@@ -18,19 +18,28 @@ $goals = Point::getIntakePointsOfCategory($patient, 'GOAL', $note);
         <table class="table table-sm table-bordered table-striped mb-0 bg-white">
             <thead>
             <tr class="">
+                <th class="border-bottom-0">Category</th>
                 <th class="border-bottom-0">Goal</th>
                 <th class="border-bottom-0">Last Review</th>
                 <th class="border-bottom-0">Last Plan</th>
                 <th class="border-bottom-0">Review Today</th>
             </tr>
             </thead>
+            <?php $previousCategory = null; ?>
             <?php foreach($goals as $goal): ?>
+                <?php if(@($goal->data->category)): ?>
                 <tr>
+                    <td>
+                        <?php if($previousCategory === $goal->data->category): ?>
+                            <span class="text-secondary"><?= $goal->data->category ?></span>
+                        <?php else: ?>
+                            <span class="font-weight-bold"><?= $goal->data->category ?></span>
+                        <?php endif; ?>
+                    </td>
                     <td>
                         <div class="d-flex align-items-baseline">
                             <div class="<?= $goal->is_removed ? 'strike-through' : '' ?>">
-                                <b><?= !!@($goal->data->name) ? @($goal->data->name) : '-' ?></b>
-                                <?= !!@($goal->data->description) ? '/&nbsp;' . @($goal->data->description) : '' ?>
+                                <?= !!@($goal->data->goal) ? @($goal->data->goal) : '' ?>
                             </div>
 
                             <!-- common actions -->
@@ -86,6 +95,8 @@ $goals = Point::getIntakePointsOfCategory($patient, 'GOAL', $note);
                         ?>
                     </td>
                 </tr>
+                <?php $previousCategory = $goal->data->category; ?>
+                <?php endif; ?>
             <?php endforeach; ?>
         </table>
     </div>
@@ -100,12 +111,21 @@ $goals = Point::getIntakePointsOfCategory($patient, 'GOAL', $note);
             <p class="mb-2"><b>Add Goal (on intake)</b></p>
 
             <div class="mb-2">
-                <label class="text-sm text-secondary mb-1">Name</label>
-                <input type="text" data-name="name" class="form-control form-control-sm">
+                <label class="text-sm text-secondary mb-1">Category</label>
+                <select type="text" data-name="category" class="form-control form-control-sm">
+                    <option value="">-- select --</option>
+                    <option value="NUTRITION">NUTRITION</option>
+                    <option value="ACTIVITY">ACTIVITY</option>
+                    <option value="SLEEP">SLEEP</option>
+                    <option value="SOCIAL CONNECTION">SOCIAL CONNECTION</option>
+                    <option value="STRESS REDUCTION">STRESS REDUCTION</option>
+                    <option value="RISKY SUBSTANCE AVOIDANCE">RISKY SUBSTANCE AVOIDANCE</option>
+                    <option value="OTHER">OTHER</option>
+                </select>
             </div>
             <div class="mb-2">
-                <label class="text-sm text-secondary mb-1">Description</label>
-                <textarea type="text" data-name="description" class="form-control form-control-sm"></textarea>
+                <label class="text-sm text-secondary mb-1">Goal</label>
+                <textarea type="text" data-name="goal" class="form-control form-control-sm" rows="3"></textarea>
             </div>
 
             <div>

+ 31 - 22
resources/views/app/patient/segment-templates/intake_goals/summary.blade.php

@@ -6,32 +6,41 @@ use App\Models\Point;
 
 $goals = Point::getIntakePointsOfCategory($patient, 'GOAL', $note);
 
+$grouped = [];
+foreach($goals as $goal) {
+    if(!@($goal->data->category)) continue;
+    if(!isset($grouped[$goal->data->category])) {
+        $grouped[$goal->data->category] = [];
+    }
+    $grouped[$goal->data->category][] = $goal;
+}
 ?>
 
-<?php if (!count($goals)): ?>
-    <div class="text-secondary">No care team members</div>
+<?php if (!count($grouped)): ?>
+    <div class="text-secondary">No goals</div>
 <?php else: ?>
-    <?php foreach ($goals as $goal): ?>
-        <div class="mb-2">
-            <div class="d-flex align-items-baseline">
-                <div class="<?= $goal->is_removed ? 'strike-through' : '' ?>">
-                    <b><?= !!@($goal->data->name) ? @($goal->data->name) : '-' ?></b>
-                    <?= !!@($goal->data->description) ? '/&nbsp;' . @($goal->data->description) : '' ?>
+    <?php foreach($grouped as $k => $group): ?>
+        <b><?= $k ?></b>
+        <?php foreach($group as $goal): ?>
+            <div class="mb-2">
+                <div class="d-flex align-items-baseline">
+                    <div class="<?= $goal->is_removed ? 'strike-through' : '' ?>">
+                        <?= !!@($goal->data->goal) ? @($goal->data->goal) : '' ?>
+                    </div>
+                    <?php if ($goal->is_removed): ?>
+                        <span class="ml-2 text-sm text-secondary">Removed on intake</span>
+                    <?php elseif ($goal->added_in_note_id === $note->id): ?>
+                        <span class="ml-2 text-sm text-success">* Added on intake</span>
+                    <?php endif; ?>
+                </div>
+                <?php $review = $goal->childReviewAddedInNote($note); ?>
+                <?php if(!!$review): ?>
+                <div class="pl-3 mt-1">
+                    <div class="text-secondary font-weight-bold">Review</div>
+                    <div>{!! $review->data->value !!}</div>
                 </div>
-                <?php if ($goal->is_removed): ?>
-                    <span class="ml-2 text-sm text-secondary">Removed on intake</span>
-                <?php elseif ($goal->added_in_note_id === $note->id): ?>
-                    <span class="ml-2 text-sm text-success">* Added on intake</span>
                 <?php endif; ?>
             </div>
-            <?php $review = $goal->childReviewAddedInNote($note); ?>
-            <?php if(!!$review): ?>
-            <div class="pl-3 mt-1">
-                <div class="text-secondary font-weight-bold">Review</div>
-                <div>{!! $review->data->value !!}</div>
-            </div>
-            <?php endif; ?>
-        </div>
+        <?php endforeach; ?>
     <?php endforeach; ?>
-<?php endif; ?>
-
+<?php endif; ?>