@php
    $img = getImage(getFilePath('withdrawMethod') . '/' . @$plan->plan_image, getFileSize('withdrawMethod'), '300x300');
@endphp

<div class="container px-4 px-lg-5 my-5">
    <div class="row gx-4 gx-lg-5 align-items-center">
        <div class="mt-3">
            <h1 class="display-3 fw-bolder text-center">{{ $plan->name }}</h1>
            <div class="fs-5 mb-5">
                <h3 class=" text-danger text-center">{{ $general->cur_sym }}{{ showAmount($plan->price, 2) }}
                </h3>
        </div>
        </div>
        <div class="col-md-6"><img class="card-img-top mb-5 mb-md-0" src="{{ $img }}" alt="product image"></div>
        <div class="col-md-6 ">
            <p class="lead ">{!! $plan->description !!}</p>
            <div class="card-footer mt-3 border-0">
                <div class="d-flex justify-content-center my-1">
                    <div class="form-check">
                        <input class="form-check-input" type="checkbox" value="" id="termsCheck"
                            autocomplete="off" @checked($user->network_status == Status::NetworkPlanPurchased || $user->network_status == Status::NetworkFullActivated)>
                        <label class="form-check-label" for="termsCheck">
                            I agree with the <a href="{{ '#terms' }}">terms and
                                conditions</a>
                        </label>
                    </div>
                </div>
                <div class="d-flex justify-content-center my-2">
                    @if ($user->network_status == Status::NetworkPlanPurchased || $user->network_status == Status::NetworkFullActivated)
                        <button type="button" class="btn btn--success btn-block" disabled>@lang('Plan Purchased Successfully')</button>
                    @else
                        <form action="{{ route('user.plan.initiate') }}" method="POST">
                            @csrf
                            <button type="submit" class="btn btn--success" @disabled(true)
                                id="purchaseBtn">@lang('Buy Now')</button>
                        </form>
                    @endif
                </div>
            </div>
            @if ($user->plan_id == 1)
                <div class="d-flex justify-content-end mt-3">
                    <div>
                        <a href="{{ route('user.plan.purchase.receipt', ['id' => $user->id]) }}" class=""
                            target="_blank"><i class="fa fa-download"></i>
                            @lang('Download Receipt')</a>
                    </div>
                </div>
            @endif
        </div>
    </div>
</div>


@push('script')
    <script>
        $(document).ready(function() {
            $('#termsCheck').change(function() {
                if ($(this).is(':checked')) {
                    $('#purchaseBtn').attr('disabled', false);
                } else {
                    $('#purchaseBtn').attr('disabled', true);
                }
            });

        });
    </script>
@endpush
