Update Cart Items

This commit is contained in:
UronShrestha
2024-07-05 15:43:08 +05:45
parent 4a512fa736
commit 7b2a70ca1d
3 changed files with 72 additions and 31 deletions

View File

@ -43,38 +43,9 @@
</thead>
{{-- <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="">
</div>
</td>
<td class="quantity__item">
<div class="product__cart__item__text">
<h6>
{{ $item->name }}
</h6>
<h5>
<b>Nrs {{ $item->price }}</b>
</h5>
</div>
<div class="quantity">
<input type="number" class="form-control" name="quantity" min="1"
max="{{ $item->pQuantity }}" value="{{ $item->quantity }} ">
</div>
</td>
<td class="cart__price"> <br> Nrs. {{ $item->price * $item->quantity }} </td>
<td class="cart__close"><i class="fa fa-close"></i></td>
</tr>
@endforeach
</tbody> --}}
<tbody>
@foreach ($cartItems as $item)
<tr>
<td class="product__cart__item">
@ -93,13 +64,45 @@
</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>
@endforeach
</tbody> --}}
<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="">
</div>
</td>
<td class="quantity__item">
<div class="product__cart__item__text">
<h6>{{ $item->name }}</h6>
<h5><b>Nrs {{ $item->price }}</b></h5>
</div>
<div class="quantity">
<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 }}">
<button type="submit" class="btn btn-primary">Update</button>
</form>
</div>
</td>
<td class="cart__price"><br> Nrs. {{ $item->price * $item->quantity }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="row">