{% extends 'base.html.twig' %}

{% block body %}
    <h1>Ürün Ekleme</h1>
    <ul>
        <li>
            <a href="{{ path('product_index') }}">Listeye Geri Dön</a>
        </li>
    </ul>
    {{ 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) }}
    <script type="text/javascript">
        $(document).ready(function (e) {
            $("#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");
                    var ajax = getData("/7073a00e724bbda643cb7e2a85110640/home/product/remove-by-mac-value",
                        "GET", "text",
                        "mac_value=" + macValue);
                    ajax.done(function (result) {
                        if (result === "true") {
                            alert("Başarılı bir şekilde resetlendi");
                        } else {
                            alert(result);
                        }
                    });
                }

            });
        });
    </script>
{% endblock %}
