|
@@ -0,0 +1,81 @@
|
|
|
+<?php
|
|
|
+$currentValue = '';
|
|
|
+$previousValue = '';
|
|
|
+$previousChildReview = null;
|
|
|
+if ($point->last_child_review_point_id && $point->last_child_review_data && $point->last_child_review_point_scoped_note_id === $note->id) {
|
|
|
+ $parsedReview = json_decode($point->last_child_review_data);
|
|
|
+ if(@$parsedReview->value) {
|
|
|
+ $currentValue = $parsedReview->value;
|
|
|
+ $previousChildReview = \App\Models\Point::where('id', '<', $point->last_child_review_point_id)
|
|
|
+ ->where('category', 'REVIEW')
|
|
|
+ ->where('parent_point_id', $point->id)
|
|
|
+ ->orderBy('id', 'DESC')
|
|
|
+ ->first();
|
|
|
+ if($previousChildReview && $previousChildReview->data) {
|
|
|
+ $parsedReview = json_decode($previousChildReview->data);
|
|
|
+ $previousValue = $parsedReview->value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+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);
|
|
|
+ if(@$parsedReview->value) {
|
|
|
+ $previousValue = $parsedReview->value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+?>
|
|
|
+<div visit-moe large relative class="d-inline">
|
|
|
+ <a start show href="#" class="mr-2 text-sm text-center" title="<?= !empty($currentValue) ? 'Edit Subjective' : 'Add Subjective'?>">
|
|
|
+ <?= !empty($currentValue) ? 'Edit' : 'Add'?>
|
|
|
+ </a>
|
|
|
+ <form url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
|
|
|
+ <input type="hidden" name="uid" value="<?= $point->uid ?>">
|
|
|
+ <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
|
|
|
+ <input type="hidden" name="data">
|
|
|
+
|
|
|
+ <p class="mb-2"><b>Subjective</b></p>
|
|
|
+
|
|
|
+ <?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-1 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
|
|
|
+ </div>
|
|
|
+ <?php endif; ?>
|
|
|
+
|
|
|
+ <div class="mb-2">
|
|
|
+ <div note-rte
|
|
|
+ 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>
|
|
|
+</div>
|
|
|
+<?php if(!empty($currentValue)): ?>
|
|
|
+ <div visit-moe relative class="d-inline">
|
|
|
+ <a start show href="#" class="mr-2 text-sm text-center" title="Undo Changes">
|
|
|
+ Undo
|
|
|
+ </a>
|
|
|
+ <form url="/api/visitPoint/destroyCurrentChildReview" class="mcp-theme-1">
|
|
|
+ <input type="hidden" name="uid" value="<?= $point->uid ?>">
|
|
|
+
|
|
|
+ <p class="mb-2 text-nowrap">Undo Changes?</p>
|
|
|
+
|
|
|
+ <div class="text-nowrap">
|
|
|
+ <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; ?>
|
|
|
+
|