Browse Source

Dx wizard - support for relevance

Vijayakrishnan 3 năm trước cách đây
mục cha
commit
a0c9e5019b
1 tập tin đã thay đổi với 52 bổ sung0 xóa
  1. 52 0
      resources/views/app/patient/problems-center.blade.php

+ 52 - 0
resources/views/app/patient/problems-center.blade.php

@@ -31,6 +31,7 @@ $problems = $points;
         <table class="table table-sm table-bordered table-striped mb-0 bg-white mb-2">
             <thead>
             <tr class="">
+                <th class="border-bottom-0 text-secondary text-center width-30px">Rel.</th>
                 <th class="border-bottom-0 text-secondary">Name</th>
                 <th class="border-bottom-0 text-secondary">Active?</th>
                 <th class="border-bottom-0 text-secondary">Edit</th>
@@ -41,9 +42,30 @@ $problems = $points;
                 <th class="border-bottom-0 text-secondary w-25">Last Plan</th>
             </tr>
             </thead>
+            <?php $prevRowRemoved = -1; ?>
             <?php foreach($problems as $problem): ?>
             <?php $point = $problem; ?>
+            @if($prevRowRemoved !== -1 && $prevRowRemoved !== $problem->is_removed)
+                <tr>
+                    <td colspan="10" class="px-0 pt-1 pb-0 on-hover-opaque bg-secondary"></td>
+                </tr>
+            @endif
+            <?php $prevRowRemoved = $problem->is_removed; ?>
+            <?php $rel = $problem->relevanceToNote($note); ?>
             <tr class="{{$problem->is_removed ? 'on-hover-opaque' : ''}}">
+                <td class="text-center">
+                    <a href="#" class="toggle-relevance"
+                       data-relevant="{{$rel ? '1' : '0'}}"
+                       data-rel-uid="{{$rel ? $rel->uid : ''}}"
+                       data-point-uid="{{$problem->uid}}"
+                       title="Mark as{{$rel ? ' not ' : ' '}}relevant to this visit">
+                        @if($rel)
+                            <i class="fa fa-star text-sm text-info"></i>
+                        @else
+                            <i class="fa fa-star text-sm text-secondary on-hover-opaque"></i>
+                        @endif
+                    </a>
+                </td>
                 <td>
                     <div class="d-flex align-items-baseline">
                         @if($problem->is_removed)
@@ -587,6 +609,36 @@ $problems = $points;
                     return false;
                 });
 
+            parentSegment.find('.toggle-relevance')
+                .off('click.toggle-relevance')
+                .on('click.toggle-relevance', function () {
+                    if(+$(this).attr('data-relevant') === 0) {
+                        $.post('/api/visitPoint/markPointRelevantToNote', {
+                            noteUid: '{{$note->uid}}',
+                            pointUid: $(this).attr('data-point-uid')
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                refreshDynamicStagPopup();
+                            }
+                        }, 'json');
+                    }
+                    else {
+                        if($(this).attr('data-rel-uid')) {
+                            $.post('/api/visitPoint/undoMarkPointRelevantToNote', {
+                                uid: $(this).attr('data-rel-uid')
+                            }, _data => {
+                                if(!hasResponseError(_data)) {
+                                    refreshDynamicStagPopup();
+                                }
+                            }, 'json');
+                        }
+                        else {
+                            console.log('Error - missing rel uid');
+                        }
+                    }
+                    return false;
+                });
+
             initStagSuggest();
 
             $('.additionReasonCategory_ui').trigger('change');