Browse Source

Merge ../BusinessAppTemplate

# Conflicts:
#	pages/form.php
Skylar Ittner 3 months ago
parent
commit
5e1ee303a8
2 changed files with 22 additions and 14 deletions
  1. 22
    6
      lib/FormBuilder.lib.php
  2. 0
    8
      pages.php

+ 22
- 6
lib/FormBuilder.lib.php View File

@@ -178,7 +178,10 @@ HTMLTOP;
178 178
             }
179 179
             $itemhtml = "";
180 180
             $itemlabel = "";
181
-            if ($item['type'] != "checkbox") {
181
+
182
+            if ($item['type'] == "textarea") {
183
+                $itemlabel = "<label class=\"mb-0\"><i class=\"$item[icon]\"></i> $item[label]:</label>";
184
+            } else if ($item['type'] != "checkbox") {
182 185
                 $itemlabel = "<label class=\"mb-0\">$item[label]:</label>";
183 186
             }
184 187
             $strippedlabel = strip_tags($item['label']);
@@ -186,13 +189,16 @@ HTMLTOP;
186 189
 \n\n                <div class="col-12 col-md-$item[width]">
187 190
                     <div class="form-group mb-3">
188 191
                         $itemlabel
189
-                        <div class="input-group">
192
+ITEMTOP;
193
+            $inputgrouptop = <<<INPUTG
194
+\n                            <div class="input-group">
190 195
                             <div class="input-group-prepend">
191 196
                                 <span class="input-group-text"><i class="$item[icon]"></i></span>
192 197
                             </div>
193
-ITEMTOP;
198
+INPUTG;
194 199
             switch ($item['type']) {
195 200
                 case "select":
201
+                    $itemhtml .= $inputgrouptop;
196 202
                     $itemhtml .= <<<SELECT
197 203
 \n                            <select class="form-control" name="$item[name]" aria-label="$strippedlabel" $required>
198 204
 SELECT;
@@ -206,6 +212,7 @@ SELECT;
206 212
                     $itemhtml .= "\n                            </select>";
207 213
                     break;
208 214
                 case "checkbox":
215
+                    $itemhtml .= $inputgrouptop;
209 216
                     $itemhtml .= <<<CHECKBOX
210 217
 \n                            <div class="form-group form-check">
211 218
                                 <input type="checkbox" name="$item[name]" $id class="form-check-input" value="$item[value]" $required aria-label="$strippedlabel">
@@ -213,7 +220,14 @@ SELECT;
213 220
                               </div>
214 221
 CHECKBOX;
215 222
                     break;
223
+                case "textarea":
224
+                    $val = htmlentities($item['value']);
225
+                    $itemhtml .= <<<TEXTAREA
226
+\n                            <textarea class="form-control" id="info" name="$item[name]" aria-label="$strippedlabel" minlength="$item[minlength]" maxlength="$item[maxlength]" $required>$val</textarea>
227
+TEXTAREA;
228
+                    break;
216 229
                 default:
230
+                    $itemhtml .= $inputgrouptop;
217 231
                     $itemhtml .= <<<INPUT
218 232
 \n                            <input type="$item[type]" name="$item[name]" $id class="form-control" aria-label="$strippedlabel" minlength="$item[minlength]" maxlength="$item[maxlength]" $pattern value="$item[value]" $required />
219 233
 INPUT;
@@ -227,9 +241,11 @@ INPUT;
227 241
                             </div>
228 242
 ERROR;
229 243
             }
244
+            if ($item["type"] != "textarea") {
245
+                $itemhtml .= "\n                                </div>";
246
+            }
230 247
             $itemhtml .= <<<ITEMBOTTOM
231
-\n                        </div>
232
-                    </div>
248
+\n                    </div>
233 249
                 </div>\n
234 250
 ITEMBOTTOM;
235 251
             $html .= $itemhtml;
@@ -242,7 +258,7 @@ ITEMBOTTOM;
242 258
 HTMLBOTTOM;
243 259
 
244 260
         if (!empty($this->buttons)) {
245
-            $html .= "\n        <div class=\"card-footer\">";
261
+            $html .= "\n        <div class=\"card-footer d-flex\">";
246 262
             foreach ($this->buttons as $btn) {
247 263
                 $btnhtml = "";
248 264
                 $inner = "<i class=\"$btn[icon]\"></i> $btn[text]";

+ 0
- 8
pages.php View File

@@ -99,13 +99,5 @@ define("PAGES", [
99 99
     ],
100 100
     "404" => [
101 101
         "title" => "404 error"
102
-    ],
103
-    "form" => [
104
-        "title" => "Form",
105
-        "navbar" => true,
106
-        "icon" => "fas fa-file-alt",
107
-        "scripts" => [
108
-            "static/js/form.js"
109
-        ]
110 102
     ]
111 103
 ]);

Loading…
Cancel
Save