<div class="modal " id="devis" style="z-index: 9999999999999 !important;">
    <div class="modal-background" onclick="closePopup('devis')"> </div>
    <div class="modal-card">
        <header class="modal-card-head">
            <p class="modal-card-title">Demander Dévis</p>
            <button class="delete" aria-label="close" onclick="closePopup('devis')"></button>
        </header>
        <section class="modal-card-body">
            <!-- Content ... -->

            <form id="devisform" action="/devis" method="post">
                {% csrf_token %}
                <div class="field">
                    <label class="label" >Nom complet <b style="color: red;">*</b></label>
                    <div class="control">
                        <input required class="input" type="text" placeholder="Papa Abdou Mbodji" name="name">
                    </div>
                </div>

                <div class="field">
                    <label class="label">Téléphone <b style="color: red;">*</b></label>
                    <div class="control has-icons-left has-icons-right">
                        <input class="input " type="text" required placeholder="Avec l'indicatif" name="telephone">
                        <span class="icon is-small is-left">
                            <i class="fas fa-phone"></i>
                        </span>
                        <span class="icon is-small is-right">
                            <i class="fas fa-check"></i>
                        </span>
                    </div>
                </div>

                <div class="field">
                    <label class="label">Budget </label>
                    <div class="control has-icons-left has-icons-right">
                        <input class="input " min="0" type="number" placeholder="Votre budget" name="budget">
                        <span class="icon is-small is-left">
                            <i class="fas fa-euro-sign"></i>
                        </span>
                        <span class="icon is-small is-right">
                            <i class="fas fa-check"></i>
                        </span>
                    </div>
                    
                </div>

                

                <div class="field">
                    <label class="label">Type de projet</label>
                    <div class="control">
                        <div class="select">
                            <select name="type">
                                {% for c in categorieRea  %}
                                    <option value="{{c.nom}}">{{c.nom}}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                </div>

                <div class="field">
                    <label class="label">Description de votre projet <b style="color: red;">*</b></label>
                    <div class="control">
                        <textarea class="textarea" required placeholder="Description détaillée du projet" name="description"></textarea>
                    </div>
                </div>

                <input type="submit" id="devissubmit" value="submit" hidden>
                
            </form>
        </section>
        <footer class="modal-card-foot">
            <button class="button" onclick="closePopup('devis')">Annuler</button>
            <button class="button is-primary" onclick="submitdevis()">Envoyer</button>
        </footer>
    </div>
</div>

<script>
    function openDevisPopup(idPopup) {
        document.getElementById(idPopup).className += " is-active"
    }

    function submitdevis() {
        closePopup("devis")
        document.getElementById('devissubmit').click() ;
    }

    function closePopup(idPopup) {

        var classes = document.getElementById(idPopup).classList.remove("is-active")

    }
</script>