From 44ffc4d34e0752014a05c6461899dcaffed72581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Wed, 28 Oct 2026 10:02:43 +0100 Subject: [PATCH 01/10] feat(DiscountProductDto): add picture property and update fromModel method feat(ProductDragAndDropComponent): enhance product display with picture and improve layout --- app/Dto/DiscountProductDto.php | 7 +- .../Discounts/GetDiscountFormDataQuery.php | 6 +- .../ProductDragAndDropComponent.vue | 113 +++++++++--------- 3 files changed, 66 insertions(+), 60 deletions(-) diff --git a/app/Dto/DiscountProductDto.php b/app/Dto/DiscountProductDto.php index ce592521..432866d7 100644 --- a/app/Dto/DiscountProductDto.php +++ b/app/Dto/DiscountProductDto.php @@ -15,6 +15,7 @@ final readonly class DiscountProductDto implements \JsonSerializable, Arrayable public function __construct( public string $id, public string $name, + public ?string $picture, ) { } @@ -23,6 +24,7 @@ final readonly class DiscountProductDto implements \JsonSerializable, Arrayable return new self( id: (string) $product->id, name: (string) $product->name, + picture: $product->picture, ); } @@ -33,8 +35,9 @@ final readonly class DiscountProductDto implements \JsonSerializable, Arrayable public function toArray(): array { return [ - 'id' => $this->id, - 'name' => $this->name, + 'id' => $this->id, + 'name' => $this->name, + 'picture' => $this->picture, ]; } diff --git a/app/Queries/Discounts/GetDiscountFormDataQuery.php b/app/Queries/Discounts/GetDiscountFormDataQuery.php index 40d105ce..3975f1d3 100644 --- a/app/Queries/Discounts/GetDiscountFormDataQuery.php +++ b/app/Queries/Discounts/GetDiscountFormDataQuery.php @@ -29,14 +29,14 @@ final readonly class GetDiscountFormDataQuery implements Query if ($input->discount !== null) { $selectedProds = Product::query() - ->select(['id', 'name']) + ->select(['id', 'name', 'picture']) ->where('discount_id', $input->discount->id) ->orderBy('name') ->get() ->map(fn (Product $p): DiscountProductDto => DiscountProductDto::fromModel($p)); $existingProds = Product::query() - ->select(['id', 'name']) + ->select(['id', 'name', 'picture']) ->whereNotIn('id', $selectedProds->pluck('id')) ->orderBy('name') ->get() @@ -46,7 +46,7 @@ final readonly class GetDiscountFormDataQuery implements Query } else { $selectedProds = collect(); $existingProds = Product::query() - ->select(['id', 'name']) + ->select(['id', 'name', 'picture']) ->orderBy('name') ->get() ->map(fn (Product $p): DiscountProductDto => DiscountProductDto::fromModel($p)); diff --git a/resources/ts/bo/components/ProductDragAndDropComponent.vue b/resources/ts/bo/components/ProductDragAndDropComponent.vue index c96f611d..b1d2f245 100644 --- a/resources/ts/bo/components/ProductDragAndDropComponent.vue +++ b/resources/ts/bo/components/ProductDragAndDropComponent.vue @@ -1,58 +1,61 @@