瀏覽代碼

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

Josh 4 年之前
父節點
當前提交
5d35fcf59d

+ 16 - 1
gem/templates/summary.php

@@ -1 +1,16 @@
-<div><?php dump($newContentData) ?></div>
+<?php foreach($newContentData as $k => $v) {
+    if(!!$v && strtolower($k) !== 'section_uid') {
+        $k = str_replace("__", " > ", $k);
+        $k = str_replace("_", " ", $k);
+        $k = ucwords($k);
+        ?>
+        <div><?= $k ?>:
+            <?php if(is_array($v)) { ?>
+                <b><?= implode(", ", $v) ?></b>
+            <?php } else { ?>
+                <b><?php print_r($v) ?></b>
+            <?php } ?>
+        </div>
+    <?php }
+} ?>
+

+ 28 - 1
resources/views/app/patient/note/dashboard.blade.php

@@ -205,9 +205,16 @@
                         }
                         $packed = implode("^^^", $packed);
                         $shortcuts = $packed;
+                        $latestSectionTS = 0;
                         ?>
                         @foreach($note->sections as $section)
-                        <div class="p-3 border-bottom note-section {{ $section->is_initialized ? '' : 'pending-initialization' }}"
+                        <?php
+                        $sectionTS = strtotime($section->created_at);
+                        if($latestSectionTS === 0 || $latestSectionTS < $sectionTS) {
+                            $latestSectionTS = $sectionTS;
+                        }
+                        ?>
+                        <div data-ts={{$sectionTS}} class="p-3 border-bottom note-section {{ $section->is_initialized ? '' : 'pending-initialization' }}"
                              data-section-uid="{{ $section->uid }}"
                              data-section-template-uid="{{ $section->sectionTemplate->uid }}"
                              data-section-template-name="{{ $section->sectionTemplate->internal_name }}">
@@ -246,6 +253,8 @@
                     </div>
                 </div>
 
+                <span class="d-none latest-section-ts">{{ $latestSectionTS }}</span>
+
                 @if($note->bills->count())
                     <div class="mt-2 px-3">
                         <div class="d-flex align-items-center mb-2">
@@ -617,9 +626,27 @@
                         );
                     });
                 }
+                else {
+                    scrollToLatest();
+                }
 
             }
 
+            // scroll to latest created section
+            function scrollToLatest() {
+                window.setTimeout(function() {
+                    let latestSectionTS = $('.latest-section-ts');
+                    if(latestSectionTS.length) {
+                        let latestSection = $('.note-section[data-ts="' + latestSectionTS.text() + '"]');
+                        if(latestSection.length) {
+                            latestSection[0].scrollIntoView({behavior: "smooth", block: "center"});
+                            latestSection.find('.edit-trigger').first().click();
+                            console.log('DONE!');
+                        }
+                    }
+                }, 100);
+            }
+
             function initializeSection(_sectionUid, _sectionTemplateName) {
                 $.get('/get-default-section-data/' + _sectionTemplateName + '/{{$patient->uid}}' , function(_data) {
                     if(!_data) {

+ 1 - 1
resources/views/app/patient/notes.blade.php

@@ -64,7 +64,7 @@
             <th class="px-2 text-secondary border-bottom-0">Signed</th>
             <th class="px-2 text-secondary border-bottom-0 w-50">Content</th>
             <th class="px-2 text-secondary border-bottom-0">&nbsp;</th>
-            <th class="px-2 text-secondary border-bottom-0">&nbsp;</th>
+            <th class="px-2 text-secondary border-bottom-0">Actions</th>
         </tr>
         </thead>
         <tbody>

+ 15 - 3
storage/sections/new-patient-intake/summary.php

@@ -1,4 +1,16 @@
-<?php foreach($newContentData as $k => $v) { ?>
-    <div><?= $k ?>: <b><?= $v ?></b></div>
-<?php } ?>
+<?php foreach($newContentData as $k => $v) {
+    if(!!$v && strtolower($k) !== 'section_uid') {
+        $k = str_replace("__", " > ", $k);
+        $k = str_replace("_", " ", $k);
+        $k = ucwords($k);
+        ?>
+        <div><?= $k ?>:
+            <?php if(is_array($v)) { ?>
+                <b><?= implode(", ", $v) ?></b>
+            <?php } else { ?>
+                <b><?php print_r($v) ?></b>
+            <?php } ?>
+        </div>
+    <?php }
+} ?>