Files
project-managment/templates/dashboard/partials/monthly_trend_chart.html
T
sankalp 71b700388b feat(templates): add polished login UI with Tailwind and Alpine.js
Enhances user experience with dark‑mode detection, responsive layout, and streamlined role selection workflow
2026-06-28 14:15:39 +05:45

94 lines
3.2 KiB
HTML

<div id="monthly-trend-chart" class="xl:col-span-2 rounded-xl bg-white dark:bg-gray-950 shadow-sm ring-1 ring-gray-950/5 dark:ring-white/10">
<div class="flex items-center justify-between px-6 py-4 border-b border-gray-100 dark:border-gray-600">
<div>
<h3 class="text-base font-semibold text-gray-900 dark:text-white">Monthly Ticket Trend</h3>
<p class="text-sm text-gray-500 dark:text-gray-400 mt-0.5">Creation and completion over time</p>
</div>
<div class="flex items-center gap-4 text-xs">
<div class="flex items-center gap-1.5">
<span class="w-3 h-0.5 bg-blue-600 rounded-full"></span>
<span class="text-gray-500 dark:text-gray-400">Created</span>
</div>
<div class="flex items-center gap-1.5">
<span class="w-3 h-0.5 bg-emerald-500 rounded-full"></span>
<span class="text-gray-500 dark:text-gray-400">Completed</span>
</div>
</div>
</div>
<div class="p-6">
<canvas id="monthlyTrendChart" height="260"></canvas>
</div>
</div>
<script>
(function() {
const ctx = document.getElementById('monthlyTrendChart');
if (!ctx) return;
const data = {{ chart_data|safe }};
const isDark = document.documentElement.classList.contains('dark');
const gridColor = isDark ? '#374151' : '#e5e7eb';
const textColor = isDark ? '#9ca3af' : '#6b7280';
new Chart(ctx, {
type: 'line',
data: {
labels: data.map(d => d.label),
datasets: [
{
label: 'Created',
data: data.map(d => d.count),
borderColor: '#3B82F6',
backgroundColor: 'rgba(59,130,246,0.08)',
fill: true,
tension: 0.4,
pointRadius: 4,
pointBackgroundColor: '#3B82F6',
pointBorderColor: '#fff',
pointBorderWidth: 2,
borderWidth: 2.5
},
{
label: 'Completed',
data: data.map(d => d.completed || 0),
borderColor: '#10B981',
backgroundColor: 'rgba(16,185,129,0.08)',
fill: true,
tension: 0.4,
pointRadius: 4,
pointBackgroundColor: '#10B981',
pointBorderColor: '#fff',
pointBorderWidth: 2,
borderWidth: 2.5
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
interaction: { mode: 'index', intersect: false },
plugins: {
legend: { display: false },
tooltip: {
backgroundColor: isDark ? '#1f2937' : '#ffffff',
titleColor: isDark ? '#f9fafb' : '#111827',
bodyColor: isDark ? '#d1d5db' : '#374151',
borderColor: isDark ? '#374151' : '#e5e7eb',
borderWidth: 1,
padding: 10,
cornerRadius: 8,
}
},
scales: {
y: {
beginAtZero: true,
ticks: { stepSize: 1, color: textColor, font: { size: 11 } },
grid: { color: gridColor, drawBorder: false }
},
x: {
ticks: { color: textColor, font: { size: 11 } },
grid: { display: false, drawBorder: false }
}
}
}
});
})();
</script>