瀏覽代碼

PSHx section UI

Vijayakrishnan Krishnan 4 年之前
父節點
當前提交
54b2b3a804

+ 6 - 0
app/Helpers/helpers.php

@@ -81,3 +81,9 @@ if(!function_exists('time_in_hrminsec')) {
     }
 }
 
+if(!function_exists('sanitize_field_name')) {
+    function sanitize_field_name($name) {
+        $result = strtolower($name);
+        return preg_replace("/[^0-9a-z]/i", "_", $result);
+    }
+}

+ 2 - 2
storage/sections/pmhx/form.blade.php

@@ -40,7 +40,7 @@ for ($i = 0; $i < count($fields); $i++) {
         if(!empty($parts[0])) $head = $parts[0];
         $values = explode("|", $parts[1]);
         for($k = 0; $k < count($values); $k++) {
-            $fName = $head . '_' . $values[$k];
+            $fName = $head . '_' . sanitize_field_name($values[$k]);
             if(!isset($contentData[$fName])) {
                 $contentData[$fName] = '';
             }
@@ -95,7 +95,7 @@ $formID = rand(0, 100000);
                         @endif
                         @for($k = 0; $k < count($values); $k++)
                             <?php
-                                $fName = $head . '_' . $values[$k];
+                                $fName = $head . '_' . sanitize_field_name($values[$k]);
                             ?>
                              <label class="d-flex align-items-center mb-1">
                                  <input type="checkbox" name="{{ $fName }}" {{ $contentData[$fName] ? 'checked' : '' }} class="m-0">

+ 1 - 1
storage/sections/pmhx/processor.php

@@ -38,7 +38,7 @@ for ($i = 0; $i < count($fields); $i++) {
         if(!empty($parts[0])) $head = $parts[0];
         $values = explode("|", $parts[1]);
         for($k = 0; $k < count($values); $k++) {
-            $fName = $head . '_' . $values[$k];
+            $fName = $head . '_' . sanitize_field_name($values[$k]);
             $newContentData[$fName] = $request->get($fName);
         }
     }

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

@@ -47,7 +47,7 @@ for ($i = 0; $i < count($fields); $i++) {
         if(!empty($parts[0])) $head = $parts[0];
         $values = explode("|", $parts[1]);
         for($k = 0; $k < count($values); $k++) {
-            $fName = $head . '_' . $values[$k];
+            $fName = $head . '_' . sanitize_field_name($values[$k]);
             if(isset($newContentData[$fName])) { ?>
                 <div>
                     <?= ucwords($head) ?>

+ 131 - 6
storage/sections/pshx/form.blade.php

@@ -1,12 +1,68 @@
 <?php
+$commonFields = [
+    [
+        ":::Aneurysm repair|Appendectomy|Back surgery|Bariatric surgery/gastric bypass|Bilateral tubal ligation|Breast resection/mastectomy|CABG|Carotid endarterectomy/stent|Carpal tunnel release surgery",
+    ],
+    [
+        ":::Cataract/lens surgery|Cesarean section|Cholecystectomy/bile duct surgery|Dilation and curettage|Hemorrhoid surgery|Hip arthroplasty|Hip replacement|Hysterectomy|Inguinal hernia repair",
+    ],
+    [
+        ":::Knee arthroplasty|LASIK|Laminectomy|Nasal surgery|PTCA/PCI|Pacemaker/defibrillator|Prostate surgery|Prostatectomy|Rotator cuff surgery",
+    ],
+    [
+        ":::Sinus surgery|Skin cancer excision|Spinal fusion|TAH-BSO|TURP|Tonsillectomy/Adenoidectomy|Vasectomy",
+    ]
+];
+
+$customFields = [
+    [
+        ":::Bladder surgery/repair posts|Cardiac catheterization|Cardiac Stent Placement",
+    ],
+    [
+        ":::IVC filter/stent|Knee Replacement|Lumpectomy",
+    ],
+    [
+        ":::Multiple heart stents|Oral surgery|Rt elbow ulnar repair",
+    ],
+    [
+        ":::Rt Nephrectomy|Thyroidectomy|Valve replacement with stent",
+    ]
+];
+
 $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($commonFields); $i++) {
+    for($j = 0; $j < count($commonFields[$i]); $j++) {
+        $parts = explode(":::", $commonFields[$i][$j]);
+        $head = 'common';
+        if(!empty($parts[0])) $head = $parts[0];
+        $values = explode("|", $parts[1]);
+        for($k = 0; $k < count($values); $k++) {
+            $fName = $head . '_' . sanitize_field_name($values[$k]);
+            if(!isset($contentData[$fName])) {
+                $contentData[$fName] = '';
+            }
+        }
+    }
+}
+for ($i = 0; $i < count($customFields); $i++) {
+    for($j = 0; $j < count($customFields[$i]); $j++) {
+        $parts = explode(":::", $customFields[$i][$j]);
+        $head = 'custom';
+        if(!empty($parts[0])) $head = $parts[0];
+        $values = explode("|", $parts[1]);
+        for($k = 0; $k < count($values); $k++) {
+            $fName = $head . '_' . sanitize_field_name($values[$k]);
+            if(!isset($contentData[$fName])) {
+                $contentData[$fName] = '';
+            }
+        }
+    }
 }
 $formID = rand(0, 100000);
 ?>
@@ -17,9 +73,78 @@ $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="font-weight-bold mb-2">Common Surgeries</div>
+
+    <div class="row">
+        @for ($i = 0; $i < count($commonFields); $i++)
+            <div class="col-md-3">
+                @for($j = 0; $j < count($commonFields[$i]); $j++)
+                    <?php
+                        $parts = explode(":::", $commonFields[$i][$j]);
+                        $head = 'common';
+                        if(!empty($parts[0])) $head = $parts[0];
+                        $values = explode("|", $parts[1]);
+                    ?>
+                    <div class="mb-3">
+                        @if($head !== 'common')
+                            <div class="font-weight-bold mb-2">{{ $head }}</div>
+                        @endif
+                        @for($k = 0; $k < count($values); $k++)
+                            <?php
+                                $fName = $head . '_' . sanitize_field_name($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="font-weight-bold mb-2">Custom Items</div>
+
+    <div class="row">
+        @for ($i = 0; $i < count($customFields); $i++)
+            <div class="col-md-3">
+                @for($j = 0; $j < count($customFields[$i]); $j++)
+                    <?php
+                    $parts = explode(":::", $customFields[$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 . '_' . sanitize_field_name($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>

+ 58 - 2
storage/sections/pshx/processor.php

@@ -1,4 +1,60 @@
 <?php
-$newContentData = [
-    'value' => $request->get('value')
+$commonFields = [
+    [
+        ":::Aneurysm repair|Appendectomy|Back surgery|Bariatric surgery/gastric bypass|Bilateral tubal ligation|Breast resection/mastectomy|CABG|Carotid endarterectomy/stent|Carpal tunnel release surgery",
+    ],
+    [
+        ":::Cataract/lens surgery|Cesarean section|Cholecystectomy/bile duct surgery|Dilation and curettage|Hemorrhoid surgery|Hip arthroplasty|Hip replacement|Hysterectomy|Inguinal hernia repair",
+    ],
+    [
+        ":::Knee arthroplasty|LASIK|Laminectomy|Nasal surgery|PTCA/PCI|Pacemaker/defibrillator|Prostate surgery|Prostatectomy|Rotator cuff surgery",
+    ],
+    [
+        ":::Sinus surgery|Skin cancer excision|Spinal fusion|TAH-BSO|TURP|Tonsillectomy/Adenoidectomy|Vasectomy",
+    ]
 ];
+
+$customFields = [
+    [
+        ":::Bladder surgery/repair post s|Cardiac catheterization|Cardiac Stent Placement",
+    ],
+    [
+        ":::IVC filter/stent|Knee Replacement|Lumpectomy",
+    ],
+    [
+        ":::Multiple heart stents|Oral surgery|Rt elbow ulnar repair",
+    ],
+    [
+        ":::Rt Nephrectomy|Thyroidectomy|Valve replacement with stent",
+    ]
+];
+
+$newContentData = [];
+
+for ($i = 0; $i < count($commonFields); $i++) {
+    for($j = 0; $j < count($commonFields[$i]); $j++) {
+        $parts = explode(":::", $commonFields[$i][$j]);
+        $head = 'common';
+        if(!empty($parts[0])) $head = $parts[0];
+        $values = explode("|", $parts[1]);
+        for($k = 0; $k < count($values); $k++) {
+            $fName = $head . '_' . sanitize_field_name($values[$k]);
+            $newContentData[$fName] = $request->get($fName);
+        }
+    }
+}
+
+for ($i = 0; $i < count($customFields); $i++) {
+    for($j = 0; $j < count($customFields[$i]); $j++) {
+        $parts = explode(":::", $customFields[$i][$j]);
+        $head = 'custom';
+        if(!empty($parts[0])) $head = $parts[0];
+        $values = explode("|", $parts[1]);
+        for($k = 0; $k < count($values); $k++) {
+            $fName = $head . '_' . sanitize_field_name($values[$k]);
+            $newContentData[$fName] = $request->get($fName);
+        }
+    }
+}
+
+$newContentData['comments'] = $request->get('comments');

+ 75 - 1
storage/sections/pshx/summary.php

@@ -1 +1,75 @@
-<div><?= $newContentData['value']; ?></div>
+<?php
+$commonFields = [
+    [
+        ":::Aneurysm repair|Appendectomy|Back surgery|Bariatric surgery/gastric bypass|Bilateral tubal ligation|Breast resection/mastectomy|CABG|Carotid endarterectomy/stent|Carpal tunnel release surgery",
+    ],
+    [
+        ":::Cataract/lens surgery|Cesarean section|Cholecystectomy/bile duct surgery|Dilation and curettage|Hemorrhoid surgery|Hip arthroplasty|Hip replacement|Hysterectomy|Inguinal hernia repair",
+    ],
+    [
+        ":::Knee arthroplasty|LASIK|Laminectomy|Nasal surgery|PTCA/PCI|Pacemaker/defibrillator|Prostate surgery|Prostatectomy|Rotator cuff surgery",
+    ],
+    [
+        ":::Sinus surgery|Skin cancer excision|Spinal fusion|TAH-BSO|TURP|Tonsillectomy/Adenoidectomy|Vasectomy",
+    ]
+];
+
+$customFields = [
+    [
+        ":::Bladder surgery/repair post s|Cardiac catheterization|Cardiac Stent Placement",
+    ],
+    [
+        ":::IVC filter/stent|Knee Replacement|Lumpectomy",
+    ],
+    [
+        ":::Multiple heart stents|Oral surgery|Rt elbow ulnar repair",
+    ],
+    [
+        ":::Rt Nephrectomy|Thyroidectomy|Valve replacement with stent",
+    ]
+];
+
+for ($i = 0; $i < count($commonFields); $i++) {
+    for($j = 0; $j < count($commonFields[$i]); $j++) {
+        $parts = explode(":::", $commonFields[$i][$j]);
+        $head = 'common';
+        if(!empty($parts[0])) $head = $parts[0];
+        $values = explode("|", $parts[1]);
+        for($k = 0; $k < count($values); $k++) {
+            $fName = $head . '_' . sanitize_field_name($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 }
+        }
+    }
+}
+
+for ($i = 0; $i < count($customFields); $i++) {
+    for($j = 0; $j < count($customFields[$i]); $j++) {
+        $parts = explode(":::", $customFields[$i][$j]);
+        $head = 'custom';
+        if(!empty($parts[0])) $head = $parts[0];
+        $values = explode("|", $parts[1]);
+        for($k = 0; $k < count($values); $k++) {
+            $fName = $head . '_' . sanitize_field_name($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-2 mb-1">
+        <div class="font-weight-bold">Comments:</div>
+        <div><?= $newContentData['comments'] ?></div>
+    </div>
+<?php }