@php
$badges = $item->badges()->where('is_active', 1)->get()->keyBy('position');
$topLeftBadge = isset($badges['top-left']) ? $badges['top-left'] : null;
$topRightBadge = isset($badges['top-right']) ? $badges['top-right'] : null;
$bottomBadge = isset($badges['bottom']) ? $badges['bottom'] : null;
$itemColorsSorted = $item->colors->where('is_hidden', 0)->sortBy(function($q) { return $q->color->order; });
$selectedColor = $itemColorsSorted->first(function($color) use ($itemColorsSorted) { return \App\facades\IHouseFacade::isSelectedColor($color->code, $itemColorsSorted); }) ?? $itemColorsSorted->first();
@endphp
@if($item->is_sale)
) }})
@endif
@if($topLeftBadge)

@endif
@if($topRightBadge)

@endif
@if($itemColorsSorted->isNotEmpty())

@foreach($item->item_colors as $color)

@endforeach
@if($bottomBadge)
background_color) style="background:{{$bottomBadge->background_color}}" @endif>
font_color) style="color:{{$bottomBadge->font_color}}" @endif>{{$bottomBadge->title}}
@endif
@endif
{{ $item->show_title }}
@if($itemColorsSorted->isNotEmpty())
{{$selectedColor->code??'-'}}
@if($itemColorsSorted->count() != 1)
اختر اللون لفحص التوفر
@endif
@foreach($itemColorsSorted as $color)
quantity==0 ? 'title="غير متوفر"' : ''!!} style="display: block; margin: 0 auto; background:{{$color->quantity==0 ? "repeating-linear-gradient( 45deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2) 3px, rgba(0, 0, 0, 0.3) 3px, rgba(0, 0, 0, 0.3) 7px ),{$color->color->color}" : $color->color->color}}" class="color-chooser {!!$color->quantity==0 ? 'disabled' : ''!!}" type="radio" id="{{$color->color->id}}" name="color-{{$item->id}}" value="{{$color->color->id}}" @if($selectedColor->id == $color->id) checked @endif>
@endforeach
@endif
{!! $item->getSpecificationsHtml($spec_categories) !!}
@if($item->can_laser)
إمكانية الحفر بالليزر
@endif
@if($item->discountState || $item->discountPercentage)
{{ number_format($item->price) }} شيكل
{{ number_format($item->totalPrice) }} شيكل
@else
{{ number_format($item->price) }} شيكل
@endif
{!! Form::open(['route' => ['details', $category->slug, $sub_category->slug, $item->id], 'method' => 'get', 'style' => 'margin-top: 3px!important;']) !!}
@if($selectedColor)
{!! Form::hidden('product', $selectedColor->code, ['id' => "color-code-{$item->id}"]) !!}
@endif
{{$selectedColor->quantity ? 'متوفر' : (($selectedColor->stock_status == 'coming-soon' && !$selectedColor->preorder_quantity) ? 'قريبا' : ($item->is_special_order ? 'طلب خاص' : ($selectedColor->preorder_quantity > 0 ? 'طلب مسبق' : 'غير متوفر')))}}
{!! Form::close() !!}