Dashboard, seats report, package pricing updates

This commit is contained in:
Stephanos A
2026-07-18 00:34:12 +03:00
parent eee14a5051
commit 8eb0582e4e
8 changed files with 80 additions and 7 deletions

View File

@@ -99,7 +99,8 @@ function DashboardPageContent() {
queryKey: ['backoffice-stats'],
queryFn: dashboardApi.getBackofficeStats,
retry: 1,
staleTime: 60000,
staleTime: 30000,
refetchInterval: 60000,
});
const { data: paymentMethods } = useQuery({

View File

@@ -2,8 +2,9 @@
import { useState, useMemo } from 'react';
import { useQuery } from '@tanstack/react-query';
import { Download, Armchair, CheckCircle, Clock, AlertCircle } from 'lucide-react';
import { Download, Armchair, CheckCircle, Clock, AlertCircle, Ban } from 'lucide-react';
import { bookingsApi } from '@/lib/api';
import { dashboardApi } from '@/lib/api/dashboard';
import Badge from '@/components/ui/Badge';
import ActionButton from '@/components/ui/ActionButton';
import { formatDateTime, formatCurrency } from '@/lib/utils';
@@ -46,6 +47,12 @@ export default function SeatStatusReportPage() {
const [statusFilter, setStatusFilter] = useState<'ALL' | 'PAID' | 'UNPAID'>('ALL');
const [search, setSearch] = useState('');
const { data: stats } = useQuery({
queryKey: ['backoffice-stats'],
queryFn: dashboardApi.getBackofficeStats,
staleTime: 30000,
});
const { data: bookingsData, isLoading } = useQuery({
queryKey: ['seat-report-bookings'],
queryFn: () => bookingsApi.getAll({ pageSize: 1000 }),
@@ -150,7 +157,7 @@ export default function SeatStatusReportPage() {
</div>
{/* Summary Cards */}
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div className="grid grid-cols-1 md:grid-cols-4 gap-4">
<div className="card">
<div className="flex items-start justify-between">
<div>
@@ -189,6 +196,19 @@ export default function SeatStatusReportPage() {
<AlertCircle className="h-8 w-8 text-red-500 opacity-30" />
</div>
</div>
<div className="card">
<div className="flex items-start justify-between">
<div>
<p className="text-muted-foreground text-sm font-medium">Blocked Seats</p>
<p className="text-2xl font-bold mt-2 text-slate-600 dark:text-slate-400">
{stats?.blockedSeatsCount ?? '—'}
</p>
<p className="text-xs text-muted-foreground mt-1">Globally blocked</p>
</div>
<Ban className="h-8 w-8 text-slate-500 opacity-30" />
</div>
</div>
</div>
{/* Filters */}

View File

@@ -1,6 +1,6 @@
'use client';
import { Bell, LogOut, Moon, Sun, ChevronDown, HelpCircle, KeyRound } from 'lucide-react';
import { Bell, LogOut, Moon, Sun, ChevronDown, HelpCircle, KeyRound, ScanLine } from 'lucide-react';
import { useAuthStore } from '@/lib/auth-store';
import { useTheme } from '@/lib/theme-store';
import { useState } from 'react';
@@ -18,6 +18,13 @@ export default function Header() {
<header className="flex h-16 items-center justify-between border-b border-gray-200 dark:border-slate-700 bg-white dark:bg-slate-900 px-6 shadow-sm">
<div className="flex flex-1 items-center gap-4">
<h2 className="text-xl font-semibold text-[rgb(20,113,76)] dark:text-[rgb(20,113,76)]"></h2>
<Link
href="/boarding"
className="ml-auto rounded-lg p-2 hover:bg-gray-100 dark:hover:bg-slate-800 transition-colors"
title="Boarding / Gate Scan"
>
<ScanLine className="h-5 w-5 text-[rgb(20,113,76)] dark:text-slate-400" />
</Link>
</div>
<div className="flex items-center gap-3">

View File

@@ -11,6 +11,7 @@ export const dashboardApi = {
totalNormalTickets: number;
totalPackageTickets: number;
totalPassengers: number;
blockedSeatsCount: number;
revenueByCurrency: { currency: string; totalMinor: number }[];
packageRevenueByCurrency: { currency: string; totalMinor: number }[];
}>('/dashboard/backoffice-stats');