@foreach($drops as $d=>$drop) @if(!isset($this->chunk[$d])) {{-- dd($this->chunk, $drops) --}} @continue @endif @if($this->chunk[$d]['is_first_in_shipment']) @endif
{{$drop['id']}}
@can('order:update') @endcan
Flagged Click to Flag
@if($columns['Season']) {{ $drop['customer_order_lines']['customer_orders']['seasons']['description'] }} @endif @if($columns['Factory'])
{{ $drop['customer_order_lines']['colourways']['style_versions']['factories']['name'] }}
@endif @if($columns['Customer'])
{{ $drop['customer_order_lines']['customer_orders']['customers']['name'] }}
@endif @if($columns['Order No'])
{{ $drop['customer_order_lines']['customer_orders']['customer_po'] }}
{{ date("d-M", strtotime($drop['customer_order_lines']['customer_orders']['order_date'])) }} @endif @if($columns['Style'])
{{ $drop['customer_order_lines']['colourways']['style_versions']['styles']['designs_id'] }}
{{ $drop['customer_order_lines']['colourways']['style_versions']['name'] }}
@if($drop['customer_order_lines']['colourways']['style_versions']['styles']['customer_ref'])
{{ $drop['customer_order_lines']['colourways']['style_versions']['styles']['customer_ref'] }}
@endif @endif @if($columns['Description'])
{{ Str::title($drop['customer_order_lines']['colourways']['style_versions']['styles']['designs']['description']) }}
@endif @if($columns['Colour']) {{ Str::title($drop['customer_order_lines']['colourways']['name']) }} @endif @if($columns['Image']) @if(!empty($drop['customer_order_lines']['colourways']['img_thumb'])) @else
No Image
@endif @endif @if($columns['Sizes']) @if(!empty($drop['customer_order_lines']['customer_order_line_quantities'])) @foreach($drop['customer_order_lines']['customer_order_line_quantities'] as $size) @endforeach @if($columns['Sizes - Ordered']) @foreach($drop['shipment_line_sizes'] as $s=>$size) @endforeach @endif @foreach($drop['shipment_line_sizes'] as $s => $size) @endforeach @if($columns['Sizes - Price']) @php // Check if all prices are the same $prices = []; $cmtPrices = []; $priceStatuses = []; $cmtStatuses = []; foreach($drop['customer_order_lines']['customer_order_line_quantities'] as $size) { $priceModel = $size['price_model_data'] ?? null; if($priceModel) { $prices[] = $priceModel['quote'] ?? 0; $cmtPrices[] = $priceModel['cmt'] ?? 0; $priceStatuses[] = $priceModel['quote_status'] ?? ""; $cmtStatuses[] = $priceModel['cmt_status'] ?? ""; } else { $prices[] = null; $cmtPrices[] = null; $priceStatuses[] = null; $cmtStatuses[] = null; } } $allPricesSame = count(array_unique(array_filter($prices, function($p) { return $p !== null; }))) <= 1; $allCmtSame = count(array_unique(array_filter($cmtPrices, function($p) { return $p !== null; }))) <= 1; $allPriceStatusSame = count(array_unique(array_filter($priceStatuses, function($s) { return $s !== null; }))) <= 1; $allCmtStatusSame = count(array_unique(array_filter($cmtStatuses, function($s) { return $s !== null; }))) <= 1; $sizeCount = count($drop['customer_order_lines']['customer_order_line_quantities']); @endphp @if($allPricesSame && $allPriceStatusSame) @php $firstPriceModel = $drop['customer_order_lines']['customer_order_line_quantities'][0]['price_model_data'] ?? null; @endphp @else @foreach($drop['customer_order_lines']['customer_order_line_quantities'] as $size) @php $priceModel = $size['price_model_data'] ?? null; @endphp @endforeach @endif @if($allCmtSame && $allCmtStatusSame) @php $firstPriceModel = $drop['customer_order_lines']['customer_order_line_quantities'][0]['price_model_data'] ?? null; @endphp @else @foreach($drop['customer_order_lines']['customer_order_line_quantities'] as $size) @php $priceModel = $size['price_model_data'] ?? null; @endphp @endforeach @endif @endif
Size{{ $size['sizes']['name'] }}Total
Ordered @if(Gate::check('order:update')) @else {{ $size['qty'] }} @endif {{ $drop['total_pieces'] }}
Shipped @if(Gate::check('order:update') || Gate::check('finance:update')) @else {{ $size['shipped_qty'] }} @endif {{$drop['total_pieces_shipped']}}
Price
@if($firstPriceModel)
{{$drop['customer_order_lines']['customer_orders']['customers']['currency'] . number_format($firstPriceModel['quote'] ?? 0, 2)}}
@else - @endif
@if($priceModel) {{$drop['customer_order_lines']['customer_orders']['customers']['currency'] . number_format($priceModel['quote'] ?? 0, 2)}} @else - @endif
CMT
@if($firstPriceModel)
{{$drop['customer_order_lines']['colourways']['style_versions']['factories']['currency'] . number_format($firstPriceModel['cmt'] ?? 0, 2)}}
@else - @endif
@if($priceModel) {{$drop['customer_order_lines']['colourways']['style_versions']['factories']['currency'] . number_format($priceModel['cmt'] ?? 0, 2)}} @else - @endif
@endif @endif @if($columns['Total Qty']) {{ $drop['total_pieces'] }} @endif @if($columns['Total Shipped']) {{ $drop['total_pieces_shipped'] }} @endif @if($columns['Sealer Sample'])
@php $status = Illuminate\Support\Str::title($drop['sealer_sample']['status']); $statusClass = match($status) { 'Approved' => 'success', 'Rejected' => 'danger', 'Required' => 'warning', 'Pending' => 'warning', 'Not Required' => 'success', default => 'secondary' }; @endphp {{ $status }} @if($drop['sealer_sample']['date_sent']) {{date("d-M", strtotime($drop['sealer_sample']['date_sent']))}} @endif @if($drop['sealer_sample']['note']) {{$drop['sealer_sample']['note']}} @endif @if($drop['sealer_sample']['comments']) {{$drop['sealer_sample']['comments']}} @endif
@endif @if($columns['Shipment Sample'])
@php $status = Illuminate\Support\Str::title($drop['shipment_sample']['status']); $statusClass = match($status) { 'Approved' => 'success', 'Rejected' => 'danger', 'Required' => 'warning', 'Pending' => 'warning', 'Not Required' => 'success', default => 'secondary' }; @endphp {{ $status }} @if($drop['shipment_sample']['date_sent']) {{date("d-M", strtotime($drop['shipment_sample']['date_sent']))}} @endif @if($drop['shipment_sample']['note']) {{$drop['shipment_sample']['note']}} @endif @if($drop['shipment_sample']['comments']) {{$drop['shipment_sample']['comments']}} @endif
@endif @if($columns['ExFty']) @if($showingHistoryFor === $drop['id'] && count($exftyHistory) > 0)
@foreach($exftyHistory as $index => $change) @if($change->new_exfty)
{{ date_format(date_create($change->new_exfty), "d M") }}
@if($index < count($exftyHistory) - 1)
@endif @endif @endforeach
@else @if(!empty($drop['first_exfty']) && $drop['first_exfty'] !== false && $drop['first_exfty'] !== 'false') @php $firstExftyDate = date_create($drop['first_exfty']); @endphp @if($firstExftyDate)
{{ date_format($firstExftyDate, "d") }}
{{ date_format($firstExftyDate, "M") }}
{{ date_format($firstExftyDate, "Y") }} @else - @endif @else - @endif @endif @endif @if($columns['Revised ExFty'])
@if(!empty($drop['exfty'])) @php $isAfterCustomerExfty = false; if (!empty($drop['customer_order_lines']['factory_cust_date'])) { $revisedExfty = strtotime($drop['exfty']); $customerExfty = strtotime($drop['customer_order_lines']['factory_cust_date']); $isAfterCustomerExfty = $revisedExfty > $customerExfty; } @endphp
{{ date_format(date_create($drop['exfty']), "d") }}
{{ date_format(date_create($drop['exfty']), "M") }}
{{ date_format(date_create($drop['exfty']), "Y") }} @else - @endif
@endif @if($columns['Customer exFty'])
@if(!empty($drop['customer_order_lines']['factory_cust_date']))
{{ date_format(date_create($drop['customer_order_lines']['factory_cust_date']), "d") }}
{{ date_format(date_create($drop['customer_order_lines']['factory_cust_date']), "M") }}
{{ date_format(date_create($drop['customer_order_lines']['factory_cust_date']), "Y") }} @else - @endif
@endif @if($columns['Customer Into w/h'])
@if(!empty($drop['customer_order_lines']['wh_cust_date']))
{{ date_format(date_create($drop['customer_order_lines']['wh_cust_date']), "d") }}
{{ date_format(date_create($drop['customer_order_lines']['wh_cust_date']), "M") }}
{{ date_format(date_create($drop['customer_order_lines']['wh_cust_date']), "Y") }} @else - @endif
@endif @if($columns['Total CMT'])
{{$drop['customer_order_lines']['colourways']['style_versions']['factories']['currency']}}{{number_format($drop['total_prices']['subtotal'], 2)}}
@endif @if($columns['Total Sale']) @php // Check if all quote prices are confirmed $allQuotesConfirmed = true; $hasAnyQuote = false; $totalSalePrice = $drop['total_prices']['quote'] ?? 0; foreach($drop['customer_order_lines']['customer_order_line_quantities'] as $size) { $priceModel = $size['price_model_data'] ?? null; if($priceModel && isset($priceModel['quote']) && $priceModel['quote'] > 0) { $hasAnyQuote = true; if(($priceModel['quote_status'] ?? "") !== "confirmed") { $allQuotesConfirmed = false; break; } } } // Determine the color class if($hasAnyQuote && $allQuotesConfirmed && $totalSalePrice >= 2) { $saleColorClass = 'text-success'; } else { $saleColorClass = 'text-warning'; } @endphp
{{$drop['customer_order_lines']['customer_orders']['customers']['currency']}}{{number_format($drop['total_prices']['quote'], 2)}}
@endif @if($columns['Transport Budget'])
£{{number_format($drop['total_prices']['transport_budget'], 2)}}
@endif @if($columns['Incoterms']) {{$drop['customer_order_lines']['customer_orders']['incoterms']}} @endif @if($columns['Truck'])
@if($drop['shipment_id'])
{{$drop['shipment_id']}}
@if(isset($drop['shipments']['transporters']['name']) && $drop['shipments']['transporters']['name']) {{$drop['shipments']['transporters']['name']}} @endif @if(isset($drop['shipments']['truck_first_collection']) && $drop['shipments']['truck_first_collection']) {{ date('d-M', strtotime($drop['shipments']['truck_first_collection'])) }} @endif @if(isset($drop['shipments']['cost']) && $drop['shipments']['cost']) £{{ number_format($drop['shipments']['cost'], 2) }} @endif @else No Shipment @endif
@if($drop['shipment_id']) @endif
@endif @if($columns['Collection'])
@if(!empty($drop['collection_date']))
{{ date_format(date_create($drop['collection_date']), "d-M") }}
{{ date_format(date_create($drop['collection_date']), "Y") }} @endif
@endif @if($columns['Customs ERN']) @if(!empty($drop['shipments']['customs_submitted_text'])) {{$drop['shipments']['customs_submitted_text']}} @else - @endif @endif @if($columns['Shipped'])
@endif @if($columns['RT Invoice'])
@can('finance:update') @else {{$drop['rt_invoice'] ?: '-'}} @endcan
@can('finance:update') @else {{$drop['factory_invoice'] ?: '-'}} @endcan
@can('finance:update') @else {{$drop['customs_agency_invoice'] ?: '-'}} @endcan
@if($drop['shipments']) @can('finance:update') @else {{$drop['shipments']['transporter_invoice'] ?: '-'}} @endcan @else - @endif
@endif @if($columns['RT Invoice'])
@can('finance:update')
@else {{$drop['invoiced'] ? 'Yes' : 'No'}} @endcan
@if(Gate::check('style:update') || Gate::check('order:update') || Gate::check('finance:update')) @else
{{$drop['fn_notes'] ?: 'No finance notes'}}
@endif
@endif @if($this->notesColsCount() != 0) @if(Gate::check('style:update') || Gate::check('order:update')) @else
{{$drop['notes'] ?: 'No notes'}}
@endif @endif @endforeach