feat(11-12-accounting): phases 11-12 complete — milestone v0.3 done

Phase 11: Receipt preview, print & PDF via dompdf.
Phase 12: Accounting section with receipt list, filters, pagination,
selectable checkboxes and XLSX export via PhpSpreadsheet.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-15 21:00:29 +01:00
parent fb60b6d5d7
commit 22fc330055
12 changed files with 1007 additions and 18 deletions

View File

@@ -0,0 +1,143 @@
---
phase: 12-accounting-list
plan: 01
subsystem: accounting
tags: [phpspreadsheet, xlsx, export, list, pagination, filters, selectable]
requires:
- phase: 11-receipt-print
provides: ReceiptController show/print/pdf, receipt views
- phase: 10-receipt-issue
provides: ReceiptRepository, receipts table, snapshots
provides:
- Accounting section in main navigation
- Receipt list with filters, pagination, sorting
- XLSX export (selected or all from filter)
- Selectable rows with checkboxes
affects: []
tech-stack:
added: [phpoffice/phpspreadsheet ^5.5]
patterns: [selectable table-list with POST export, findByIds batch query]
key-files:
created:
- src/Modules/Accounting/AccountingController.php
- resources/views/accounting/index.php
modified:
- src/Modules/Accounting/ReceiptRepository.php
- routes/web.php
- resources/views/layouts/app.php
- resources/lang/pl.php
- composer.json
- DOCS/ARCHITECTURE.md
key-decisions:
- "PhpSpreadsheet v5.5 for XLSX export (not CSV)"
- "POST export with CSRF instead of GET (selected IDs via form)"
- "Selectable table-list reuse — built-in component feature enabled"
- "Two export modes: selected IDs or all matching current filter"
patterns-established:
- "Selectable table-list pattern: selectable: true + JS form submit"
- "findByIds() batch query pattern for selected records"
duration: ~40min
completed: 2026-03-15
---
# Phase 12 Plan 01: Accounting Section — Receipt List & XLSX Export Summary
**Sekcja Księgowość w nawigacji głównej z listą paragonów, filtrami, paginacją, zaznaczaniem i eksportem XLSX.**
## Performance
| Metric | Value |
|--------|-------|
| Duration | ~40min |
| Completed | 2026-03-15 |
| Tasks | 4 completed (3 auto + 1 checkpoint) |
| Files modified | 10 |
## Acceptance Criteria Results
| Criterion | Status | Notes |
|-----------|--------|-------|
| AC-1: Link Księgowość w nawigacji głównej | Pass | Osobny link w sidebar z ikoną dokumentu, przed Ustawienia |
| AC-2: Lista paragonów z paginacją | Pass | Reuse table-list, sortowanie po numerze/dacie/kwocie |
| AC-3: Filtry listy | Pass | Szukaj, konfiguracja (select), data od/do — zachowane w URL |
| AC-4: Eksport XLSX | Pass | Dwa tryby: zaznaczone (POST + selected_ids) i wszystkie z filtra |
| AC-5: Pusta lista | Pass | Komunikat "Brak paragonów" |
## Accomplishments
- AccountingController z index() i export() — pełna sekcja księgowości
- ReceiptRepository: paginate(), exportData(), findByIds() — 3 nowe metody
- Zaznaczanie paragonów checkboxami (reuse wbudowanego selectable w table-list)
- Eksport XLSX z PhpSpreadsheet: zaznaczone lub wszystkie z filtra
- Link "Księgowość" w sidebar nawigacji
## Files Created/Modified
| File | Change | Purpose |
|------|--------|---------|
| `src/Modules/Accounting/AccountingController.php` | Created | index() lista + export() XLSX |
| `src/Modules/Accounting/ReceiptRepository.php` | Modified | +paginate(), +exportData(), +findByIds() |
| `routes/web.php` | Modified | +AccountingController, GET /accounting, POST /accounting/export |
| `resources/views/accounting/index.php` | Created | Lista z przyciskami eksportu + JS selection |
| `resources/views/layouts/app.php` | Modified | +link Księgowość w sidebar |
| `resources/lang/pl.php` | Modified | +accounting.*, +navigation.accounting_section |
| `composer.json` | Modified | +phpoffice/phpspreadsheet ^5.5 |
| `public/assets/css/app.css` | Modified | Rebuild |
| `DOCS/ARCHITECTURE.md` | Modified | +AccountingController, +trasy, +metody repo |
## Decisions Made
| Decision | Rationale | Impact |
|----------|-----------|--------|
| PhpSpreadsheet (nie CSV) | XLSX lepszy dla księgowości — formatowanie, polskie znaki | Nowa zależność composer |
| POST eksport z CSRF | Wysyłanie selected_ids[] wymaga POST; bezpieczeństwo | Formularz ukryty + JS submit |
| Dwa tryby eksportu | User request: zaznaczanie + eksport wszystkich z filtra | findByIds() + exportData() |
| Selectable table-list reuse | Komponent już ma wbudowane checkboxy | Zero nowego kodu w komponencie |
## Deviations from Plan
### Summary
| Type | Count | Impact |
|------|-------|--------|
| Scope additions | 1 | Zaznaczanie paragonów (user request during checkpoint) |
| Auto-fixed | 0 | — |
**Total impact:** Pozytywne rozszerzenie — zaznaczanie paragonów do eksportu na prośbę użytkownika.
### Scope Additions
**1. Zaznaczanie paragonów do eksportu**
- **Requested during:** Checkpoint (Task 4)
- **What:** Checkboxy, "Eksportuj zaznaczone", "Eksportuj wszystkie (filtr)"
- **Implementation:** selectable: true w table-list, POST export, findByIds(), JS form
- **Impact:** Lepsza kontrola użytkownika nad eksportem
### Skill Audit
| Expected | Invoked | Notes |
|----------|---------|-------|
| sonar-scanner | ○ | Required — do uruchomienia przed kolejnym UNIFY |
## Next Phase Readiness
**Ready:**
- Milestone v0.3 Moduł Paragonów COMPLETE
- Pełny cykl: konfiguracja → wystawienie → podgląd → druk → PDF → lista → eksport
**Concerns:**
- sonar-scanner nie uruchomiony (gap z wielu faz)
- vendor/ musi być uploadowany ręcznie na serwer po każdej zmianie zależności
**Blockers:**
- Brak
---
*Phase: 12-accounting-list, Plan: 01*
*Completed: 2026-03-15*