feat : finalisation du tableau d'estimation des poids bovin

This commit is contained in:
tristan
2026-02-26 08:41:56 +01:00
parent e31bdce713
commit 624591c096
4 changed files with 58 additions and 100 deletions
+14
View File
@@ -8,6 +8,7 @@ Project overview
Backend conventions Backend conventions
- Use English for code identifiers/messages; keep “pont-bascule” as domain term. - Use English for code identifiers/messages; keep “pont-bascule” as domain term.
- API Platform operations are defined on Doctrine entities. - 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 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 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`). - 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. - Custom exception: `App\Exception\PontBasculeException` with French messages, mapped to 500 in provider.
- Parsing of pont-bascule payload is in `src/Service/PontBasculePayloadDecoder.php`. - Parsing of pont-bascule payload is in `src/Service/PontBasculePayloadDecoder.php`.
- `config/reference.php` is auto-generated; keep it. - `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 Frontend conventions
- Nuxt SSR disabled; Tailwind used. - Nuxt SSR disabled; Tailwind used.
@@ -36,6 +44,7 @@ Frontend conventions
- Service layer lives in `frontend/services/` with typed DTOs in `frontend/services/dto/`. - 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 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`. - 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 Environment & routing
- Frontend dev server: `npm run dev` in `frontend/`. - Frontend dev server: `npm run dev` in `frontend/`.
@@ -47,6 +56,11 @@ Environment & routing
Notes Notes
- Do not add a GET that creates resources; use POST + PATCH. - Do not add a GET that creates resources; use POST + PATCH.
- Keep endpoints in plural (API Platform convention). - 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: - New reference data added:
- Reception types (`reception_type`, fields: `label`, `code`), selectable on reception form. - 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`). - Merchandise types (`merchandise_type`, fields: `label`, `code`) and pellet types (`pellet_type`, fields: `label`, `code`).
+1 -1
View File
@@ -5,7 +5,7 @@
:disabled="!hasCaseId" :disabled="!hasCaseId"
@click="printCaseReport" @click="printCaseReport"
> >
Imprimer case {{ caseId || '-' }} Imprimer
</UiButton> </UiButton>
</div> </div>
</template> </template>
@@ -150,11 +150,7 @@ final readonly class BuildingCaseWeightsReportProvider implements ProviderInterf
private function resolveDailyGainKg(?string $breedCode): float private function resolveDailyGainKg(?string $breedCode): float
{ {
return match ($breedCode) { return 1.3;
'34' => 1.3, // Limousin
'38' => 1.5, // Charolais
default => 1.4, // Other breeds
};
} }
/** /**
+42 -94
View File
@@ -178,39 +178,9 @@
/* ========================= /* =========================
FOOTER VACCINS / NOTES FOOTER VACCINS / NOTES
========================= */ ========================= */
.footer { .footer {
margin-top: 6px; font-size: 12px;
} }
.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; }
/* Header droit sans bordures par défaut */ /* Header droit sans bordures par défaut */
.header-right-free, .header-right-free,
@@ -363,68 +333,46 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<!-- ========================= <!-- =========================
FOOTER (traitements / vaccins) FOOTER (traitements / vaccins)
========================= --> ========================= -->
{# <table class="footer">#} <table class="footer" style="border-collapse:collapse; margin-top: 32px">
{# <colgroup>#} <tr>
{# #}{# 14 colonnes pour gérer proprement les colspan #} <td style="height: 20px; border: 0" colspan="4"></td>
{# <col style="width:12.5%">#} <td style="font-weight: 700" colspan="2">Grippe</td>
{# <col style="width:8%">#} <td style="font-weight: 700" colspan="2">Protivity</td>
{# <col style="width:12.5%">#} </tr>
{# <col style="width:8%">#} <tr>
{# <col style="width:12.5%">#} <td style="height: 20px">Date</td>
{# <col style="width:8%">#} <td>Antibiotique</td>
{# <col style="width:12.5%">#} <td>Date</td>
{# <col style="width:8%">#} <td>Antero</td>
{# <col style="width:8%">#} <td>Date</td>
{# <col style="width:6%">#} <td>Intranasale</td>
{# <col style="width:8%">#} <td>Date</td>
{# <col style="width:8%">#} <td>Rappel 30 jours</td>
{# <col style="width:6%">#} </tr>
{# <col style="width:8%">#} <tr>
{# </colgroup>#} <td style="height: 20px"></td>
<td></td>
{# <tr>#} <td></td>
{# <th colspan="2">Date</th>#} <td></td>
{# <th colspan="2">Antibiotique</th>#} <td></td>
{# <th colspan="2">Date</th>#} <td></td>
{# <th colspan="2">Antero</th>#} <td></td>
{# <th colspan="3">Grippe</th>#} <td></td>
{# <th colspan="3">Protivity</th>#} </tr>
{# </tr>#} <tr>
<td style="height: 20px"></td>
{# <tr>#} <td></td>
{# <td colspan="2"></td>#} <td></td>
{# <td colspan="2"></td>#} <td></td>
{# <td colspan="2"></td>#} <td></td>
{# <td colspan="2"></td>#} <td></td>
<td></td>
{# <td class="small">Date</td>#} <td></td>
{# <td colspan="2" class="small">Intranasale</td>#} </tr>
</table>
{# <td class="small">Date</td>#}
{# <td colspan="2" class="small">Rappel 30 jours</td>#}
{# </tr>#}
{# <tr>#}
{# <td colspan="2"></td>#}
{# <td colspan="2"></td>#}
{# <td colspan="2"></td>#}
{# <td colspan="2" class="small">Rappel 30 jours</td>#}
{# <td></td>#}
{# <td colspan="2" class="small">Rappel 90 jours</td>#}
{# <td></td>#}
{# <td colspan="2" class="small">3 semaines</td>#}
{# </tr>#}
{# </table>#}
{# <div class="meta">#}
{# Édité le {{ printedAt|date('d/m/Y H:i') }} - Case {{ buildingCase.code ?? '' }}#}
{# </div>#}
</div> </div>
</body> </body>
</html> </html>