65 lines
2.8 KiB
PHP
65 lines
2.8 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 Revenue extends Component
|
||
{
|
||
public function render()
|
||
{
|
||
$locale = app()->getLocale();
|
||
$eur = fn (int $v) => Number::currency($v, in: 'EUR', locale: $locale);
|
||
$months = collect(range(11, 0))
|
||
->map(fn ($i) => Carbon::now()->locale($locale)->startOfMonth()->subMonths($i)->isoFormat('MMM'))
|
||
->all();
|
||
|
||
return view('livewire.admin.revenue', [
|
||
'kpis' => [
|
||
['label' => __('admin.rev.mrr'), 'value' => $eur(7842), 'delta' => '+6,2 %'],
|
||
['label' => __('admin.rev.arr'), 'value' => $eur(94104), 'delta' => '+18 %'],
|
||
['label' => __('admin.rev.arpu'), 'value' => $eur(187), 'delta' => '+1,4 %'],
|
||
['label' => __('admin.rev.churn'), 'value' => '1,8 %', 'delta' => '−0,3 %'],
|
||
],
|
||
'mrrChart' => [
|
||
'type' => 'line',
|
||
'data' => [
|
||
'labels' => $months,
|
||
'datasets' => [[
|
||
'label' => 'MRR',
|
||
'data' => [4100, 4460, 4900, 5300, 5600, 6050, 6300, 6700, 7050, 7300, 7620, 7842],
|
||
'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]],
|
||
],
|
||
],
|
||
'planChart' => [
|
||
'type' => 'doughnut',
|
||
'data' => [
|
||
'labels' => ['Solo', 'Team', 'Enterprise'],
|
||
'datasets' => [[
|
||
'data' => [1659, 3366, 1796],
|
||
'backgroundColor' => ['token:info', 'token:accent', 'token:success-bright'],
|
||
'borderWidth' => 0,
|
||
]],
|
||
],
|
||
'options' => ['cutout' => '62%', 'plugins' => ['legend' => ['position' => 'bottom', 'labels' => ['boxWidth' => 10, 'padding' => 12]]]],
|
||
],
|
||
'payments' => [
|
||
['customer' => 'Notariat Külz', 'amount' => $eur(449), 'when' => '01.07.'],
|
||
['customer' => 'Kanzlei Berger', 'amount' => $eur(198), 'when' => '01.07.'],
|
||
['customer' => 'Steuerberatung Reiss', 'amount' => $eur(198), 'when' => '01.07.'],
|
||
['customer' => 'Ordination Dr. Fux', 'amount' => $eur(79), 'when' => '30.06.'],
|
||
],
|
||
]);
|
||
}
|
||
}
|