@extends('layouts.page') @section('head') @include('elements.seo', [ 'title'=>'Carrito de compras', 'description'=> 'Carrito de compras' ]) @endsection @section('content') @php // Define delivery settings variables at top level for use throughout the view $forceDeliveryDateEnabled = \App\Models\Setting::getByKey('force_delivery_date_enabled'); $isForceEnabled = ($forceDeliveryDateEnabled === '1' || $forceDeliveryDateEnabled === 1 || $forceDeliveryDateEnabled === true); $express48hEnabled = \App\Models\Setting::getByKey('express_48h_enabled'); $isEnabled = ($express48hEnabled === '1' || $express48hEnabled === 1 || $express48hEnabled === true); @endphp @if($set_user)
{{ Aire::open()->route('seller.setclient')}}
{{ Aire::input('document', 'Documento Cliente: Escribe el NIT sin dígito de verificación')->groupClass('mb-0') }} {{ Aire::input('zone', 'Zona Sucursal: Diligencia este campo si tu cliente cuenta con varias sucursales')->helpText('*En el siguiente paso verás las direcciones asociadas')->groupClass('mb-0') }}
Ingresar
{{ Aire::close() }}
@else
{{-- Toast Notifications (via JS) --}} @if($alertVendors) @endif @if($vendorDiscountAlerts) @endif @if($alertTotal) @endif @if(session('coupon_removed_message')) @endif {{-- Page Title --}}

Tu Carrito

{{-- ============================================= --}} {{-- CARD 1: Products, Coupon & Total --}} {{-- ============================================= --}}
{{-- Products Header --}}

Productos ({{ count($products) }} {{ count($products) == 1 ? 'artículo' : 'artículos' }})

{{-- Products List --}}
@foreach ($products as $key => $product)
{{-- Mobile Layout --}}
{{-- Product Info Row --}}
{{ $product->name }}
slug)}}' class="font-medium text-sm text-gray-900 hover:text-orange-600 transition-colors block"> {{$product->name}} @if($product->variation) {{$product->variation->name}} {{$product->item->name}} @endif ${{currency($product->calculatedFinalPrice['old'])}}
{{-- Delete Button --}}
{{-- Quantity & Price Row --}}
{{-- Quantity Controls --}}
{{-- Price --}}
${{currency(($has_orders ? $product->calculatedFinalPrice['old'] : $product->calculatedFinalPrice['price']) * $product->quantity)}} @if($product->calculatedFinalPrice['has_discount'] && !$has_orders) ${{currency($product->calculatedFinalPrice['old'] * $product->quantity)}} @endif
{{-- Desktop Layout --}}
@endforeach
{{-- Coupon Section --}}

Cupón de descuento

@if($appliedCoupon)
{{$appliedCoupon['coupon_code']}} -${{currency($appliedCoupon['discount_amount'])}} de descuento
@csrf
@else
@csrf
@endif
{{-- Totals Section --}}
@php $subtotal = $products->sum(function($product){ return $product->calculatedFinalPrice['old'] * $product->quantity; }); $totalAfterDiscounts = $products->sum(function($product){ return $product->calculatedFinalPrice['price'] * $product->quantity; }); if(!$has_orders) { $totalDiscount = $subtotal - $totalAfterDiscounts; $couponDiscountAmount = $appliedCoupon ? ($appliedCoupon['discount_amount'] ?? 0) : 0; $discount = $appliedCoupon ? ($totalDiscount - $couponDiscountAmount) : $totalDiscount; } else { $discount = 0; } $finalTotal = $totalAfterDiscounts; @endphp
Subtotal ${{currency($subtotal)}}
Descuento -${{currency($discount)}}
@if($appliedCoupon && $appliedCoupon['discount_amount'] > 0)
Cupón ({{$appliedCoupon['coupon_code']}}) -${{currency($appliedCoupon['discount_amount'])}}
@endif
Total ${{currency($finalTotal)}}
{{-- ============================================= --}} {{-- CARD 2: Order Details & Checkout --}} {{-- ============================================= --}}
{{-- Section Header --}}

Detalles del pedido

{{-- Client Info (if seller with client) --}} @if($client)
Cliente {{$client->name}}
{{ Aire::open()->route('seller.removeclient')->class('inline')}} {{ Aire::close() }}
@endif @if($alertVendors || $alertTotal) {{-- Disabled state - show message --}}

Revisa los mensajes de alerta para poder continuar con tu pedido.

@else {{ Aire::open()->route('cart.process')}}
{{-- Address Selection --}}
{{-- Delivery Method Selection --}} @if($shippingMethods->isNotEmpty())
@foreach($shippingMethods as $method) @endforeach
@else

No hay métodos de envío disponibles en este momento. Por favor contacta al administrador.

@endif {{-- Observations --}}
{{-- Submit Button --}}
{{ Aire::close() }} @endif
@endif @endsection @section('scripts') @endsection