Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/allocation-card.blade.php
Joseph.Rawlings 760cf84451 Add AdminLTE-style CSS framework to app.css
- Introduced AdminLTE CSS variables for color palette, body colors, card styles, and button styles.
- Implemented card components with variants for primary, success, warning, danger, and info.
- Added button styles including sizes and outline variants.
- Created form controls, select inputs, and input groups with consistent styling.
- Included utility classes for text and background colors, gradients, and shadows.
- Developed components for badges, alerts, callouts, progress bars, tables, small boxes, and info boxes.
- Integrated modal, dropdown, spinner, tooltip, and direct chat styles.
- Established timeline and close button styles, with dark mode support for specific components.
2025-12-17 13:45:56 -05:00

213 lines
6.8 KiB
PHP

{{--
Resource Allocation Card Component - AdminLTE style
For displaying CPU, Memory, and other resource allocation vs entitlement
Usage:
<x-proxmox::ui.allocation-card
label="CPU Allocation"
:percent="45"
usage-summary="1.8 / 4 vCPU"
entitlement-label="4 vCPU entitlement"
description="Live hypervisor usage sampled directly from the cluster."
gradient="linear-gradient(90deg, #38bdf8 0%, #6366f1 100%)"
:badge="['label' => 'Healthy', 'class' => 'text-success-500 bg-success-50 dark:bg-success-500/15']"
/>
--}}
@props([
'label',
'percent' => null,
'usageSummary',
'entitlementLabel',
'description' => null,
'gradient' => 'linear-gradient(90deg, #0d6efd 0%, #6f42c1 100%)',
'badge' => null,
'icon' => null,
'iconColor' => 'primary',
])
@php
$iconBgColors = [
'primary' => 'background-color: rgba(13, 110, 253, 0.1);',
'success' => 'background-color: rgba(25, 135, 84, 0.1);',
'warning' => 'background-color: rgba(255, 193, 7, 0.1);',
'danger' => 'background-color: rgba(220, 53, 69, 0.1);',
'info' => 'background-color: rgba(13, 202, 240, 0.1);',
];
$iconTextColors = [
'primary' => 'color: var(--lte-primary, #0d6efd);',
'success' => 'color: var(--lte-success, #198754);',
'warning' => 'color: var(--lte-warning, #ffc107);',
'danger' => 'color: var(--lte-danger, #dc3545);',
'info' => 'color: var(--lte-info, #0dcaf0);',
];
@endphp
<style>
.allocation-card-lte {
background-color: #fff;
border: 1px solid var(--lte-border-color, #dee2e6);
border-radius: var(--lte-border-radius, 0.375rem);
padding: 1.25rem;
box-shadow: var(--lte-card-shadow);
transition: background-color var(--lte-transition-speed, 0.3s) ease;
}
.allocation-card-lte:hover {
background-color: #f8f9fa;
}
.allocation-card-lte-content {
display: flex;
flex-direction: column;
gap: 1rem;
}
.allocation-card-lte-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 0.75rem;
}
.allocation-card-lte-main {
display: flex;
align-items: flex-start;
gap: 0.875rem;
}
.allocation-card-lte-icon {
display: flex;
align-items: center;
justify-content: center;
width: 2.75rem;
height: 2.75rem;
flex-shrink: 0;
border-radius: calc(var(--lte-border-radius, 0.375rem) + 2px);
}
.allocation-card-lte-icon svg {
width: 1.25rem;
height: 1.25rem;
}
.allocation-card-lte-info {
min-width: 0;
}
.allocation-card-lte-label {
font-size: 0.8125rem;
font-weight: 500;
color: var(--lte-secondary, #6c757d);
margin-bottom: 0.25rem;
}
.allocation-card-lte-value {
font-size: 1.25rem;
font-weight: 700;
color: #212529;
line-height: 1.3;
}
.allocation-card-lte-entitlement {
font-size: 0.8125rem;
color: var(--lte-secondary, #6c757d);
margin-top: 0.25rem;
}
.allocation-card-lte-badge {
flex-shrink: 0;
padding: 0.25rem 0.625rem;
font-size: 0.75rem;
font-weight: 500;
border-radius: 9999px;
background-color: rgba(25, 135, 84, 0.1);
color: var(--lte-success, #198754);
}
.allocation-card-lte-progress-section {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.allocation-card-lte-progress-header {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 0.8125rem;
}
.allocation-card-lte-progress-label {
color: var(--lte-secondary, #6c757d);
}
.allocation-card-lte-progress-value {
font-weight: 600;
color: #212529;
}
.allocation-card-lte-progress-track {
height: 0.5rem;
background-color: #e9ecef;
border-radius: 9999px;
overflow: hidden;
}
.allocation-card-lte-progress-bar {
height: 100%;
border-radius: 9999px;
transition: width var(--lte-transition-speed, 0.3s) ease;
}
.allocation-card-lte-description {
font-size: 0.8125rem;
color: #adb5bd;
}
/* Dark mode */
.dark .allocation-card-lte {
background-color: #1f2937;
border-color: #374151;
}
.dark .allocation-card-lte:hover {
background-color: #374151;
}
.dark .allocation-card-lte-value {
color: #f3f4f6;
}
.dark .allocation-card-lte-progress-value {
color: #f3f4f6;
}
.dark .allocation-card-lte-progress-track {
background-color: #374151;
}
.dark .allocation-card-lte-description {
color: #6b7280;
}
</style>
<div {{ $attributes->class(['allocation-card-lte']) }}>
<div class="allocation-card-lte-content">
<div class="allocation-card-lte-header">
<div class="allocation-card-lte-main">
@if($icon)
<div class="allocation-card-lte-icon" style="{{ $iconBgColors[$iconColor] ?? $iconBgColors['primary'] }}">
<x-dynamic-component :component="$icon" style="{{ $iconTextColors[$iconColor] ?? $iconTextColors['primary'] }}" />
</div>
@endif
<div class="allocation-card-lte-info">
<p class="allocation-card-lte-label">{{ $label }}</p>
<p class="allocation-card-lte-value">{{ $usageSummary }}</p>
<p class="allocation-card-lte-entitlement">{{ $entitlementLabel }}</p>
</div>
</div>
@if($badge)
<span class="allocation-card-lte-badge" @if(isset($badge['class'])) style="{{ $badge['class'] }}" @endif>
{{ $badge['label'] ?? '' }}
</span>
@endif
</div>
@if(!is_null($percent))
<div class="allocation-card-lte-progress-section">
<div class="allocation-card-lte-progress-header">
<span class="allocation-card-lte-progress-label">Usage</span>
<span class="allocation-card-lte-progress-value">{{ $percent }}%</span>
</div>
<div class="allocation-card-lte-progress-track">
<div
class="allocation-card-lte-progress-bar"
style="width: {{ min($percent, 130) }}%; background-image: {{ $gradient }};"
></div>
</div>
</div>
@endif
@if($description)
<p class="allocation-card-lte-description">{{ $description }}</p>
@endif
</div>
</div>