Jelajahi Sumber

PMHx section UI

Vijayakrishnan Krishnan 4 tahun lalu
induk
melakukan
f2f7a98104

+ 11 - 0
public/css/style.css

@@ -272,3 +272,14 @@ body>nav.navbar {
 .c-pointer {
     cursor: pointer;
 }
+.inset-comment p:last-child {
+    margin-bottom: 0 !important;
+}
+.note-section.edit {
+    background: #f0f8ff7d;
+    outline: 2px solid #9de3ff;
+}
+.note-section.edit .ql-editor,
+.note-section.edit .btn-default {
+    background-color: #fff !important;
+}

+ 82 - 6
storage/sections/pmhx/form.blade.php

@@ -1,13 +1,53 @@
 <?php
+$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 = false;
 if($section){
     $contentData = json_decode($section->content_data, true);
 }
-if(!$contentData || !isset($contentData['value'])) {
-    $contentData = [
-        'value'=>''
-    ];
+if(!$contentData) {
+    $contentData = [];
 }
+for ($i = 0; $i < count($fields); $i++) {
+    for($j = 0; $j < count($fields[$i]); $j++) {
+        $parts = explode(":::", $fields[$i][$j]);
+        $head = 'custom';
+        if(!empty($parts[0])) $head = $parts[0];
+        $values = explode("|", $parts[1]);
+        for($k = 0; $k < count($values); $k++) {
+            $fName = $head . '_' . $values[$k];
+            if(!isset($contentData[$fName])) {
+                $contentData[$fName] = '';
+            }
+        }
+    }
+}
+
 $formID = rand(0, 100000);
 ?>
 <form method="POST" action="/process_form_submit" onsubmit="return submitForm_NoteSection_{{ $formID }}(this);">
@@ -17,9 +57,45 @@ $formID = rand(0, 100000);
         <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 class="row">
+        @for ($i = 0; $i < count($fields); $i++)
+            <div class="col-md-3">
+                @for($j = 0; $j < count($fields[$i]); $j++)
+                    <?php
+                        $parts = explode(":::", $fields[$i][$j]);
+                        $head = 'custom';
+                        if(!empty($parts[0])) $head = $parts[0];
+                        $values = explode("|", $parts[1]);
+                    ?>
+                    <div class="mb-3">
+                        @if($head !== 'custom')
+                            <div class="font-weight-bold mb-2">{{ $head }}</div>
+                        @endif
+                        @for($k = 0; $k < count($values); $k++)
+                            <?php
+                                $fName = $head . '_' . $values[$k];
+                            ?>
+                             <label class="d-flex align-items-center mb-1">
+                                 <input type="checkbox" name="{{ $fName }}" {{ $contentData[$fName] ? 'checked' : '' }} class="m-0">
+                                 <span class="ml-2">{{ $values[$k] }}</span>
+                             </label>
+                        @endfor
+                    </div>
+                @endfor
+            </div>
+        @endfor
+    </div>
+
+    <div class="row mb-3">
+        <div class="col-12">
+            <textarea rte type="text" class="form-control form-control-sm p-2"
+                      name="comments"
+                      data-shortcuts="{{ $shortcuts }}"
+                      placeholder="Value"><?= isset($contentData['comments']) ? $contentData['comments'] : '' ?></textarea>
+        </div>
     </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>

+ 42 - 2
storage/sections/pmhx/processor.php

@@ -1,4 +1,44 @@
 <?php
-$newContentData = [
-    'value' => $request->get('value')
+$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)",
+    ]
 ];
+
+$newContentData = [];
+
+for ($i = 0; $i < count($fields); $i++) {
+    for($j = 0; $j < count($fields[$i]); $j++) {
+        $parts = explode(":::", $fields[$i][$j]);
+        $head = 'custom';
+        if(!empty($parts[0])) $head = $parts[0];
+        $values = explode("|", $parts[1]);
+        for($k = 0; $k < count($values); $k++) {
+            $fName = $head . '_' . $values[$k];
+            $newContentData[$fName] = $request->get($fName);
+        }
+    }
+}
+
+$newContentData['comments'] = $request->get('comments');

+ 53 - 1
storage/sections/pmhx/summary.php

@@ -1 +1,53 @@
-<div><?= $newContentData['value']; ?></div>
+<?php
+$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)",
+    ]
+];
+
+for ($i = 0; $i < count($fields); $i++) {
+    for($j = 0; $j < count($fields[$i]); $j++) {
+        $parts = explode(":::", $fields[$i][$j]);
+        $head = 'custom';
+        if(!empty($parts[0])) $head = $parts[0];
+        $values = explode("|", $parts[1]);
+        for($k = 0; $k < count($values); $k++) {
+            $fName = $head . '_' . $values[$k];
+            if(isset($newContentData[$fName])) { ?>
+                <div>
+                    <?= ucwords($head) ?>
+                    <i class="fa fa-arrow-right text-sm text-secondary"></i>
+                    <span class="font-weight-bold"><?= $values[$k] ?></span>
+                </div>
+            <?php }
+        }
+    }
+}
+
+if(isset($newContentData['comments'])) { ?>
+    <div class="mt-3 mb-1">
+        <div class="font-weight-bold">Comments:</div>
+        <div class="inset-comment"><?= $newContentData['comments'] ?></div>
+    </div>
+<?php }