@extends($activeTemplate . 'layouts.master')
@section('content')
    @php
        $discount = $plan->price - $plan->discounted_plan_price;

    @endphp
    <div class="">
        <div class="container-sm">
            <div class="row justify-content-center">

                <div class="card plan-purchase-details-card my-3">

                    <div class="card-body">
                        <table class="table table-striped">
                            <thead>
                                <tr>
                                    <th>@lang('Description')</th>
                                    <th>@lang('Amount')</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>@lang('Product Name')</td>
                                    <td>{{ $plan->name }}</td>
                                </tr>
                                <tr>
                                    <td>@lang('Price')</td>
                                    <td>{{ showAmount($plan->price, 2) }} INR</td>
                                </tr>
                                <tr>
                                    <td>@lang('Discount')</td>
                                    <td>{{ showAmount($discount) }} INR</td>
                                </tr>
                                <tr>
                                    <td>@lang('After Discounted Price')</td>
                                    <td>{{ showAmount($plan->discounted_plan_price) }} INR</td>
                                </tr>
                                <tr>
                                    <td colspan="100%" class="p-0">
                                        <form action="{{ route('user.plan.success') }}" method="POST"
                                            style="">
                                            @csrf
                                            <input type="hidden" value="{{ $transaction->trx }}" name="trx"
                                                id="hidden">
                                            <script src="https://checkout.razorpay.com/v1/checkout.js" data-key="{{ $key }}"
                                                data-amount="{{ $transaction->amount * 100 }}" data-currency="INR"
                                                data-order_id="{{ $transaction->metadata['id'] }}" data-buttontext="Continue"
                                                data-name="{{ auth()->user()->username }}" data-description="Payment By Razorpay"
                                                data-image="http://localhost:8000/assets/images/logoIcon/logo.png"
                                                data-prefill.name="{{ auth()->user()->fullname }}" data-prefill.email="{{ auth()->user()->email }}"
                                                data-prefill.contact="+{{ auth()->user()->mobile }}" data-theme.color="#2ecc71"></script>
                                        </form>
                                    </td>
                                </tr>

                            </tbody>
                        </table>
                    </div>
                </div>


            </div>

        </div>
    </div>
@endsection

@section('script')
    <script></script>
@endsection

@push('style')
    <style>
        .plan-purchase-details-card {
            max-width: 576px;
        }
    </style>
@endpush
