diff --git a/app/extensions/IconsHelper.php b/app/extensions/IconsHelper.php new file mode 100644 index 0000000..c733ffb --- /dev/null +++ b/app/extensions/IconsHelper.php @@ -0,0 +1,53 @@ + ['fas fa-plus-circle has-text-warning', "πŸ†•"], + 'In Progress' => ['fas fa-repeat has-text-link', "πŸ”„"], + 'On Hold' => ['fas fa-pause-circle has-text-danger',"⏸️"], + 'Completed' => ['fas fa-check-circle has-text-success', "βœ…"] + ]; + + static public $priority_icons = [ + 'Low' => ['fas fa-arrow-down',"🟒"], + 'Medium' => ['fas fa-minus', "🟑"], + 'High' => ['fas fa-arrow-up', "πŸ”΄"] + ]; + + static public function icons($node){ + + $attr = $node['@attrib']; + + $tpl = Template::instance(); + $f3 = Base::instance(); + + $context = $f3->hive(); + $inner = $tpl->token($node[0], $context); + + return ''; + + } + + static function do_the_switch($type, $value){ + + $icon_class = ''; + switch(strtolower($type)){ + case 'status': + $icon_class = IconsHelper::$status_icons[$value] ?? ['fas fa-question-circle has-text-info', "πŸ”²"]; + break; + case 'priority': + $icon_class = IconsHelper::$priority_icons[$value] ?? ['fas fa-question-circle', "πŸ”²"]; + break; + default: + $icon_class = 'fas fa-question-circle'; + } + + return ''.$icon_class[1].''; + return ''; + + } + +} + +\Template::instance()->extend('icons', 'IconsHelper::icons'); \ No newline at end of file diff --git a/public/index.php b/public/index.php index 2e844c9..d744fc6 100644 --- a/public/index.php +++ b/public/index.php @@ -15,7 +15,7 @@ $htmlpurifier = \HTMLPurifier::instance(); $md = \ParsedownTableExtension::instance(); $md->setSafeMode(true); -$f3->set('EXT', [new ParsedownHelper, new BulmaFormHelper]); +$f3->set('EXT', [new ParsedownHelper, new BulmaFormHelper, new IconsHelper]); $f3->set('DB', new \DB\SQL( 'mysql:host=localhost;port=3306;dbname=' . $f3->get('database.db_name'), diff --git a/ui/views/ticket/create.html b/ui/views/ticket/create.html index b8c1263..7a75166 100644 --- a/ui/views/ticket/create.html +++ b/ui/views/ticket/create.html @@ -1,6 +1,5 @@

Create Ticket Form

-
@@ -8,8 +7,13 @@ - - + + +
diff --git a/ui/views/ticket/edit.html b/ui/views/ticket/edit.html index 588961f..066a888 100644 --- a/ui/views/ticket/edit.html +++ b/ui/views/ticket/edit.html @@ -7,8 +7,13 @@ - - + + + diff --git a/ui/views/ticket/index.html b/ui/views/ticket/index.html index f6fe17e..d5eac19 100644 --- a/ui/views/ticket/index.html +++ b/ui/views/ticket/index.html @@ -17,8 +17,8 @@ {{@ticket.id}} {{@ticket.title}} - {{@ticket.status}} - {{@ticket.priority}} + {{@ticket.status_name}} + {{@ticket.priority_name}} {{@ticket.created_at}}