refactor(ui): extract admin mini bar component and reuse in expiry top10
This commit is contained in:
25
resources/views/admin/components/mini_bar.blade.php
Normal file
25
resources/views/admin/components/mini_bar.blade.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
@php
|
||||||
|
/**
|
||||||
|
* Admin UI Component: Mini Bar
|
||||||
|
*
|
||||||
|
* Required:
|
||||||
|
* - $pct
|
||||||
|
*
|
||||||
|
* Optional:
|
||||||
|
* - $role (data-role)
|
||||||
|
* - $title
|
||||||
|
*/
|
||||||
|
|
||||||
|
$pct = (float) ($pct ?? 0);
|
||||||
|
$role = (string) ($role ?? '');
|
||||||
|
$title = (string) ($title ?? '');
|
||||||
|
|
||||||
|
$pct = max(0, min(100, $pct));
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div class="adm-mini-bar"
|
||||||
|
@if($role !== '') data-role="{{ $role }}" @endif
|
||||||
|
@if($title !== '') title="{{ $title }}" @endif
|
||||||
|
>
|
||||||
|
<span class="adm-mini-bar-fill" style="width: {{ $pct }}%"></span>
|
||||||
|
</div>
|
||||||
@@ -132,9 +132,11 @@
|
|||||||
$barPct = min(100, max(0, round(((int) $cnt / (int) ($summaryStats['expiring_7d_subscriptions'] ?? 1)) * 100, 1)));
|
$barPct = min(100, max(0, round(((int) $cnt / (int) ($summaryStats['expiring_7d_subscriptions'] ?? 1)) * 100, 1)));
|
||||||
}
|
}
|
||||||
@endphp
|
@endphp
|
||||||
<div class="adm-mini-bar" data-role="expiry-merchant-bar" title="占比 {{ $barPct }}%">
|
@include('admin.components.mini_bar', [
|
||||||
<span class="adm-mini-bar-fill" style="width: {{ $barPct }}%"></span>
|
'role' => 'expiry-merchant-bar',
|
||||||
</div>
|
'pct' => $barPct,
|
||||||
|
'title' => '占比 ' . $barPct . '%',
|
||||||
|
])
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $minEndsAt !== '' ? $minEndsAt : '-' }}</td>
|
<td>{{ $minEndsAt !== '' ? $minEndsAt : '-' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -188,9 +190,11 @@
|
|||||||
$barPct = min(100, max(0, round(((int) $cnt / (int) ($summaryStats['expiring_7d_subscriptions'] ?? 1)) * 100, 1)));
|
$barPct = min(100, max(0, round(((int) $cnt / (int) ($summaryStats['expiring_7d_subscriptions'] ?? 1)) * 100, 1)));
|
||||||
}
|
}
|
||||||
@endphp
|
@endphp
|
||||||
<div class="adm-mini-bar" data-role="expiry-merchant-plan-bar" title="占比 {{ $barPct }}%">
|
@include('admin.components.mini_bar', [
|
||||||
<span class="adm-mini-bar-fill" style="width: {{ $barPct }}%"></span>
|
'role' => 'expiry-merchant-plan-bar',
|
||||||
</div>
|
'pct' => $barPct,
|
||||||
|
'title' => '占比 ' . $barPct . '%',
|
||||||
|
])
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ $minEndsAt !== '' ? $minEndsAt : '-' }}
|
{{ $minEndsAt !== '' ? $minEndsAt : '-' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user