{% extends "template.html" %}
{% block title %}Admin{% endblock %}
{% block head %}
    {{ super() }}
    <style type="text/css">
        .important { color: #336699; }
    </style>
{% endblock %}
{% block content %}
    <div class="container">
        <h1 class="row">Admin pages</h1>
        <p class="important row">
            Welcome Admin {{user}}
        </p>

        <div class="row">
            <h3 id="cache-invalidate">Invalidate the cache</h3><br>
            <p><a href="/admin/restaurants/edit">Edit restaurants</a></p>
        </div>
    
    </div>
{% endblock %}

{% block scripts %}
<script>
    $(document).ready(function () {
       
        $('#cache-invalidate').on('click', function() {
            console.log("cache invalidate: ");
            postJson("/admin/cache-invalidate", {})
            .done(function(result) {
                    console.log("Success Result", result);
            }).fail(function(result){
                    console.log("Fail Result", result);
            });
        });
    });
</script>
{% endblock %}