Browse Source

Assessment v2 [wip #3]

Vijayakrishnan 4 years ago
parent
commit
f54a38e57d
1 changed files with 38 additions and 7 deletions
  1. 38 7
      storage/sections/assessment/form.blade.php

+ 38 - 7
storage/sections/assessment/form.blade.php

@@ -39,7 +39,8 @@ $formID = rand(0, 100000);
             <tr class="">
                 <th class="px-2 text-secondary width-50px">
                     <label class="d-flex align-items-center c-pointer align-items-end m-0">
-                        <input type="checkbox" class="mr-1">
+                        <input type="checkbox" class="mr-1"
+                               v-model="includeAll" v-on:change="includeAllChanged()">
                         <span>All</span>
                     </label>
                 </th>
@@ -61,21 +62,29 @@ $formID = rand(0, 100000);
                 <tr>
                     <td class="px-2">
                         <label class="d-block c-pointer m-0">
-                            <input type="checkbox" class="mt-1" v-model="items['{{$line->uid}}'].included">
+                            <input type="checkbox" class="mt-1"
+                                   v-model="items['{{$line->uid}}'].included"
+                                   v-on:change="includeChanged()">
                         </label>
                     </td>
                     <td class="px-2">{{$line->content_text}}</td>
                     <td class="px-2">{{ @$line->contentDetail()->{"ICD"} }}</td>
                     <td class="px-2">{{ @$line->contentDetail()->{"Chronic or Acute"} }}</td>
                     <td class="px-1">
-                        <textarea rows="4" class="form-control form-control-sm outline-0 width-100pc outline-0">{{ @$line->contentDetail()->{"Prognosis"} }}</textarea>
+                        <textarea rows="4"
+                                  v-model="items['{{$line->uid}}'].prognosis"
+                                  class="form-control form-control-sm outline-0 width-100pc outline-0">
+                        </textarea>
                     </td>
-                    {{--<td class="px-1"><pre class="m-0" style="white-space:pre-wrap">{{ @$line->contentDetail()->{"History"} }}</pre></td>--}}
                     <td class="px-1">
-                        <textarea rows="4" class="form-control form-control-sm outline-0 width-100pc outline-0">{{ @$line->contentDetail()->{"Treatment Goal"} }}</textarea>
+                        <textarea rows="4"
+                                  v-model="items['{{$line->uid}}'].goal"
+                                  class="form-control form-control-sm outline-0 width-100pc outline-0"></textarea>
                     </td>
                     <td class="px-1">
-                        <textarea rows="4" class="form-control form-control-sm outline-0 width-100pc outline-0">{{ @$line->contentDetail()->{"Treatment Plan"} }}</textarea>
+                        <textarea rows="4"
+                                  v-model="items['{{$line->uid}}'].plan"
+                                  class="form-control form-control-sm outline-0 width-100pc outline-0"></textarea>
                     </td>
                     <td class="px-2 text-center delete-column">
                         <span moe wide relative class="mr-1">
@@ -182,10 +191,29 @@ $formID = rand(0, 100000);
             window.assessmentApp = new Vue({
                 el: '#assessment_{{ $formID }}',
                 data: {
+                    includeAll: false,
                     items: {!! json_encode($plainRows)  !!}
                 },
                 methods: {
-
+                    includeAllChanged: function() {
+                        for(let x in this.items) {
+                            if(this.items.hasOwnProperty(x)) {
+                                this.items[x].included = this.includeAll;
+                            }
+                        }
+                    },
+                    includeChanged: function() {
+                        let all = true;
+                        for(let x in this.items) {
+                            if(this.items.hasOwnProperty(x)) {
+                                if(!this.items[x].included) {
+                                    all = false;
+                                    break;
+                                }
+                            }
+                        }
+                        this.includeAll = all;
+                    }
                 },
                 mounted: function() {
                     $('input[type="text"][name="ICD"]').each(function() {
@@ -206,6 +234,9 @@ $formID = rand(0, 100000);
                             return false;
                         });
                     });
+
+                    $('#assessment_{{ $formID }} [moe][initialized]').removeAttr('initialized');
+                    initMoes();
                 }
             });