Pārlūkot izejas kodu

Note - new section care-team

Vijayakrishnan Krishnan 4 gadi atpakaļ
vecāks
revīzija
2e6d50e411

+ 45 - 0
storage/sections/care-team/actions.php

@@ -0,0 +1,45 @@
+<?php
+$infoLines = json_decode($patient->info_lines);
+$infoLines = !$infoLines ? [] : $infoLines;
+$rows = [];
+foreach ($infoLines as $category => $lines):
+    if ($category === "care_team"):
+        foreach ($lines as $line):
+            $rows[] = '<label class="d-flex align-items-center current-careteam-item mb-1 c-pointer">' .
+                '<input type="checkbox" checked class="my-0 mr-2">' .
+                '<span><b>' . $line->contentText . '</b>' .
+                (isset($line->contentDetail->{"Specialty"}) ? '<span class="text-secondary">&nbsp/&nbsp</span>' . @$line->contentDetail->{"Specialty"} : '') .
+                (isset($line->contentDetail->{"Next Appointment"}) ? '<span class="text-secondary mx-1">&nbsp/&nbsp</span>' . @$line->contentDetail->{"Next Appointment"} : '') .
+                '</span></label>';
+        endforeach;
+    endif;
+endforeach;
+?>
+
+<div moe class="position-relative d-none if-edit ml-3 pl-3 border-left">
+    <a start show href="#">Current Care Team</a>
+    <form url="/no-op" class="current-careteam-form">
+        <div class="min-width-300px">
+            <?= implode("", $rows) ?>
+            <div class="mt-2 mb-0">
+                <button class="btn btn-primary btn-sm mr-1" type="button" onclick="return applySelectedCareTeam()">Apply</button>
+                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+            </div>
+        </div>
+    </form>
+</div>
+
+<script>
+    function applySelectedCareTeam() {
+        let html = [];
+        $('.current-careteam-item input:checkbox:checked').each(function() {
+            html.push('<p>' + $(this).next().html() + '</p>');
+        });
+        $('.current-careteam-form').hide();
+        hideMask();
+        hideMoeFormMask();
+        $('.ql-editor[contenteditable]:visible').first().html(html.join('')).focus();
+        return false;
+    }
+</script>
+

+ 23 - 0
storage/sections/care-team/default.php

@@ -0,0 +1,23 @@
+<?php
+$value = [];
+$infoLines = json_decode($patient->info_lines);
+$infoLines = !$infoLines ? [] : $infoLines;
+global $defaultData;
+foreach($infoLines as $category => $lines):
+    if($category === "care_team"):
+        foreach ($lines as $line):
+            $value[] = '<p><b>' . $line->contentText . '</b> ';
+            $value[] = @$line->contentDetail->{"Specialty"};
+            if(@$line->contentDetail->{"Next Appointment"}) {
+                $value[] = ' / ';
+                $value[] = @$line->contentDetail->{"Next Appointment"};
+            }
+            $value[] = '</p>';
+        endforeach;
+    endif;
+endforeach;
+$value = implode("", $value);
+$defaultData = [
+    "summary" => $value,
+    "value" => $value,
+];

+ 39 - 0
storage/sections/care-team/form.blade.php

@@ -0,0 +1,39 @@
+<?php
+$contentData = false;
+if($section){
+    $contentData = json_decode($section->content_data, true);
+}
+if(!$contentData || !isset($contentData['value'])) {
+    $contentData = [
+        'value'=>''
+    ];
+}
+$formID = rand(0, 100000);
+?>
+<form method="POST" action="/process_form_submit" onsubmit="return submitForm_NoteSection_{{ $formID }}(this);">
+    <?php if($section): ?>
+        <input type="hidden" name="section_uid" value="<?= $section->uid?>">
+    <?php else: ?>
+        <input type="hidden" name="note_uid" value="<?= $note->uid?>">
+        <input type="hidden" name="section_template_uid" value="<?= $sectionTemplate->uid ?>">
+    <?php endif; ?>
+    <div class="form-group mb-2">
+        <textarea rte type="text" class="form-control form-control-sm p-2" name="value" placeholder="Value"><?= $contentData['value'] ?></textarea>
+    </div>
+    <div class="form-group m-0 d-flex">
+        <button class="btn btn-sm btn-primary mr-2">Submit</button>
+        <button class="btn btn-sm btn-default border" onclick="return cancelForm_NoteSection_{{ $formID }}(this)">Cancel</button>
+    </div>
+</form>
+<script>
+    function submitForm_NoteSection_{{ $formID }}(_form) {
+        $.post(_form.action, $(_form).serialize(), function(_data) {
+            fastReload();
+        });
+        return false;
+    }
+    function cancelForm_NoteSection_{{ $formID }}(_trigger) {
+        $(_trigger).closest('.note-section').toggleClass('edit');
+        return false;
+    }
+</script>

+ 4 - 0
storage/sections/care-team/processor.php

@@ -0,0 +1,4 @@
+<?php
+$newContentData = [
+    'value' => $request->get('value')
+];

+ 1 - 0
storage/sections/care-team/summary.php

@@ -0,0 +1 @@
+<div><?= $newContentData['value']; ?></div>