• 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
..
Activities Loading commit data...
Admin Loading commit data...
Assignments Loading commit data...
Attendance Loading commit data...
Audit Loading commit data...
Auth Loading commit data...
Branches Loading commit data...
CashSessions Loading commit data...
Components Loading commit data...
Concerns Loading commit data...
Dashboard Loading commit data...
Documents Loading commit data...
Enrollments Loading commit data...
Evaluations Loading commit data...
Events Loading commit data...
Facilities Loading commit data...
Financial Loading commit data...
Groups Loading commit data...
Guardian Loading commit data...
HR Loading commit data...
Inventory Loading commit data...
Invoices Loading commit data...
Messaging Loading commit data...
Notifications Loading commit data...
POS Loading commit data...
Parent Loading commit data...
Participants Loading commit data...
People Loading commit data...
Pricing Loading commit data...
Profile Loading commit data...
Programs Loading commit data...
Public Loading commit data...
Receptionist Loading commit data...
Reports Loading commit data...
Roles Loading commit data...
Schedule Loading commit data...
Settings Loading commit data...
Trainer Loading commit data...
Training Loading commit data...
Users Loading commit data...
Wallets Loading commit data...
Website Loading commit data...
WhatsApp Loading commit data...
Wizards Loading commit data...
BranchSwitcher.php Loading commit data...
Dashboard.php Loading commit data...
GlobalSearch.php Loading commit data...