@extends('layouts.app') @section('content') @php $secondaryLocale = $locale === 'ar' ? 'en' : 'ar'; $secondaryTranslation = $product->translation($secondaryLocale); $value = fn (string $field) => filled($translation->{$field}) ? $translation->{$field} : null; $facts = array_filter([ ['origin', $value('origin') ?: $value('origin_growing_region'), 'pin'], ['part_used', $value('part_used'), 'leaf'], ['extraction_processing_method', $value('extraction_processing_method'), 'drop'], ['available_grades', $value('available_grades'), 'layers'], ['moq', $value('moq'), 'box'], ], fn ($fact) => filled($fact[1])); $profile = array_filter([ ['appearance_color', $value('appearance_color')], ['odor_aroma_flavor_profile', $value('odor_aroma_flavor_profile')], ['part_used', $value('part_used')], ['extraction_processing_method', $value('extraction_processing_method')], ['origin_growing_region', $value('origin_growing_region')], ], fn ($item) => filled($item[1])); $compliance = array_filter([ ['standard_followed', $value('standard_followed')], ['available_grades', $value('available_grades')], ['non_gmo', $product->is_non_gmo === null ? null : __('product_detail.'.($product->is_non_gmo ? 'yes' : 'no'))], ['country_certificate', $product->has_country_of_origin_certificate === null ? null : __('product_detail.'.($product->has_country_of_origin_certificate ? 'yes' : 'no'))], ], fn ($item) => filled($item[1])); $commercial = array_filter([ ['moq', $value('moq')], ['available_grades', $value('available_grades')], ['origin', $value('origin') ?: $value('origin_growing_region')], ], fn ($item) => filled($item[1])); $applications = filled($translation->applications) ? preg_split('/\s*(?:\r?\n|;|•)\s*/u', $translation->applications, -1, PREG_SPLIT_NO_EMPTY) : []; $contactUrl = route('contact', ['locale' => $locale]); $canEditProduct = auth()->user()?->can('update', $product) ?? false; @endphp
@if ($canEditProduct) @endif
@if ($primaryMedia) {{ $primaryMedia->translation($locale)?->alt_text ?: $translation->name }} @else @endif
{{ $translation->name }}

{{ $categoryTranslation->name }}

{{ $translation->name }}

@if ($secondaryTranslation?->name)

{{ $secondaryTranslation->name }}

@endif @if ($product->botanical_name)

{{ $product->botanical_name }}

@endif @if ($translation->short_description || $translation->description || $translation->technical_content)

{{ $translation->short_description ?: ($translation->description ?: $translation->technical_content) }}

@endif
@if ($facts || $canEditProduct)
@if ($canEditProduct)@endif
@foreach ($facts as [$label, $factValue, $icon])
{{ __('product_detail.'.$label) }}
{{ $factValue }}
@endforeach
@endif @if ($profile || $translation->technical_content || $canEditProduct)
@if ($canEditProduct)@endif

{{ __('product_detail.profile') }}

{{ __('product_detail.profile_heading') }}

@if ($translation->technical_content)

{{ $translation->technical_content }}

@endif
@if ($profile)
@foreach ($profile as [$label, $profileValue])
{{ __('product_detail.'.$label) }}
{{ $profileValue }}
@endforeach
@endif
@endif @if ($applications || $canEditProduct)
@if ($canEditProduct)@endif

{{ __('product_detail.applications') }}

{{ __('product_detail.applications_heading') }}

    @foreach ($applications as $application)
  • {{ $application }}
  • @endforeach
@endif @if ($compliance || $canEditProduct)
@if ($canEditProduct)@endif

{{ __('product_detail.quality') }}

{{ __('product_detail.quality_heading') }}

@foreach ($compliance as [$label, $complianceValue])
{{ __('product_detail.'.$label) }}
{{ $complianceValue }}
@endforeach
@endif

{{ __('product_detail.technical_documentation') }}

{{ __('product_detail.technical_documentation_heading') }}

{{ __('product_detail.technical_documentation_copy') }}

@if ($commercial || $canEditProduct)
@if ($canEditProduct)@endif

{{ __('product_detail.commercial') }}

{{ __('product_detail.commercial_heading') }}

@foreach ($commercial as [$label, $commercialValue])
{{ __('product_detail.'.$label) }}
{{ $commercialValue }}
@endforeach
@endif

{{ __('product_detail.inquiry', ['product' => $translation->name]) }}

{{ __('product_detail.inquiry_heading', ['product' => $translation->name]) }}

{{ __('product_detail.inquiry_copy') }}

@if ($relatedProducts->isNotEmpty())

{{ __('product_detail.related') }}

{{ __('product_detail.explore', ['category' => $categoryTranslation->name]) }}

{{ __('product_detail.view_all', ['category' => $categoryTranslation->name]) }}
@endif
@endsection