Indicateur d’étapes
-
Mettre en pause
+
Mettre en attente
@@ -20,7 +20,7 @@ const route = useRoute()
const router = useRouter()
const receptionStore = useReceptionStore()
-const { current: storeReception, isLoading, errorMessage } = storeToRefs(receptionStore)
+const { current: storeReception, errorMessage } = storeToRefs(receptionStore)
onMounted(async () => {
const raw = route.params.id
diff --git a/src/Entity/Weight.php b/src/Entity/Weight.php
index 197e8f4..0b619b5 100644
--- a/src/Entity/Weight.php
+++ b/src/Entity/Weight.php
@@ -11,9 +11,11 @@ use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
+use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Attribute\Context;
use Symfony\Component\Serializer\Attribute\Groups;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
+use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity]
#[ORM\Table(name: 'weight')]
@@ -31,6 +33,7 @@ use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
),
],
)]
+#[UniqueEntity(fields: ['reception', 'type'], message: 'A weighing already exists for this type.')]
class Weight
{
#[ORM\Id]
@@ -46,10 +49,12 @@ class Weight
#[ORM\Column(nullable: true)]
#[Groups(['reception:read', 'weight:read', 'weight:write'])]
+ #[Assert\PositiveOrZero]
private ?int $dsd = null;
#[ORM\Column(nullable: true)]
#[Groups(['reception:read', 'weight:read', 'weight:write'])]
+ #[Assert\PositiveOrZero]
private ?int $weight = null;
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
@@ -59,6 +64,8 @@ class Weight
#[ORM\Column(length: 10)]
#[Groups(['reception:read', 'weight:read', 'weight:write'])]
+ #[Assert\NotBlank]
+ #[Assert\Choice(choices: ['gross', 'tare'])]
private string $type = 'gross';
public function getId(): ?int