diff --git a/app/extensions/BulmaFormHelper.php b/app/extensions/BulmaFormHelper.php index 81c3a8d..b79e05b 100644 --- a/app/extensions/BulmaFormHelper.php +++ b/app/extensions/BulmaFormHelper.php @@ -67,6 +67,17 @@ class BulmaFormHelper extends \Prefab { } static function build_h_field_select($label, $name, $options, $selected){ + $opts = json_decode(str_replace("'", '"', $options)); + $opts_string = ""; + foreach($opts as $k => $v){ + if($v == $selected){ + $selected_str = " selected"; + } else { + $selected_str = ""; + } + $opts_string .= ''.$v.''; + } + $string = '
@@ -75,7 +86,9 @@ class BulmaFormHelper extends \Prefab {
- $options +
diff --git a/app/model/BulmaForm.php b/app/model/BulmaForm.php deleted file mode 100644 index 728f724..0000000 --- a/app/model/BulmaForm.php +++ /dev/null @@ -1,83 +0,0 @@ - -
- -
-
-
-
- -
-
-
-
- '; - - $string = str_replace('%label%', $label, $string); - $string = str_replace('%name%', $name, $string); - $string = str_replace('%value%', $value, $string); - - return $string; - } - - public static function horizontal_field_textarea($label = "%label%", $name = "%name%", $value=""){ - $string = ' -
-
- -
-
-
-
- -
-
-
-
- '; - - $string = str_replace('%label%', $label, $string); - $string = str_replace('%name%', $name, $string); - $string = str_replace('%value%', $value, $string); - - return $string; - } - - public static function horizontal_field_select($label="%label%", $name="%name%", $options=[], $selected=0){ - $string = ' -
-
- -
-
-
-
- -
-
-
-
- '; - - $string = str_replace('%label%', $label, $string); - $string = str_replace('%name%', $name, $string); - $opts_str = ''; $i=0; - foreach($options as $v){ - $opts_str .= ''.$v.''; - $i++; - } - $string = str_replace('%options%', $opts_str, $string); - - return $string; - } - -} \ No newline at end of file diff --git a/ui/views/ticket/create.html b/ui/views/ticket/create.html index a1aadd1..f9caba1 100644 --- a/ui/views/ticket/create.html +++ b/ui/views/ticket/create.html @@ -6,8 +6,9 @@ - {{ BulmaForm::horizontal_field_select('Priority:', 'priority', ['Low', 'Medium', 'High'])}} - {{ BulmaForm::horizontal_field_select('Status:', 'status', ['New', 'In Progress', 'On Hold', 'Completed'])}} + + +
diff --git a/ui/views/ticket/edit.html b/ui/views/ticket/edit.html index 76f10d3..9215576 100644 --- a/ui/views/ticket/edit.html +++ b/ui/views/ticket/edit.html @@ -5,8 +5,9 @@ - {{ BulmaForm::horizontal_field_select('Priority:', 'priority', ['Low', 'Medium', 'High'])}} - {{ BulmaForm::horizontal_field_select('Status:', 'status', ['New', 'In Progress', 'On Hold', 'Completed'])}} + + +