feat: Add reports feature

Enables a new reports section in the application. This includes:
- Adding a `reports` flag to `AppFeatures` and `AppSettings`.
- Including a new "Reportistica" link in the main navigation for privileged users.
- Adding a `getCondoPayments` endpoint to the mock DB service.
- Updating the backend to support filtering payments by `condoId`.
- Providing a basic `ReportsPage` component.
This commit is contained in:
2025-12-09 13:35:10 +01:00
parent 25d84e7b51
commit a5645a32c0
16 changed files with 340 additions and 77 deletions

View File

@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import { NavLink, Outlet } from 'react-router-dom';
import { Users, Settings, Building, LogOut, Menu, X, ChevronDown, Check, LayoutDashboard, Megaphone, Info, AlertTriangle, Hammer, Calendar, MessageSquareWarning } from 'lucide-react';
import { Users, Settings, Building, LogOut, Menu, X, ChevronDown, Check, LayoutDashboard, Megaphone, Info, AlertTriangle, Hammer, Calendar, MessageSquareWarning, PieChart } from 'lucide-react';
import { CondoService } from '../services/mockDb';
import { Condo, Notice, AppSettings } from '../types';
@@ -240,6 +240,14 @@ export const Layout: React.FC = () => {
<span className="font-medium">Famiglie</span>
</NavLink>
{/* Privileged Links */}
{isAdmin && settings?.features.reports && (
<NavLink to="/reports" className={navClass} onClick={closeMenu}>
<PieChart className="w-5 h-5" />
<span className="font-medium">Reportistica</span>
</NavLink>
)}
{/* Hide Tickets if disabled */}
{settings?.features.tickets && (
<NavLink to="/tickets" className={navClass} onClick={closeMenu}>
@@ -264,7 +272,7 @@ export const Layout: React.FC = () => {
</div>
<button
onClick={() => CondoService.logout()}
className="flex items-center gap-3 px-4 py-2.5 w-full text-slate-600 hover:bg-red-50 hover:text-red-600 rounded-lg transition-colors text-sm font-medium border border-slate-200 hover:border-red-200 bg-white"
className="flex-1 flex items-center gap-3 px-4 py-2.5 w-full text-slate-600 hover:bg-red-50 hover:text-red-600 rounded-lg transition-colors text-sm font-medium border border-slate-200 hover:border-red-200 bg-white"
>
<LogOut className="w-4 h-4" />
Esci
@@ -280,4 +288,4 @@ export const Layout: React.FC = () => {
</main>
</div>
);
};
};