@foreach($styles ?? [] as $s=>$style) @foreach($style['style_versions'] ?? [] as $sv=>$styleVersion) @foreach($styleVersion['prices'] ?? [] as $p=>$price) {{-- If first row for this style, output style header cell --}} @if($loop->parent->iteration === 1 && $loop->iteration === 1) {{ $style['designs_id'] }}
{{ $style['customer_ref'] }}
{{ ucwords($style['designs']['description']) }} @endif {{-- First cell for the style version --}} @if($loop->first) @if($this->canedit($style)) @else {{ $styleVersion['name'] }}
{{ $styleVersion['factories']['name'] ?? "" }} @endif @endif {{-- Image cell (only once per style version) --}} @if($loop->first) @endif {{-- Yarns cell (only once per style version) --}} @if($loop->first) @foreach ($this->getYarns($styleVersion) as $yarn) {{ $yarn }}
@endforeach @endif {{-- Price actions and identification --}} @if($this->canedit($style))
@else {{ $price['name'] }} @endif {{-- Size, Colourway, Colour Type --}} @if($this->canedit($style)) @else {{ optional(collect($this->sizes)->firstWhere('id', $price['sizes_id']))->name }}
{{ $price['colourway_name'] ?? "" }}
{{ $price['colour_type'] ?? "" }} @endif {{-- Yarn Cost --}} @if($price['model'] === 'manual' && $this->canedit($style))
@else
€{{ number_format($price['yarn_cost_kg'], 2) }}
@endif {{-- Yarn Transport --}} @if($this->canedit($style))
@else {{ $price['yarn_trans_currency'] ?? "" }}{{ $price['yarn_trans'] ?? "" }} @endif {{-- Weight --}} @if($this->canedit($style)) @else {{ $price['weight'] }} @endif {{-- Costed Weight --}} @if($this->canedit($style)) @else {{ $price['costed_weight'] }} @endif {{-- Yarn Value (Calculated) --}} €{{ $price['yarn_value_euro'] }} {{-- CMT & Status --}} @if($this->canedit($style))
{{ $styleVersion['factories']['currency'] }}
@else {{ $styleVersion['factories']['currency'] }}{{ $price['cmt'] }} - {{ $price['cmt_status'] }} @endif {{-- Valid Until --}} @if($this->canedit($style)) @else {{ $price['valid_until'] }} @endif {{-- AOC --}} @if($this->canedit($style)) @else {{ $price['aoc'] ?? "" }}% @endif {{-- Accessory --}} @if($this->canedit($style))
@else {{ $price['accessory_currency'] ?? "" }}{{ $price['accessory'] ?? "" }} @endif {{-- Label --}} @if($this->canedit($style))
@else {{ $price['label_currency'] ?? "" }}{{ $price['label'] ?? "" }} @endif {{-- GMT Trans --}} @if($this->canedit($style))
@else {{ $price['gmt_trans_currency'] ?? "" }}{{ $price['gmt_trans'] ?? "" }} @endif {{-- Testing --}} @if($this->canedit($style))
£
@else £{{ $price['testing'] ?? "" }} @endif {{-- Embroidery --}} @if($this->canedit($style))
@else {{ $price['embroidery_currency'] ?? "" }}{{ $price['embroidery'] ?? "0.00" }} @endif {{-- Duty --}} @if($this->canedit($style)) @else £{{ $price['duty'] ?? "" }} @endif {{-- Customs --}} £{{ $price['customs'] }} {{-- Factoring --}} {{ $styleVersion['factories']['currency'] }}{{ $price['factoring'] }} {{-- Subtotal --}} {{ $styleVersion['factories']['currency'] }}{{ $price['subtotal'] }}
£{{ $price['subtotal_base'] }} {{-- Quote & Margin --}} @if($this->canedit($style))
{{ $style['customers']['currency'] }}
@else {{ $style['customers']['currency'] ?? "" }}{{ $price['quote'] ?? "0.00" }}
Margin: {{ $price['margin'] }}% @endif {{-- Quotes Sent --}} @foreach($price['quotes_sent'] ?? [] as $quote) {{ \Carbon\Carbon::parse($quote['date_sent'])->format('d-M') }} - {{ $style['customers']['currency'] }}{{ $quote['quote'] }}
@endforeach {{-- Target --}} @if($this->canedit($style))
{{ $style['customers']['currency'] }}
@else {{ $style['customers']['currency'] ?? "" }}{{ $price['target'] ?? "0.00" }} @endif {{-- Min Qty --}} @if($this->canedit($style)) @else {{ $price['min_qty'] ?? "" }} @endif {{-- Notes --}} @if($this->canedit($style)) @else {{ $price['notes'] ?? "" }} @endif {{-- Customer Notes --}} @if($this->canedit($style)) @else {{ $price['customer_notes'] ?? "" }} @endif {{-- Share Button --}} {{-- Last Updated By --}} {{-- {{ $price['last_updated_by'] }} --}} @if($this->canedit($style)) @else {{ $styleVersion['comments_yarn'] ?? '' }} @endif @if(isset($price['historic'])) @foreach(json_decode($price['historic'], true) ?? [] as $old_price) {{ $old_price['season'] }} {{ $style['customers']['currency'] }}{{ number_format($old_price['cmt'], 2) }}
@endforeach @endif @if($this->canedit($style)) @else {{ $styleVersion['comments_cmt'] ?? '' }} @endif @if(isset($price['historic'])) @foreach(json_decode($price['historic'], true) ?? [] as $old_price) {{ $old_price['season'] }} {{ $style['customers']['currency'] }}{{ number_format($old_price['quote'], 2) }}
@endforeach @endif @endforeach @endforeach @if(!$style['empty']) @endif @endforeach