|
@@ -0,0 +1,118 @@
|
|
|
+<?php
|
|
|
+$currentValue = '';
|
|
|
+$previousValue = '';
|
|
|
+$previousChildPlan = null;
|
|
|
+if (@$point) {
|
|
|
+ if ($point->lastChildPlan && $point->last_child_plan_point_scoped_note_id === $note->id) {
|
|
|
+ $parsedPlan = json_decode($point->lastChildPlan->data);
|
|
|
+ if(@$parsedPlan->value) {
|
|
|
+ $currentValue = $parsedPlan->value;
|
|
|
+ $previousChildPlan = \App\Models\Point::where('id', '<', $point->lastChildPlan->id)
|
|
|
+ ->where('category', 'PLAN')
|
|
|
+ ->where('parent_point_id', $point->id)
|
|
|
+ ->orderBy('id', 'DESC')
|
|
|
+ ->first();
|
|
|
+ if($previousChildPlan && $previousChildPlan->data) {
|
|
|
+ $parsedPlan = json_decode($previousChildPlan->data);
|
|
|
+ $previousValue = $parsedPlan->value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $previousChildPlan = \App\Models\Point::where('parent_point_id', $point->id)
|
|
|
+ ->where('category', 'PLAN')
|
|
|
+ ->orderBy('id', 'DESC')
|
|
|
+ ->first();
|
|
|
+ if($previousChildPlan && $previousChildPlan->data) {
|
|
|
+ $parsedPlan = json_decode($previousChildPlan->data);
|
|
|
+ if(@$parsedPlan->value) {
|
|
|
+ $previousValue = $parsedPlan->value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+?>
|
|
|
+<div moe wide relative class="d-inline">
|
|
|
+ <a start show href="#" class="px-1 text-center d-block" title="<?= !empty($currentValue) ? 'Edit Plan' : 'Add Plan'?>">
|
|
|
+ <i class="fa <?= !empty($currentValue) ? 'fa-pencil-alt' : 'fa-plus-square'?>"></i>
|
|
|
+ </a>
|
|
|
+ <?php if($point): ?>
|
|
|
+ <form url="/api/visitPoint/upsertChildPlan" 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 Plan / <?= friendlier_date($previousChildPlan->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>Change goal:</b></p>
|
|
|
+
|
|
|
+ <div class="mb-2">
|
|
|
+ <div note-rte
|
|
|
+ <?= $segment->segmentTemplate->internal_name === 'intake_problems' ? 'use-shortcuts="hpi,user"' : '' ?>
|
|
|
+ class="form-group mb-2 border-left border-right rte-holder"
|
|
|
+ data-field-name="value"><?= $currentValue ?></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 Plan / <?= friendlier_date($previousChildPlan->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 (soda, sweet-tea, coffee, juice, etc.)</b></p>
|
|
|
+
|
|
|
+ <div class="mb-2">
|
|
|
+ <div note-rte
|
|
|
+ class="form-group mb-2 border-left border-right rte-holder"
|
|
|
+ data-field-name="planValue"><?= $currentValue ?></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($currentValue)): ?>
|
|
|
+ <div visit-moe relative class="d-inline">
|
|
|
+ <a start show href="#" class="px-1 text-center d-block" title="Delete Plan">
|
|
|
+ <i class="fa fa-trash-alt text-danger on-hover-opaque"></i>
|
|
|
+ </a>
|
|
|
+ <form url="/api/visitPoint/destroyCurrentChildPlan" class="mcp-theme-1" right>
|
|
|
+ <input type="hidden" name="uid" value="<?= $point->uid ?>">
|
|
|
+
|
|
|
+ <p class="mb-2">Delete this plan?</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; ?>
|
|
|
+
|