@if(!$drop)
Loading...

Loading split drop form...

@else @if($errorMessage)
{{ $errorMessage }}
@endif @if($successMessage)
{{ $successMessage }}
@endif
@for($i = 1; $i <= $totalSteps; $i++) @endfor
{{ $this->getCurrentStepDescription() }}
@if($createNewOrder && $step >= 2) Creating new order for split drop @endif
@if($step === 1)
Step 1: Order Overview

Review the order quantities and existing drops.

Order Quantities
@foreach($orderQtys as $sizeId => $orderData) @php $shippedQty = $currentDropShippedQtys[$sizeId]['shipped_qty'] ?? 0; $remaining = $orderData['qty'] - $shippedQty; @endphp @endforeach
Size Order Qty Shipped Remaining
{{ $orderData['size_name'] }} {{ $orderData['qty'] }} {{ $shippedQty }} {{ $remaining }}
@if(count($existingDrops) > 1)
Existing Drops
@foreach($existingDrops as $drop) @php $totalShipped = array_sum($drop['shipped_quantities'] ?? []); $remaining = $drop['total_pieces'] - $totalShipped; @endphp @endforeach
Drop ID ExFty Status Total Qty Total Shipped To Ship
{{ $drop['id'] }} {{ $drop['exfty'] }} @if($drop['complete']) Shipped @else Unshipped @endif {{ $drop['total_pieces'] }} {{ $totalShipped }} {{ $remaining }}
@endif
@endif @if($step === 2)
Step 2: Drop Configuration & Quantities

Configure the new drop date and set quantities.

Must be after {{ $drop->exfty ?? 'existing drop date' }} @error("newDropDates.0")
{{ $message }}
@enderror
@if($this->canCreateNewOrder())
@else @php $warningMessage = $this->getNewOrderWarningMessage(); @endphp @if($warningMessage)
New Order Creation Not Available: {{ $warningMessage }}
@endif @endif @if($createNewOrder)
Creating New Order: You are creating a new order for this drop. The quantities you set here will be moved to the new order, and the remaining quantities will stay in the original order.
@else

Set quantities for the new drop. Total quantities should equal order quantities.

@endif @if($this->canShowTakeFromExistingCheckbox())
@endif
@foreach($existingDrops as $dropIndex => $drop) @endforeach @for($i = 0; $i < $newDropCount; $i++) @endfor @foreach($orderQtys as $sizeId => $orderData) @php $existingDropsQty = 0; $existingDropsShipped = 0; foreach($existingDrops as $drop) { $existingDropsQty += $drop['quantities'][$sizeId] ?? 0; $existingDropsShipped += $drop['shipped_quantities'][$sizeId] ?? 0; } $newDropsQty = 0; foreach($newDropQtys as $dropQtys) { $newDropsQty += $dropQtys[$sizeId]['qty'] ?? 0; } $totalAllocated = $existingDropsQty + $newDropsQty; $totalShipped = $existingDropsShipped; $remaining = $orderData['qty'] - $totalShipped; @endphp @foreach($existingDrops as $dropIndex => $drop) @php $dropQty = $drop['quantities'][$sizeId] ?? 0; $shippedQty = $drop['shipped_quantities'][$sizeId] ?? 0; @endphp @endforeach @for($i = 0; $i < $newDropCount; $i++) @endfor @endforeach
Size Order Qty {{ date('d-M-y', strtotime($drop['exfty'])) }} @if($drop['complete'])
(Shipped) @endif
{{ $newDropDates[$i] ? date('d-M-y', strtotime($newDropDates[$i])) : 'Date not set' }}Allocated Totals
{{ $orderData['size_name'] }} {{ $orderData['qty'] }} @if(!$drop['complete'] && $this->canEditExistingDrops()) Shipped: {{ $shippedQty }} @else
Due: {{ $dropQty }} @if($shippedQty > 0)
Shipped: {{ $shippedQty }} @endif
@endif
{{ $totalAllocated }}
To Ship: {{ $remaining }} Ordered: {{ $orderData['qty'] }} Shipped: {{ $totalShipped }} Drop Orders: {{ $totalAllocated }} @if($createNewOrder && $remaining < 0) Exceeds order qty @endif
@if($createNewOrder)
Note: When creating a new order, the remaining quantities will stay in the original order. Make sure the split makes sense for your business needs.
@if(!$this->isSplitReasonable())
Warning: The current split may not be reasonable for business purposes. Consider leaving at least 20% of quantities in the original order.
@endif @endif
@endif @if($step === 3)
@if($createNewOrder)
Step 3: Order Comparison

Compare the original order with the new order to be created.

Drops Overview
@foreach($overview as $sizeId => $data) @php $totalAllocated = $data['total_new_drop_qty'] + $data['existing_drops_qty']; $isBalanced = $totalAllocated == $data['order_qty']; $movingToNewOrder = $data['total_new_drop_qty']; @endphp @endforeach
Size Order Qty Shipped New Drop Qty Totals
{{ $data['size_name'] }} {{ $data['order_qty'] }} {{ $data['total_shipped'] }} {{ $movingToNewOrder }} @if($isBalanced) Balanced @else Unbalanced @endif
@php $hasUnbalanced = false; foreach($overview as $sizeId => $data) { $totalAllocated = $data['total_new_drop_qty'] + $data['existing_drops_qty']; if ($totalAllocated != $data['order_qty']) { $hasUnbalanced = true; break; } } @endphp @if($hasUnbalanced)
Warning: Some sizes have quantities that don't balance with the order. Please review the quantities in Step 2 to ensure totals equal order quantities.
@endif
Important: New Order Creation

You are about to create a new order with the following details:

  • A new customer order will be created with the same details as the original
  • The new order qtys will match the new drop qtys
  • The new drop will be linked to the new order
  • The original order qtys will be the remaining quantities
@php $orderSummary = $this->getNewOrderSummary(); @endphp @if($orderSummary)
Order Comparison
Original Order

PO: {{ $orderSummary['original_order']['po'] }}

Customer: {{ $orderSummary['original_order']['customer'] }}

Quantities:

    @foreach($orderSummary['original_order']['remaining_quantities'] as $sizeId => $data)
  • {{ $data['size_name'] }}: {{ $data['qty'] }} units
  • @endforeach

Drops:

    @foreach($existingDrops as $drop)
  • {{ date('d/m/y', strtotime($drop['exfty'])) }}
  • @endforeach
New Order

PO: {{ $orderSummary['new_order']['po'] }}

Customer: {{ $orderSummary['original_order']['customer'] }}

Quantities:

    @foreach($orderSummary['new_order']['quantities'] as $sizeId => $data)
  • {{ $data['size_name'] }}: {{ $data['qty'] }} units
  • @endforeach

Drops:

    @for($i = 0; $i < $newDropCount; $i++) @if($newDropDates[$i])
  • {{ date('d/m/y', strtotime($newDropDates[$i])) }} (new)
  • @endif @endfor
@endif @php $finalConfirmation = $this->getFinalConfirmationMessage(); @endphp @if($finalConfirmation)

You are about to split {{ $finalConfirmation['total_new_order_qty'] }} units ({{ $finalConfirmation['split_percentage'] }}%) from the original order into a new order.

The original order will retain {{ $finalConfirmation['remaining_in_original'] }} units.

@endif @else
Step 3: Drops Overview

Review the complete drops configuration and quantities.

@foreach($overview as $sizeId => $data) @php $totalAllocated = $data['total_new_drop_qty'] + $data['existing_drops_qty']; $isBalanced = $totalAllocated == $data['order_qty']; @endphp @endforeach
Size Order Qty Shipped New Drop Qty Totals
{{ $data['size_name'] }} {{ $data['order_qty'] }} {{ $data['total_shipped'] }} {{ $data['total_new_drop_qty'] }} @if($isBalanced) Balanced @else Unbalanced @endif
@php $hasUnbalanced = false; foreach($overview as $sizeId => $data) { $totalAllocated = $data['total_new_drop_qty'] + $data['existing_drops_qty']; if ($totalAllocated != $data['order_qty']) { $hasUnbalanced = true; break; } } @endphp @if($hasUnbalanced)
Warning: Some sizes have quantities that don't balance with the order. Please review the quantities in Step 2 to ensure totals equal order quantities.
@endif
New Drop to be Created:
  • {{ $newDropDates[0] ? date('d-M-y', strtotime($newDropDates[0])) : 'Date not set' }}
      @foreach($orderQtys as $sizeId => $orderData) @php $qty = $newDropQtys[0][$sizeId]['qty'] ?? 0; @endphp @if($qty > 0)
    • {{ $orderData['size_name'] }}: {{ $qty }} units
    • @endif @endforeach
@if(!empty($existingDropChanges))
Existing Drops to be Updated:
    @foreach($existingDropChanges as $change)
  • Drop #{{ $change['id'] }} ({{ date('d-M-y', strtotime($change['exfty'])) }}):
      @foreach($change['size_changes'] as $sc)
    • {{ $sc['size_name'] }}: {{ $sc['old'] }} → {{ $sc['new'] }} (@if($sc['delta']>0)+@endif{{ $sc['delta'] }})
    • @endforeach
  • @endforeach
@endif @endif
@if($createNewOrder) @else @endif
@endif @endif