107 lines
2.6 KiB
PHP
107 lines
2.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Dashboard Helper Functions
|
|
* File ini berisi function helper yang bisa digunakan langsung di view atau controller
|
|
*/
|
|
|
|
if (!function_exists('get_dashboard_status')) {
|
|
/**
|
|
* Mendapatkan status data untuk tipe izin tertentu
|
|
*/
|
|
function get_dashboard_status(string $type): array
|
|
{
|
|
return App\Helpers\DashboardHelper::getStatusDataByType($type);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('get_dashboard_total')) {
|
|
/**
|
|
* Menambahkan total ke data statuses
|
|
*/
|
|
function get_dashboard_total(array $statuses): array
|
|
{
|
|
return App\Helpers\DashboardHelper::addTotalToStatuses($statuses);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('dashboard_type_label')) {
|
|
/**
|
|
* Mendapatkan label untuk tipe izin
|
|
*/
|
|
function dashboard_type_label(string $type): string
|
|
{
|
|
return App\Helpers\DashboardHelper::getTypeLabel($type);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('dashboard_status_icon')) {
|
|
/**
|
|
* Mendapatkan icon untuk status
|
|
*/
|
|
function dashboard_status_icon(string $statusId): string
|
|
{
|
|
return App\Helpers\DashboardHelper::getStatusIcon($statusId);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('dashboard_card_background')) {
|
|
/**
|
|
* Mendapatkan background color untuk card
|
|
*/
|
|
function dashboard_card_background(string $statusId): string
|
|
{
|
|
return App\Helpers\DashboardHelper::getCardBackground($statusId);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('dashboard_icon_circle_color')) {
|
|
/**
|
|
* Mendapatkan warna lingkaran icon
|
|
*/
|
|
function dashboard_icon_circle_color(string $statusId): string
|
|
{
|
|
return App\Helpers\DashboardHelper::getIconCircleColor($statusId);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('dashboard_badge_color')) {
|
|
/**
|
|
* Mendapatkan badge color untuk tipe izin
|
|
*/
|
|
function dashboard_badge_color(string $type): string
|
|
{
|
|
return App\Helpers\DashboardHelper::getBadgeColor($type);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('dashboard_percentage')) {
|
|
/**
|
|
* Menghitung persentase
|
|
*/
|
|
function dashboard_percentage(int $value, int $total): float
|
|
{
|
|
return App\Helpers\DashboardHelper::calculatePercentage($value, $total);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('dashboard_trend')) {
|
|
/**
|
|
* Mendapatkan trend indicator
|
|
*/
|
|
function dashboard_trend(string $type, string $statusId): array
|
|
{
|
|
return App\Helpers\DashboardHelper::getTrendIndicator($type, $statusId);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('dashboard_chart_data')) {
|
|
/**
|
|
* Mendapatkan data untuk chart
|
|
*/
|
|
function dashboard_chart_data(string $type): array
|
|
{
|
|
return App\Helpers\DashboardHelper::getChartData($type);
|
|
}
|
|
}
|