Browse Source

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

Josh 4 years ago
parent
commit
728dc6dffb

+ 39 - 13
app/Console/Commands/Gem.php

@@ -96,24 +96,32 @@ class Gem extends Command
 
                     // YES
                     $output .= $this->ln('<label class="d-inline-flex align-items-center my-0 mr-3">', $fieldLevel + 2);
-                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '" type="radio" value="YES" class="mr-1">', $fieldLevel + 3);
+                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                        "{{ @\$contentData['{$key}'] === 'YES' ? 'checked' : '' }} " .
+                        'name="' . $key . '" type="radio" value="YES" class="mr-1">', $fieldLevel + 3);
                     $output .= $this->ln('<span>Yes</span>', $fieldLevel + 3);
                     $output .= $this->ln('</label>', $fieldLevel + 2);
 
                     // NO
                     $output .= $this->ln('<label class="d-inline-flex align-items-center my-0 mr-3">', $fieldLevel + 2);
-                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '" type="radio" value="NO" class="mr-1">', $fieldLevel + 3);
+                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                        "{{ @\$contentData['{$key}'] === 'NO' ? 'checked' : '' }} " .
+                        'name="' . $key . '" type="radio" value="NO" class="mr-1">', $fieldLevel + 3);
                     $output .= $this->ln('<span>No</span>', $fieldLevel + 3);
                     $output .= $this->ln('</label>', $fieldLevel + 2);
 
                     // NO
                     $output .= $this->ln('<label class="d-inline-flex align-items-center my-0 mr-3">', $fieldLevel + 2);
-                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '" type="radio" value="UNKNOWN" class="mr-1">', $fieldLevel + 3);
+                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                        "{{ @\$contentData['{$key}'] === 'UNKNOWN' ? 'checked' : '' }} " .
+                        'name="' . $key . '" type="radio" value="UNKNOWN" class="mr-1">', $fieldLevel + 3);
                     $output .= $this->ln('<span>Unknown</span>', $fieldLevel + 3);
                     $output .= $this->ln('</label>', $fieldLevel + 2);
 
                     // MEMO
-                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '_memo" type="text" class="form-control form-control-sm" placeholder="Memo">', $fieldLevel + 2);
+                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                        'value="' . "{{ @\$contentData['{$key}_memo'] }}" . '" ' .
+                        'name="' . $key . '_memo" type="text" class="form-control form-control-sm" placeholder="Memo">', $fieldLevel + 2);
 
                     // end
                     $output .= $this->ln('</div>', $fieldLevel + 1);
@@ -124,16 +132,22 @@ class Gem extends Command
                     $output .= $this->ln('<div class="d-flex align-items-center">', $fieldLevel + 1);
 
                     // VALUE
-                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '" type="text" class="form-control form-control-sm" placeholder="Answer">', $fieldLevel + 2);
+                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                        'value="' . "{{ @\$contentData['{$key}'] }}" . '" ' .
+                        'name="' . $key . '" type="text" class="form-control form-control-sm" placeholder="Answer">', $fieldLevel + 2);
 
                     // UNKNOWN
                     $output .= $this->ln('<label class="d-inline-flex align-items-center my-0 ml-3 mr-2">', $fieldLevel + 2);
-                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '" type="checkbox" class="mr-1">', $fieldLevel + 3);
+                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                        "{{ @\$contentData['{$key}_unknown'] ? 'checked' : '' }} " .
+                        'name="' . $key . '_unknown" type="checkbox" class="mr-1">', $fieldLevel + 3);
                     $output .= $this->ln('<span>Unknown</span>', $fieldLevel + 3);
                     $output .= $this->ln('</label>', $fieldLevel + 2);
 
                     // MEMO
-                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '_memo" type="text" class="form-control form-control-sm" placeholder="Memo">', $fieldLevel + 2);
+                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                        'value="' . "{{ @\$contentData['{$key}_memo'] }}" . '" ' .
+                        'name="' . $key . '_memo" type="text" class="form-control form-control-sm" placeholder="Memo">', $fieldLevel + 2);
 
                     // end
                     $output .= $this->ln('</div>', $fieldLevel + 1);
@@ -144,10 +158,14 @@ class Gem extends Command
                     $output .= $this->ln('<div class="d-flex align-items-center">', $fieldLevel + 1);
 
                     // VALUE
-                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '" type="text" class="form-control form-control-sm mr-2" placeholder="Answer">', $fieldLevel + 2);
+                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                        'value="' . "{{ @\$contentData['{$key}'] }}" . '" ' .
+                        'name="' . $key . '" type="text" class="form-control form-control-sm mr-2" placeholder="Answer">', $fieldLevel + 2);
 
                     // MEMO
-                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '_memo" type="text" class="form-control form-control-sm" placeholder="Memo">', $fieldLevel + 2);
+                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                        'value="' . "{{ @\$contentData['{$key}_memo'] }}" . '" ' .
+                        'name="' . $key . '_memo" type="text" class="form-control form-control-sm" placeholder="Memo">', $fieldLevel + 2);
 
                     // end
                     $output .= $this->ln('</div>', $fieldLevel + 1);
@@ -159,13 +177,17 @@ class Gem extends Command
 
                     foreach ($_node->Options as $option) {
                         $output .= $this->ln('<label class="d-flex align-items-center mb-1 mr-2">', $fieldLevel + 2);
-                        $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '[]" value="' . $option . '" type="checkbox" class="mr-1">', $fieldLevel + 3);
+                        $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                            "{{ in_array('" . str_replace("'", "\\'", $option) . "', \$contentData['{$key}']) !== FALSE ? 'checked' : '' }} " .
+                            'name="' . $key . '[]" value="' . $option . '" type="checkbox" class="mr-1">', $fieldLevel + 3);
                         $output .= $this->ln('<span>' . $option . '</span>', $fieldLevel + 3);
                         $output .= $this->ln('</label>', $fieldLevel + 2);
                     }
 
                     // OTHER
-                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '_other" type="text" class="form-control form-control-sm my-3" placeholder="Other">', $fieldLevel + 2);
+                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                        'value="' . "{{ @\$contentData['{$key}_other'] }}" . '" ' .
+                        'name="' . $key . '_other" type="text" class="form-control form-control-sm my-3" placeholder="Other">', $fieldLevel + 2);
 
                     // end
                     $output .= $this->ln('</div>', $fieldLevel + 1);
@@ -177,13 +199,17 @@ class Gem extends Command
 
                     // YES
                     $output .= $this->ln('<label class="d-inline-flex align-items-center my-0 mr-3">', $fieldLevel + 2);
-                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '" type="radio" value="ACCEPT" class="mr-1">', $fieldLevel + 3);
+                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                        "{{ @\$contentData['{$key}'] === 'ACCEPT' ? 'checked' : '' }} " .
+                        'name="' . $key . '" type="radio" value="ACCEPT" class="mr-1">', $fieldLevel + 3);
                     $output .= $this->ln('<span>Accept</span>', $fieldLevel + 3);
                     $output .= $this->ln('</label>', $fieldLevel + 2);
 
                     // NO
                     $output .= $this->ln('<label class="d-inline-flex align-items-center my-0 mr-3">', $fieldLevel + 2);
-                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" name="' . $key . '" type="radio" value="REJECT" class="mr-1">', $fieldLevel + 3);
+                    $output .= $this->ln('<input onchange="onGemVChange_{{ $formID }}(this)" '.
+                        "{{ @\$contentData['{$key}'] === 'REJECT' ? 'checked' : '' }} " .
+                        'name="' . $key . '" type="radio" value="REJECT" class="mr-1">', $fieldLevel + 3);
                     $output .= $this->ln('<span>Reject</span>', $fieldLevel + 3);
                     $output .= $this->ln('</label>', $fieldLevel + 2);
 

File diff suppressed because it is too large
+ 183 - 182
gem/forms/new-patient-intake/build/form.blade.php


+ 1 - 1
gem/forms/new-patient-intake/build/summary.php

@@ -1 +1 @@
-<div><?= dump($newContentData['value']) ?></div>
+<div><?php dump($newContentData) ?></div>

+ 5 - 4
gem/templates/form.blade.php

@@ -3,13 +3,14 @@ $contentData = false;
 if($section){
     $contentData = json_decode($section->content_data, true);
 }
-if(!$contentData || !isset($contentData['value'])) {
-    $contentData = [
-        'value'=>''
-    ];
+if(!$contentData) {
+    $contentData = [];
 }
 $formID = rand(0, 100000);
 ?>
+<pre>
+    <?php var_dump($contentData); ?>
+</pre>
 <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?>">

+ 1 - 1
gem/templates/summary.php

@@ -1 +1 @@
-<div><?= dump($newContentData['value']) ?></div>
+<div><?php dump($newContentData) ?></div>

File diff suppressed because it is too large
+ 183 - 182
storage/sections/new-patient-intake/form.blade.php


+ 1 - 1
storage/sections/new-patient-intake/summary.php

@@ -1 +1 @@
-<div><?= dump($newContentData['value']) ?></div>
+<div><?php dump($newContentData) ?></div>

Some files were not shown because too many files changed in this diff