|
@@ -0,0 +1,131 @@
|
|
|
+<?php
|
|
|
+$currentUnhealthySnacks = '';
|
|
|
+$currentHealthySnacks = '';
|
|
|
+$previousValue = '';
|
|
|
+$previousChildReview = null;
|
|
|
+if (@$point) {
|
|
|
+ if ($point->lastChildReview && $point->last_child_review_point_scoped_note_id === $note->id) {
|
|
|
+ $parsedReview = json_decode($point->lastChildReview->data);
|
|
|
+ $currentUnhealthySnacks = @($parsedReview->unhealthySnacks) ?: '';
|
|
|
+ $currentHealthySnacks = @($parsedReview->healthySnacks) ?: '';
|
|
|
+ $previousChildReview = \App\Models\Point::where('id', '<', $point->lastChildReview->id)
|
|
|
+ ->where('category', 'REVIEW')
|
|
|
+ ->where('parent_point_id', $point->id)
|
|
|
+ ->orderBy('id', 'DESC')
|
|
|
+ ->first();
|
|
|
+ if($previousChildReview && $previousChildReview->data) {
|
|
|
+ $parsedReview = json_decode($previousChildReview->data);
|
|
|
+ $previousValue = '<span class="text-sm">Unhealthy snacks:</span> ' . (@($parsedReview->unhealthySnacks) ? strip_tags($parsedReview->unhealthySnacks) : '-') . '<br>' .
|
|
|
+ '<span class="text-sm">Healthy snacks:</span> ' . (@($parsedReview->healthySnacks) ? strip_tags($parsedReview->healthySnacks) : '-');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $previousChildReview = \App\Models\Point::where('parent_point_id', $point->id)
|
|
|
+ ->where('category', 'REVIEW')
|
|
|
+ ->orderBy('id', 'DESC')
|
|
|
+ ->first();
|
|
|
+ if($previousChildReview && $previousChildReview->data) {
|
|
|
+ $parsedReview = json_decode($previousChildReview->data);
|
|
|
+ $previousValue = '<span class="text-sm">Unhealthy snacks:</span> ' . (@($parsedReview->unhealthySnacks) ? strip_tags($parsedReview->unhealthySnacks) : '-') . '<br>' .
|
|
|
+ '<span class="text-sm">Healthy snacks:</span> ' . (@($parsedReview->healthySnacks) ? strip_tags($parsedReview->healthySnacks) : '-');
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+?>
|
|
|
+<div moe wide relative class="d-inline">
|
|
|
+ <a start show href="#" class="px-1 text-center d-block" title="<?= !empty($currentUnhealthySnacks) || !empty($currentHealthySnacks) ? 'Edit Subjective' : 'Add Subjective'?>">
|
|
|
+ <i class="fa <?= !empty($currentUnhealthySnacks) || !empty($currentHealthySnacks) ? 'fa-pencil-alt' : 'fa-plus-square'?>"></i>
|
|
|
+ </a>
|
|
|
+ <?php if($point): ?>
|
|
|
+ <form url="/api/visitPoint/upsertChildReview" class="mcp-theme-1" right>
|
|
|
+ <input type="hidden" name="uid" value="<?= $point->uid ?>">
|
|
|
+ <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
|
|
|
+ <input type="hidden" name="data">
|
|
|
+
|
|
|
+ <?php if($segment->segmentTemplate->internal_name === 'intake_problems' && $previousValue): ?>
|
|
|
+ <div class="d-none disallow-if-value-same-as"><?= str_compact($previousValue) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+
|
|
|
+ <?php if($previousValue): ?>
|
|
|
+ <div class="mb-2">
|
|
|
+ <div class="d-flex align-items-baseline mb-1">
|
|
|
+ <span class="text-sm text-secondary">Previous Subjective / <?= friendlier_date($previousChildReview->created_at) ?>) (click to copy)</span>
|
|
|
+ </div>
|
|
|
+ <div class="p-2 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
|
|
|
+ </div>
|
|
|
+ <?php endif; ?>
|
|
|
+
|
|
|
+ <p class="mb-2"><b>Current Consumption</b></p>
|
|
|
+
|
|
|
+ <p class="mb-1"><img class="icon-nutrition-rx-row-sm" src="/img/nutrition-rx/us.png"> Unhealthy Snacks</p>
|
|
|
+ <div class="mb-2">
|
|
|
+ <div note-rte slim-rte class="form-group mb-2 border-left border-right rte-holder"
|
|
|
+ data-field-name="unhealthySnacks"><?= $currentUnhealthySnacks ?></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <p class="mb-1"><img class="icon-nutrition-rx-row-sm" src="/img/nutrition-rx/hs.png"> Healthy Snacks</p>
|
|
|
+ <div class="mb-2">
|
|
|
+ <div note-rte slim-rte class="form-group mb-2 border-left border-right rte-holder"
|
|
|
+ data-field-name="healthySnacks"><?= $currentHealthySnacks ?></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div>
|
|
|
+ <button submit class="btn btn-sm btn-primary mr-2">Save</button>
|
|
|
+ <button cancel class="btn btn-sm btn-default border">Cancel</button>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ <?php else: ?>
|
|
|
+ <form url="/api/visitPoint/addTopLevel" class="mcp-theme-1 frm-add-review-plan-nutrition" right>
|
|
|
+ <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
|
|
|
+ <input type="hidden" name="category" value="<?= $p['category'] ?>">
|
|
|
+ <input type="hidden" name="additionReasonCategory" value="ON_INTAKE">
|
|
|
+ <input type="hidden" name="data">
|
|
|
+
|
|
|
+ <?php if($previousValue): ?>
|
|
|
+ <div class="mb-2">
|
|
|
+ <div class="d-flex align-items-baseline mb-1">
|
|
|
+ <span class="text-sm text-secondary">Previous Subjective / <?= friendlier_date($previousChildReview->created_at) ?>) (click to copy)</span>
|
|
|
+ </div>
|
|
|
+ <div class="p-2 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
|
|
|
+ </div>
|
|
|
+ <?php endif; ?>
|
|
|
+
|
|
|
+ <p class="mb-2"><b>Current Consumption</b></p>
|
|
|
+
|
|
|
+ <p class="mb-1"><img class="icon-nutrition-rx-row-sm" src="/img/nutrition-rx/us.png"> Unhealthy Snacks</p>
|
|
|
+ <div class="mb-2">
|
|
|
+ <div note-rte slim-rte class="form-group mb-2 border-left border-right rte-holder"
|
|
|
+ data-field-name="reviewValue__unhealthySnacks"></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <p class="mb-1"><img class="icon-nutrition-rx-row-sm" src="/img/nutrition-rx/hs.png"> Healthy Snacks</p>
|
|
|
+ <div class="mb-2">
|
|
|
+ <div note-rte slim-rte class="form-group mb-2 border-left border-right rte-holder"
|
|
|
+ data-field-name="reviewValue__healthySnacks"></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div>
|
|
|
+ <button type="submit" class="btn btn-sm btn-primary mr-2">Save</button>
|
|
|
+ <button cancel class="btn btn-sm btn-default border">Cancel</button>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ <?php endif; ?>
|
|
|
+</div>
|
|
|
+<?php if(!empty($currentUnhealthySnacks) || !empty($currentHealthySnacks)): ?>
|
|
|
+ <div visit-moe relative class="d-inline">
|
|
|
+ <a start show href="#" class="px-1 text-center d-block" title="Delete Subjective">
|
|
|
+ <i class="fa fa-trash-alt text-danger on-hover-opaque"></i>
|
|
|
+ </a>
|
|
|
+ <form url="/api/visitPoint/destroyCurrentChildReview" class="mcp-theme-1" right>
|
|
|
+ <input type="hidden" name="uid" value="<?= $point->uid ?>">
|
|
|
+
|
|
|
+ <p class="mb-2">Delete this subjective?</p>
|
|
|
+
|
|
|
+ <div>
|
|
|
+ <button submit class="btn btn-sm btn-danger mr-2">Delete</button>
|
|
|
+ <button cancel class="btn btn-sm btn-default border">Cancel</button>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+<?php endif; ?>
|
|
|
+
|