{% extends 'base_public.html.twig' %}
{% block content %}
    <section class="in_sec_1">
        <div class="user user-login pure-form pure-form-aligned" style="height: auto;top:150px!important;">
            <header class="in_head_1">
                <h2 id="pageTitle">Playlist Yükle</h2>
            </header>
            <article class="art_loop">
                {{ form_start(form) }}
                <input type="submit" value="Kaydet" style="float: left"/>
                <div>
                    <button type="button" id="btnReset" class="buttonSubmit" style="margin-left:20px;margin-top:4px">
                        Reset
                    </button>
                </div>

                {{ form_widget(form) }}
                {{ form_end(form) }}
            </article>
        </div>
    </section>
    <script type="text/javascript">
        $(document).ready(function (e) {
            $("label[for='appbundle_product_productGroup']").remove();
            $("#appbundle_product_productGroup").remove();
            $("label[for='appbundle_product_name']").remove();
            $("#appbundle_product_name").remove();

            $("#btnReset").click(function () {
                if (confirm("Resetlemek istediğinize emin misiniz?")) {
                    var macValue = $("#appbundle_product_mac_value").val();
                    if (macValue.length != 17) {
                        alert("Lütfen mac adresini tam yazınız");
                        return;
                    }
                    var playlistType = $("#appbundle_product_playlist_type").val();
                    var ajax = getData("/remove-by-mac-value",
                            "GET", "text",
                            "mac_value=" + macValue + "&playlist_type=" + playlistType);
                    ajax.done(function (result) {
                        if (result === "true") {
                            alert("Başarılı bir şekilde resetlendi");
                        } else {
                            alert(result);
                        }
                    });
                }
            });
        });
    </script>
{% endblock %}
