관리-도구
편집 파일: cartcheckout.blade.php
@extends('layouts.appss') @section('content') <main class="py-5"> <div class="container"> <div class="row g-5"> <!-- LEFT: BILLING DETAILS --> <div class="col-lg-7"> <div class="card p-4 shadow-sm rounded-4"> <h4 class="mb-4 fw-bold">Billing Details</h4> <form action="{{ route('checkout.submit') }}" method="POST" id="checkoutForm"> @csrf <div class="row g-3"> <div class="col-md-6"> <label class="form-label">First Name*</label> <input type="text" name="first_name" class="form-control" required> </div> <div class="col-md-6"> <label class="form-label">Last Name*</label> <input type="text" name="last_name" class="form-control" required> </div> <div class="col-md-12"> <label class="form-label">Country*</label> <input type="text" name="country" class="form-control" required> </div> <div class="col-md-12"> <label class="form-label">Street Address*</label> <input type="text" name="address" class="form-control" required> </div> <div class="col-md-6"> <label class="form-label">City*</label> <input type="text" name="city" class="form-control" required> </div> <div class="col-md-6"> <label class="form-label">State*</label> <input type="text" name="state" class="form-control" required> </div> <div class="col-md-6"> <label class="form-label">ZIP Code*</label> <input type="text" name="zip" class="form-control" required> </div> <div class="col-md-6"> <label class="form-label">Phone*</label> <input type="text" name="phone" class="form-control" required> </div> <div class="col-md-12"> <label class="form-label">Email Address*</label> <input type="email" name="email" class="form-control" required> </div> <div class="col-md-12"> <label class="form-label">Order Notes (optional)</label> <textarea name="order_notes" class="form-control" rows="3"></textarea> </div> </div> </div> </div> <!-- RIGHT: ORDER SUMMARY --> <div class="col-lg-5"> <div class="card p-4 shadow-sm rounded-4"> <h4 class="mb-4 fw-bold">Your Order</h4> <div class="border-bottom mb-3 pb-2 d-flex justify-content-between fw-semibold"> <span>Product</span> <span>Subtotal</span> </div> @php $subtotal = 0; @endphp @foreach($cartItems as $item) @php $product = $item->product; $color = $item->color ? \App\Models\ProductColor::with('images')->find($item->color) : null; $displayImage = $color && $color->images->isNotEmpty() ? asset('storage/' . $color->images->first()->image) : ($product->images->isNotEmpty() ? asset('storage/' . $product->images->first()->image) : asset('images/no-image.jpg')); $colorName = $color ? $color->color_name : null; $total = $product->price * $item->quantity; $subtotal += $total; @endphp <div class="d-flex justify-content-between align-items-center mb-3"> <div class="d-flex align-items-center"> <img src="{{ $displayImage }}" alt="{{ $product->title }}" width="70" class="me-3 rounded border"> <div> <span class="fw-semibold d-block">{{ $product->title }}</span> @if($colorName) <small>Color: {{ ucfirst($colorName) }}</small><br> @endif @if($product->product_mode === 'material') <small>Meters: {{ $item->quantity }}</small> @else <small>Qty: {{ $item->quantity }}</small><br> @if(!empty($item->size)) <small>Size: {{ strtoupper($item->size) }}</small> @endif @endif </div> </div> <span>₹{{ number_format($total, 2) }}</span> </div> @endforeach <hr> <div class="d-flex justify-content-between fw-bold fs-5"> <span>Total</span> <span>₹{{ number_format($subtotal, 2) }}</span> </div> <button type="submit" class="btn btn-dark w-100 mt-4 py-2">Place Order</button> </div> </div> </div> </div> </main> @endsection