<?php
    namespace App\Utils;

    class RenderHelper {
        public static function render_btn_action(string $icon, string $label, string $route, bool $enabled) : string {

            if ($enabled) {
                return "<a class='btn btn-action btn-sm' href='$route')><i class='fa fa-$icon fa-fw icon'></i><span>$label</span></a>";
            } else {
                return "<a class='btn btn-action btn-sm disabled text-white' aria-disabled='true'><i class='fa fa-$icon fa-fw icon'></i><span>$label</span></a>";
            }            

        }

        public static function render_btn_action_quick(string $icon, string $route, bool $enabled, bool $danger) : string {

            if ($enabled) {
                return "<a class='btn " . ( $danger ? "btn-danger" : "" ) . " btn-action-quick btn-sm' href='$route')><i class='fa fa-$icon fa-fw icon'></i></a>";
            } else {
                return "<a class='btn " . ( $danger ? "btn-danger" : "" ) . " btn-action-quick btn-sm disabled text-white' aria-disabled='true'><i class='fa fa-$icon fa-fw icon'></i></a>";
            }            

        }

        public static function render_linked_list(int $count, string $icon, string $route) : string {

            $render = "<a href=" . $route . ">";

            if ($count > 0) {
                $render .= "<span class='list-n'>$count&nbsp;<i class='fa fa-$icon'></i></span>";
            } else {
                $render .= "<span class='list-0'>0&nbsp;<i class='fa fa-$icon'></i></span>";
            }

            $render .= "</a>";

            return $render;

        }
    }