@extends ('includes.main-layout')

@section('styles')

@endsection

@section('header')
    @include('includes.header')
@endsection

@section('content')
    <div class="row mt-4">
        <div class="col-md-12">
        @include('includes.errors')
            <div class="card">
                <div class="card-body">
                    <h3 class="card-title">Vous avez commandez :</h3>
                    <table class="table table-dark mx-auto">
                        <thead class="thead-default">
                            <tr>
                            <th></th>
                                <th>Libellé</th>
                                <th>Prix</th>
                                <th>Qté</th>
                                <th>Total</th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach(Cart::content() as $product)
                            <tr>
                                <td><img src="{{URL::to('images/'.$product->model->file)}}" height="50" width="50" alt=""></td>
                                <td scope="row">{{$product->name}}</td>
                                <td>{{$product->price}} dh</td>
                                <td>
                                    {{$product->qty}}
                                </td>
                                <td>{{Cart::subtotal()}} dh</td>
                            </tr> 
                            @endforeach
                        </tbody>
                    </table>
                    <p class="lead">Total: <span class="badge bg-success text-white">{{Cart::total()}} dh</span></p>
                    <form action="{{route('cart.pay')}}" method="POST">
                    {{csrf_field()}}
                        <script
                            src="https://checkout.stripe.com/checkout.js" class="stripe-button"
                            data-key="api key"
                            data-amount= {{Cart::total() * 9.95}}
                            data-name="Ecommerce Site"
                            data-description="Commande"
                            data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
                            data-locale="fr">
                        </script>
                    </form>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('footer')

@endsection

@section('scripts')

@endsection
