diff --git a/src/pages/BudgetWorkbookPage.tsx b/src/pages/BudgetWorkbookPage.tsx index dd21afc..35de4f4 100644 --- a/src/pages/BudgetWorkbookPage.tsx +++ b/src/pages/BudgetWorkbookPage.tsx @@ -2,7 +2,7 @@ import { useEffect, useMemo, useState } from "react"; import { useQuery, useQueryClient } from "@tanstack/react-query"; import jsPDF from "jspdf"; import autoTable from "jspdf-autotable"; -import { Building2, RefreshCw, Save, Upload, Download, FileText, Loader2, RotateCcw } from "lucide-react"; +import { Building2, RefreshCw, Save, Upload, Download, FileText, Loader2, RotateCcw, ChevronLeft, ChevronRight } from "lucide-react"; import { toast } from "sonner"; import { useAssociation } from "@/contexts/AssociationContext"; import { supabase } from "@/integrations/supabase/client"; @@ -65,6 +65,14 @@ export default function BudgetWorkbookPage() { [associations], ); + // Step through every client in order so a budget can be built for each. + const assocIdx = sortedAssoc.findIndex((a: any) => a.id === selectedAssociation?.id); + const stepAssoc = (delta: number) => { + if (sortedAssoc.length === 0) return; + const next = assocIdx < 0 ? 0 : (assocIdx + delta + sortedAssoc.length) % sortedAssoc.length; + setSelectedAssociation(sortedAssoc[next]); + }; + const from = `${fy}-01-01`; const to = monthEnd(fy, through); @@ -402,15 +410,30 @@ export default function BudgetWorkbookPage() {

Budget Workbook

Build next year's budget from YTD actuals through a chosen month.

- +
+ +
+ + {sortedAssoc.length > 0 && assocIdx >= 0 && ( + Client {assocIdx + 1} of {sortedAssoc.length} + )} +
+ +
{!associationId ? (