@php use Illuminate\Support\Str; @endphp @extends('layouts/contentLayoutMaster') @section('title', 'Edit Order') @section('main-page', 'Orders') @section('sub-page', 'Edit Orders') @section('main-page-url', route("orders.index")) @section('sub-page-url', route("orders.edit", $model->id)) @section('vendor-style') @endsection @section('content')
Order Number: {{$model->order_number}}
@csrf @method("PUT")
@php $address = $model->orderAddress; @endphp @if($address)
Customer Details
@if($address)
{{ $address?->type === 'pickup' ? 'Pickup Details' : 'Shipping Details' }}
{{ $address?->type === 'pickup' ? 'Location:' : 'Address:' }}
@if($address?->type === 'pickup') {{ $address->location_name }}
{{ $address?->state }}, {{ $address?->country }} @else {{ $address?->address_line }}, {{ $address?->address_label }}
{{ $address?->state }}, {{ $address->country }} @endif
@endif Delivery Instructions:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Estimated delivery time

Tomorrow, 2:00 PM - 4:00 PM
@endif

Order Placed on:

{{ $model->created_at->format('F d, Y') }}

@if($address)
@php $assignedIds = $model->inventories?->pluck('id')->all() ?? []; $parent = $model->inventories->first()?->parent ?? $model->inventories->first(); $available = $parent?->children() ->select('id','name','is_available') ->whereNotNull('parent_id') ->where('is_available', 1) ->get() ?? collect(); $selected = !empty($assignedIds) ? App\Models\Inventory::query()->whereIn('id', $assignedIds)->get(['id','name','is_available']) : collect(); $options = $selected->concat($available)->unique('id')->sortBy('name'); @endphp
@endif
Items
@foreach ($model->orderItems as $orderItem) @php $product = $orderItem->itemable; $isDesign = $orderItem->itemable && get_class($orderItem->itemable) === \App\Models\Design::class; $isTemplate = $orderItem->itemable && get_class($orderItem->itemable) === \App\Models\Template::class; $isDownload = $orderItem->type === \App\Enums\Item\TypeEnum::DOWNLOAD; $orderItemPreview = $orderItem->getFirstMediaUrl('order_item_mockups') ?: $orderItem->getFirstMediaUrl('order_item_previews'); $previewImage = match (true) { filled($orderItemPreview) && !$isDesign => $orderItemPreview, $isDesign && $orderItem->itemable->mockup_id => $orderItem->itemable->getFirstMediaUrl('front-mockup-designs') ?: $orderItem->itemable->getFirstMediaUrl('none-mockup-designs') ?: $orderItem->itemable->getFirstMediaUrl('back-mockup-designs'), $isTemplate => $orderItem->itemable?->getFirstMediaUrl('templates-preview') ?: $orderItem->itemable?->getFirstMediaUrl('templates'), default => $orderItem->itemable?->getFirstMediaUrl( Str::plural(Str::lower(class_basename($orderItem->itemable))) ), }; @endphp
Product
{{ $product->name ?? 'No Product Found' }} {{ $isDownload ? 'Download' : 'Print' }}
Qty: {{ $orderItem->quantity }}
@if($orderItem->color)
Color: {{ $orderItem->color }}
@endif
@if($orderItem->discount_amount > 0)
{{ number_format(($orderItem->sub_total) ?? 0, 2) }}
{{ number_format($orderItem->sub_total -$orderItem->discount_amount ?? 0, 2) }}
-{{ number_format($orderItem->discount_amount, 2) }}
@else
{{ number_format($orderItem->sub_total ?? 0, 2) }}
@endif
{{-- Types / Download Design Area --}} @if($orderItem->itemable?->types)

Designs:

@foreach($orderItem->itemable->types as $type) @php $itemable = $orderItem->itemable; $label = $type->value->label(); $useTemplate = $isDesign && $itemable->template?->approach === 'without_editor'; $downloadUrl = ($useTemplate ? $itemable->template : $itemable)->getImageUrlForType($label); $coloredPreview = null; if ($orderItem->color) { $coloredPreview = $orderItem->getMedia('order_item_previews') ->first(fn($m) => $m->getCustomProperty('type') == $label) ?->getUrl(); } @endphp

{{ $label }} Design

{{ $label }} item photo {{-- Original transparent download --}} Download Design @if($coloredPreview) Download with Color @endif
@endforeach
@endif {{-- Design Mockup Area --}} {{-- @if(--}} {{-- $isDesign &&--}} {{-- !empty($orderItem->itemable->design_mockup_area) &&--}} {{-- is_array($orderItem->itemable->design_mockup_area)--}} {{-- )--}} {{--
--}} {{--
Design Mockup Areas
--}} {{-- @foreach($orderItem->itemable->design_mockup_area as $index => $area)--}} {{--
--}} {{--

--}} {{-- Area {{ $index + 1 }} ({{ $area['name'] ?? 'unknown' }}):--}} {{--

--}} {{--
    --}} {{--
  • Top-Left X: {{ $area['p1x'] ?? '-' }}
  • --}} {{--
  • Top-Left Y: {{ $area['p1y'] ?? '-' }}
  • --}} {{--
  • Top-Right X: {{ $area['p2x'] ?? '-' }}
  • --}} {{--
  • Top-Right Y: {{ $area['p2y'] ?? '-' }}
  • --}} {{--
  • Bottom-Left X: {{ $area['p3x'] ?? '-' }}
  • --}} {{--
  • Bottom-Left Y: {{ $area['p3y'] ?? '-' }}
  • --}} {{--
  • Bottom-Right X: {{ $area['p4x'] ?? '-' }}
  • --}} {{--
  • Bottom-Right Y: {{ $area['p4y'] ?? '-' }}
  • --}} {{--
--}} {{--
--}} {{-- @endforeach--}} {{--
--}} {{-- @endif--}}
@endforeach
Pricing Details
Subtotal {{ $model->subtotal }}
Discount - {{$model->discount_amount}}
Delivery {{$model->delivery_amount}}
Tax {{$model->tax_amount}}

Total {{$model->total_price}}
{{ $model->status->label() }}
@if($address) @include("modals.orders.edit-shipping-details",['model' => $model]) @endif @endsection @section('vendor-script') @endsection @section('page-script') @endsection