laravelEcomm/resources/views/cart.blade.php

184 lines
8.0 KiB
PHP
Raw Permalink Normal View History

2024-07-04 04:34:45 +00:00
<x-header />
<!-- Breadcrumb Section Begin -->
<section class="breadcrumb-option">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="breadcrumb__text">
<h4>Shopping Cart</h4>
<div class="breadcrumb__links">
2024-07-05 06:55:14 +00:00
<a href="{{ url::to('/') }}">Home</a>
<a href="{{ url::to('shop') }}">Shop</a>
2024-07-04 04:34:45 +00:00
<span>Shopping Cart</span>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Breadcrumb Section End -->
<!-- Shopping Cart Section Begin -->
<section class="shopping-cart spad">
<div class="container">
<div class="row">
<div class="col-lg-8">
<div class="shopping__cart__table">
2024-07-05 07:29:27 +00:00
@if (session()->has('success'))
2024-07-07 07:21:31 +00:00
<div id="success-message" class="alert alert-success">
2024-07-05 07:29:27 +00:00
{{ session()->get('success') }}
</div>
@endif
2024-07-07 07:21:31 +00:00
@if (session()->has('error'))
<div id="error-message" class="alert alert-danger">
{{ session()->get('error') }}
</div>
@endif
2024-07-04 04:34:45 +00:00
<table>
<thead>
<tr>
<th>Product</th>
<th>Quantity</th>
<th>Total</th>
<th></th>
</tr>
</thead>
2024-07-05 06:55:14 +00:00
2024-07-05 09:58:08 +00:00
2024-07-05 06:55:14 +00:00
{{-- <tbody>
@foreach ($cartItems as $item)
<tr>
<td class="product__cart__item">
<div class="product__cart__item__pic">
<img src="{{ asset('uploads/products/' . $item->picture) }}" alt="">
2024-07-04 04:34:45 +00:00
</div>
2024-07-05 06:55:14 +00:00
</td>
<td class="quantity__item">
<div class="product__cart__item__text">
2024-07-05 09:58:08 +00:00
<h6>{{ $item->name }} (<b>Nrs {{ $item->price }}</b>)</h6>
<h5></h5>
2024-07-04 04:34:45 +00:00
</div>
2024-07-05 06:55:14 +00:00
<div class="quantity">
<input type="number" class="form-control" name="quantity" min="1"
2024-07-05 09:58:08 +00:00
max="{{ $item->pQuantity }}" value="{{ $item->quantity }}">
2024-07-04 04:34:45 +00:00
</div>
2024-07-05 06:55:14 +00:00
</td>
2024-07-05 09:58:08 +00:00
<td class="cart__price"><br> Nrs. {{ $item->price * $item->quantity }}</td>
<td class="cart__close"> <a href="{{ url::to('deleteCartItem/' . $item->id) }}">
<i class="fa fa-trash"></i></a>
</td>
2024-07-05 06:55:14 +00:00
</tr>
@endforeach
</tbody> --}}
2024-07-07 07:21:31 +00:00
2024-07-05 06:55:14 +00:00
<tbody>
2024-07-07 07:21:31 +00:00
@php
$total = 0;
@endphp
2024-07-05 06:55:14 +00:00
@foreach ($cartItems as $item)
<tr>
<td class="product__cart__item">
<div class="product__cart__item__pic">
<img src="{{ asset('uploads/products/' . $item->picture) }}" alt="">
2024-07-04 04:34:45 +00:00
</div>
2024-07-05 06:55:14 +00:00
</td>
<td class="quantity__item">
<div class="product__cart__item__text">
2024-07-05 09:58:08 +00:00
<h6>{{ $item->name }}</h6>
<h5><b>Nrs {{ $item->price }}</b></h5>
2024-07-05 06:55:14 +00:00
</div>
<div class="quantity">
2024-07-05 09:58:08 +00:00
<form action="{{ route('cart.update', $item->id) }}" method="post">
@csrf
<input type="number" class="form-control" name="quantity"
min="1" max="{{ $item->pQuantity }}"
value="{{ $item->quantity }}">
2024-07-07 07:21:31 +00:00
<button type="submit"
class="btn btn-primary mt-2 btn-block">Update</button>
2024-07-05 09:58:08 +00:00
</form>
2024-07-05 06:55:14 +00:00
</div>
</td>
<td class="cart__price"><br> Nrs. {{ $item->price * $item->quantity }}</td>
2024-07-07 07:21:31 +00:00
<td class="cart__close"> <a href="{{ url::to('deleteCartItem/' . $item->id) }}">
<i class="fa fa-trash"></i></a>
</td>
2024-07-05 06:55:14 +00:00
</tr>
2024-07-07 07:21:31 +00:00
@php
$total += $item->price * $item->quantity;
@endphp
2024-07-05 06:55:14 +00:00
@endforeach
2024-07-04 04:34:45 +00:00
</tbody>
2024-07-05 06:55:14 +00:00
2024-07-05 09:58:08 +00:00
2024-07-04 04:34:45 +00:00
</table>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="continue__btn">
<a href="#">Continue Shopping</a>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="continue__btn update__btn">
<a href="#"><i class="fa fa-spinner"></i> Update cart</a>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="cart__discount">
<h6>Discount codes</h6>
<form action="#">
<input type="text" placeholder="Coupon code">
<button type="submit">Apply</button>
</form>
</div>
<div class="cart__total">
<h6>Cart total</h6>
<ul>
2024-07-07 07:21:31 +00:00
<li>Subtotal <span>Nrs {{ $total }} </span></li>
<li>Total <span>Nrs {{ $total }}</span></li>
2024-07-04 04:34:45 +00:00
</ul>
2024-07-07 07:21:31 +00:00
<form action=" {{ url::to('checkout') }} ">
{{-- <form action=" {{ url::to('stripe') }} "> --}}
2024-07-07 07:21:31 +00:00
<input type="text" name="name" class="form-control mt-2" placeholder="Enter Name"
id="" required>
<input type="text" name="phone" class="form-control mt-2"
placeholder
="Enter Phone" id="" required>
<input type="text" name="address" class="form-control mt-2"
placeholder
="Enter Address" id="" required>
<input type="hidden" name="bill" class="form-control mt-2" value="{{ $total }}"
id="" required>
<input type="submit" name="checkout" class="primary-btn mt-2 btn-block"
value="Proceed to Checkout" id="" required>
</form>
2024-07-04 04:34:45 +00:00
</div>
</div>
</div>
</div>
</section>
<!-- Shopping Cart Section End -->
<!-- Footer Section Begin -->
<x-footer />
<!-- Footer Section End -->