Переглянути джерело

Merge branch 'dev' of rav.triplestart.com:jmudaka/stagfe2 into dev

Samson Mutunga 3 роки тому
батько
коміт
8c82d5c1b8
48 змінених файлів з 672 додано та 242 видалено
  1. BIN
      .env.swp
  2. 25 16
      app/Http/Controllers/FDBPGController.php
  3. 1 1
      config/app.php
  4. 7 0
      config/stag.php
  5. 21 4
      js-dev/click-to-copy.js
  6. 1 1
      js-dev/stag-suggest.js
  7. 16 3
      public/css/style.css
  8. 2 2
      resources/views/app/dashboard-mcp.blade.php
  9. 1 1
      resources/views/app/mc.blade.php
  10. 68 9
      resources/views/app/patient/medications-reconcile.blade.php
  11. 2 2
      resources/views/app/patient/module-specific-summary-renderers/allergy/plan.blade.php
  12. 2 2
      resources/views/app/patient/module-specific-summary-renderers/behavior/plan.blade.php
  13. 2 2
      resources/views/app/patient/module-specific-summary-renderers/care_team_member/plan.blade.php
  14. 2 2
      resources/views/app/patient/module-specific-summary-renderers/exercise/plan.blade.php
  15. 2 2
      resources/views/app/patient/module-specific-summary-renderers/goal/plan.blade.php
  16. 2 2
      resources/views/app/patient/module-specific-summary-renderers/medication/plan.blade.php
  17. 2 2
      resources/views/app/patient/module-specific-summary-renderers/nutrition/plan.blade.php
  18. 2 2
      resources/views/app/patient/module-specific-summary-renderers/problem/plan.blade.php
  19. 3 3
      resources/views/app/patient/note/follow-up-appointment.blade.php
  20. 1 1
      resources/views/app/patient/note/segment-slim.blade.php
  21. 5 1
      resources/views/app/patient/prescriptions/list.blade.php
  22. 46 53
      resources/views/app/patient/problems-center.blade.php
  23. 2 2
      resources/views/app/patient/segment-templates/_child_plan/edit-plan-optimized-flat.php
  24. 2 2
      resources/views/app/patient/segment-templates/_child_plan/edit-plan-optimized.php
  25. 1 1
      resources/views/app/patient/segment-templates/_child_plan/medication/edit-plan-optimized.php
  26. 2 2
      resources/views/app/patient/segment-templates/_child_review/edit-review-optimized-flat.php
  27. 2 2
      resources/views/app/patient/segment-templates/_child_review/edit-review-optimized.php
  28. 1 1
      resources/views/app/patient/segment-templates/_child_review/medication/edit-review-optimized.php
  29. 0 0
      resources/views/app/patient/segment-templates/current_mental-status/edit.blade.php
  30. 0 0
      resources/views/app/patient/segment-templates/current_mental-status/summary.blade.php
  31. 3 3
      resources/views/app/patient/segment-templates/omega_allergies/summary.blade.php
  32. 7 7
      resources/views/app/patient/segment-templates/omega_care_team/summary.blade.php
  33. 2 4
      resources/views/app/patient/segment-templates/omega_goals/summary.blade.php
  34. 1 1
      resources/views/app/patient/segment-templates/omega_history_past_medical/edit.blade.php
  35. 38 9
      resources/views/app/patient/segment-templates/omega_history_past_medical/summary.blade.php
  36. 159 0
      resources/views/app/patient/segment-templates/omega_history_past_medical/summary.blade.php_NEW
  37. 20 17
      resources/views/app/patient/segment-templates/omega_history_social/summary.blade.php
  38. 3 3
      resources/views/app/patient/segment-templates/omega_medications/summary.blade.php
  39. 16 27
      resources/views/app/patient/segment-templates/omega_problems/summary.blade.php
  40. 60 0
      resources/views/app/patient/segment-templates/omega_problems/summary.blade.php__NEW
  41. 1 1
      resources/views/app/patient/segment-templates/omega_subjective_system/summary.blade.php
  42. 1 1
      resources/views/app/patient/segment-templates/past_medical_history/edit.blade.php
  43. 1 1
      resources/views/app/patient/segment-templates/sigma_history_past_medical/edit.blade.php
  44. 68 35
      resources/views/app/patient/segment-templates/typical_day_lifestyle/summary.blade.php
  45. 10 5
      resources/views/app/patient/wizard-partials/add-multiple-pre-existing.blade.php
  46. 58 6
      resources/views/app/patient/wizard-partials/common-script.blade.php
  47. BIN
      resources/views/app/practice-management/.process-claims.blade.php.swp
  48. 1 1
      resources/views/app/practice-management/process-claims.blade.php

+ 25 - 16
app/Http/Controllers/FDBPGController.php

@@ -87,15 +87,16 @@ SELECT r_med.medid,
        r_med.med_medid_desc as text,
        r_med.gcn_seqno,
        r_dosage_form.routed_dosage_form_med_id,
-       r_route.routed_med_id
+       r_route.routed_med_id,
+       SIMILARITY(r_med.med_medid_desc, :term) as sim1
 FROM rmiid1_med r_med
          JOIN rmidfid1_routed_dose_form_med r_dosage_form
               ON r_med.routed_dosage_form_med_id = r_dosage_form.routed_dosage_form_med_id
          JOIN rmirmid1_routed_med r_route ON r_dosage_form.routed_med_id = r_route.routed_med_id
 WHERE r_med.med_status_cd = '0'
-  AND r_med.med_medid_desc ILIKE :term
-ORDER BY REPLACE(r_med.med_medid_desc, '-', 'x')",
-            ['term' => $term . '%']
+  AND SIMILARITY(r_med.med_medid_desc, :term) >= " . config('stag.fuzzySearchMinimumSimilarityScore')['medication'] . "
+ORDER BY sim1 DESC",
+            ['term' => $term]
         );
         return json_encode([
             "success" => true,
@@ -229,16 +230,24 @@ where r1.related_dxid = :dxid
         $term = $request->input('term') ? trim($request->input('term')) : '';
         if (empty($term)) return '';
         $matches = DB::connection('pgsql_fdb')->select("
-SELECT DISTINCT ON (r1.search_icd_cd) search_icd_cd as sub_text, r1.icd_cd_type, r2.icd_desc as text, r1.related_dxid as dxid, r1.fml_clin_code, r1.fml_nav_code, r3.dxid_desc56
+SELECT distinct on (sim1) SIMILARITY(r2.icd_desc, :term) as sim1,
+       search_icd_cd                            as sub_text,
+       r1.icd_cd_type,
+       r2.icd_desc                              as text,
+       r1.related_dxid                          as dxid,
+       r1.fml_clin_code,
+       r1.fml_nav_code,
+       r3.dxid_desc56
 FROM RFMLISR1_ICD_SEARCH r1
-JOIN RFMLINM1_ICD_DESC r2 ON r1.search_icd_cd = r2.icd_cd
-LEFT OUTER JOIN RFMLDX0_DXID r3 ON r1.related_dxid = r3.dxid
+         JOIN RFMLINM1_ICD_DESC r2 ON r1.search_icd_cd = r2.icd_cd
+         LEFT OUTER JOIN RFMLDX0_DXID r3 ON r1.related_dxid = r3.dxid
 WHERE r1.icd_cd_type = '05'
-    AND r1.fml_clin_code = '01'
-    AND (r2.icd_desc ILIKE :term OR r1.search_icd_cd ILIKE :term)
-ORDER BY r1.search_icd_cd ASC, r1.fml_nav_code ASC
+  AND r1.fml_clin_code = '01'
+  AND (SIMILARITY(r2.icd_desc, :term) >= " . config('stag.fuzzySearchMinimumSimilarityScore')['problem'] . " OR
+       r1.search_icd_cd ILIKE :term2)
+ORDER BY sim1 DESC
 ",
-            ['term' => '%' . $term . '%']
+            ['term' => $term, 'term2' => $term . '%']
         );
         return response()->json(['success'=>true, 'data'=>$matches]);
     }
@@ -265,13 +274,13 @@ ORDER BY r1.dam_concept_id_desc
         $term = $request->input('term') ? trim($request->input('term')) : '';
         if (empty($term)) return '';
         $matches = DB::connection('pgsql_fdb')->select("
-SELECT r1.dam_concept_id, r1.dam_concept_id_typ, r1.dam_concept_id_desc as text,
-r2.dam_concept_id_typ_desc as sub_text
+SELECT distinct on (sim1) SIMILARITY(r1.dam_concept_id_desc, :term) as sim1,
+       r1.dam_concept_id, r1.dam_concept_id_typ, r1.dam_concept_id_desc as text
 FROM rdamca0_concept r1 join rdamcd0_picklist_con_typ_desc r2 on r1.dam_concept_id_typ = r2.dam_concept_id_typ
-WHERE (r1.dam_concept_id_desc ILIKE :term)
-ORDER BY r1.dam_concept_id_desc
+WHERE SIMILARITY(r1.dam_concept_id_desc, :term) >= " . config('stag.fuzzySearchMinimumSimilarityScore')['allergy'] . "
+ORDER BY sim1 DESC
 ",
-            ['term' => $term . '%']
+            ['term' => $term]
         );
         return json_encode([
             "success" => true,

+ 1 - 1
config/app.php

@@ -65,7 +65,7 @@ return [
 
     'hrm2_url' => env('HRM2_URL'),
 
-    'asset_version' => 78,
+    'asset_version' => 80,
 
     'temp_dir' => env('TEMP_DIR'),
 

+ 7 - 0
config/stag.php

@@ -5,6 +5,13 @@ return [
     'adminPortalUrl' => env('ADMIN_PORTAL_URL', 'https://fe.scholar.securecpu.com'),
     'backendUrl' => env('BACKEND_URL','https://scholar.securecpu.com'),
 
+    // tweak these to adjust fuzzy search match strictness
+    'fuzzySearchMinimumSimilarityScore' => [
+        'allergy' => 0.11,
+        'medication' => 0.11,
+        'problem' => 0.11,
+    ],
+
     'segmentRefreshConfig' => [
         'typeToSegments' => [
             'allergy' => [

+ 21 - 4
js-dev/click-to-copy.js

@@ -1,5 +1,5 @@
 (function() {
-    function fallbackCopyTextToClipboard(text) {
+    function fallbackCopyTextToClipboard(text, pasteTo = false) {
         var textArea = document.createElement("textarea");
         textArea.value = text;
 
@@ -17,13 +17,14 @@
             var msg = successful ? 'successful' : 'unsuccessful';
             console.log('Fallback: Copying text command was ' + msg);
             toastr.success('Copied!');
+            pasteToElement(pasteTo, text);
         } catch (err) {
             console.error('Fallback: Oops, unable to copy', err);
         }
 
         document.body.removeChild(textArea);
     }
-    function copyTextToClipboard(text) {
+    function copyTextToClipboard(text, pasteTo = false) {
         if (!navigator.clipboard) {
             fallbackCopyTextToClipboard(text);
             return;
@@ -31,17 +32,33 @@
         navigator.clipboard.writeText(text).then(function() {
             console.log('Async: Copying to clipboard was successful!');
             toastr.success('Copied!');
+            pasteToElement(pasteTo, text);
         }, function(err) {
             console.error('Async: Could not copy text: ', err);
         });
     }
+    function pasteToElement(_elem, _text) {
+        if(_elem && _elem.length) {
+            // if rte
+            if(_elem.is('.ql-container') && _elem[0].__quill) {
+                let qlRoot = _elem[0].__quill.root;
+                if($.trim($(qlRoot.innerHTML).text()) === '') {
+                    _elem[0].__quill.clipboard.dangerouslyPasteHTML(0, _text);
+                    _elem[0].__quill.root.focus();
+                }
+            }
+            else _elem.val(_text);
+        }
+    }
 
     function init() {
         $(document)
             .off('click.click-to-copy', '.click-to-copy')
             .on('click.click-to-copy', '.click-to-copy', function(event) {
-            copyTextToClipboard($(this).text());
-        });
+                let self = $(this);
+                copyTextToClipboard(self.text(),
+                    self.is('[auto-paste]') ? self.closest('form').find(self.attr('auto-paste')) : false);
+            });
         window.copyTextToClipboard = copyTextToClipboard;
     }
 

+ 1 - 1
js-dev/stag-suggest.js

@@ -20,7 +20,7 @@
             let term = elem.val();
             let ep = $(elem).attr('stag-suggest-ep'), extra = $(elem).attr('stag-suggest-extra');
             if(!!ep) { // remote lookup
-                if (!!term) {
+                if (!!term && term.length >= 2) {
 
                     $.get(ep + '?term=' + $.trim(term) + (!!extra ? '&' + extra : ''), function (_data) {
 

+ 16 - 3
public/css/style.css

@@ -430,6 +430,9 @@ body>nav.navbar {
 .mcp-theme-1 .min-width-110px {
     min-width: 110px !important;
 }
+.mcp-theme-1 .max-width-110px {
+    max-width: 110px !important;
+}
 .mcp-theme-1 .min-width-140px {
     min-width: 140px !important;
 }
@@ -2531,9 +2534,6 @@ body.in-iframe .main-row > .sidebar {
     font-weight: bold;
     background: #fff;
 }
-tr.relevant-to-visit td:nth-child(1) {
-    color: #17a2b8;
-}
 .autosave-indicator {
     display: none;
 }
@@ -3365,6 +3365,7 @@ body.forced-masking #mask {
 .stag-sheet tbody tr td {
     padding: 0;
     background: #fff;
+    cursor: text;
 }
 .stag-sheet tbody tr td input,
 .stag-sheet tbody tr td textarea {
@@ -3384,6 +3385,18 @@ body.forced-masking #mask {
 .stag-sheet tbody tr td textarea:focus-visible{
     border: 1px solid steelblue;
 }
+.mcp-theme-1 .stag-sheet .ql-container {
+    border: 0;
+}
+.mcp-theme-1 .stag-sheet .ql-editor[contenteditable] {
+    min-height: 28px;
+    border: 1px solid transparent;
+    padding: 3px;
+}
+.mcp-theme-1 .stag-sheet .ql-editor[contenteditable]:focus {
+    min-height: 28px;
+    border: 1px solid steelblue;
+}
 .note-container .summary-container p {
     margin-top: 0 !important;
     margin-bottom: 0 !important;

+ 2 - 2
resources/views/app/dashboard-mcp.blade.php

@@ -339,7 +339,7 @@
                             <div id="mcp-dashboard-appointments" class="mb-4">
 
                             </div>
-                            @if($performer->pro->can_view_rm_matrix || $performer->pro->pro_type=='ADMIN')
+                            {{--@if($performer->pro->can_view_rm_matrix || $performer->pro->pro_type=='ADMIN')
                             <div class="card mb-4">
                                 <div class="card-header pl-2">
                                     <strong>
@@ -350,7 +350,7 @@
                                     @include('app.practice-management.remote-monitoring-tree')
                                 </div>
                             </div>
-                            @endif
+                            @endif--}}
                             <div class="card mb-4">
                                 <div class="card-header pl-2">
                                     <strong>

+ 1 - 1
resources/views/app/mc.blade.php

@@ -5,7 +5,7 @@
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
+    <script src="/js/jquery-3.5.1.min.js"></script>
     <link href="/css/app.css?v={{config('app.asset_version')}}" rel="stylesheet">
     <link href="/css/style.css?v={{config('app.asset_version')}}" rel="stylesheet">
     <link href="/v-splitter-px/v-splitter.css?v={{config('app.asset_version')}}" rel="stylesheet" >

+ 68 - 9
resources/views/app/patient/medications-reconcile.blade.php

@@ -65,16 +65,14 @@ $medications = $points;
             ?>
             <tr>
                 <td class="bg-light font-weight-bold">
-                    {{$medication->data->name}}
+                    <span class="" if-active>{{$medication->data->name}}</span>
+                    <span class="text-secondary on-hover-opaque d-none" if-historic>{{$medication->data->name}}</span>
                     <div class="d-block font-weight-normal">
                         <div class="d-flex align-items-baseline">
                             <span class="text-secondary mr-1">Active:</span>
-                            @if($medication->is_removed)
-                                <span class="text-secondary">No</span>
-                            @else
-                                <span class="text-success">Yes</span>
-                            @endif
-                            <div moe class="ml-2">
+                            <span class="text-success font-weight-bold" if-active>Yes</span>
+                            <span class="text-warning-mellow font-weight-bold d-none" if-historic>No</span>
+                            <div moe class="ml-2" if-active>
                                 <a href="#" start show>Mark {{$medication->is_removed ? 'Active' : 'Historic'}}</a>
                                 <form url="/api/visitPoint/updateTopLevel" no-auto-focus class="mcp-theme-1">
                                     <p class="mb-2">Mark medication as {{$medication->is_removed ? 'Active' : 'Historic'}}</p>
@@ -82,7 +80,20 @@ $medications = $points;
                                     <input type="hidden" name="noteUid" value="{{$note->uid}}">
                                     <input type="hidden" name="isRemoved" value="{{$medication->is_removed ? '0' : '1'}}">
                                     <div>
-                                        <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+                                        <button type="button" class="btn-mark-historic btn btn-sm btn-primary mr-2">Save</button>
+                                        <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                            <div moe class="ml-2 d-none" if-historic>
+                                <a href="#" start show>Mark as Active</a>
+                                <form url="/api/visitPoint/updateTopLevel" no-auto-focus class="mcp-theme-1">
+                                    <p class="mb-2">Mark medication as Active</p>
+                                    <input type="hidden" name="uid" value="{{$medication->uid}}">
+                                    <input type="hidden" name="noteUid" value="{{$note->uid}}">
+                                    <input type="hidden" name="isRemoved" value="0">
+                                    <div>
+                                        <button type="button" class="btn-mark-active btn btn-sm btn-primary mr-2">Save</button>
                                         <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
                                     </div>
                                 </form>
@@ -137,7 +148,20 @@ $medications = $points;
                                 }
                             }
                         }
-                    }
+                    },
+                    formats: [
+                        'bold',
+                        'italic',
+                        'link',
+                        'size',
+                        'strike',
+                        'underline',
+                        'blockquote',
+                        'header',
+                        'indent',
+                        'list',
+                        'align',
+                    ]
                 });
                 quill.root.innerHTML = existingContent;
                 $(quill.container)
@@ -215,6 +239,41 @@ $medications = $points;
                     });
 
                 });
+
+            $('#medications-reconcile-{{$note->id}} .btn-mark-historic')
+                .off('click')
+                .on('click', function() {
+                    showMask();
+                    let form = $(this).closest('form'), row = $(this).closest('tr');
+                    $.post(form.attr('url'), form.serialize(), _data => {
+                        if(!hasResponseError(_data)) {
+                            row.find('[if-active], [if-historic]').addClass('d-none');
+                            row.find('[if-historic]').removeClass('d-none');
+                        }
+                    }, 'json').then(() => {
+                        $('[moe] form').hide();
+                        hideMask();
+                    });
+                    return false;
+                });
+
+            $('#medications-reconcile-{{$note->id}} .btn-mark-active')
+                .off('click')
+                .on('click', function() {
+                    showMask();
+                    let form = $(this).closest('form'), row = $(this).closest('tr');
+                    $.post(form.attr('url'), form.serialize(), _data => {
+                        if(!hasResponseError(_data)) {
+                            row.find('[if-active], [if-historic]').addClass('d-none');
+                            row.find('[if-active]').removeClass('d-none');
+                        }
+                    }, 'json').then(() => {
+                        $('[moe] form').hide();
+                        hideMask();
+                    });
+                    return false;
+                });
+
             __initRTEs($('#medications-reconcile-{{$note->id}} [note-rte]'))
         }
         addMCInitializer('medications-reconcile-{{$note->id}}', init, '#medications-reconcile-{{$note->id}}')

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/allergy/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/behavior/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/care_team_member/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/exercise/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/goal/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/medication/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/nutrition/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/problem/plan.blade.php

@@ -17,9 +17,9 @@
                 <?php $rel = $point->relevanceToNote($note); ?>
 		
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 3 - 3
resources/views/app/patient/note/follow-up-appointment.blade.php

@@ -22,13 +22,13 @@
         </div>
     @endif
 
-    <div class="align-items-baseline mb-3 fu-appt-choices {{!is_null($note->is_follow_up_needed) ? 'd-none' : 'd-flex'}}">
+    <div class="align-items-center mb-3 fu-appt-choices {{!is_null($note->is_follow_up_needed) ? 'd-none' : 'd-flex'}}">
         <p class="font-weight-bold text-secondary my-0 mr-3">Would you like to book a follow-up appointment?</p>
-        <label class="d-inline-flex align-items-center mr-3">
+        <label class="d-inline-flex align-items-center mr-3 my-0">
             <input type="radio" name="is_follow_up_needed" value="1">
             <span class="ml-1">Yes</span>
         </label>
-        <label class="d-inline-flex align-items-center mr-3">
+        <label class="d-inline-flex align-items-center mr-3 my-0">
             <input type="radio" name="is_follow_up_needed" value="0">
             <span class="ml-1 mr-3">No</span>
         </label>

+ 1 - 1
resources/views/app/patient/note/segment-slim.blade.php

@@ -16,7 +16,7 @@ $isOmegaHistorySegment = strpos($iName, 'omega_history_') === 0;
     <!-- title -->
 
             <?php
-            $extraClass = $segment->heading ? 'min-width-110px' : 'min-width-140px pl-2';
+            $extraClass = $segment->heading ? 'min-width-110px max-width-110px' : 'min-width-140px pl-2';
             ?>
 
             @if(!!$segment->display_title)

+ 5 - 1
resources/views/app/patient/prescriptions/list.blade.php

@@ -139,7 +139,7 @@
             </table>
         </div>
         <div v-if="currentPrescription" class="border-top border-right border-bottom align-self-stretch p-3 flex-grow-1 min-width-50">
-            <div class="d-flex align-items-center">
+            <div class="d-flex align-items-baseline">
                 <h3 class="font-size-16 m-0 d-flex align-items-baseline">
                     <i v-if="currentPrescription.has_hcp_pro_signed" title="Signed" class="fa fa-check text-success mr-2"></i>
                     <b class="mr-1 font-size-16">@{{ currentPrescription.erx_category }} ERx <span class="ml-2">@{{ currentPrescription.created_at_friendly }}</span></b>
@@ -147,6 +147,10 @@
                         <div v-if="currentPrescription.note_id === {{$note->id}}" class="text-info mt-1 font-weight-bold text-nowrap ml-2">* From this note</div>
                     @endif
                 </h3>
+                <div v-if="currentPrescription.pro_declared_status == 'CANCELLED'" class="ml-3 bg-danger font-weight-bold text-sm px-2 py-1 rounded text-white">
+                    <i class="fa fa-ban"></i>
+                    CANCELLED
+                </div>
                 <a class="ml-auto" href="#" v-on:click.prevent="setCurrentPrescription(null);">
                     <i class="fa fa-times-circle on-hover-opaque"></i>
                 </a>

+ 46 - 53
resources/views/app/patient/problems-center.blade.php

@@ -31,66 +31,59 @@ if(!@$summaryView) {
     <div class="point-table-container">
 
         @if(!@$summaryView && $patient->core_note_id !== $note->id && $ccSegment)
-        <div class="d-flex align-items-baseline">
-            <div class="mb-2 font-weight-bold font-size-14 text-secondary">Chief Complaint</div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="font-weight-bold font-size-14 text-secondary">Chief Complaint</div>
             <span class="mx-2 text-secondary">|</span>
-            <a href="#" class="regenerate-cc">Regenerate with relevant problems</a>
-        </div>
-
-        <?php
-        $ccPoint = Point::where('added_in_note_id', $note->id)->where('category', 'CHIEF_COMPLAINT')->orderBy('id', 'DESC')->first();
-        $parsed = null;
-        if ($ccPoint && !!@$ccPoint->data) {
-            $parsed = json_decode($ccPoint->data);
-        }
-        if(!$parsed || !@$parsed->free_text) {
-            list($problemPoints, $counts) = Point::getPointsOfCategoryExtended($patient, 'PROBLEM', $note);
-            $problemNames = [];
-            foreach ($problemPoints as $problemPoint) {
-                if($problemPoint->relevanceToNote($note)) {
-                    $problemNames[] = $problemPoint->data->name;
-                }
+            <a href="#" class="regenerate-cc mr-2">Regenerate</a>
+            <?php
+            $ccPoint = Point::where('added_in_note_id', $note->id)->where('category', 'CHIEF_COMPLAINT')->orderBy('id', 'DESC')->first();
+            $parsed = null;
+            if ($ccPoint && !!@$ccPoint->data) {
+                $parsed = json_decode($ccPoint->data);
             }
-            $ccProblems = '';
-            for($i = 0; $i < count($problemNames); $i++) {
-                if($i > 0) {
-                    if($i === count($problemNames) - 1) {
-                        $ccProblems .= " and ";
+            if(!$parsed || !@$parsed->free_text) {
+                list($problemPoints, $counts) = Point::getPointsOfCategoryExtended($patient, 'PROBLEM', $note);
+                $problemNames = [];
+                foreach ($problemPoints as $problemPoint) {
+                    if($problemPoint->relevanceToNote($note)) {
+                        $problemNames[] = $problemPoint->data->name;
                     }
-                    else {
-                        $ccProblems .= ", ";
+                }
+                $ccProblems = '';
+                for($i = 0; $i < count($problemNames); $i++) {
+                    if($i > 0) {
+                        if($i === count($problemNames) - 1) {
+                            $ccProblems .= " and ";
+                        }
+                        else {
+                            $ccProblems .= ", ";
+                        }
                     }
+                    $ccProblems .= $problemNames[$i];
                 }
-                $ccProblems .= $problemNames[$i];
+                $defaultCC = "Patient {$patient->name_first} {$patient->name_last} " .
+                    "is a {$patient->age_in_years} year old" .
+                    ($patient->sex ? ($patient->sex === 'F' ? ' female' : ($patient->sex === 'M' ? ' male' : ' ' . $patient->sex)) : '') .
+                    ($ccProblems ? " with a history of {$ccProblems}" : "") .
+                    ($note->new_or_fu_or_na === 'NEW' ? ' presenting for establishing care' : ' presenting for follow-up') .
+                    ".";
+                $parsed = json_decode(json_encode([
+                    "free_text" => $defaultCC
+                ]));
             }
-            $defaultCC = "Patient {$patient->name_first} {$patient->name_last} " .
-                "is a {$patient->age_in_years} year old" .
-                ($patient->sex ? ($patient->sex === 'F' ? ' female' : ($patient->sex === 'M' ? ' male' : ' ' . $patient->sex)) : '') .
-                ($ccProblems ? " with a history of {$ccProblems}" : "") .
-                ($note->new_or_fu_or_na === 'NEW' ? ' presenting for establishing care' : ' presenting for follow-up') .
-                ".";
-            $parsed = json_decode(json_encode([
-                "free_text" => $defaultCC
-            ]));
-        }
-        ?>
-        <div visit-moe class="d-block">
-            <form show="" url="/api/visitPoint/upsertNoteSingleton" class="mcp-theme-1" id="frm-cc-regenerate">
-                <input type="hidden" name="segmentUid" value="{{$ccSegment->uid}}">
-                <input type="hidden" name="category" value="CHIEF_COMPLAINT">
-                <input type="hidden" name="data" value="">
-                <div note-rte slim-rte
-                     class="form-group mb-2 border-left border-right rte-holder cc-generated"
-                     data-field-name="free_text"
-                ><?= $parsed && @$parsed->free_text ? $parsed->free_text : '' ?></div>
-            </form>
+            ?>
+            <div visit-moe class="d-inline-block flex-grow-1">
+                <form show="" url="/api/visitPoint/upsertNoteSingleton" class="mcp-theme-1" id="frm-cc-regenerate">
+                    <input type="hidden" name="segmentUid" value="{{$ccSegment->uid}}">
+                    <input type="hidden" name="category" value="CHIEF_COMPLAINT">
+                    <input type="hidden" name="data" value="">
+                    <div note-rte slim-rte
+                         class="form-group mb-0 border-left border-right rte-holder cc-generated"
+                         data-field-name="free_text"
+                    ><?= $parsed && @$parsed->free_text ? $parsed->free_text : '' ?></div>
+                </form>
+            </div>
         </div>
-
-        <hr class="m-neg-3 mt-3 mb-2">
-        @endif
-
-        @if(!@$summaryView)
-        <div class="mb-2 font-weight-bold font-size-14 text-secondary">Problems</div>
         @endif
 
         <table class="table table-sm table-bordered bg-white mb-2 point-table read">

+ 2 - 2
resources/views/app/patient/segment-templates/_child_plan/edit-plan-optimized-flat.php

@@ -42,7 +42,7 @@ else {
             <div class="d-flex align-items-baseline mb-1">
                 <span class="text-sm text-secondary">Previous Plan / <?= friendlier_date($previousChildPlan->created_at) ?> (click to copy)</span>
             </div>
-            <div class="p-1 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
+            <div class="p-1 bg-light border inline-html-container click-to-copy" auto-paste="[data-field-name=value]"><?= $previousValue ?></div>
         </div>
         <?php endif; ?>
 
@@ -52,7 +52,7 @@ else {
                  data-field-name="value"><?= $currentValue ?></div>
         </div>
         <div>
-            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <button cancel class="btn btn-sm btn-default border">Cancel</button>
         </div>
     </form>

+ 2 - 2
resources/views/app/patient/segment-templates/_child_plan/edit-plan-optimized.php

@@ -42,7 +42,7 @@ else {
             <div class="d-flex align-items-baseline mb-1">
                 <span class="text-sm text-secondary">Previous Plan / <?= friendlier_date($previousChildPlan->created_at) ?> (click to copy)</span>
             </div>
-            <div class="p-1 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
+            <div class="p-1 bg-light border inline-html-container click-to-copy" auto-paste="[data-field-name=value]"><?= $previousValue ?></div>
         </div>
         <?php endif; ?>
 
@@ -52,7 +52,7 @@ else {
                  data-field-name="value"><?= $currentValue ?></div>
         </div>
         <div>
-            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <button cancel class="btn btn-sm btn-default border">Cancel</button>
         </div>
     </form>

+ 1 - 1
resources/views/app/patient/segment-templates/_child_plan/medication/edit-plan-optimized.php

@@ -18,7 +18,7 @@
         </div>
 
         <div>
-            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <button cancel class="btn btn-sm btn-default border">Cancel</button>
         </div>
     </form>

+ 2 - 2
resources/views/app/patient/segment-templates/_child_review/edit-review-optimized-flat.php

@@ -46,7 +46,7 @@ else {
                 <div class="d-flex align-items-baseline mb-1">
                     <span class="text-sm text-secondary">Previous Subjective / <?= friendlier_date($previousChildReview->created_at) ?> (click to copy)</span>
                 </div>
-                <div class="p-1 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
+                <div class="p-1 bg-light border inline-html-container click-to-copy" auto-paste="[data-field-name=value]"><?= $previousValue ?></div>
             </div>
         <?php endif; ?>
 
@@ -56,7 +56,7 @@ else {
                  data-field-name="value"><?= $currentValue ?></div>
         </div>
         <div>
-            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <button cancel class="btn btn-sm btn-default border">Cancel</button>
         </div>
     </form>

+ 2 - 2
resources/views/app/patient/segment-templates/_child_review/edit-review-optimized.php

@@ -46,7 +46,7 @@ else {
                 <div class="d-flex align-items-baseline mb-1">
                     <span class="text-sm text-secondary">Previous Subjective / <?= friendlier_date($previousChildReview->created_at) ?> (click to copy)</span>
                 </div>
-                <div class="p-1 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
+                <div class="p-1 bg-light border inline-html-container click-to-copy" auto-paste="[data-field-name=value]"><?= $previousValue ?></div>
             </div>
         <?php endif; ?>
 
@@ -56,7 +56,7 @@ else {
                  data-field-name="value"><?= $currentValue ?></div>
         </div>
         <div>
-            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <button cancel class="btn btn-sm btn-default border">Cancel</button>
         </div>
     </form>

+ 1 - 1
resources/views/app/patient/segment-templates/_child_review/medication/edit-review-optimized.php

@@ -25,7 +25,7 @@
         </div>
 
         <div>
-            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <button cancel class="btn btn-sm btn-default border">Cancel</button>
         </div>
     </form>

+ 0 - 0
resources/views/app/patient/segment-templates/psych_intake_current_mental-status/edit.blade.php → resources/views/app/patient/segment-templates/current_mental-status/edit.blade.php


+ 0 - 0
resources/views/app/patient/segment-templates/psych_intake_current_mental-status/summary.blade.php → resources/views/app/patient/segment-templates/current_mental-status/summary.blade.php


+ 3 - 3
resources/views/app/patient/segment-templates/omega_allergies/summary.blade.php

@@ -11,10 +11,10 @@ $plural = 'Allergies';
 ?>
 
 <?php if($tracker && @($tracker->data->no_known_drug_allergies)): ?>
-    <div class="text-secondary mb-2"><span>-</span></div>
+    <div class="text-secondary mb-1">No known drug allergies</div>
 <?php endif; ?>
 <?php if($tracker && @($tracker->data->no_known_allergies_of_any_type)): ?>
-    <div class="text-secondary mb-2"><span>-</span></div>
+    <div class="text-secondary mb-1">No known allergies of any type</div>
 <?php endif; ?>
 
 <?php if(!$tracker || !@($tracker->data->no_known_allergies_of_any_type)): ?>
@@ -25,7 +25,7 @@ $plural = 'Allergies';
     <?php $j = 0; foreach ($points as $point): $j++; ?>
 	<?php $rel = $point->relevanceToNote($note); ?>
         <tr>
-            <td class="width-30px text-right pl-0 pr-1">
+            <td class="width-22px pl-0 pr-1">
                 @if($rel)
                     <?php $numRelevant++; ?>
                 @endif

+ 7 - 7
resources/views/app/patient/segment-templates/omega_care_team/summary.blade.php

@@ -16,7 +16,7 @@ $plural = 'Care team members';
     <?php $j = 0; foreach ($points as $point): $j++; ?>
         <?php $rel = $point->relevanceToNote($note); ?>
         <tr>
-            <td class="width-30px text-right pl-0 pr-1">
+            <td class="width-22px pl-0 pr-1 {{ $rel ? ' text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
                 @endif
@@ -33,14 +33,14 @@ $plural = 'Care team members';
                 if(@($point->data->date)) $parts[] = $point->data->date;
                 $parts = implode(' • ', $parts);
                 ?>
-                <div class="<?= $point->is_removed ? 'strike-through' : '' ?>">
+                <span class="<?= $point->is_removed ? 'strike-through' : '' ?>">
                     <?= $parts ?>
-                    <div>
+                    <span>
                         <?php $review = $point->childReviewAddedInNote($note); ?>
                         <?php if(!!$review && @$review->data->value): ?>
-                        <span class="pr-2"><b>Subj.</b> {!! trim(strip_tags($review->data->value)) !!}</span>
+                        <span class="pl-2"><b>Subj.</b> {!! trim(strip_tags($review->data->value)) !!}</span>
                         <?php endif; ?>
-                        <span class="text-nowrap">
+                        <span class="text-nowrap pl-2">
                         <?php if ($point->is_removed): ?>
                             @if($point->removal_reason_category === 'DURING_VISIT')
                                 <span class="text-sm text-secondary">Removed during visit</span>
@@ -55,8 +55,8 @@ $plural = 'Care team members';
                             <?php endif;?>
                         <?php endif; ?>
                         </span>
-                    </div>
-                </div>
+                    </span>
+                </span>
             </td>
             <td></td>
         </tr>

+ 2 - 4
resources/views/app/patient/segment-templates/omega_goals/summary.blade.php

@@ -16,13 +16,11 @@ $plural = 'Goals';
     <?php $j = 0; foreach ($points as $point): $j++; ?>
         <?php $rel = $point->relevanceToNote($note); ?>
         <tr>
-            <td class="width-30px text-right pl-0 pr-1 {{ $rel ? ' text-info':'' }}">
+            <td class="width-22px pl-0 pr-1 {{ $rel ? ' text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
-                    *{{ $j }}.
-                @else
-                    {{ $j }}.
                 @endif
+                {{ $j }}.
             </td>
             <td class="px-2">
                 <div class="<?= $point->is_removed ? 'strike-through' : '' ?> grow-till-300px">

+ 1 - 1
resources/views/app/patient/segment-templates/omega_history_past_medical/edit.blade.php

@@ -144,7 +144,7 @@ for ($i = 0; $i < count($fields); $i++) {
                                                        open-in-stag-popup
                                                        mc-initer="problems-center-{{$note->id}}"
                                                        title="Problems Center"
-                                                       popup-style="wide overflow-visible"
+                                                       popup-style="overflow-visible"
                                                        href="/problems-center/{{$patient->uid}}/{{$note->uid}}?dx={{urlencode($values[$k])}}">
                                                         <i class="fa fa-plus-circle on-hover-opaque"></i>
                                                     </a>

+ 38 - 9
resources/views/app/patient/segment-templates/omega_history_past_medical/summary.blade.php

@@ -73,16 +73,24 @@ if ($contentData) {
     $blood = implode(" ", $blood);
     if(!empty(trim($blood))) { ?>
         <div class="mb-2">
-            <div>Blood Type &amp; RH: <b><?= $blood ?></b></div>
+            <div><b>Blood Type &amp; RH: </b><?= $blood ?></div>
         </div>
     <?php }
 
+	$commonMap = [];
+
     for ($i = 0; $i < count($fields); $i++):
         foreach($fields[$i] as $head => $values):
             for($k = 0; $k < count($values); $k++):
+		$value = $values[$k];
                 $fName = $head . '_' . sanitize_field_name($values[$k]);
-                if(@$contentData['common'][$fName]): ?>
-                    <div>
+		if(@$contentData['common'][$fName]) {
+			if(!isset($commonMap[$head])) {
+				$commonMap[$head] = [];
+			}
+			$commonMap[$head][] = ['value' => $value, 'fName' => $fName, 'comments' => @$contentData['common'][$fName.'__comments']];
+		?>
+                    <div class="d-none">
                         <?= ucwords($head) ?>
                         <i class="fa fa-arrow-right text-sm text-secondary"></i>
                         <span class="font-weight-bold"><?= $values[$k] ?></span>
@@ -91,11 +99,28 @@ if ($contentData) {
                         <?php endif; ?>
                     </div>
                 <?php
-                endif;
+                }
             endfor;
         endforeach;
     endfor;
 
+	// var_dump(json_encode($commonMap));
+	?> <div> <?php
+	foreach($commonMap as $head => $set):
+		?>
+		<div>
+			<span class="font-weight-bold"><?= ucwords($head) ?></span>
+			<i class="fa fa-arrow-right text-secondary d-none_"></i>
+			<span class="">
+			<?php $out = []; foreach($set as $item) { $out[] = '<span class="__font-weight-bold">' . $item['value'] . '</span>' . ($item['comments'] ? ('<span class="text-sm ml-1 text-secondary">(' . $item['comments'] . ')</span>') : ''); } if(!empty($out)) echo ' • '; echo implode(' • ', $out); ?>
+			</span>
+		</div>
+		<?php
+	endforeach;
+	?>
+
+	<?php
+
     // custom fields
 
     if(isset($contentData['customFields']) && count($contentData['customFields'])):
@@ -103,20 +128,24 @@ if ($contentData) {
         for ($i = 0; $i < count($contentData['customFields']); $i++):
             $item = $contentData['customFields'][$i];
             if($item['value']): ?>
-                <div>
-                    Custom
-                    <i class="fa fa-arrow-right text-sm text-secondary"></i>
-                    <span class="font-weight-bold"><?= $item['label'] ?></span>
+                <span>
+                    <span class="font-weight-bold">Other: </span>
+		    <i class="fa fa-arrow-right d-none"></i>
+                </span>
+		<span>
+		    <span class="__font-weight-bold"><?= $item['label'] ?></span>
                     <?php if($item['comments']): ?>
                         <span class="text-sm ml-1 text-secondary">(<?= $item['comments'] ?>)</span>
                     <?php endif; ?>
-                </div>
+                </span>
             <?php
             endif;
         endfor;
         ?> </div> <?php
     endif;
 
+	echo '</div>';
+
     if(isset($contentData['comments']) && !empty(trim($contentData['comments']))) { ?>
         <div class="mt-2 mb-1">
             <b>Comments: </b><?= $contentData['comments'] ?>

+ 159 - 0
resources/views/app/patient/segment-templates/omega_history_past_medical/summary.blade.php_NEW

@@ -0,0 +1,159 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+if(!@$note) {
+    $note = $patient->coreNote;
+}
+
+$fields = [
+    [
+        "Head" => ["Trauma"],
+        "Eyes" => ["Blindness", "Cataracts", "Glaucoma", "Wears glasses/contacts"],
+        "Ears" => ["Hearing aids"],
+        "Nose/Sinuses" => ["Allergic Rhinitis", "Sinus infections"],
+        "Mouth/Throat/Teeth" => ["Dentures"],
+        "Cardiovascular" => ["Aneurysm", "Angina", "DVT", "Dysrhythmia", "HTN", "Murmur", "Myocardial infarction", "Other heart disease"],
+    ],
+    [
+        "Respiratory" => ["Asthma", "Bronchitis", "COPD - Bronchitis/Emphysema", "Pleuritis", "Pneumonia"],
+        "Gastrointestinal" => ["Cirrhosis", "GERD", "Gallbladder disease", "Heartburn", "Hemorrhoids", "Hepatitis", "Hiatal hernia", "Jaundice", "Ulcer"],
+        "Genitourinary" => ["Hernia", "Incontinence", "Nephrolithiasis", "Other kidney disease", "STDs", "UTI(s)"],
+    ],
+    [
+        "Musculoskeletal" => ["Arthritis", "Gout", "M/S injury"],
+        "Skin" => ["Dermatitis", "Mole(s)", "Other skin condition(s)", "Psoriasis"],
+        "Neurological" => ["Epilepsy", "Seizures", "Severe headaches, migraines", "Stroke", "TIA"],
+        "Psychiatric" => ["Bipolar disorder", "Depression", "Hallucinations, delusions", "Suicidal ideation", "Suicide attempts"],
+    ],
+    [
+        "Endocrine" => ["Goiter", "Hyperlipidemia", "Hypothyroidism", "Thyroid disease", "Thyroiditis", "Type I DM", "Type II DM"],
+        "Heme/Onc" => ["Anemia", "Cancer"],
+        "Infectious" => ["HIV", "STDs", "Tuberculosis (dz)", "Tuberculosis (exposure)"],
+    ]
+];
+
+$contentData = [
+    "bloodType" => "",
+    "bloodRH" => "",
+    "common" => [],
+    "customFields" => [],
+    "comments" => "",
+];
+$isempty = false;
+
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'PAST_MEDICAL_HISTORY', $sessionKey, true);
+
+$contentData = $parsed = false;
+
+$rel = !!$point->relevanceToNote($note);
+
+if ($point->lastChildReview && $point->lastChildReview->data && ($rel || $point->lastChildReview->added_in_note_id === $note->id)) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $parsed = $point->lastChildReview->data;
+}
+
+if ($contentData) {
+
+    $blood = [];
+    if(isset($contentData['bloodType'])) {
+        $blood[] = $contentData['bloodType'];
+    }
+    if(isset($contentData['bloodRH'])) {
+        $blood[] = $contentData['bloodRH'];
+    }
+    $blood = implode(" ", $blood);
+    if(!empty(trim($blood))) { ?>
+        <div class="mb-2">
+            <div>Blood Type &amp; RH: <b><?= $blood ?></b></div>
+        </div>
+    <?php }
+
+	$commonMap = [];
+
+    for ($i = 0; $i < count($fields); $i++):
+        foreach($fields[$i] as $head => $values):
+            for($k = 0; $k < count($values); $k++):
+		$value = $values[$k];
+                $fName = $head . '_' . sanitize_field_name($values[$k]);
+		if(@$contentData['common'][$fName]) {
+			if(!isset($commonMap[$head])) {
+				$commonMap[$head] = [];
+			}
+			$commonMap[$head][] = ['value' => $value, 'fName' => $fName, 'comments' => @$contentData['common'][$fName.'__comments']];
+		?>
+                    <div class="d-none">
+                        <?= ucwords($head) ?>
+                        <i class="fa fa-arrow-right text-sm text-secondary"></i>
+                        <span class="font-weight-bold"><?= $values[$k] ?></span>
+                        <?php if(@$contentData['common'][$fName . '__comments']): ?>
+                            <span class="text-sm ml-1 text-secondary">(<?= $contentData['common'][$fName . '__comments'] ?>)</span>
+                        <?php endif; ?>
+                    </div>
+                <?php
+                }
+            endfor;
+        endforeach;
+    endfor;
+
+	// var_dump(json_encode($commonMap));
+	?> <table class="table-bordered table-xs table-cage mb-0"> <?php
+	foreach($commonMap as $head => $set):
+		?>
+		<tr>
+			<td class="font-weight-bold"><?= ucwords($head) ?></td>
+			<td class="px-2">
+			<?php $out = []; foreach($set as $item) { $out[] = '<span class="__font-weight-bold">' . $item['value'] . '</span>' . ($item['comments'] ? ('<span class="text-sm ml-1 text-secondary">(' . $item['comments'] . ')</span>') : ''); } echo implode(', ', $out); ?>
+			</td>
+			<td></td>
+		</tr>
+		<?php
+	endforeach;
+	?>
+
+	<?php
+
+    // custom fields
+
+    if(isset($contentData['customFields']) && count($contentData['customFields'])):
+        ?> <tr class=""> <?php
+        for ($i = 0; $i < count($contentData['customFields']); $i++):
+            $item = $contentData['customFields'][$i];
+            if($item['value']): ?>
+                <td>
+                    <span class="font-weight-bold">Other</span>
+                </td>
+		<td>
+		    <span class="__font-weight-bold"><?= $item['label'] ?></span>
+                    <?php if($item['comments']): ?>
+                        <span class="text-sm ml-1 text-secondary">(<?= $item['comments'] ?>)</span>
+                    <?php endif; ?>
+                </td>
+		<td></td>
+            <?php
+            endif;
+        endfor;
+        ?> </tr> <?php
+    endif;
+
+	echo '</table>';
+
+    if(isset($contentData['comments']) && !empty(trim($contentData['comments']))) { ?>
+        <div class="mt-2 mb-1">
+            <b>Comments: </b><?= $contentData['comments'] ?>
+        </div>
+    <?php }
+
+} else {
+    echo '<div class="text-secondary">-</div>';
+}
+?>
+

+ 20 - 17
resources/views/app/patient/segment-templates/omega_history_social/summary.blade.php

@@ -42,24 +42,27 @@ if ($point->lastChildReview && $point->lastChildReview->data && ($rel || $point-
     $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
     $contentData = $parsed = $point->lastChildReview->data;
 
-    for ($i = 0; $i < count($fields); $i++):
-        foreach($fields[$i] as $head => $values):
-            for($k = 0; $k < count($values); $k++):
+    $prevHead = ''; $items = [];
+    for ($i = 0; $i < count($fields); $i++) {
+        foreach($fields[$i] as $head => $values) {
+            $items = [];
+            for($k = 0; $k < count($values); $k++) {
                 $fName = $head . '_' . sanitize_field_name($values[$k]);
-                if(@$contentData['common'][$fName]): ?>
-                    <div>
-                        <?= ucwords($head) ?>
-                        <i class="fa fa-arrow-right text-sm text-secondary"></i>
-                        <span class="font-weight-bold"><?= $values[$k] ?></span>
-                        <?php if(@$contentData['common'][$fName . '__comments']): ?>
-                            <span class="text-sm ml-1 text-secondary">(<?= $contentData['common'][$fName . '__comments'] ?>)</span>
-                        <?php endif; ?>
-                    </div>
-                <?php
-                endif;
-            endfor;
-        endforeach;
-    endfor;
+                if(@$contentData['common'][$fName]) {
+                    $items[] = $values[$k] . (@$contentData['common'][$fName . '__comments'] ? '<span class="text-sm ml-1 text-secondary">(' . $contentData['common'][$fName . '__comments'] . ')</span>' : '');
+                }
+            }
+            if(count($items) && trim(implode('', $items)) !== '') {
+            ?>
+                <div>
+                    <b><?= $head ?></b>
+                    <i class="fa fa-arrow-right text-sm text-secondary"></i>
+                    <?= implode(' • ', $items) ?>
+                </div>
+            <?php
+            }
+        }
+    }
 
     // custom fields
 

+ 3 - 3
resources/views/app/patient/segment-templates/omega_medications/summary.blade.php

@@ -11,7 +11,7 @@ $plural = 'Medications';
 ?>
 
 <?php if($tracker && @($tracker->data->no_known_medications)): ?>
-    <div class="text-secondary"><span>-</span></div>
+    <div class="text-secondary">No known medications</div>
 <?php endif; ?>
 <?php if(!$tracker || !@($tracker->data->no_known_medications)): ?>
 <?php if (!count($points)): ?>
@@ -20,7 +20,7 @@ $plural = 'Medications';
 	<table class="table table-bordered table-xs table-cage mb-0">
 		<thead>
 		<tr>
-			<th class="py-1 px-2 border-top-0 text-right">#</th>
+			<th class="pl-0 pr-1 py-1 border-top-0">#</th>
 			<th class="py-1 px-2 border-top-0">Name</th>
 			<th class="py-1 px-2 border-top-0">Frequency</th>
 			<th class="py-1 px-2 border-top-0">Experience</th>
@@ -36,7 +36,7 @@ $plural = 'Medications';
 		}
 		?>
 	<tr>
-		<td class="width-30px text-right pl-0 pr-1">
+		<td class="width-22px pl-0 pr-1">
 			@if($rel)
 				<?php $numRelevant++; ?>
 			@endif

+ 16 - 27
resources/views/app/patient/segment-templates/omega_problems/summary.blade.php

@@ -12,30 +12,15 @@ $plural = 'Problems';
 <?php if (!count($points)): ?>
     <div class="text-secondary">-</div>
 <?php else: ?>
-    <table class="table table-bordered table-xs table-cage mb-0">
+    <div>
     <?php $j = 0; foreach ($points as $point): $j++; ?>
         <?php $rel = $point->relevanceToNote($note); ?>
-       <tr>
-            <td class="width-30px text-right pl-0 pr-1 {{ $rel ? ' text-info':'' }}">
-                @if($rel)
-                    <?php $numRelevant++; ?>
-                    *{{ $j }}.
-                @else
-                    {{ $j }}.
-                @endif
-            </td>
-            <td class="px-2">
-                <div class=" <?= $point->is_removed ? 'strike-through' : '' ?> grow-till-300px" >
-                    <?= !!@($point->data->name) ? @($point->data->name) : '-' ?>
-                </div>
-            </td>
-           <td class="width-300px">
-               <div class="d-flex align-items-baseline pl-2">
-                   <?php $review = $point->childReviewAddedInNote($note); ?>
-                   <?php if(!!$review && @$review->data->value): ?>
-                   <span class="pr-2">{!! $review->data->value !!}</span>
-                   <?php endif; ?>
-                   <span class="text-nowrap">
+       <div>
+            <span class="">
+                <span class="font-weight-bold" <?= $point->is_removed ? 'strike-through' : '' ?> grow-till-300px" >
+                    <?= !!@($point->data->name) ? @($point->data->name) : '-' ?>:
+                </span>
+		<span class="text-nowrap">
                        <?php if ($point->is_removed): ?>
                        @if($point->removal_reason_category === 'DURING_VISIT')
                            <span class="text-sm text-secondary">Removed during visit</span>
@@ -50,11 +35,15 @@ $plural = 'Problems';
                             <?php endif;?>
                        <?php endif; ?>
                     </span>
-               </div>
-           </td>
-           <td></td>
-        </tr>
+            </span>
+           <div class="ml-3 mb-1">
+                   <?php $review = $point->childReviewAddedInNote($note); ?>
+                   <?php if(!!$review && @$review->data->value): ?>
+                   <span class="pr-2" style="display: inline-block">{!! $review->data->value !!}</span>
+                   <?php endif; ?>
+           </div>
+        </div>
     <?php endforeach; ?>
-    </table>
+    </div>
 <?php endif; ?>
 

+ 60 - 0
resources/views/app/patient/segment-templates/omega_problems/summary.blade.php__NEW

@@ -0,0 +1,60 @@
+<?php
+
+use App\Models\Point;
+
+/** @var \App\Models\Client $patient */
+
+$points = Point::getIntakePointsOfCategory($patient, 'PROBLEM', $note);
+$numRelevant = 0;
+$plural = 'Problems';
+?>
+
+<?php if (!count($points)): ?>
+    <div class="text-secondary">-</div>
+<?php else: ?>
+    <table class="table table-bordered table-xs table-cage mb-0">
+    <?php $j = 0; foreach ($points as $point): $j++; ?>
+        <?php $rel = $point->relevanceToNote($note); ?>
+       <tr>
+            <td class="width-30px text-right pl-0 pr-1 {{ $rel ? ' text-info':'' }}">
+                @if($rel)
+                    <?php $numRelevant++; ?>
+                    *{{ $j }}.
+                @else
+                    {{ $j }}.
+                @endif
+            </td>
+            <td class="px-2">
+                <div class=" <?= $point->is_removed ? 'strike-through' : '' ?> grow-till-300px" >
+                    <?= !!@($point->data->name) ? @($point->data->name) : '-' ?>
+                </div>
+            </td>
+           <td class="width-300px">
+               <div class="d-flex align-items-baseline pl-2">
+                   <?php $review = $point->childReviewAddedInNote($note); ?>
+                   <?php if(!!$review && @$review->data->value): ?>
+                   <span class="pr-2">{!! $review->data->value !!}</span>
+                   <?php endif; ?>
+                   <span class="text-nowrap">
+                       <?php if ($point->is_removed): ?>
+                       @if($point->removal_reason_category === 'DURING_VISIT')
+                           <span class="text-sm text-secondary">Removed during visit</span>
+                       @elseif($point->removal_reason_category === 'ON_INTAKE')
+                           <span class="text-sm text-secondary">Removed on intake</span>
+                       @endif
+                       <?php elseif ($point->added_in_note_id === $note->id): ?>
+                       <?php if ($point->addition_reason_category === 'DURING_VISIT'): ?>
+                                <span class="text-sm text-success">* Added during visit</span>
+                            <?php else: ?>
+                                <span class="text-sm text-info">* Added on intake</span>
+                            <?php endif;?>
+                       <?php endif; ?>
+                    </span>
+               </div>
+           </td>
+           <td></td>
+        </tr>
+    <?php endforeach; ?>
+    </table>
+<?php endif; ?>
+

+ 1 - 1
resources/views/app/patient/segment-templates/omega_subjective_system/summary.blade.php

@@ -28,7 +28,7 @@ $wizardLinks = [
 
 ?>
 
-<div class="mb-2 hide-if-note-signed">
+<div class="my-1 hide-if-note-signed">
     @foreach($wizardLinks as $link)
         @if(@$link['name'])
             <a href="{{$link['href']}}"

+ 1 - 1
resources/views/app/patient/segment-templates/past_medical_history/edit.blade.php

@@ -144,7 +144,7 @@ for ($i = 0; $i < count($fields); $i++) {
                                                        open-in-stag-popup
                                                        mc-initer="problems-center-{{$note->id}}"
                                                        title="Problems Center"
-                                                       popup-style="wide overflow-visible"
+                                                       popup-style="overflow-visible"
                                                        href="/problems-center/{{$patient->uid}}/{{$note->uid}}?dx={{urlencode($values[$k])}}">
                                                         <i class="fa fa-plus-circle on-hover-opaque"></i>
                                                     </a>

+ 1 - 1
resources/views/app/patient/segment-templates/sigma_history_past_medical/edit.blade.php

@@ -144,7 +144,7 @@ for ($i = 0; $i < count($fields); $i++) {
                                                        open-in-stag-popup
                                                        mc-initer="problems-center-{{$note->id}}"
                                                        title="Problems Center"
-                                                       popup-style="wide overflow-visible"
+                                                       popup-style="overflow-visible"
                                                        href="/problems-center/{{$patient->uid}}/{{$note->uid}}?dx={{urlencode($values[$k])}}">
                                                         <i class="fa fa-plus-circle on-hover-opaque"></i>
                                                     </a>

+ 68 - 35
resources/views/app/patient/segment-templates/typical_day_lifestyle/summary.blade.php

@@ -32,11 +32,29 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
     $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
     $contentData = $point->lastChildReview->data;
 }
+$hasTypicalDayData = false;
+if(@$contentData["lines"] && count($contentData["lines"])) {
+    foreach(@$contentData["lines"] as $line) {
+        if(!!@$line['S'] && (!!@$line['I'] || !!@$line['P'])) {
+            $hasTypicalDayData = true;
+            break;
+        }
+    }
+}
+$hasDailyAggregates = (
+    @$contentData["estimated_daily_calories"]["S"] ||
+    @$contentData["estimated_daily_calories"]["P"] ||
+    @$contentData["estimated_daily_protein_grams"]["S"] ||
+    @$contentData["estimated_daily_protein_grams"]["P"] ||
+    @$contentData["estimated_daily_vegetable_servings"]["S"] ||
+    @$contentData["estimated_daily_vegetable_servings"]["P"] ||
+    @$contentData["estimated_daily_hours_of_sleep"]["S"] ||
+    @$contentData["estimated_daily_hours_of_sleep"]["P"]
+);
 ?>
 <div class="events-none form-read-mode">
-    <p class="mb-2 font-weight-bold">Typical Day</p>
-
-    @if(@$contentData["lines"] && count($contentData["lines"]))
+    @if($hasTypicalDayData)
+        <div class="mb-1 font-weight-bold">Typical Day</div>
         <table class="table table-sm table-bordered mb-3">
             <thead class="bg-light">
             <tr>
@@ -46,6 +64,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
             </thead>
             <tbody>
             @foreach(@$contentData["lines"] as $line)
+                @if($line['S'])
                 <tr>
                     <td><pre class="m-0">{{$line['S']}}&nbsp;</pre></td>
                     <td>
@@ -57,42 +76,56 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
                         </div>
                     </td>
                 </tr>
+                @endif
             @endforeach
             </tbody>
         </table>
     @endif
 
-    <p class="mb-2 font-weight-bold">Daily Aggregates</p>
+    @if($hasDailyAggregates)
+        <div class="mb-1 font-weight-bold">Daily Aggregates</div>
+        <table class="table table-sm table-bordered mb-2">
+            <thead class="bg-light">
+            <tr>
+                <th class="border-bottom-0 text-secondary width-200px">Subject</th>
+                <th class="border-bottom-0 text-secondary">Current</th>
+                <th class="border-bottom-0 text-secondary w-50">Target</th>
+            </tr>
+            </thead>
+            <tbody>
+            @if(@$contentData["estimated_daily_calories"]["S"] || @$contentData["estimated_daily_calories"]["P"])
+            <tr>
+                <td class="pl-1 align-middle bg-light">Est. Daily Calories</td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_calories"]["S"]}}</pre></td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_calories"]["P"]}}</pre></td>
+            </tr>
+            @endif
+            @if(@$contentData["estimated_daily_protein_grams"]["S"] || @$contentData["estimated_daily_protein_grams"]["P"])
+            <tr>
+                <td class="pl-1 align-middle bg-light">Est. Daily Protein Grams</td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_protein_grams"]["S"]}}</pre></td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_protein_grams"]["P"]}}</pre></td>
+            </tr>
+            @endif
+            @if(@$contentData["estimated_daily_vegetable_servings"]["S"] || @$contentData["estimated_daily_vegetable_servings"]["P"])
+            <tr>
+                <td class="pl-1 align-middle bg-light">Est. Daily Vegetable Servings</td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_vegetable_servings"]["S"]}}</pre></td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_vegetable_servings"]["P"]}}</pre></td>
+            </tr>
+            @endif
+            @if(@$contentData["estimated_daily_hours_of_sleep"]["S"] || @$contentData["estimated_daily_hours_of_sleep"]["P"])
+            <tr>
+                <td class="pl-1 align-middle bg-light">Est. Daily Hours Of Sleep</td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_hours_of_sleep"]["S"]}}</pre></td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_hours_of_sleep"]["P"]}}</pre></td>
+            </tr>
+            @endif
+            </tbody>
+        </table>
+    @endif
 
-    <table class="table table-sm table-bordered mb-2">
-        <thead class="bg-light">
-        <tr>
-            <th class="border-bottom-0 text-secondary width-200px">Subject</th>
-            <th class="border-bottom-0 text-secondary">Current</th>
-            <th class="border-bottom-0 text-secondary w-50">Target</th>
-        </tr>
-        </thead>
-        <tbody>
-        <tr>
-            <td class="pl-1 align-middle bg-light">Est. Daily Calories</td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_calories"]["S"]}}</pre></td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_calories"]["P"]}}</pre></td>
-        </tr>
-        <tr>
-            <td class="pl-1 align-middle bg-light">Est. Daily Protein Grams</td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_protein_grams"]["S"]}}</pre></td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_protein_grams"]["P"]}}</pre></td>
-        </tr>
-        <tr>
-            <td class="pl-1 align-middle bg-light">Est. Daily Vegetable Servings</td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_vegetable_servings"]["S"]}}</pre></td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_vegetable_servings"]["P"]}}</pre></td>
-        </tr>
-        <tr>
-            <td class="pl-1 align-middle bg-light">Est. Daily Hours Of Sleep</td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_hours_of_sleep"]["S"]}}</pre></td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_hours_of_sleep"]["P"]}}</pre></td>
-        </tr>
-        </tbody>
-    </table>
+    @if(!$hasTypicalDayData && !$hasDailyAggregates)
+        -
+    @endif
 </div>

+ 10 - 5
resources/views/app/patient/wizard-partials/add-multiple-pre-existing.blade.php

@@ -69,6 +69,7 @@
                            stag-suggest-bottom-left
                            stag-suggest-text-only
                            stag-suggest-ep="/fdb-dx-suggest-v2/json"
+                           value="{{trim(request()->input('dx')) ? trim(request()->input('dx')) : ''}}"
                            @elseif($label === 'allergy')
                            stag-suggest
                            stag-suggest-bottom-left
@@ -101,16 +102,20 @@
                         <input type="text" key="organization" bucket="data">
                     </td>
                 @endif
-                <td class="p-0">
-                    <textarea rows="1" key="value" bucket="childReviewData"></textarea>
-                </td>
                 @if($label === 'medication')
                     <td class="p-0">
-                        <textarea rows="1" key="experience" bucket="childReviewData"></textarea>
+                        <textarea rows="1" key="value" bucket="childReviewData"></textarea>
+                    </td>
+                    <td class="p-0">
+                        <div note-rte class="rte-holder" key="experience" bucket="childReviewData"></div>
+                    </td>
+                @else
+                    <td class="p-0">
+                        <div note-rte class="rte-holder" key="value" bucket="childReviewData"></div>
                     </td>
                 @endif
                 <td class="p-0">
-                    <textarea rows="1" key="value" bucket="childPlanData"></textarea>
+                    <div note-rte class="rte-holder" key="value" bucket="childPlanData"></div>
                 </td>
                 <td class="p-0">
                     <input type="date" key="start_date" bucket="data">

+ 58 - 6
resources/views/app/patient/wizard-partials/common-script.blade.php

@@ -68,7 +68,20 @@ function __initRTEs(_collection) {
                         }
                     }
                 }
-            }
+            },
+            formats: [
+                'bold',
+                'italic',
+                'link',
+                'size',
+                'strike',
+                'underline',
+                'blockquote',
+                'header',
+                'indent',
+                'list',
+                'align',
+            ]
         });
 
         var toolbar = $(quill.container).prev('.ql-toolbar');
@@ -91,7 +104,8 @@ function __initRTEs(_collection) {
             if(!pElem.length) {
                 pElem = $(el).closest('form');
             }
-            let v = pElem.find('input[name="' + ($(el).attr('data-container-name') ? $(el).attr('data-container-name') : 'data') + '"]').val();
+            let dataElem = pElem.find('input[name="' + ($(el).attr('data-container-name') ? $(el).attr('data-container-name') : 'data') + '"]');
+            let v = dataElem.val();
             if(!!v) {
                 try {
                     v = JSON.parse(v);
@@ -106,7 +120,7 @@ function __initRTEs(_collection) {
                 v = JSON.stringify(dataObject);
             }
 
-            pElem.find('input[name=' + ($(el).attr('data-container-name') ? $(el).attr('data-container-name') : 'data') + ']').val(v);
+            dataElem.val(v);
 
             $(el).trigger('rich-text-input');
         };
@@ -834,12 +848,13 @@ function newRow(_tr) {
     newTr.find('input, textarea').val('');
     newTr.find('textarea').attr('rows', 1).css({minHeight: '', height: ''});
     newTr.find('[stag-suggest-initialized]').removeAttr('stag-suggest-initialized');
+    newTr.find('.stag-suggestions-container').remove();
     return newTr;
 }
 
 function createAndMoveToNextRowInput(_td) {
     let tr = createRowAfter(_td.closest('tr'));
-    tr.find('td:eq(0)').find('input, textarea').first().focus();
+    tr.find('input, textarea').first().focus();
 }
 
 function moveToNextRowInput(_td, _forceCreate = false) {
@@ -868,6 +883,9 @@ function generateData(_parentSegment) {
         $(this).find('input, textarea').each(function() {
             line[$(this).attr('bucket')][$(this).attr('key')] = this.value;
         });
+        $(this).find('[note-rte][key][bucket]').each(function() {
+            line[$(this).attr('bucket')][$(this).attr('key')] = $(this).find('.ql-editor[contenteditable]').first().html();
+        });
         line.data = JSON.stringify(line.data);
         line.childReviewData = JSON.stringify(line.childReviewData);
         line.childPlanData = JSON.stringify(line.childPlanData);
@@ -884,6 +902,7 @@ parentSegment
                 if (!_e.shiftKey || !$(this).is('textarea')) {
                     if($(this).closest('.stag-sheet').is('.allow-row-addition')) {
                         createAndMoveToNextRowInput($(this).closest('td'));
+                        initStagSuggest();
                     }
                     else {
                         moveToNextRowInput($(this).closest('td'), false);
@@ -921,6 +940,16 @@ parentSegment
 
     });
 
+parentSegment
+    .off('click', '.stag-sheet tbody td')
+    .on('click', '.stag-sheet tbody td', function(_e) {
+        let focusable = $(this).find('input, textarea, .ql-editor[contenteditable]').first();
+        if(!focusable.is(':focus')) {
+            focusable.focus();
+            return false;
+        }
+    });
+
 parentSegment
     .off('click.delete-line', '.stag-sheet .delete-line')
     .on('click.delete-line', '.stag-sheet .delete-line', function() {
@@ -945,14 +974,37 @@ parentSegment
 parentSegment
     .off('click.btn-save-lines', '.btn-save-lines')
     .on('click.btn-save-lines', '.btn-save-lines', function() {
+        let numRows = parentSegment.find('.stag-sheet').find('tbody>tr').length;
+        let numEmptyRows = numRows;
+        let emptyRows = [];
+        parentSegment.find('.stag-sheet').find('tbody>tr').each(function() { // loop A
+            let isEmptyRow = true;
+             $(this).find('input, textarea').each(function() { // loop B
+                 if($.trim($(this).val())) {
+                     isEmptyRow = false;
+                     return false; // break from B
+                 }
+             });
+             if(!isEmptyRow) numEmptyRows--;
+             else emptyRows.push(this);
+        });
+        if(numEmptyRows > 0) {
+            if(numEmptyRows === numRows && numRows === 1) return false; // if only 1 row and all empty in that - ignore and stop
+            else { // else clear empty rows
+                for (let i = 0; i < emptyRows.length; i++) {
+                    $(emptyRows[i]).remove();
+                }
+            }
+        }
+
         parentSegment.find('[name="dataJson"]').val(generateData(parentSegment));
         saveVisitForm(this);
         return false;
     });
 
 parentSegment
-    .off('click.switch-to-edit', '.point-table [if-read-mode] .inline-html-container')
-    .on('click.switch-to-edit', '.point-table [if-read-mode] .inline-html-container', function() {
+    .off('click.switch-to-edit', '.point-table [if-read-mode] .inline-html-container:not(.click-to-copy)')
+    .on('click.switch-to-edit', '.point-table [if-read-mode] .inline-html-container:not(.click-to-copy)', function() {
         let trigger = $(this).closest('[if-read-mode]')
             .find('form[url="/api/visitPoint/upsertChildReview"], form[url="/api/visitPoint/upsertChildPlan"]')
             .first().closest('[moe], [visit-moe]')

BIN
resources/views/app/practice-management/.process-claims.blade.php.swp


+ 1 - 1
resources/views/app/practice-management/process-claims.blade.php

@@ -53,7 +53,7 @@
                          v-on:click.prevent="setCurrentClaim(claimIndex)">
                         <div class="d-flex align-items-center c-pointer">
 
-                            <b class="p-2 border-right mr-1 bg-aliceblue" :class="claim.status === 'PICKED_UP' ? 'text-dark' : 'text-secondary'">@{{ claim.created }}</b>
+                            <b class="p-2 border-right mr-1 bg-aliceblue" :class="claim.status === 'PICKED_UP' ? 'text-dark' : 'text-secondary'">@{{ claim.claim_date }}</b>
 
                             <div v-if="claim.care_month_uid" class="rounded text-sm px-2 py-1 font-weight-bold bg-secondary text-white mr-1">
                                 <i class="fa fa-clock mr-1"></i>RM