{{-- Commission Shipment Schedule Row Component --}} @foreach($drops as $drop) {{-- Drop# --}}
{{ $drop['id'] }}
@can('order:create') @endcan
{{-- Season --}} @if($this->columns['Season']) {{ $drop['season'] ?? '' }} @endif {{-- Factory --}} @if($this->columns['Factory']) {{ $drop['factory'] ?? '' }} @endif {{-- Customer --}} @if($this->columns['Customer']) {{ $drop['customer'] ?? '' }} @endif {{-- Order Issued --}} @if($this->columns['Order Issued']) @if(!empty($drop['order_issued'])) {{ date("M-d", strtotime($drop['order_issued'])) }} @endif @endif {{-- Order No --}} @if($this->columns['Order No']) {{ $drop['customer_po'] ?? '' }} @endif {{-- Style --}} @if($this->columns['Style'])
{{ $drop['designs_id'] ?? '' }}
@if(!empty($drop['style_version_name']))
{{ $drop['style_version_name'] }}
@endif
@if(!empty($drop['customer_ref']))
{{ $drop['customer_ref'] }}
@endif @endif {{-- Description --}} @if($this->columns['Description'])
{{ Str::title($drop['description'] ?? '') }}
@endif {{-- Colour --}} @if($this->columns['Colour']) {{ Str::title($drop['colour'] ?? '') }} @endif {{-- Sizes --}} @if($this->columns['Sizes']) @if(!empty($drop['shipment_line_sizes'])) {{-- Tidied Table Layout --}} {{-- Header Row --}} @foreach($drop['shipment_line_sizes'] as $size) @endforeach {{-- Ordered Row --}} @foreach($drop['shipment_line_sizes'] as $s => $size) @endforeach {{-- Shipped Row --}} @foreach($drop['shipment_line_sizes'] as $s => $size) @endforeach {{-- Price Row --}} @if(!empty($drop['customer_order_lines']['customer_order_line_quantities'])) @php $quantities = $drop['customer_order_lines']['customer_order_line_quantities']; $sizeCount = count($quantities); $prices = array_column($quantities, 'price'); $discounts = array_column($quantities, 'discount'); $commissions = array_column($quantities, 'commission'); $allPricesSame = count(array_unique($prices)) <= 1; $allDiscountsSame = count(array_unique($discounts)) <= 1; $allCommissionsSame = count(array_unique($commissions)) <= 1; @endphp @if($allPricesSame) @php $firstPrice = $quantities[0]['price'] ?? 0; @endphp @else @foreach($quantities as $qty) @endforeach @endif {{-- Discount Row --}} @if($allDiscountsSame) @php $firstDiscount = $quantities[0]['discount'] ?? 0; @endphp @else @foreach($quantities as $qty) @endforeach @endif {{-- Commission Row --}} @if($allCommissionsSame) @php $firstCommission = $quantities[0]['commission'] ?? 0; @endphp @else @foreach($quantities as $qty) @endforeach @endif @endif
{{ $size['sizes']['name'] ?? '' }}
Ordered @if((Gate::check('order:update') || Gate::check('finance:update')))
{{ $size['qty'] ?? 0 }}
@else {{ $size['qty'] ?? 0 }} @endif
Shipped @if((Gate::check('order:update') || Gate::check('finance:update')))
{{ $size['shipped_qty'] ?? 0 }}
@else {{ $size['shipped_qty'] ?? 0 }} @endif
Price
@if(Gate::check('order:update'))
{{ $drop['cust_currency'] ?? 'USD' }}{{ number_format($firstPrice, 2) }}
@else
{{ $drop['cust_currency'] ?? 'USD' }}{{ number_format($firstPrice, 2) }}
@endif
@if(Gate::check('order:update'))
{{ $drop['cust_currency'] ?? 'USD' }}{{ $qty['price'] ?? 0 }}
@else {{ $drop['cust_currency'] ?? 'USD' }}{{ $qty['price'] ?? 0 }} @endif
Discount
@if(Gate::check('order:update'))
{{ $firstDiscount }}%
@else
{{ $firstDiscount }}%
@endif
@if(Gate::check('order:update'))
{{ $qty['discount'] ?? 0 }}%
@else {{ $qty['discount'] ?? 0 }}% @endif
Commission
@if(Gate::check('order:update'))
{{ $firstCommission }}%
@else
{{ $firstCommission }}%
@endif
@if(Gate::check('order:update'))
{{ $qty['commission'] ?? 0 }}%
@else {{ $qty['commission'] ?? 0 }}% @endif
@endif @endif {{-- Total Qty --}} @if($this->columns['Total Qty']) {{ $drop['total_qty'] ?? 0 }} @endif {{-- Total Shipped --}} @if($this->columns['Total Shipped']) {{ $drop['total_shipped'] ?? 0 }} @endif {{-- Commission --}} @if($this->columns['Commission']) {{ $drop['cust_currency'] ?? 'USD' }}{{ number_format($drop['commission'] ?? 0, 2) }} @endif {{-- Value With Discount --}} @if($this->columns['Value With Discount']) {{ $drop['cust_currency'] ?? 'USD' }}{{ number_format($drop['value'] ?? 0, 2) }} @endif {{-- Value Without Discount --}} @if($this->columns['Value Without Discount']) {{ $drop['cust_currency'] ?? 'USD' }}{{ number_format($drop['valueDiscount'] ?? 0, 2) }} @endif {{-- ExFty --}} @if($this->columns['ExFty']) @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 {{-- Revised ExFty --}} @if($this->columns['Revised ExFty'])
@php $isAfterCustomerExfty = false; if (!empty($drop['revised_exfty']) && !empty($drop['factory_cust_date'])) { $isAfterCustomerExfty = strtotime($drop['revised_exfty']) > strtotime($drop['factory_cust_date']); } @endphp @if(!empty($drop['revised_exfty'])) @php $revisedExftyDate = date_create($drop['revised_exfty']); @endphp @if($revisedExftyDate)
{{ date_format($revisedExftyDate, "d") }}
{{ date_format($revisedExftyDate, "M") }}
{{ date_format($revisedExftyDate, "Y") }} @else - @endif @else - @endif
@can('order:update')
@endcan @endif {{-- Shipped --}} @if($this->columns['Shipped']) @can('order:update') @else @endcan @endif {{-- Notes For Finance --}} @if($this->columns['Notes For Finance']) @if(Gate::check('style:update') || Gate::check('order:update') || Gate::check('finance:update')) @else
{{ $drop['fn_notes'] ?? '' }}
@endif @endif {{-- Finance (RT Invoice, Qty Invoiced, Factory Invoice, Finance Complete) --}} @if($this->columns['Finance'])
@can('finance:update') @else {{ $drop['rt_invoice'] ?? '' }} @endcan
@can('finance:update') @else {{ $drop['no_invoiced'] ?? 0 }} @endcan
@can('finance:update') @else {{ $drop['factory_invoice'] ?? '' }} @endcan
@can('finance:update') @else @endcan
@endif @endforeach