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 @@