{% extends "customer_main.html" %}
{%load static%}

{% block modules_section %}
<!-- This block is intentionally left empty to exclude the modules section -->
{% endblock modules_section %}

{% block content %}

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<p id="itemId" class="hidden">{{item.id}}</p>


<div class="w-full flex flex-col gap-5 mt-5 font-poppinsLight">
    <div class="w-full h-fit bg-white rounded-md shadow-md">
        <div class="grid grid-cols-1 xxlg1:grid-cols-2">

            <!-- ITEM DETAILS -->
            <div
                class="w-full flex flex-col items-center justify-between rounded-tl-md rounded-lb-none xxlg1:rounded-l-md h-full rounded-tr-md xxlg1:rounded-tr-none gap-8 overflow-hidden relative bg-gradient-to-b from-gray-400 via-gray-500 to-blue-950">
                <div
                    class="absolute top-0 left-32 w-[400px] h-[400px] bg-slate-800 filter blur-xl opacity-70 animate-blob animation-delay-2000">
                </div>
                <div
                    class="absolute top-20 right-0 w-[400px] h-[400px] bg-osiblue filter blur-xl opacity-70 animate-blob animation-delay-2000">
                </div>
                <div
                    class="absolute bottom-0 left-10 w-[400px] h-[400px] bg-blue-900 filter blur-xl opacity-70 animate-blob animation-delay-2000">
                </div>
                <div
                    class="absolute bottom-0 right-36 w-[400px] h-[400px] bg-gray-400 filter blur-xl opacity-70 animate-blob animation-delay-2000">
                </div>


                <div></div>


                <div class="z-10 flex flex-col justify-center items-center gap-8 p-5 w-full s:w-fit">
                    <div class="hidden s:flex z-10">
                        <img src="{% static 'images/ositcom_logos/full-logo-white.png' %}" class="w-[150px]">
                    </div>

                    <div
                        class="w-full s:w-fit flex flex-col justify-center items-center gap-5 text-center rounded-md py-10 px-10 s:px-20 shadow-md bg-white z-10">
                        <p class="text-secondosiblue font-poppinsExtraBold uppercase text-xl s:text-2xl">{{item.title}}</p>
                        <p class="text-secondosiblue text-xl s:text-2xl">$<span id="cyclePrice"></span></p>

                        <select
                            class="w-full s:w-[300px] bg-white border border-gray-200 rounded-md px-3 py-3 text-secondosiblue outline-none cursor-pointer"
                            id="cycle">
                            {% for cycle in cycles %}
                            <option value="{{cycle.id}}" data-cycle-price="{{cycle.cycle_price}}">{{cycle.months}} 
                            {% if cycle.months == 1 %}month {% else %}months{% endif %}</option>
                            {% endfor %}
                        </select>

                    </div>
                </div>


                <div
                    class="w-full bg-white border-bl-none xxlg1:border-bl-md px-5 py-3 z-10 flex flex-col justify-center items-center border border-gray-100">
                    <p class="text-secondosiblue font-poppinsLight text-sm">Payment Powered By</p>
                    <img src="{% static 'images/netcommerce-logo.png' %}" class="w-[120px]">
                </div>
            </div>


            <!-- EMBEDDED PAYMENT FORM -->
            <div class="p-5 relative min-h-[200px] xxlg1:h-full">
                <div class="w-full h-full absolute flex justify-center items-center bg-black bg-opacity-30 z-10 inset-0 rounded-rt-none rounded-b-md xxlg1:rounded-r-md rounded-bl-md xxlg1:rounded-bl-none hidden"
                    id="paymentLoader">
                    <div role="status">
                        <svg aria-hidden="true"
                            class="w-14 h-14 text-white animate-spin dark:text-gray-600 fill-secondosiblue"
                            viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <path
                                d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
                                fill="currentColor" />
                            <path
                                d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
                                fill="currentFill" />
                        </svg>
                    </div>
                </div>

                <div id="paymentContent">
                </div>
            </div>
        </div>
    </div>
</div>


<!---------------------- JS SCRIPTS -------------------->

<script src="https://code.jquery.com/jquery-3.6.0.slim.min.js"
    integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI=" crossorigin="anonymous"></script>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/js/bootstrap.min.js" crossorigin="anonymous"></script>

<script src="https://creditlibanais-netcommerce.gateway.mastercard.com/static/checkout/checkout.min.js"></script>


<!-- TO CALL THE INITIATE CHECKOUT PAGE -->
<script type="text/javascript" src='{% static "js/customer_dashboard/payment/buy-now.js" %}'></script>

<!-- TO CHANGE THE PRICE BASED ON THE CHOSEN CYCLE FROM THE SELECT TAG -->
<script type="text/javascript" src='{% static "js/customer_dashboard/payment/payment-pricing.js" %}'></script>


{% endblock %}