88 lines
4.0 KiB
PHP
88 lines
4.0 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Admin;
|
|
|
|
use Illuminate\Support\Carbon;
|
|
use Illuminate\Support\Number;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Component;
|
|
|
|
#[Layout('layouts.admin')]
|
|
class Overview extends Component
|
|
{
|
|
public function render()
|
|
{
|
|
$locale = app()->getLocale();
|
|
$months = collect(range(11, 0))
|
|
->map(fn ($i) => Carbon::now()->locale($locale)->startOfMonth()->subMonths($i)->isoFormat('MMM'))
|
|
->all();
|
|
|
|
return view('livewire.admin.overview', [
|
|
'kpis' => [
|
|
['label' => __('admin.kpi.customers'), 'value' => '42', 'delta' => '+3', 'tone' => 'success'],
|
|
['label' => __('admin.kpi.instances'), 'value' => '39', 'sub' => __('admin.kpi.instances_sub'), 'tone' => 'success'],
|
|
['label' => __('admin.kpi.hosts'), 'value' => '4', 'sub' => __('admin.kpi.hosts_sub'), 'tone' => 'muted'],
|
|
['label' => __('admin.kpi.mrr'), 'value' => Number::currency(7842, in: 'EUR', locale: $locale), 'delta' => '+6,2 %', 'tone' => 'success'],
|
|
],
|
|
'fleetChart' => [
|
|
'type' => 'line',
|
|
'data' => [
|
|
'labels' => $months,
|
|
'datasets' => [[
|
|
'label' => __('admin.kpi.instances'),
|
|
'data' => [21, 23, 25, 27, 28, 30, 31, 33, 35, 36, 38, 39],
|
|
'borderColor' => 'token:accent',
|
|
'backgroundColor' => 'token:accent/0.12',
|
|
'fill' => true, 'tension' => 0.35, 'pointRadius' => 0, 'borderWidth' => 2,
|
|
]],
|
|
],
|
|
'options' => [
|
|
'scales' => ['x' => ['grid' => ['display' => false]], 'y' => ['grid' => ['color' => 'token:border']]],
|
|
'plugins' => ['legend' => ['display' => false]],
|
|
],
|
|
],
|
|
'revenueChart' => [
|
|
'type' => 'bar',
|
|
'data' => [
|
|
'labels' => $months,
|
|
'datasets' => [[
|
|
'label' => 'MRR',
|
|
'data' => [4100, 4460, 4900, 5300, 5600, 6050, 6300, 6700, 7050, 7300, 7620, 7842],
|
|
'backgroundColor' => 'token:accent/0.85', 'borderRadius' => 3,
|
|
]],
|
|
],
|
|
'options' => [
|
|
'scales' => ['x' => ['grid' => ['display' => false]], 'y' => ['grid' => ['color' => 'token:border']]],
|
|
'plugins' => ['legend' => ['display' => false]],
|
|
],
|
|
],
|
|
'hostChart' => [
|
|
'type' => 'bar',
|
|
'data' => [
|
|
'labels' => ['pve-fsn-1', 'pve-fsn-2', 'pve-fsn-3', 'pve-hel-1'],
|
|
'datasets' => [[
|
|
'label' => '%',
|
|
'data' => [72, 64, 81, 38],
|
|
'backgroundColor' => ['token:accent/0.85', 'token:accent/0.85', 'token:danger/0.85', 'token:success-bright/0.85'],
|
|
'borderRadius' => 3,
|
|
]],
|
|
],
|
|
'options' => [
|
|
'indexAxis' => 'y',
|
|
'scales' => ['x' => ['max' => 100, 'grid' => ['color' => 'token:border']], 'y' => ['grid' => ['display' => false]]],
|
|
'plugins' => ['legend' => ['display' => false]],
|
|
],
|
|
],
|
|
'runs' => [
|
|
['customer' => 'Ordination Dr. Fux', 'step' => __('admin.run.deploy'), 'state' => 'running'],
|
|
['customer' => 'Architekturbüro Lang', 'step' => __('admin.run.dns'), 'state' => 'running'],
|
|
['customer' => 'Weingut Prantl', 'step' => __('admin.run.acceptance'), 'state' => 'running'],
|
|
],
|
|
'alerts' => [
|
|
['level' => 'warning', 'text' => __('admin.alert.host_load', ['host' => 'pve-fsn-3'])],
|
|
['level' => 'info', 'text' => __('admin.alert.cert_soon', ['n' => 3])],
|
|
],
|
|
]);
|
|
}
|
|
}
|