{% extends "mnfapp/base.html" %}
{% load static %}
{% block content %}
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> gift subscription</title>
    <script src="https://js.stripe.com/v3/"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>


    <style>
    body{
        font-family:  Helvetica, sans-serif;
    }
        .sample-container{
            width:60vw;
            margin: auto;
            margin-top: 10vh;
            border-radius: 10px;
            padding: 1em;
            display: grid;
            grid-template-columns: auto auto;
            box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
        }
        .sample-container input{
            margin: auto;
            width: 25vw;
            margin-top: 5px;
            margin-bottom: 5px;
        }
        .sample-container button{
            width: 20vw;
            margin:auto;
            text-align: center;
            margin-left: 20vw;
            margin-top: 1em;
        }
        #h1{
            text-align: center;
            /* color: linear-gradient(#ee364d , rgb(0, 89, 255)); */
            background: -webkit-linear-gradient(#ee364d, rgb(56, 109, 206));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
    </style>

    <div>
        <h6 style="text-align: right;">
            <button onclick="window.history.back()" style="width:2vw; height:2vw;padding: 3px; border-radius: 4px; color: white; background-color: red;">x</button></h6>

        <div>
            <h1 style="text-align: center; margin-top: 1em;">GIFT SUBSCRIPTIONS</h1>
            <h3 id="h1">
                Gift a subscription of 1 month (for 80% of the fee)
            </h3>
            <div style="width: 100vw; text-align: center;">
            <span>
                {%if message%}
                <span style="color: green;">{{message}}</span>
                {%endif%}
            </span>
		<h3 id ='text' style="text-align:center;color:red"></h3>
            </div>
            <div class="sample-container">
                <form action="" method="POST" class="form-group">
                    {% csrf_token %}
                    <div style="display: grid; grid-template-columns: auto auto;">
                        <input type="text" placeholder="Name" class="form-control border border-dark" name="name1"  required>
                        <input type="email" placeholder="Email" class="form-control border border-dark" name="email1" id="email1" required>
                    </div>
                    <span id="text" style="color: red;"></span>
                    <button type="submit" class="btn btn-primary" id="refer">Gift Now</button>
                </form><br>
            </div>
        </div>
        
        {% if response %}
        <div id="amt-cont" method="POST" style="display: grid; grid-template-columns: auto auto auto;  padding: 1em;">
            <h6 style="text-align: right;"><button onclick="$('#amt-cont').hide()" style="width:2vw; height:2vw; border-radius: 4px; color: white; background-color: red;">x</button></h6>
            <div style="text-align: center;"></div>
            <form action="/pay/giftsent/{{giftId}}" method="post">
            {%csrf_token%} 
           <span style="font-size: 1.3em; font-weight: bold; margin-right: 15%;margin-top: 6px;">Amount to be paid</span>
            <span style="font-size: 1.3em; font-weight: bold; margin-right: 15%;margin-top: 6px;" id="amount"><del>₹100</del> ₹80</span>
            <input type="text" style="display: none;" name="plan" id="plan" required>
            <!-- <button class="btn btn-success" id = "rzp-button1">Buy Now</button> -->
            <script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
               data-key="pk_live_51JT8ahSF9vzGWngg4N8fwhTPk5jq8fqBFdokqSMe7AVaOvH6BdyTwAfAoY79qkeJTFA0OdT5qkAk2FCNWCu6W9l000STNnHa7H"
               data-description='Gift One Month Membership'
               data-image = "{% static 'logo.jpg' %}"
               data-label = 'Pay Now'
               data-amount="8000"
               data-locale="auto"
               data-currency='INR'
               data-email = '{{user.email}}'
                   >
                   </script>
        </form>
        </div>

        </div>
        {% endif %}


        
    </div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

 <script>
        $('#refer').click(function(){
            if($('#email1').val() == '{{user.email}}'){
                document.getElementById('text').innerHTML = 'You cant put your registered email id. LOL'
                return false
            }
        })


</script>


{%endblock%}