Prechádzať zdrojové kódy

Updated rx form/summary

Vijayakrishnan 4 rokov pred
rodič
commit
8eae697062

+ 4 - 0
public/css/style.css

@@ -1780,6 +1780,10 @@ form.non-interactive .form-content * {
 }
 [data-type="existing"] {
 
+}
+[data-type="updated"] {
+    font-weight: bold;
+    color: #d8a714;
 }
 [data-type="prescribed today"] {
     font-weight: bold;

+ 19 - 1
resources/views/app/patient/canvas-sections/rx/form.blade.php

@@ -112,6 +112,7 @@ $formID = rand(0, 100000);
                        data-field="strength" v-model="item.strength">
                 <input type="text" :data-index="index"
                        class="form-control form-control-sm"
+                       v-on:change="onItemChange(index)"
                        data-option-list="frequency-options"
                        data-field="frequency" v-model="item.frequency">
                 <div id="frequency-options" class="data-option-list">
@@ -124,7 +125,9 @@ $formID = rand(0, 100000);
                           v-model="item.detail"></textarea>
             </td>
             <td>
-                <textarea class="form-control form-control-sm" v-model="item.notes[item.notes.length-1].text"></textarea>
+                <textarea class="form-control form-control-sm"
+                          v-on:change="onItemChange(index)"
+                          v-model="item.notes[item.notes.length-1].text"></textarea>
             </td>
             <td class="px-2 text-nowrap">
                 <div v-if="item.type !== 'removed'">
@@ -233,6 +236,18 @@ $formID = rand(0, 100000);
                     }
                 },
                 methods: {
+                    onItemChange: function(_index) {
+                        let item = this.items[_index], originalItem = originalItems[_index];
+                        if(item.type === 'existing' && !!originalItem) {
+                            if(item.title !== originalItem.title ||
+                                item.strength !== originalItem.strength ||
+                                item.frequency !== originalItem.frequency ||
+                                item.detail !== originalItem.detail) {
+                                item.type = 'updated';
+                                item.updated_note_uid = '{{@$note->uid}}';
+                            }
+                        }
+                    },
                     addItem: function(_type) {
                         let self = this;
                         this.items.push({
@@ -320,6 +335,7 @@ $formID = rand(0, 100000);
 
                             qe.on('text-change', function() {
                                 self.items[vueIndex][vueField] = qe.root.innerHTML;
+                                self.onItemChange(vueIndex);
                             });
 
                             $(qe.container)
@@ -347,6 +363,7 @@ $formID = rand(0, 100000);
                             window.Def.Autocompleter.Event.observeListSelections(dynID, function() {
                                 var autocomp = elem.autocomp, acData = autocomp.getSelectedItemData();
                                 self.items[vueIndex].title = acData[0].code;
+                                self.onItemChange(vueIndex);
                                 var strengths = acData[0].data['STRENGTHS_AND_FORMS'];
                                 if (strengths) {
                                     strengthElem.autocomp.setListAndField(strengths, '');
@@ -355,6 +372,7 @@ $formID = rand(0, 100000);
                             window.Def.Autocompleter.Event.observeListSelections(dynStrengthsID, function() {
                                 var autocomp = elem.autocomp, acData = autocomp.getSelectedItemData();
                                 self.items[vueIndex].strength = $(strengthElem).val();
+                                self.onItemChange(vueIndex);
                             });
                             $(elem).attr('ac-initialized', 1);
                             $(strengthElem).attr('ac-initialized', 1);

+ 12 - 4
resources/views/app/patient/canvas-sections/rx/summary.php

@@ -17,7 +17,7 @@ if(count($contentData['items'])) {
     for ($i = 0; $i < count($contentData['items']); $i++) {
         $item = $contentData['items'][$i];
 ?>
-        <div class="mb-2">
+        <div class="mb-2 <?= @$item["type"] === 'removed' ? 'on-hover-opaque' : '' ?>">
             <div class="">
                 <?php if(isset($item["title"]) && !empty($item["title"])): ?>
                     <b class="<?= isset($item["type"]) && $item["type"] === 'removed' ? 'text-secondary' : '' ?>">
@@ -26,6 +26,17 @@ if(count($contentData['items'])) {
                 <?php endif; ?>
                 <?= !!$item["strength"] ? '/&nbsp;' . $item["strength"] : '' ?>
                 <?= !!$item["frequency"] ? '/&nbsp;' . $item["frequency"] : '' ?>
+                <?php if(isset($item["type"])): ?>
+                    <?php if($item["type"] === 'removed'): ?>
+                        <span class="pl-3 text-secondary text-sm mr-2">(CURRENTLY INACTIVE)</span>
+                    <?php elseif($item["type"] === 'updated'): ?>
+                        <span class="pl-3 text-warning-mellow text-sm mr-2 font-weight-bold">(* UPDATED)</span>
+                    <?php elseif($item["type"] === 'prescribed today'): ?>
+                        <span class="pl-3 text-success text-sm mr-2 font-weight-bold">(* PRESCRIBED TODAY)</span>
+                    <?php elseif($item["type"] === 'existing'): ?>
+                        <span class="pl-3 text-secondary text-sm mr-2 font-weight-bold">(EXISTING)</span>
+                    <?php endif; ?>
+                <?php endif; ?>
             </div>
             <?php
             $detailPlain = isset($item["detail"]) ? $item["detail"] : '';
@@ -34,9 +45,6 @@ if(count($contentData['items'])) {
             ?>
                 <div class="text-secondary"><?= $detailPlain ?></div>
             <?php endif; ?>
-            <?php if(isset($item["type"]) && $item["type"] === 'removed'): ?>
-                <span class="pl-3 text-secondary text-sm mr-2 font-weight-bold">(CURRENTLY INACTIVE)</span>
-            <?php endif; ?>
             <?php if(isset($item["notes"]) && count($item["notes"])): ?>
                 <div class="pl-3">
                 <?php foreach($item["notes"] as $rxNote): ?>