Combat tracker: multiple named encounters

- Encounter entity; Combatant now belongs to an encounter (ON DELETE
  CASCADE). Migration adds encounter_id, rehoming any existing combatants.
- /tracker lists encounters (name, count, last updated) with a "New
  encounter" form; /tracker/{id} is the HP tracker for one encounter.
- Encounters can be renamed, have their combatants cleared, or be deleted.
- The Enemies list gains an encounter picker next to "Add to tracker"
  (existing encounter or "— New encounter —", which prompts for a name);
  an encounter's "Add enemies" link pre-selects it via ?encounter=.
- Routes for combatant HP/remove moved under /tracker/combatant/ to keep
  the numeric {id} for encounters.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Frank
2026-09-06 19:24:37 +02:00
co-authored by Claude Sonnet 5
parent 9854e6c034
commit cbe4b0a0e1
11 changed files with 433 additions and 112 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Repository;
use App\Entity\Encounter;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Encounter>
*/
class EncounterRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Encounter::class);
}
/** @return list<Encounter> most-recent first */
public function recent(): array
{
return $this->findBy([], ['updatedAt' => 'DESC', 'id' => 'DESC']);
}
}