@extends('layouts.app') @section('title', 'Ship - Central') @section('content')
@if(session('success')) @endif @if(session('error')) @endif @if($errors->any()) @endif
@csrf

Billing Address

{{ $order->billing_street_address }}

{{ $order->billing_city }}

{{ $order->billing_state }}, {{ $order->billing_zip }}

{{ $order->billing_country }}

Shipping Address

{{ $order->shipping_street_address }}

{{ $order->shipping_city }}

{{ $order->shipping_state }}, {{ $order->shipping_zip }}

{{ $order->shipping_country }}

Shipping Method

@if(!empty($showGoPartsShip))
@endif

Order Items

@foreach($order->items as $item) @endforeach
Product Status Part # Best Carrier Supplier ETA Stock
Extra
partslink
@php // Status IDs: 1=Needs Order, 3=Ordered, 5=Dropshipped $allowShipStatuses = [1, 3, 5]; $canShip = in_array($item->current_status, $allowShipStatuses); @endphp
{{ $item->name ?: ($item->product ? $item->product->name : 'N/A') }}
@php $sku = 'N/A'; if ($item->product) { $sku = $item->product->sku; } elseif ($item->part_num) { // Try to find product by part_num $product = \App\Models\Product::where('partslink', $item->part_num) ->orWhere('sku', $item->part_num) ->first(); if ($product) { $sku = $product->sku; } } @endphp SKU: {{ $sku }}
@php // Get status name from relationship or use fallback $statusName = $item->status ? $item->status->status : 'Unknown'; // Add supplier code for shipping statuses $displayStatus = $statusName; if ($item->supplier && $item->supplier->code) { $shippingStatuses = ['Shipped', 'Delivered', 'In Transit', 'Out for Delivery']; foreach ($shippingStatuses as $shippingStatus) { if (stripos($statusName, $shippingStatus) !== false) { $displayStatus = $statusName . ' ' . $item->supplier->code; break; } } } @endphp {{ $displayStatus }} @php $partslink = 'N/A'; if ($item->product) { $partslink = $item->product->partslink; } elseif ($item->part_num) { // Try to find product by part_num or use part_num itself $product = \App\Models\Product::where('partslink', $item->part_num) ->orWhere('sku', $item->part_num) ->first(); if ($product) { $partslink = $product->partslink ?: $item->part_num; } else { $partslink = $item->part_num; } } @endphp {{ $partslink }} @if($item->current_status == 1) {{-- Needs Order status --}} N/A @endif @if($item->supplier) @else @php // Find best supplier - cheapest in-stock supplier $bestSupplierId = null; if ($item->product && $item->product->partslink) { $bestSupplier = \DB::table('parts_suppliers') ->join('suppliers', 'parts_suppliers.supplier_id', '=', 'suppliers.supplier_id') ->where('parts_suppliers.partslink', $item->product->partslink) ->where('parts_suppliers.qty', '>', 0) ->where('suppliers.is_active', true) ->orderBy('parts_suppliers.price') ->first(); if ($bestSupplier) { $bestSupplierId = $bestSupplier->supplier_id; } } @endphp @endif

Shipment Details

@php $addressLines = explode("\n", $order->shipping_street_address ?? ''); $line1 = $addressLines[0] ?? ''; $line2 = $addressLines[1] ?? ''; @endphp
@php $currentCountry = strtoupper(strtolower($order->shipping_country) === 'usa' ? 'US' : $order->shipping_country); $isUS = in_array($currentCountry, ['US', 'USA', 'UNITED STATES']); @endphp @php // Convert full state names to abbreviations if needed $stateValue = $order->shipping_state; $stateAbbreviations = [ 'Alabama' => 'AL', 'Alaska' => 'AK', 'Arizona' => 'AZ', 'Arkansas' => 'AR', 'California' => 'CA', 'Colorado' => 'CO', 'Connecticut' => 'CT', 'Delaware' => 'DE', 'District of Columbia' => 'DC', 'Florida' => 'FL', 'Georgia' => 'GA', 'Hawaii' => 'HI', 'Idaho' => 'ID', 'Illinois' => 'IL', 'Indiana' => 'IN', 'Iowa' => 'IA', 'Kansas' => 'KS', 'Kentucky' => 'KY', 'Louisiana' => 'LA', 'Maine' => 'ME', 'Maryland' => 'MD', 'Massachusetts' => 'MA', 'Michigan' => 'MI', 'Minnesota' => 'MN', 'Mississippi' => 'MS', 'Missouri' => 'MO', 'Montana' => 'MT', 'Nebraska' => 'NE', 'Nevada' => 'NV', 'New Hampshire' => 'NH', 'New Jersey' => 'NJ', 'New Mexico' => 'NM', 'New York' => 'NY', 'North Carolina' => 'NC', 'North Dakota' => 'ND', 'Ohio' => 'OH', 'Oklahoma' => 'OK', 'Oregon' => 'OR', 'Pennsylvania' => 'PA', 'Rhode Island' => 'RI', 'South Carolina' => 'SC', 'South Dakota' => 'SD', 'Tennessee' => 'TN', 'Texas' => 'TX', 'Utah' => 'UT', 'Vermont' => 'VT', 'Virginia' => 'VA', 'Washington' => 'WA', 'West Virginia' => 'WV', 'Wisconsin' => 'WI', 'Wyoming' => 'WY' ]; // If it's a full state name and we're in US, convert to abbreviation if ($isUS && isset($stateAbbreviations[$stateValue])) { $stateValue = $stateAbbreviations[$stateValue]; } @endphp
@php $countries = [ 'US' => 'United States', 'CA' => 'Canada', 'MX' => 'Mexico', 'GB' => 'United Kingdom', 'FR' => 'France', 'DE' => 'Germany', 'IT' => 'Italy', 'ES' => 'Spain', 'AU' => 'Australia', 'JP' => 'Japan', 'CN' => 'China', 'IN' => 'India', 'BR' => 'Brazil', 'RU' => 'Russia', 'KR' => 'South Korea', 'NL' => 'Netherlands', 'BE' => 'Belgium', 'CH' => 'Switzerland', 'SE' => 'Sweden', 'NO' => 'Norway', 'DK' => 'Denmark', 'FI' => 'Finland', 'PL' => 'Poland', 'PT' => 'Portugal', 'GR' => 'Greece', 'TR' => 'Turkey', 'IL' => 'Israel', 'AE' => 'United Arab Emirates', 'SA' => 'Saudi Arabia', 'ZA' => 'South Africa', 'SG' => 'Singapore', 'HK' => 'Hong Kong', 'TW' => 'Taiwan', 'TH' => 'Thailand', 'MY' => 'Malaysia', 'ID' => 'Indonesia', 'PH' => 'Philippines', 'VN' => 'Vietnam', 'NZ' => 'New Zealand', 'AR' => 'Argentina', 'CL' => 'Chile', 'CO' => 'Colombia', 'PE' => 'Peru', 'VE' => 'Venezuela', 'EG' => 'Egypt', 'NG' => 'Nigeria', 'KE' => 'Kenya', 'PK' => 'Pakistan', 'BD' => 'Bangladesh', 'UA' => 'Ukraine', 'CZ' => 'Czech Republic', 'HU' => 'Hungary', 'RO' => 'Romania', 'AT' => 'Austria', 'IE' => 'Ireland', ]; @endphp @foreach($countries as $code => $name) @endforeach
$
× × inches lbs

Dropship Order Items

@php // Show all items in dropship section, just like the classic system $dropshipItems = $order->items; @endphp @if($dropshipItems->count() > 0) @foreach($dropshipItems as $item) @endforeach @else @endif
Product Status Part # Supplier ETA
{{ $item->name ?: ($item->product ? $item->product->name : 'N/A') }}
@php $dropshipSku = 'N/A'; if ($item->product) { $dropshipSku = $item->product->sku; } elseif ($item->part_num) { // Try to find product by part_num $dropshipProduct = \App\Models\Product::where('partslink', $item->part_num) ->orWhere('sku', $item->part_num) ->first(); if ($dropshipProduct) { $dropshipSku = $dropshipProduct->sku; } } @endphp SKU: {{ $dropshipSku }}
Dropship @php $dropshipPartslink = 'N/A'; if ($item->product) { $dropshipPartslink = $item->product->partslink; } elseif ($item->part_num) { // Try to find product by part_num or use part_num itself $dropshipProduct2 = \App\Models\Product::where('partslink', $item->part_num) ->orWhere('sku', $item->part_num) ->first(); if ($dropshipProduct2) { $dropshipPartslink = $dropshipProduct2->partslink ?: $item->part_num; } else { $dropshipPartslink = $item->part_num; } } @endphp {{ $dropshipPartslink }} @if($item->supplier) @else @endif
No dropship items in this order
(if available)
@endsection