Pārlūkot izejas kodu

Dx wizard - add/edit plan & review

Vijayakrishnan 3 gadi atpakaļ
vecāks
revīzija
aa997b1667
1 mainītis faili ar 82 papildinājumiem un 20 dzēšanām
  1. 82 20
      resources/views/app/patient/problems-center.blade.php

+ 82 - 20
resources/views/app/patient/problems-center.blade.php

@@ -37,8 +37,8 @@ $problems = $points;
                 <th class="border-bottom-0 text-secondary">Delete</th>
                 <th class="border-bottom-0 text-secondary">Started</th>
                 <th class="border-bottom-0 text-secondary">Ended</th>
-                <th class="border-bottom-0 text-secondary">Last Review</th>
-                <th class="border-bottom-0 text-secondary">Last Plan</th>
+                <th class="border-bottom-0 text-secondary w-25">Last Review</th>
+                <th class="border-bottom-0 text-secondary w-25">Last Plan</th>
             </tr>
             </thead>
             <?php foreach($problems as $problem): ?>
@@ -236,14 +236,22 @@ $problems = $points;
                             include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
                             ?>
                         </div>
-                        <a class="px-2 view-review-log"
-                           native target="_blank"
-                           open-in-stag-popup
-                           popup-style="stag-popup-md"
-                           title="Review log<?= !!@($problem->data->name) ? ' for ' . @($problem->data->name) : '' ?>"
-                           href="/point/review-log/<?= $problem->uid ?>?popupmode=1">
-                            <i class="fa fa-history"></i>
-                        </a>
+                        <div class="d-inline-flex flex-nowrap">
+                            <a class="px-2 view-review-log"
+                               native target="_blank"
+                               open-in-stag-popup
+                               popup-style="stag-popup-md"
+                               title="Review log<?= !!@($problem->data->name) ? ' for ' . @($problem->data->name) : '' ?>"
+                               href="/point/review-log/<?= $problem->uid ?>?popupmode=1">
+                                <i class="fa fa-history"></i>
+                            </a>
+                            <?php
+                            $segment = $note->getSegmentByInternalName('intake_problems');
+                            if($segment) {
+                                include resource_path('views/app/patient/segment-templates/_child_review/edit-review.php');
+                            }
+                            ?>
+                        </div>
                     </div>
                 </td>
                 <td>
@@ -253,14 +261,22 @@ $problems = $points;
                             include resource_path('views/app/patient/segment-templates/_child_plan/last-plan.php');
                             ?>
                         </div>
-                        <a class="px-2 view-review-log"
-                           native target="_blank"
-                           open-in-stag-popup
-                           popup-style="stag-popup-md"
-                           title="Plan log<?= !!@($problem->data->name) ? ' for ' . @($problem->data->name) : '' ?>"
-                           href="/point/plan-log/<?= $problem->uid ?>?popupmode=1">
-                            <i class="fa fa-history"></i>
-                        </a>
+                        <div class="d-inline-flex flex-nowrap">
+                            <a class="px-2 view-review-log"
+                               native target="_blank"
+                               open-in-stag-popup
+                               popup-style="stag-popup-md"
+                               title="Plan log<?= !!@($problem->data->name) ? ' for ' . @($problem->data->name) : '' ?>"
+                               href="/point/plan-log/<?= $problem->uid ?>?popupmode=1">
+                                <i class="fa fa-history"></i>
+                            </a>
+                            <?php
+                            $segment = $note->getSegmentByInternalName('plan_problems');
+                            if($segment) {
+                                include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
+                            }
+                            ?>
+                        </div>
                     </div>
                 </td>
             </tr>
@@ -359,6 +375,49 @@ $problems = $points;
 
 <script>
     (function() {
+        function initVisitMoeRTEs() {
+            $('.stag-popup [visit-moe]').find('[note-rte]:not(.ql-container)').each(function() {
+
+                $(this).wrap(
+                    $('<div class="border-left border-right rte-holder"/>')
+                        .attr('data-shortcuts', '')
+                );
+
+                // give a unique id to this editor instance
+                var editorID = Math.ceil(Math.random() * 99999),
+                    fieldName = $(this).attr('data-field-name') ? $(this).attr('data-field-name') : 'free_text';
+
+                var el = this;
+                var existingContent = $(el).html();
+                var quill = new Quill(el, {
+                    theme: 'snow',
+                    modules: stagQuillConfig
+                });
+
+                var toolbar = $(quill.container).prev('.ql-toolbar');
+
+                // add button for new shortcut
+                var newSCButton = $('<button class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
+                    'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
+                toolbar.append(newSCButton);
+
+                quill.root.innerHTML = existingContent;
+
+                quill.on('text-change', function(delta, oldDelta, source) {
+                    var content = quill.root.innerHTML;
+                    let dataObject = {};
+                    dataObject[fieldName] = content;
+                    var dataValue = JSON.stringify(dataObject);
+                    $(el).closest('[visit-moe]').find('input[name=data]').val(dataValue);
+                });
+
+                $(quill.container)
+                    .find('.ql-editor[contenteditable]')
+                    .attr('data-field', fieldName)
+                    .attr('data-editor-id', editorID)
+                    .attr('with-shortcuts', 1);
+            });
+        }
         function init() {
             let parentSegment = $('#problems-center-{{$note->id}}');
             parentSegment.find('input[stag-suggest][data-name="name"]')
@@ -373,7 +432,7 @@ $problems = $points;
                         }
                         icdSelect.prop('disabled', false);
                         if (_data.length === 1) {
-                            icdSelect.val(_data[0].routed_med_id).trigger('change');
+                            icdSelect.val(_data[0].search_icd_cd).trigger('change');
                         }
                     }, 'json');
                 });
@@ -531,7 +590,10 @@ $problems = $points;
             initStagSuggest();
 
             $('.additionReasonCategory_ui').trigger('change');
+
+            initSegmentMoes($('#problems-center-{{$note->id}}'));
+            initVisitMoeRTEs();
         }
-        addMCInitializer('problems-center-{{$note->id}}', init, '#problems-center-{{$note->id}}')
+        addMCInitializer('problems-center-{{$note->id}}', init, '#problems-center-{{$note->id}}');
     }).call(window);
 </script>