pai-sklep/resources/views/cart.blade.php

44 lines
1.6 KiB
PHP
Raw Normal View History

2021-12-08 16:39:56 +01:00
@push('head')
<link rel="stylesheet" href="{{ mix("css/user.css") }}">
@endpush
@extends('layouts.app')
@section('title', "Sklep")
@section('main')
<div>
<h2>Your cart:</h2>
<div>
<div class="cart-items">
@foreach($user->cart as $product)
2021-12-14 18:03:22 +01:00
{{-- dd($product->pivot->quantity) --}}
2021-12-08 16:39:56 +01:00
<div class="cart-item">
<x-product :product="$product" />
2021-12-14 18:03:22 +01:00
<form method="POST" action="{{route("addToCart",$product)}}">
<input type="number" value="{{ $product->pivot->quantity }}" name="quantity">
<button type="submit"> Zatwierdź </button>
@csrf
</form>
<form class="remove-cart-form" action="{{ route("removeFromCart", $product) }}" method="post">
2021-12-08 16:39:56 +01:00
@csrf
<button type="submit"> Remove from cart </button>
</form>
</div>
@endforeach()
</div>
<form action="{{ route("order.create") }}" method="post">
@csrf
@foreach($user->cart as $product)
<input type="hidden" name="products[{{ $loop->index }}]" value="{{ $product->uuid }}">
2021-12-14 18:03:22 +01:00
<input type="hidden" name="product_quantities[{{ $loop->index }}]" value="{{ $product->pivot->quantity }}">
2021-12-08 16:39:56 +01:00
@endforeach()
<button type="submit"> Order </button>
</form>
</div>
</div>
@endsection()