diff --git a/AGENTS.md b/AGENTS.md index 3aa6687..b1aac43 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,6 +8,7 @@ Project overview Backend conventions - Use English for code identifiers/messages; keep “pont-bascule” as domain term. - API Platform operations are defined on Doctrine entities. +- No custom repository classes are used (`src/Repository` removed); use default Doctrine repositories via `EntityManagerInterface`. - Reception entity is in `src/Entity/Reception.php`, with custom weigh endpoint `/receptions/weigh`. - Reception fields: `date_reception`, `license_plate`, `current_step` (default 0), `is_valid` (default false). - Reception also has `identification_number` (auto `N-BR-####`), `merchandise_type`, `merchandise_detail`, `buildings` (M2M), and `pellet_buildings` (via `reception_pellet_building`). @@ -17,6 +18,13 @@ Backend conventions - Custom exception: `App\Exception\PontBasculeException` with French messages, mapped to 500 in provider. - Parsing of pont-bascule payload is in `src/Service/PontBasculePayloadDecoder.php`. - `config/reference.php` is auto-generated; keep it. +- Bovine storage: + - `src/Entity/Bovine.php` with fields `nationalNumber` (unique), `receivedWeight`, `arrivalDate`, and `buildingCase` (ManyToOne). + - `src/Entity/BuildingCase.php` has `bovines` (OneToMany). +- Case PDF report: + - Endpoint: `GET /building_cases/{id}/weights-report` (provider: `App\State\BuildingCaseWeightsReportProvider`). + - Template: `templates/case_weights_report.html.twig`. + - Projection logic is done in backend from `arrivalDate`; daily gain is currently fixed at `1.3 kg/day` for all races. Frontend conventions - Nuxt SSR disabled; Tailwind used. @@ -36,6 +44,7 @@ Frontend conventions - Service layer lives in `frontend/services/` with typed DTOs in `frontend/services/dto/`. - Reception service uses `receptions`, `receptions/{id}`, `receptions/weigh` and supports success/error toast keys. - Reception receipt endpoint is `receptions/{id}/receipt` (PDF) via `frontend/composables/usePdfPrinter.ts`. +- Infrastructure case page prints the case weight report PDF from `frontend/pages/infrastructure/case.vue` using `usePdfPrinter('/building_cases/{id}/weights-report')`. Environment & routing - Frontend dev server: `npm run dev` in `frontend/`. @@ -47,6 +56,11 @@ Environment & routing Notes - Do not add a GET that creates resources; use POST + PATCH. - Keep endpoints in plural (API Platform convention). +- Seed and fixtures conventions: + - `app:seed` now seeds infrastructure (`statut`, `building_layout`, `building_case`, `building_case_position`) and bovines. + - `app:seed` uses intermediate flushes (after buildings and after infrastructure) so find queries can resolve just-created records. + - Bovine seed rows use a legacy case token mapping to building-case code (`B{building}-C{case}`) before fallback to direct id lookup. + - Fixtures include `BuildingInfrastructureFixtures` + `BovineFixtures` (via `AppFixtures` dependencies). - New reference data added: - Reception types (`reception_type`, fields: `label`, `code`), selectable on reception form. - Merchandise types (`merchandise_type`, fields: `label`, `code`) and pellet types (`pellet_type`, fields: `label`, `code`). diff --git a/frontend/pages/infrastructure/case.vue b/frontend/pages/infrastructure/case.vue index e8247b9..3c359a7 100644 --- a/frontend/pages/infrastructure/case.vue +++ b/frontend/pages/infrastructure/case.vue @@ -5,7 +5,7 @@ :disabled="!hasCaseId" @click="printCaseReport" > - Imprimer case {{ caseId || '-' }} + Imprimer diff --git a/src/State/BuildingCaseWeightsReportProvider.php b/src/State/BuildingCaseWeightsReportProvider.php index fc2798a..45584b0 100644 --- a/src/State/BuildingCaseWeightsReportProvider.php +++ b/src/State/BuildingCaseWeightsReportProvider.php @@ -150,11 +150,7 @@ final readonly class BuildingCaseWeightsReportProvider implements ProviderInterf private function resolveDailyGainKg(?string $breedCode): float { - return match ($breedCode) { - '34' => 1.3, // Limousin - '38' => 1.5, // Charolais - default => 1.4, // Other breeds - }; + return 1.3; } /** diff --git a/templates/case_weights_report.html.twig b/templates/case_weights_report.html.twig index 49e6f04..6ee9c8e 100644 --- a/templates/case_weights_report.html.twig +++ b/templates/case_weights_report.html.twig @@ -178,39 +178,9 @@ /* ========================= FOOTER VACCINS / NOTES ========================= */ - .footer { - margin-top: 6px; - } - - .footer th { - background: #ffffff; - font-size: 9px; - font-weight: 700; - padding: 2px; - } - - .footer td { - font-size: 8px; - padding: 2px; - height: 18px; - } - - .footer .small { - font-size: 8px; - } - - /* Ligne méta */ - .meta { - margin-top: 3px; - text-align: right; - font-size: 8px; - color: #444; - line-height: 1.2; - } - - /* Petits ajustements dompdf */ - .mt-0 { margin-top: 0; } - .mb-0 { margin-bottom: 0; } + .footer { + font-size: 12px; + } /* Header droit sans bordures par défaut */ .header-right-free, @@ -363,68 +333,46 @@ {% endfor %} - -{# #} -{# #} -{# #}{# 14 colonnes pour gérer proprement les colspan #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} - -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} - -{# #} -{# #} -{# #} -{# #} -{# #} - -{# #} -{# #} - -{# #} -{# #} -{# #} - -{# #} -{# #} -{# #} -{# #} -{# #} - -{# #} -{# #} - -{# #} -{# #} -{# #} -{# #} - -{#
#} -{# Édité le {{ printedAt|date('d/m/Y H:i') }} - Case {{ buildingCase.code ?? '' }}#} -{#
#} + FOOTER (traitements / vaccins) + ========================= --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +