Update CLAUDE.md with design conventions and fix mutable default arg in utils.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Konrad du Plessis 2026-02-20 01:33:48 +02:00
parent d858966915
commit c2c83a58ff
2 changed files with 44 additions and 1 deletions

View File

@ -67,6 +67,47 @@ Django payroll management system for Fox Fitt Construction, a civil works contra
- **OVERTIME** — links to `WorkLog` via `adj.work_log` FK; deleting removes worker from `work_log.overtime_paid_to` M2M (un-prices the OT)
- **LOAN_REPAYMENT** — links to `Loan` via `adj.loan` FK; loan balance only changes during payment processing
## Frontend Design Conventions
- **CSS variables** defined in `static/css/custom.css` `:root` — always use `var(--name)` instead of hardcoding hex values
- `--primary-dark: #0f172a` (navbar), `--primary-color: #1e293b` (headers), `--accent-color: #10b981` (CTAs, brand green), `--text-main: #334155`, `--bg-color: #f1f5f9`
- **Icon library**: Font Awesome 6 only (`fas fa-*`). Do NOT use Bootstrap Icons (`bi bi-*`)
- **CTA buttons**: `btn-accent` (green) for all primary page-level actions. `btn-primary` (Bootstrap blue) for modal Save/Submit buttons only
- **Page titles**: `{% block title %}Page Name | Fox Fitt{% endblock %}` — always use ` | ` separator, always "Fox Fitt" (never "LabourFlow")
- **Fonts**: Inter (body) + Poppins (headings) loaded once in base.html. Do not add `@import` in custom.css
- **Cards**: `shadow-sm` everywhere, never `shadow-lg`. Table headers use `table-light` class, never `bg-light` on `<thead>`
- **Email/PDF payslips**: Worker name must be the dominant element — do NOT add prominent Fox Fitt branding (Spark reads the vendor name from the document)
## Recent Work (Feb 2026)
### Completed This Session
1. **Mobile responsiveness review & fixes** — 17 issues found and fixed across all templates (card hover on touch, calendar compact view, form columns, chart heights, button stacking, heading sizes)
2. **Design consistency review** — 25 issues identified across branding, colours, fonts, icons, buttons, cards, spacing, and tables
3. **Branding fixes** — Replaced all "LabourFlow" → "Fox Fitt", standardized title separators to ` | `
4. **Font cleanup** — Removed duplicate Inter import from custom.css, removed duplicate inline body font rule from base.html, consolidated Google Fonts loading into single base.html link
5. **Icon standardization** — Replaced all 13 Bootstrap Icon usages with Font Awesome equivalents, removed Bootstrap Icons CDN
6. **Colour variable standardization** — Added `--primary-dark` CSS variable, replaced all inline hex colours with CSS variables
7. **Shadow & table standardization** — All cards use `shadow-sm`, all theads use `table-light`, payslip tables changed from `table-bordered` to `table-hover`
8. **Button consistency** — All page-level CTA buttons use `btn-accent`, login button inline override removed
### Completed in Prior Sessions
- Edit & Delete unpaid payroll adjustments feature
- Advance Payment feature (plan written, not yet implemented)
- Section header comments added to all core/ files
- Bug/security fixes (mutable default args, queryset evaluation, timezone-aware dates, XSS protection, etc.)
- Performance optimizations (database indexes, select_related/prefetch_related, aggregate queries)
### Remaining from Design Review (Not Yet Fixed)
- **#10**: Unify stat card styles between index.html (glassmorphism `.stat-card`) and payroll_dashboard (tinted `bg-X bg-opacity-10`)
- **#16**: Inconsistent card header patterns across pages
- **#18**: Create_receipt has dark primary-color card header while others don't
- **#19**: Inconsistent page top spacing (some use `dashboard-header` + negative margin, some use `py-5`, some use `mt-5`)
- **#22**: Footer is very basic — could use brand accent
- **#23**: No loading/spinner states on form submissions
- **#25**: Plain text empty states — could use icons
### Pending Feature Work
- **Advance Payment feature** — Full plan exists at `.claude/plans/cozy-twirling-rainbow.md`. Allows partial advance payments against earned wages with standalone payslip generation. Ready for implementation.
## Important Context
- Read APP_DOCUMENTATION.md for detailed workflows (attendance, payroll, expenses)
- Environment variables loaded from `../.env`

View File

@ -7,7 +7,9 @@ import os
# === PDF GENERATION ===
def render_to_pdf(template_src, context_dict={}):
def render_to_pdf(template_src, context_dict=None):
if context_dict is None:
context_dict = {}
template = get_template(template_src)
html = template.render(context_dict)
result = BytesIO()