فهرست منبع

Rx -> support for is_currently_active and dated notes

Vijayakrishnan 4 سال پیش
والد
کامیت
2344e5bb89

+ 35 - 5
resources/views/app/patient/canvas-sections/rx/form.blade.php

@@ -52,7 +52,8 @@ $formID = rand(0, 100000);
         <thead>
         <tr class="bg-light">
             <th class="px-2 text-secondary border-bottom-0 width-30px text-center">#</th>
-            <th class="px-2 text-secondary border-bottom-0 w-35">
+            <th class="px-2 text-secondary border-bottom-0 width-30px text-center">Active</th>
+            <th class="px-2 text-secondary border-bottom-0 w-25">
                 <div class="d-flex align-items-center font-weight-normal">
                     <span>Title</span>
                     <div class="hide-if-dashboard ml-auto">
@@ -82,14 +83,20 @@ $formID = rand(0, 100000);
                     </div>
                 </div>
             </th>
-            <th class="px-2 text-secondary border-bottom-0">Strength/Form/Freq.</th>
-            <th class="px-2 text-secondary border-bottom-0 w-35">Detail</th>
+            <th class="px-2 text-secondary border-bottom-0 width-150px">Strength/Form/Freq.</th>
+            <th class="px-2 text-secondary border-bottom-0 w-25">Detail</th>
+            <th class="px-2 text-secondary border-bottom-0">Notes</th>
             <th class="px-2 text-secondary border-bottom-0"></th>
         </tr>
         </thead>
         <tbody>
         <tr v-for="(item, index) in items">
             <td class="px-2 pt-2 text-center text-sm font-weight-bold">@{{ index + 1 }}</td>
+            <td>
+                <label class="d-block text-center py-2">
+                    <input type="checkbox" v-model="item.is_currently_active">
+                </label>
+            </td>
             <td>
                 <input type="text" :data-index="index"
                        class="form-control form-control-sm canvas-rx-title"
@@ -112,6 +119,9 @@ $formID = rand(0, 100000);
                           rx-rte :data-index="index" data-field="detail"
                           v-model="item.detail"></textarea>
             </td>
+            <td>
+                <textarea class="form-control form-control-sm" v-model="item.notes[item.notes.length-1].text"></textarea>
+            </td>
             <td class="px-2 text-nowrap">
                 <a href="#"
                    v-if="!isFavorite(item)" v-on:click.prevent="addToFavorites(item)"
@@ -147,11 +157,24 @@ $formID = rand(0, 100000);
         for (let i = 0; i < favorites.length; i++) {
             favorites[i].data = JSON.parse(favorites[i].data);
         }
+        let dbItems = <?= json_encode($contentData['items']) ?>;
+        for (let i = 0; i < dbItems.length; i++) {
+            if(typeof dbItems[i].is_currently_active === 'undefined') {
+                dbItems[i].is_currently_active = true;
+            }
+            if(typeof dbItems[i].notes === 'undefined') {
+                dbItems[i].notes = [];
+            }
+            dbItems[i].notes.push({
+                date: '{{@$note ? $note->effective_dateest : date('Y-m-d')}}',
+                text: '',
+            });
+        }
         function init() {
             window.clientRXApp_{{$formID}} = new Vue({
                 el: '#rxSection_{{$formID}}',
                 data: {
-                    items: <?= json_encode($contentData['items']) ?>,
+                    items: dbItems,
                     favorites: favorites,
                 },
                 mounted: function() {
@@ -163,8 +186,14 @@ $formID = rand(0, 100000);
                 watch: {
                     $data: {
                         handler: function(val, oldVal) {
+                            let payload = JSON.parse(JSON.stringify(this.cleanArray(this.items)));
+                            for (let i = 0; i < payload.length; i++) {
+                                payload[i].notes = payload[i].notes.filter(_x => {
+                                    return !!_x.text;
+                                })
+                            }
                             $(this.$el).closest('#rxSection_{{$formID}}').find('[name="data"]').val(JSON.stringify({
-                                items: this.cleanArray(this.items)
+                                items: payload
                             }));
                         },
                         deep: true
@@ -178,6 +207,7 @@ $formID = rand(0, 100000);
                             strength: '',
                             frequency: '',
                             detail: '',
+                            is_currently_active: true,
                         });
                         Vue.nextTick(function() {
                             self.initRTE();

+ 16 - 1
resources/views/app/patient/canvas-sections/rx/summary.php

@@ -20,7 +20,9 @@ if(count($contentData['items'])) {
         <div class="mb-2">
             <div class="">
                 <?php if(isset($item["title"]) && !empty($item["title"])): ?>
-                    <b><?= $item["title"] ?></b>
+                    <b class="<?= isset($item["is_currently_active"]) && $item["is_currently_active"] === false ? 'text-secondary' : '' ?>">
+                        <?= $item["title"] ?>
+                    </b>
                 <?php endif; ?>
                 <?= !!$item["strength"] ? '/&nbsp;' . $item["strength"] : '' ?>
                 <?= !!$item["frequency"] ? '/&nbsp;' . $item["frequency"] : '' ?>
@@ -32,6 +34,19 @@ if(count($contentData['items'])) {
             ?>
                 <div class="text-secondary"><?= $detailPlain ?></div>
             <?php endif; ?>
+            <?php if(isset($item["is_currently_active"]) && $item["is_currently_active"] === false): ?>
+                <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): ?>
+                    <div>
+                        <span class="text-secondary text-sm mr-2"><?= $rxNote["date"] ?></span>
+                        <span class="text-secondary"><?= $rxNote["text"] ?></span>
+                    </div>
+                <?php endforeach; ?>
+                </div>
+            <?php endif; ?>
         </div>
 <?php
     }