diff --git a/src/app/admin/forecast/page.tsx b/src/app/admin/forecast/page.tsx deleted file mode 100644 index d974191..0000000 --- a/src/app/admin/forecast/page.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import { getRevenueForecast12Months } from "@/lib/forecast-queries"; - -export const revalidate = 0; - -export default async function ForecastPage() { - const forecast = await getRevenueForecast12Months(); - const totalForecast = forecast.reduce((sum, m) => sum + m.total, 0); - - return ( -
-

Revenue Forecast

-

- Proiezione 12 mesi basata sulle offerte attive, i loro accepted_total e le durate in mesi. - Ogni offerta distribuisce il suo totale equamente per i mesi di durata a partire dalla data di inizio. -

- -
- - - - - - - - - - {forecast.map((month) => { - const maxTotal = Math.max(...forecast.map((m) => m.total), 1); - const pct = Math.round((month.total / maxTotal) * 100); - return ( - - - - - - ); - })} - - - - - - - -
- Mese - - Fatturato previsto - - Barra -
{month.label} - {month.total > 0 ? `€${month.total.toFixed(2)}` : } - - {month.total > 0 && ( -
-
-
- )} -
Totale 12 mesi - €{totalForecast.toFixed(2)} - -
-
- - {forecast.every((m) => m.total === 0) && ( -

- Nessuna offerta con accepted_total trovata. Assegna micro-offerte ai progetti e imposta il totale accettato. -

- )} -
- ); -} diff --git a/src/app/admin/projects/project-actions.ts b/src/app/admin/projects/project-actions.ts index f030cc9..6c628ad 100644 --- a/src/app/admin/projects/project-actions.ts +++ b/src/app/admin/projects/project-actions.ts @@ -135,14 +135,12 @@ export async function assignOfferToProject(formData: FormData) { : null, }); revalidatePath(`/admin/projects/${parsed.data.project_id}`); - revalidatePath("/admin/forecast"); } export async function removeProjectOffer(projectOfferId: string, projectId: string) { await requireAdmin(); await db.delete(project_offers).where(eq(project_offers.id, projectOfferId)); revalidatePath(`/admin/projects/${projectId}`); - revalidatePath("/admin/forecast"); } export async function updateProjectOfferTotal( @@ -158,5 +156,4 @@ export async function updateProjectOfferTotal( .set({ accepted_total: amount.toFixed(2) }) .where(eq(project_offers.id, projectOfferId)); revalidatePath(`/admin/projects/${projectId}`); - revalidatePath("/admin/forecast"); } \ No newline at end of file diff --git a/src/components/admin/AdminSidebar.tsx b/src/components/admin/AdminSidebar.tsx index f0e29a7..3f46294 100644 --- a/src/components/admin/AdminSidebar.tsx +++ b/src/components/admin/AdminSidebar.tsx @@ -8,7 +8,6 @@ import { Users, FolderOpen, Tag, - TrendingUp, BookOpen, Settings, LogOut, @@ -21,7 +20,6 @@ const NAV_ITEMS = [ { href: "/admin/leads", label: "Lead", icon: Zap }, { href: "/admin/projects", label: "Progetti", icon: FolderOpen }, { href: "/admin/offers", label: "Offerte", icon: Tag }, - { href: "/admin/forecast", label: "Forecast", icon: TrendingUp }, { href: "/admin/catalog", label: "Catalogo", icon: BookOpen }, { href: "/admin/impostazioni", label: "Impostazioni", icon: Settings }, ];