Place Order

This commit is contained in:
UronShrestha
2024-07-07 13:06:31 +05:45
parent 7b2a70ca1d
commit 49d6315cc4
9 changed files with 189 additions and 27 deletions

View File

@ -27,11 +27,19 @@
<div class="shopping__cart__table">
@if (session()->has('success'))
<div class="alert alert-success">
<div id="success-message" class="alert alert-success">
{{ session()->get('success') }}
</div>
@endif
@if (session()->has('error'))
<div id="error-message" class="alert alert-danger">
{{ session()->get('error') }}
</div>
@endif
<table>
<thead>
<tr>
@ -72,7 +80,14 @@
</tr>
@endforeach
</tbody> --}}
<tbody>
@php
$total = 0;
@endphp
@foreach ($cartItems as $item)
<tr>
<td class="product__cart__item">
@ -91,13 +106,19 @@
<input type="number" class="form-control" name="quantity"
min="1" max="{{ $item->pQuantity }}"
value="{{ $item->quantity }}">
<button type="submit" class="btn btn-primary">Update</button>
<button type="submit"
class="btn btn-primary mt-2 btn-block">Update</button>
</form>
</div>
</td>
<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>
</tr>
@php
$total += $item->price * $item->quantity;
@endphp
@endforeach
</tbody>
@ -129,10 +150,27 @@
<div class="cart__total">
<h6>Cart total</h6>
<ul>
<li>Subtotal <span>$ 169.50</span></li>
<li>Total <span>$ 169.50</span></li>
<li>Subtotal <span>Nrs {{ $total }} </span></li>
<li>Total <span>Nrs {{ $total }}</span></li>
</ul>
<a href="#" class="primary-btn">Proceed to checkout</a>
<form action=" {{ url::to('checkout') }} ">
<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>
</div>
</div>
</div>