832 lines
26 KiB
PHP
832 lines
26 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', 'Dashboard')
|
|
|
|
@push('styles')
|
|
<style>
|
|
/* Modern Stats Cards */
|
|
.stat-card {
|
|
border: none;
|
|
border-radius: 20px;
|
|
padding: 2rem 1.75rem;
|
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
position: relative;
|
|
overflow: hidden;
|
|
background: var(--bg-primary);
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
.stat-card::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 3px;
|
|
background: var(--card-accent);
|
|
opacity: 0.8;
|
|
}
|
|
|
|
.stat-card:hover {
|
|
transform: translateY(-6px);
|
|
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.stat-card.primary {
|
|
--card-accent: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
|
|
}
|
|
|
|
.stat-card.success {
|
|
--card-accent: linear-gradient(135deg, #10b981 0%, #059669 100%);
|
|
}
|
|
|
|
.stat-card.danger {
|
|
--card-accent: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
|
|
}
|
|
|
|
.stat-card.info {
|
|
--card-accent: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
|
|
}
|
|
|
|
.dark .stat-card {
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
.dark .stat-card:hover {
|
|
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
|
|
}
|
|
|
|
.stat-icon {
|
|
width: 64px;
|
|
height: 64px;
|
|
border-radius: 16px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 1.75rem;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.stat-icon::before {
|
|
content: '';
|
|
position: absolute;
|
|
inset: 0;
|
|
background: var(--icon-gradient);
|
|
opacity: 0.1;
|
|
}
|
|
|
|
.stat-icon i {
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
.stat-icon.primary {
|
|
--icon-gradient: linear-gradient(135deg, #06b6d4, #0891b2);
|
|
color: #06b6d4;
|
|
}
|
|
|
|
.stat-icon.success {
|
|
--icon-gradient: linear-gradient(135deg, #10b981, #059669);
|
|
color: #10b981;
|
|
}
|
|
|
|
.stat-icon.danger {
|
|
--icon-gradient: linear-gradient(135deg, #ef4444, #dc2626);
|
|
color: #ef4444;
|
|
}
|
|
|
|
.stat-icon.info {
|
|
--icon-gradient: linear-gradient(135deg, #3b82f6, #1d4ed8);
|
|
color: #3b82f6;
|
|
}
|
|
|
|
.dark .stat-icon {
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.stat-value {
|
|
font-size: 2.5rem;
|
|
font-weight: 800;
|
|
line-height: 1;
|
|
margin-bottom: 0.5rem;
|
|
letter-spacing: -0.02em;
|
|
}
|
|
|
|
.stat-label {
|
|
font-size: 0.8125rem;
|
|
font-weight: 600;
|
|
opacity: 0.6;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.8px;
|
|
}
|
|
|
|
.stat-trend {
|
|
font-size: 0.75rem;
|
|
margin-top: 0.5rem;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.stat-trend.up {
|
|
color: #10b981;
|
|
}
|
|
|
|
.stat-trend.down {
|
|
color: #ef4444;
|
|
}
|
|
|
|
/* Chart Card */
|
|
.chart-card {
|
|
border: none;
|
|
border-radius: 20px;
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
|
|
background: var(--bg-primary);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.dark .chart-card {
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
.chart-card .card-header {
|
|
background: transparent;
|
|
border-bottom: 1px solid var(--border-color);
|
|
padding: 1.75rem 2rem;
|
|
}
|
|
|
|
.chart-card .card-body {
|
|
padding: 2rem;
|
|
}
|
|
|
|
.chart-card .card-title {
|
|
font-size: 1.125rem;
|
|
font-weight: 700;
|
|
margin: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.chart-card .card-title i {
|
|
color: #0ea5e9;
|
|
}
|
|
|
|
/* Modern Table */
|
|
.table-modern {
|
|
border-collapse: separate;
|
|
border-spacing: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
.table-modern thead th {
|
|
background: var(--bg-secondary);
|
|
border: none;
|
|
font-weight: 700;
|
|
font-size: 0.75rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: 1px;
|
|
padding: 1.25rem 1.5rem;
|
|
color: var(--text-secondary);
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.table-modern thead th:first-child {
|
|
border-top-left-radius: 12px;
|
|
}
|
|
|
|
.table-modern thead th:last-child {
|
|
border-top-right-radius: 12px;
|
|
}
|
|
|
|
.table-modern tbody tr {
|
|
transition: all 0.2s ease;
|
|
border-bottom: 1px solid var(--border-color);
|
|
}
|
|
|
|
.table-modern tbody tr:hover {
|
|
background: var(--bg-secondary);
|
|
}
|
|
|
|
.table-modern tbody tr:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.table-modern tbody td {
|
|
padding: 1.5rem 1.5rem;
|
|
vertical-align: middle;
|
|
border: none;
|
|
}
|
|
|
|
.site-info {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.site-avatar {
|
|
width: 48px;
|
|
height: 48px;
|
|
border-radius: 12px;
|
|
background: linear-gradient(135deg, #06b6d4, #0891b2);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: white;
|
|
font-weight: 700;
|
|
font-size: 1.25rem;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.site-details {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
|
|
.site-name {
|
|
font-weight: 700;
|
|
color: var(--text-primary);
|
|
font-size: 1rem;
|
|
margin-bottom: 0.25rem;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.site-url {
|
|
font-size: 0.8125rem;
|
|
color: var(--text-secondary);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.375rem;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.site-url i {
|
|
opacity: 0.5;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
/* Status Badges */
|
|
.badge-modern {
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 10px;
|
|
font-weight: 700;
|
|
font-size: 0.6875rem;
|
|
letter-spacing: 0.5px;
|
|
text-transform: uppercase;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.375rem;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.badge-modern i {
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
/* Metric Display */
|
|
.metric-display {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.metric-value {
|
|
font-weight: 700;
|
|
font-size: 0.9375rem;
|
|
}
|
|
|
|
.metric-label {
|
|
font-size: 0.75rem;
|
|
color: var(--text-secondary);
|
|
font-weight: 500;
|
|
}
|
|
|
|
/* Progress Bar */
|
|
.progress-modern {
|
|
height: 8px;
|
|
border-radius: 10px;
|
|
background: var(--bg-secondary);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.progress-modern .progress-bar {
|
|
border-radius: 10px;
|
|
transition: width 0.6s ease;
|
|
}
|
|
|
|
/* Buttons */
|
|
.btn-action {
|
|
padding: 0.625rem 1.25rem;
|
|
border-radius: 12px;
|
|
font-weight: 600;
|
|
font-size: 0.875rem;
|
|
transition: all 0.2s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
border: none;
|
|
}
|
|
|
|
.btn-action:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 8px 20px rgba(14, 165, 233, 0.25);
|
|
}
|
|
|
|
.btn-action.btn-outline-primary:hover {
|
|
background: #0ea5e9;
|
|
color: white;
|
|
border-color: #0ea5e9;
|
|
}
|
|
|
|
/* Empty State */
|
|
.empty-state {
|
|
padding: 5rem 2rem;
|
|
text-align: center;
|
|
}
|
|
|
|
.empty-state-icon {
|
|
font-size: 5rem;
|
|
opacity: 0.15;
|
|
margin-bottom: 2rem;
|
|
background: linear-gradient(135deg, #06b6d4, #0891b2);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
background-clip: text;
|
|
}
|
|
|
|
.empty-state h5 {
|
|
font-size: 1.5rem;
|
|
font-weight: 700;
|
|
margin-bottom: 0.75rem;
|
|
}
|
|
|
|
.empty-state p {
|
|
font-size: 1rem;
|
|
color: var(--text-secondary);
|
|
max-width: 400px;
|
|
margin: 0 auto 2rem;
|
|
}
|
|
|
|
/* Page Header */
|
|
.page-header {
|
|
margin-bottom: 2.5rem;
|
|
}
|
|
|
|
.page-title {
|
|
font-size: 2.25rem;
|
|
font-weight: 800;
|
|
margin-bottom: 0.5rem;
|
|
letter-spacing: -0.02em;
|
|
background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
background-clip: text;
|
|
}
|
|
|
|
.page-subtitle {
|
|
color: var(--text-secondary);
|
|
font-size: 1.0625rem;
|
|
font-weight: 400;
|
|
}
|
|
|
|
/* Time Badge */
|
|
.time-badge {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
padding: 0.5rem 1rem;
|
|
background: var(--bg-secondary);
|
|
border-radius: 10px;
|
|
font-size: 0.8125rem;
|
|
font-weight: 600;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
/* Chart Container */
|
|
.chart-container {
|
|
position: relative;
|
|
min-height: 300px;
|
|
}
|
|
|
|
/* Responsive adjustments */
|
|
@media (max-width: 768px) {
|
|
.stat-card {
|
|
padding: 1.5rem 1.25rem;
|
|
}
|
|
|
|
.stat-value {
|
|
font-size: 2rem;
|
|
}
|
|
|
|
.stat-icon {
|
|
width: 52px;
|
|
height: 52px;
|
|
font-size: 1.5rem;
|
|
}
|
|
|
|
.page-title {
|
|
font-size: 1.75rem;
|
|
}
|
|
|
|
.table-modern thead th,
|
|
.table-modern tbody td {
|
|
padding: 1rem;
|
|
}
|
|
|
|
.site-avatar {
|
|
width: 40px;
|
|
height: 40px;
|
|
font-size: 1rem;
|
|
}
|
|
}
|
|
</style>
|
|
@endpush
|
|
|
|
@section('content')
|
|
<!-- Page Header -->
|
|
<div class="page-header">
|
|
<h1 class="page-title">Dashboard</h1>
|
|
<p class="page-subtitle">Monitor and manage all your websites from one place</p>
|
|
</div>
|
|
|
|
<!-- Summary Stats -->
|
|
<div class="row g-4 mb-4">
|
|
<div class="col-lg-3 col-md-6">
|
|
<div class="stat-card primary">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<div class="flex-grow-1">
|
|
<div class="stat-label">Total Sites</div>
|
|
<div class="stat-value">{{ $totalSites }}</div>
|
|
</div>
|
|
<div class="stat-icon primary">
|
|
<i class="bi bi-globe"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-3 col-md-6">
|
|
<div class="stat-card success">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<div class="flex-grow-1">
|
|
<div class="stat-label">Sites Online</div>
|
|
<div class="stat-value" style="color: #10b981;">{{ $sitesUp }}</div>
|
|
</div>
|
|
<div class="stat-icon success">
|
|
<i class="bi bi-check-circle-fill"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-3 col-md-6">
|
|
<div class="stat-card danger">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<div class="flex-grow-1">
|
|
<div class="stat-label">Sites Down</div>
|
|
<div class="stat-value" style="color: #ef4444;">{{ $sitesDown }}</div>
|
|
</div>
|
|
<div class="stat-icon danger">
|
|
<i class="bi bi-x-circle-fill"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-3 col-md-6">
|
|
<div class="stat-card info">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<div class="flex-grow-1">
|
|
<div class="stat-label">Average Uptime</div>
|
|
<div class="stat-value" style="color: #3b82f6;">{{ number_format($avgUptime, 1) }}%</div>
|
|
</div>
|
|
<div class="stat-icon info">
|
|
<i class="bi bi-graph-up-arrow"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 7-Day Uptime Chart -->
|
|
@if($sites->isNotEmpty())
|
|
<div class="card chart-card mb-4">
|
|
<div class="card-header">
|
|
<div class="d-flex justify-content-between align-items-center flex-wrap gap-3">
|
|
<h5 class="card-title">
|
|
<i class="bi bi-activity"></i>
|
|
Uptime Trends
|
|
</h5>
|
|
<div class="time-badge">
|
|
<i class="bi bi-calendar3"></i>
|
|
Last 7 Days
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="chart-container">
|
|
<canvas id="weeklyUptimeChart"></canvas>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
<!-- Sites Table -->
|
|
<div class="card chart-card">
|
|
<div class="card-header">
|
|
<div class="d-flex justify-content-between align-items-center flex-wrap gap-3">
|
|
<h5 class="card-title">
|
|
<i class="bi bi-list-check"></i>
|
|
Your Websites
|
|
</h5>
|
|
<a href="{{ route('sites.create') }}" class="btn btn-primary btn-action">
|
|
<i class="bi bi-plus-lg"></i>
|
|
Add Website
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
@if($sites->isNotEmpty())
|
|
<div class="table-responsive">
|
|
<table class="table table-modern mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th style="width: 30%;">Website</th>
|
|
<th style="width: 12%;">Status</th>
|
|
<th style="width: 15%;">Uptime</th>
|
|
<th style="width: 12%;">Response</th>
|
|
<th style="width: 12%;">SSL</th>
|
|
<th style="width: 10%;">Links</th>
|
|
<th style="width: 9%;" class="text-end">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($sites as $site)
|
|
@php
|
|
$latestCheck = $site->uptimeChecks->first();
|
|
$latestSsl = $site->sslCertificates->first();
|
|
$daysUntilExpiry = $latestSsl ? now()->diffInDays($latestSsl->expires_at, false) : null;
|
|
$uptime = $site->uptime_percentage ?? 0;
|
|
$initials = strtoupper(substr($site->name, 0, 2));
|
|
@endphp
|
|
<tr>
|
|
<td>
|
|
<div class="site-info">
|
|
<div class="site-avatar" style="background: linear-gradient(135deg, {{ '#' . substr(md5($site->id), 0, 6) }}, {{ '#' . substr(md5($site->id . 'salt'), 0, 6) }});">
|
|
{{ $initials }}
|
|
</div>
|
|
<div class="site-details">
|
|
<div class="site-name" title="{{ $site->name }}">{{ $site->name }}</div>
|
|
<div class="site-url" title="{{ $site->url }}">
|
|
<i class="bi bi-link-45deg"></i>
|
|
<span>{{ Str::limit(parse_url($site->url, PHP_URL_HOST), 35) }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
@if(!$latestCheck)
|
|
<span class="badge badge-modern bg-secondary">
|
|
<i class="bi bi-dash-circle"></i> Pending
|
|
</span>
|
|
@elseif($latestCheck->status_code >= 200 && $latestCheck->status_code < 400)
|
|
<span class="badge badge-modern bg-success">
|
|
<i class="bi bi-check-circle-fill"></i> Online
|
|
</span>
|
|
@else
|
|
<span class="badge badge-modern bg-danger">
|
|
<i class="bi bi-exclamation-circle-fill"></i> Down
|
|
</span>
|
|
@endif
|
|
</td>
|
|
<td>
|
|
<div class="metric-display">
|
|
<div class="progress-modern" style="width: 70px;">
|
|
<div class="progress-bar bg-{{ $uptime >= 99 ? 'success' : ($uptime >= 95 ? 'warning' : 'danger') }}"
|
|
role="progressbar"
|
|
style="width: {{ $uptime }}%"
|
|
aria-valuenow="{{ $uptime }}"
|
|
aria-valuemin="0"
|
|
aria-valuemax="100"></div>
|
|
</div>
|
|
<span class="metric-value">{{ number_format($uptime, 1) }}%</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
@if($site->avg_response_time)
|
|
<div class="metric-display">
|
|
<span class="metric-value">{{ round($site->avg_response_time) }}</span>
|
|
<span class="metric-label">ms</span>
|
|
</div>
|
|
@else
|
|
<span class="text-muted fw-semibold">—</span>
|
|
@endif
|
|
</td>
|
|
<td>
|
|
@if($latestSsl)
|
|
@if($daysUntilExpiry < 0)
|
|
<span class="badge badge-modern bg-danger">
|
|
<i class="bi bi-shield-x"></i> Expired
|
|
</span>
|
|
@elseif($daysUntilExpiry < 30)
|
|
<span class="badge badge-modern bg-warning text-dark">
|
|
<i class="bi bi-clock-history"></i> {{ $daysUntilExpiry }}d
|
|
</span>
|
|
@else
|
|
<span class="badge badge-modern bg-success">
|
|
<i class="bi bi-shield-check"></i> Valid
|
|
</span>
|
|
@endif
|
|
@else
|
|
<span class="text-muted fw-semibold">—</span>
|
|
@endif
|
|
</td>
|
|
<td>
|
|
@if($site->broken_links_count > 0)
|
|
<span class="badge badge-modern bg-danger">
|
|
<i class="bi bi-link-45deg"></i> {{ $site->broken_links_count }}
|
|
</span>
|
|
@else
|
|
<span class="badge badge-modern bg-success">
|
|
<i class="bi bi-check2"></i> None
|
|
</span>
|
|
@endif
|
|
</td>
|
|
<td class="text-end">
|
|
<a href="{{ route('dashboard.show', $site) }}" class="btn btn-sm btn-outline-primary btn-action">
|
|
<i class="bi bi-arrow-right"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@else
|
|
<div class="empty-state">
|
|
<div class="empty-state-icon">
|
|
<i class="bi bi-globe2"></i>
|
|
</div>
|
|
<h5>No Websites Yet</h5>
|
|
<p>Get started by adding your first website to monitor. It only takes a few seconds!</p>
|
|
<a href="{{ route('sites.create') }}" class="btn btn-primary btn-lg btn-action">
|
|
<i class="bi bi-plus-circle-fill"></i>
|
|
Add Your First Website
|
|
</a>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
@if($sites->isNotEmpty() && isset($chartData))
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const ctx = document.getElementById('weeklyUptimeChart');
|
|
if (!ctx) return;
|
|
|
|
const chartData = @json($chartData);
|
|
|
|
// Check if user prefers dark mode
|
|
const isDarkMode = document.documentElement.classList.contains('dark') ||
|
|
localStorage.getItem('darkMode') === 'true';
|
|
|
|
const gridColor = isDarkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.06)';
|
|
const textColor = isDarkMode ? 'rgba(255, 255, 255, 0.7)' : 'rgba(0, 0, 0, 0.7)';
|
|
|
|
new Chart(ctx, {
|
|
type: 'line',
|
|
data: {
|
|
labels: chartData.labels,
|
|
datasets: chartData.datasets.map((dataset, index) => {
|
|
const colors = [
|
|
{ border: '#06b6d4', bg: 'rgba(6, 182, 212, 0.1)' },
|
|
{ border: '#10b981', bg: 'rgba(16, 185, 129, 0.1)' },
|
|
{ border: '#f59e0b', bg: 'rgba(245, 158, 11, 0.1)' },
|
|
{ border: '#ef4444', bg: 'rgba(239, 68, 68, 0.1)' },
|
|
{ border: '#0ea5e9', bg: 'rgba(14, 165, 233, 0.1)' },
|
|
];
|
|
const color = colors[index % colors.length];
|
|
|
|
return {
|
|
label: dataset.label,
|
|
data: dataset.data,
|
|
borderColor: color.border,
|
|
backgroundColor: color.bg,
|
|
borderWidth: 3,
|
|
fill: true,
|
|
tension: 0.4,
|
|
pointRadius: 4,
|
|
pointHoverRadius: 6,
|
|
pointBackgroundColor: color.border,
|
|
pointBorderColor: '#fff',
|
|
pointBorderWidth: 2,
|
|
pointHoverBackgroundColor: color.border,
|
|
pointHoverBorderColor: '#fff',
|
|
pointHoverBorderWidth: 3,
|
|
};
|
|
})
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
maintainAspectRatio: true,
|
|
aspectRatio: 2.5,
|
|
interaction: {
|
|
mode: 'index',
|
|
intersect: false,
|
|
},
|
|
plugins: {
|
|
legend: {
|
|
display: true,
|
|
position: 'bottom',
|
|
labels: {
|
|
usePointStyle: true,
|
|
pointStyle: 'circle',
|
|
padding: 20,
|
|
font: {
|
|
size: 13,
|
|
weight: '600',
|
|
family: 'Inter, sans-serif'
|
|
},
|
|
color: textColor
|
|
}
|
|
},
|
|
tooltip: {
|
|
enabled: true,
|
|
backgroundColor: isDarkMode ? 'rgba(30, 30, 30, 0.95)' : 'rgba(255, 255, 255, 0.95)',
|
|
titleColor: isDarkMode ? '#fff' : '#000',
|
|
bodyColor: isDarkMode ? 'rgba(255, 255, 255, 0.8)' : 'rgba(0, 0, 0, 0.8)',
|
|
borderColor: gridColor,
|
|
borderWidth: 1,
|
|
padding: 12,
|
|
boxPadding: 6,
|
|
usePointStyle: true,
|
|
titleFont: {
|
|
size: 14,
|
|
weight: '700',
|
|
family: 'Inter, sans-serif'
|
|
},
|
|
bodyFont: {
|
|
size: 13,
|
|
weight: '600',
|
|
family: 'Inter, sans-serif'
|
|
},
|
|
callbacks: {
|
|
label: function(context) {
|
|
let label = context.dataset.label || '';
|
|
if (label) {
|
|
label += ': ';
|
|
}
|
|
if (context.parsed.y !== null) {
|
|
label += context.parsed.y.toFixed(1) + '%';
|
|
}
|
|
return label;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
scales: {
|
|
y: {
|
|
beginAtZero: true,
|
|
max: 100,
|
|
grid: {
|
|
color: gridColor,
|
|
drawBorder: false,
|
|
},
|
|
ticks: {
|
|
callback: function(value) {
|
|
return value + '%';
|
|
},
|
|
font: {
|
|
size: 12,
|
|
weight: '600',
|
|
family: 'Inter, sans-serif'
|
|
},
|
|
color: textColor,
|
|
padding: 8
|
|
}
|
|
},
|
|
x: {
|
|
grid: {
|
|
display: false,
|
|
drawBorder: false,
|
|
},
|
|
ticks: {
|
|
font: {
|
|
size: 12,
|
|
weight: '600',
|
|
family: 'Inter, sans-serif'
|
|
},
|
|
color: textColor,
|
|
padding: 8
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
@endif
|
|
@endpush
|