• Claude's avatar
    Filter every management screen by the active branch · f282f7bc
    Claude authored
    The system predates branches, and adoption of the branch switcher was
    partial: 44 of 186 Livewire components used UsesBranchScope, and several
    that imported it never actually called it. The dashboard was the worst
    case — half its widgets were branch-aware and half silently reported
    academy-wide totals next to them, so the numbers on one screen were not
    comparable with each other.
    
    OC-Sport runs 7 active branches, so every unscoped widget was showing
    six other branches' data.
    
    Dashboard: scoped trainers-present, pending payslips, pending documents,
    low stock and expiring medical certificates, which were academy-wide.
    All six dashboard widgets (revenue, product revenue, subscription
    revenue, enrolment trends, overdue renewals, trainer dues) now filter by
    branch, including the raw-SQL CTEs in the revenue breakdowns.
    
    Lists and reports: events, evaluations, base prices, pricing rules,
    promotions, stock counts, kits, document approvals, trainers, trainer
    advances, payroll, essential deliveries and the financial report.
    
    Pickers: participant, group, program, facility, warehouse, product and
    employee selectors now offer only the active branch's records, so a
    transfer or invoice cannot silently reference another branch.
    
    POS and InvoiceShow used auth()->user()->branch_id directly, ignoring
    the switcher entirely — a user who switched branch still transacted
    against their home branch. Both now read the active branch.
    
    Deliberately left unscoped: parent- and guardian-facing screens, which
    are scoped to their own children and have no branch switcher, and
    single-record detail screens, which are already scoped by the record and
    would hide legitimately related history for participants who moved
    between branches.
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    f282f7bc
Name
Last commit
Last update
..
CouponValidator.php Loading commit data...
ExpenseForm.php Loading commit data...
ExpenseList.php Loading commit data...
ExternalRevenueForm.php Loading commit data...
FacilityRentForm.php Loading commit data...
FacilityRentList.php Loading commit data...
FinancialOverview.php Loading commit data...
PaymentPlanCreate.php Loading commit data...