Current File : /home/tradevaly/www/resources/views/user/pages/product/cart.blade.php |
@extends('frontend.layouts.app')
@push('title','Cart')
@section('content')
@section('content')
<div class="container-fluid">
<div class="row">
<div class="col-md-10 mx-auto">
<div class="card">
<div class="card-header card-header-info card-header-icon ">
<h4 class="card-title">Cart Table</h4>
</div>
<div class="card-body">
<div class="table-responsive">
<a class="btn btn-success text-end mb-3" href="{{url('products')}}">Buy More</a>
@if($carts->count() >0)
<table class="table">
<thead>
<tr>
<th class="text-center">#</th>
<th>Image</th>
<th>Title</th>
<th>Quantity</th>
<th>Price</th>
<th>Sub Total</th>
<th>Discount</th>
<th>Total</th>
<th class="text-right">Actions</th>
</tr>
</thead>
<tbody>
@php
$i = 0;
$total = 0;
@endphp
@foreach($carts as $cart)
<tr>
<form action="{{route('user.cart.update',$cart->id)}}" method="post">
<?php $i++; ?>
<td class="text-center">{{$i}}</td>
<td><img style="width:50px; border-radius:10%;" src="{{asset('storage/images/admin/product/'.$cart->product->image)}}" alt=""></td>
<td>
<a target="_blank" href="{{route('product.view',$cart->product->slug)}}">{{$cart->product->title}}</a>
</td>
<td>
<input type="number" class="form-control" name="quantity" value="{{$cart->quantity}}"/>
<input type="hidden" class="form-control" name="product_id" value="{{$cart->product_id}}"/>
</td>
<td>{{$cart->product->price}}</td>
@php
$subtotal=$cart->product->price*$cart->quantity;
$discount=($cart->product->discount_price/100)*$subtotal;
$totalPrice=$subtotal-$discount;
@endphp
<td>{{$subtotal}}</td>
<td>-{{$discount}}</td>
<td>{{$totalPrice}}</td>
@php
$total=$total+ $totalPrice
@endphp
<td>
<button class="btn btn-success">Update</button>
<a href="{{route('user.cart.delete',$cart->id)}}" class="btn btn-warning" title="Feature Product" style="color: #fff"><i class="fas fa-trash"></i>
</a>
</td>
</form>
</tr>
@endforeach
<tr>
<td colspan="6"></td>
<td>Total :</td>
<td>{{$total}}</td>
</tr>
<tr>
<td colspan="7"></td>
<td><a href="{{route('user.check.index')}}" class="btn btn-success">Check Out</a></td>
</tr>
</tbody>
</table>
@else
<h3 class="text-danger">No Product in cart</h3>
@endif
</div>
</div>
</div>
</div>
</div>
@stop
@push('script')
@endpush