|
@@ -1 +1,114 @@
|
|
|
-<h1>Edit for history_screenings</h1>
|
|
|
+<?php
|
|
|
+
|
|
|
+use App\Models\Client;
|
|
|
+use App\Models\Point;
|
|
|
+use App\Models\Note;
|
|
|
+/** @var Client $patient */
|
|
|
+/** @var Note $note */
|
|
|
+
|
|
|
+// try loading afresh - since base section might have gotten dynamically updated
|
|
|
+$point = Point::getGlobalSingletonOfCategory($patient, 'SCREENINGS_HISTORY', true);
|
|
|
+
|
|
|
+$contentData = $parsed = @$point && @$point->data ? $point->data : false;
|
|
|
+
|
|
|
+if(!$contentData) {
|
|
|
+ $contentData = [
|
|
|
+ "count" => 1,
|
|
|
+ "items" => [
|
|
|
+ [
|
|
|
+ "screening" => '',
|
|
|
+ "comments" => '',
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+}
|
|
|
+
|
|
|
+?>
|
|
|
+
|
|
|
+<div class="p-3 border-top mt-3 mcp-theme-1">
|
|
|
+ <div visit-moe close-on-save close-on-cancel class="d-block">
|
|
|
+ <form show url="/api/visitPoint/upsertGlobalSingleton" class="mcp-theme-1">
|
|
|
+ <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
|
|
|
+ <input type="hidden" name="category" value="SCREENINGS_HISTORY">
|
|
|
+ <input type="hidden" name="data">
|
|
|
+
|
|
|
+ <div id="edit-univ_history_screenings-container">
|
|
|
+
|
|
|
+ <div v-for="(item, index) in items" class="note-section-item-row">
|
|
|
+ <div class="row mb-2">
|
|
|
+ <div class="col-md-3">
|
|
|
+ <label class="text-secondary text-sm mb-1 d-block">Screening</label>
|
|
|
+ <input type="text" class="form-control form-control-sm min-width-unset" v-model="item.screening" required>
|
|
|
+ </div>
|
|
|
+ <div class="col-md-2">
|
|
|
+ <label class="text-secondary text-sm mb-1 d-block"> </label>
|
|
|
+ <a v-if="items.length > 1" href="#" v-on:click.prevent="removeItem(index)"
|
|
|
+ class="on-hover-opaque text-danger mt-1 d-inline-block">
|
|
|
+ <i class="fa fa-trash-alt"></i>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="row mb-2">
|
|
|
+ <div class="col-md-12">
|
|
|
+ <textarea class="form-control form-control-sm" type="text" v-model="item.comments" :model-index="index" placeholder="Additional details (optional)">
|
|
|
+ </textarea>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <hr class="m-neg-4">
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="form-group my-2">
|
|
|
+ <button class="btn btn-sm btn-default text-primary border border-primary mr-2"
|
|
|
+ v-on:click.prevent="addItem()"
|
|
|
+ >Add Screening</button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div>
|
|
|
+ <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
|
|
|
+ <button cancel class="btn btn-sm btn-default border">Cancel</button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+<script>
|
|
|
+ (function() {
|
|
|
+
|
|
|
+ window.segmentInitializers.<?= $segment->segmentTemplate->internal_name ?> = function() {
|
|
|
+
|
|
|
+ new Vue({
|
|
|
+ el: '#edit-univ_history_screenings-container',
|
|
|
+ data: {
|
|
|
+ count: {{ $contentData['count'] }},
|
|
|
+ items: <?= json_encode($contentData['items']) ?>
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ $data: {
|
|
|
+ handler: function(val, oldVal) {
|
|
|
+ let parent = $('#edit-univ_history_screenings-container').closest('form');
|
|
|
+ parent.find('[name="data"]').val(JSON.stringify(this.$data));
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ addItem: function() {
|
|
|
+ this.items.push({
|
|
|
+ screening: '',
|
|
|
+ comments: '',
|
|
|
+ });
|
|
|
+ this.count = this.items.length;
|
|
|
+ },
|
|
|
+ removeItem: function(_index) {
|
|
|
+ this.items.splice(_index, 1);
|
|
|
+ this.count = this.items.length;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ }).call(window);
|
|
|
+</script>
|