@extends('layouts.app') @section('title', '{{ $product->name }} | OraFresh Beauty') @section('content')
@if($product->images && $product->images->count() > 0)
@if($product->promo_price && $product->promo_price < $product->price)
-{{ round((($product->price - $product->promo_price) / $product->price) * 100) }}% DE RÉDUCTION
@endif @if($product->stock !== null)
@if($product->stock == 0)
ÉPUISÉ
@elseif($product->stock <= 5)
STOCK LIMITÉ ({{ $product->stock }})
@else
EN STOCK ({{ $product->stock }})
@endif
@endif
@if($product->images->count() > 1)
@foreach($product->images as $image)
@endforeach
@endif @else
@endif

{{ $product->name }}

@if($product->promo_price && $product->promo_price < $product->price) Promotion -{{ round((($product->price - $product->promo_price) / $product->price) * 100) }}% @endif @if($product->stock !== null) @if($product->stock > 10) En stock ({{ $product->stock }} disponibles) @elseif($product->stock > 0) Plus que {{ $product->stock }} en stock! @else Épuisé @endif @endif @auth Gagnez {{ floor($product->promo_price ?? $product->price) }} points fidélité @endauth {{ $product->category->name ?? 'Produit' }}
@php $reviewCount = $product->approvedReviews->count(); $avgRating = $reviewCount > 0 ? $product->approvedReviews->avg('rating') : 0; @endphp
@if($reviewCount > 0)
@for($i = 1; $i <= 5; $i++) @endfor
{{ number_format($avgRating, 1) }}/5 ({{ $reviewCount }} {{ $reviewCount > 1 ? 'avis' : 'avis' }}) @else
@for($i = 1; $i <= 5; $i++) @endfor
Aucun avis @endif

{{ number_format($product->promo_price ?? $product->price, 2) }} DT

@if($product->promo_price) {{ number_format($product->price, 2) }} DT @endif
@if($product->promo_price)
Vous économisez {{ number_format($product->price - $product->promo_price, 2) }} DT
@endif

{{ $product->description }}

@if($product->attributeValues->count() > 0)

Caractéristiques

@foreach($product->attributeValues as $val)
{{ $val->attribute->name }}: {{ $val->value }}
@endforeach
@endif
@csrf

Livraison Gratuite
dès 60DT

Retours
30 jours

Paiement
sécurisé

Avis Clients

Ce que nos clients disent

@php $avgRating = $product->approvedReviews->avg('rating'); $totalReviews = $product->approvedReviews->count(); @endphp @if($totalReviews > 0)
@for($i = 1; $i <= 5; $i++) @endfor
{{ number_format($avgRating, 1) }} sur 5 ({{ $totalReviews }} avis)
@endif

Donnez votre avis

@if(session('success'))
{{ session('success') }}
@endif
@csrf
@for($i = 1; $i <= 5; $i++) @endfor
@error('rating'){{ $message }}@enderror
@error('comment'){{ $message }}@enderror
@if($product->approvedReviews->count() > 0)
@foreach($product->approvedReviews as $review)
{{ substr($review->name, 0, 1) }}

{{ $review->name }}

@for($i = 1; $i <= 5; $i++) @endfor
{{ $review->created_at->diffForHumans() }}
Achat vérifié

{{ $review->comment }}

@endforeach
@else

Soyez le premier à donner votre avis sur ce produit

@endif
@if($relatedProducts->count() > 0)
Recommandations

Vous Aimerez Aussi

@foreach($relatedProducts as $rel)
@if($rel->promo_price && $rel->promo_price < $rel->price)
-{{ round((($rel->price - $rel->promo_price) / $rel->price) * 100) }}%
@endif @if($rel->stock !== null)
@if($rel->stock == 0)
Épuisé
@elseif($rel->stock <= 5)
Limité
@endif
@endif

{{ $rel->name }}

{{ $rel->category->name ?? 'Collection' }}

{{ number_format($rel->promo_price ?? $rel->price, 2) }} DT

@if($rel->promo_price)

{{ number_format($rel->price, 2) }} DT

@endif
@csrf
@endforeach
@endif
@endsection