# Automated Invoicing & Bulk Grading Invoices Plan

## Current Status
- **Nothing is sent automatically.** All emails (`PortalInviteMail` and `InvoiceMail`) are 100% manual—triggered only when an admin explicitly clicks **Create Invoice** (with *"Email payment link now"* checked), **Resend**, or **Send Portal Invite**.
- There are no scheduled jobs or background commands sending emails automatically.

---

## Future Automation: Opt-In Renewal Invoices
Once all family, guardian, and payer relationships are set up and verified:
- Add an **`auto_send_renewal_invoices`** boolean toggle in **Club Settings** (`/admin/clubs/{id}/edit`), **default `false`**.
- Add a daily scheduled Artisan command (e.g. `invoices:send-renewals`) that:
  - Only runs for clubs where `auto_send_renewal_invoices = true`.
  - Finds active training members whose `renewal_date` is within the club's lead window (e.g. 30 days) and who don't already have an open `pending` renewal invoice.
  - Creates the renewal `Invoice` (using `club->renewal_fee` + processing fee if enabled) and emails the payment link to `$member->effectivePayer()->email`.

---

## Bulk Grading Invoices (By Grading Date)
A dedicated **"Bulk Grading Invoices"** tool (linked from `/financials` or `/events`):
1. Enter a grading date and description (e.g., *"Winter Grading – 14 Dec"*).
2. Select students who are grading from a checklist showing:
   - **Current rank → Next rank** (grading *to*)
   - **Auto-calculated fee** from `$nextRank->effectiveGradingFee()` (plus processing fee if enabled), editable if needed
   - **Resolved payer & email** (`$student->effectivePayer()`), flagging anyone whose payer is missing an email address
3. Click once to create (and optionally email) all selected grading invoices in one batch.

