@extends('frontend.layouts.template-base') @section('meta_tags') @include('frontend.layouts.meta-tags', ['title' => 'My Cart', 'page' => 'cart']) @endsection @section('styles') @endsection @section('content')
My Cart
Loading...
{{-- Schedule pill lives in the header (top-right), matching the design. Visibility is tied to the groceries panel in updateCartTabs(). --}}
{{-- Empty cart state --}} {{-- Only shown when the cart has both groceries AND Vital Kitchen items — switches which panel below is visible instead of stacking both. --}}
{{-- Populated by JS --}}
Forget something? Add more items
{{-- Vital Kitchen — separate list, separate delivery timing (now or scheduled today/tomorrow), same address + single combined payment as groceries. #vkDeliverySelect stays as the actual value-holder (still populated by buildVkDeliveryOptions(), still read as-is at checkout in buildCheckoutPayload()) — hidden, and driven by openSchedule('vk') opening the SAME #scheduleOverlay modal groceries use (same design for both tabs), just with a "Deliver Now" pill added and its own selection state kept separate from the groceries one. --}}
Bag it for Free
Reduce waste with eco-friendly packaging
{{-- Apply Coupon --}}
Apply Coupons & Offers
More vouchers for you
Lets Go
Delivery Address
Bill Details
{{-- Row order & labels follow the approved bill mockup: Vital Kitchens first, then groceries, discount, tip, fee — the struck "was" total shows on the To Pay line. --}}
Grocery Items total ₹0
Delivery Fee FREE
To Pay Inclusive of all taxes and charges
₹0
Tip your delivery partner
100% of the tip goes to the driver.
Total pay: ₹0

Note: Once order placed, any cancellation may result in a fee. In case of unexpected delays leading to order cancellation, a complete refund will be provided.

{{-- Clear-cart confirmation — styled modal (same overlay pattern as the schedule modal) instead of the native browser confirm() alert. --}}
🗑
Clear Cart?

This will remove all items from your cart.

Schedule Your Order

Choose a delivery time that works best for you!
{{-- Add Delivery Address Modal --}} {{-- Cart Map Picker Modal --}} @endsection @section('scripts') {{-- ══════════════════════════════════════════════════════════════════════════ CART PAGE — CUSTOMER FLOW NOTES ══════════════════════════════════════════════════════════════════════════ This page renders and manages TWO independent product lines that share one cart page, one delivery address, and one combined payment: 1. Groceries — GET /api/cart → data.groceries (state: cartState) 2. Vital Kitchen — GET /api/cart → data.vital_kitchen (state: vitalKitchenCartState) Both are fetched together via loadCart() on page load, and re-fetched independently whenever either side changes (cartQty/cartRemove for groceries, vkCartQty/vkCartRemove for Vital Kitchen). DISPLAY — Groceries/Vital Kitchen tabs ---------------------------------------------------------------------------- updateCartTabs() decides how the two panels (#cartCard, #vkCartSection) are shown, based on how many item TYPES are present: - Both groceries AND Vital Kitchen have items → show as tabs (#cartSectionTabs), one panel visible at a time via switchCartTab(). - Only one has items → show that panel directly, no tab bar (nothing to switch between). - Neither has items → show the combined #cartEmpty state instead. This function is the single source of truth for panel/tab/empty-state visibility — render*() functions no longer toggle these directly, so there is one place to look when this display logic needs to change. DELIVERY SCHEDULING — two different rules, same modal infra ---------------------------------------------------------------------------- - Groceries are SCHEDULE-ONLY: a real future delivery slot is mandatory before checkout can proceed (see ensureCheckoutReady() → the groceryItemCount() > 0 branch). The "Schedule (Required)" button opens #scheduleOverlay; renderSlots()/renderDateTabs() populate it from GET /api/settings/scheduled-delivery (today/tomorrow/day-after, morning + evening windows). Disabled slot buttons are ones already in the past for the selected date (slotIsPast()). - Vital Kitchen delivery is flexible: "now" OR scheduled for today/ tomorrow, chosen independently via #vkDeliverySelect (buildVkDeliveryOptions()) — no mandatory-schedule guard, defaults to "now" if left untouched. CHECKOUT — one payment for both ---------------------------------------------------------------------------- The bill (renderBill()) always shows groceries grand_total + Vital Kitchen grand_total combined (vkGrandTotal()), because that combined figure is exactly what gets charged: POST /api/orders/from-cart reads both carts server-side and creates a grocery Order and/or a SaladOrder under one Razorpay payment (or one COD confirmation). See App\Http\Controllers\Api\OrderController::storeFromCart() for the authoritative total calculation — the client never computes the amount that gets sent to Razorpay itself (see openRazorpayCheckout()). ══════════════════════════════════════════════════════════════════════════ --}} {{-- Dynamic Cart JS --}} @endsection