Kaynağa Gözat

Dx - HPI/Plan - Copy from previous

Vijayakrishnan 4 yıl önce
ebeveyn
işleme
4f1ad5c0e3

+ 13 - 0
resources/views/app/patient/canvas-sections/dx/form.blade.php

@@ -133,6 +133,9 @@ $formID = rand(0, 100000);
                     <b><i class="fa fa-clock mr-1 text-sm"></i>Previous HPI: </b><br>
                     <div v-html="item.previous_hpi"></div>
                 </div>
+                <a v-if="item.previous_hpi" href="#"
+                   v-on:click.prevent="item.detail = item.previous_hpi"
+                   class="d-block py-1 px-2 border-bottom">Copy from previous</a>
                 <textarea type="text" class="form-control form-control-sm" v-model="item.detail" placeholder="Updated HPI *"></textarea>
             </td>
             <td @if(@$note) v-show="inclusion[index]" @endif>
@@ -140,6 +143,9 @@ $formID = rand(0, 100000);
                     <b><i class="fa fa-clock mr-1 text-sm"></i>Previous Plan: </b><br>
                     <div v-html="item.previous_plan"></div>
                 </div>
+                <a v-if="item.previous_plan" href="#"
+                   v-on:click="copyPreviousPlan(item, index, $event)"
+                   class="d-block py-1 px-2 border-bottom">Copy from previous</a>
                 <textarea type="text" class="form-control form-control-sm"
                           dx-rte :data-index="index" data-field="plan"
                           v-model="item.plan"></textarea>
@@ -252,6 +258,13 @@ $formID = rand(0, 100000);
                     }
                 },
                 methods: {
+                    copyPreviousPlan: function(item, index, trigger) {
+                        item.plan = item.previous_plan;
+                        Vue.nextTick(() => {
+                            $(trigger.currentTarget).closest('td').find('.ql-editor').html(item.plan);
+                        });
+                        return false;
+                    },
                     includeAllChanged: function() {
                         for (let i = 0; i < this.items.length; i++) {
                             this.inclusion[i] = this.includeAll; // NOTE: this does not trigger a watch event