@extends('layouts.app') @section('title', 'Shopping Cart') @section('styles') @endsection @section('content')

Shopping Cart

@if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif @if(count($items) > 0)
@foreach($items as $item)
@if($item['product']->images->count() > 0) {{ $item['product']->name }} @else {{ $item['product']->name }} @endif

{{ $item['product']->name }}{{ $item['is_sample'] ? ' - Sample' : '' }}

{{ $item['product']->category->name }}

@php $stockCost = 0; $stockUnit = $item['type'] === 'wallpaper' ? '/m' : '/m²'; if (!$item['is_sample'] && $item['stock']) { $stockCost = $item['type'] === 'wallpaper' ? $item['stock']->cost_per_meter : $item['stock']->cost_per_m2; } @endphp @if($item['is_sample'])

Sample - Fixed Price: R{{ number_format(\App\Services\ShippingService::getSampleCost(), 2) }}

@elseif($item['stock'])

{{ $item['stock']->name }}: R{{ number_format($stockCost, 2) }}{{ $stockUnit }}

@endif @if(!$item['is_sample']) @if($item['type'] === 'wallpaper')

Length: {{ $item['length'] }}m

@elseif($item['type'] === 'mural')

Dimensions: {{ $item['width'] }}m × {{ $item['height'] }}m ({{ number_format($item['width'] * $item['height'], 2) }}m²)

@endif @endif

Subtotal: R{{ number_format($item['subtotal'], 2) }}

@csrf
@endforeach

Order Summary

Subtotal: R{{ number_format($total, 2) }}
{{ $shippingLabel }}: R {{ number_format($shippingFee, 2) }}
Total: R {{ number_format($total + $shippingFee, 2) }}
@csrf
@else

Your cart is empty

Start Shopping
@endif
@endsection