{% extends "@ChillMain/layout.html.twig" %}

{% block title 'Update calendar'|trans %}

{% block content %}
<div class="calendar-edit">

    <div id="calendar"></div> {# <=== vue component #}
    {% include '@ChillCalendar/Calendar/edit.html.twig' with {'context': 'user'} %}

</div>
{% endblock %}

{% block js %}
    {{ parent() }}
    <script type="text/javascript">
        window.addEventListener('DOMContentLoaded', function (e) {
            chill.displayAlertWhenLeavingModifiedForm('form[name="{{ form.vars.form.vars.name }}"]',
            '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
        });
        window.entity = {{ entity_json|json_encode|raw }};
        window.startDate = {{ entity.startDate|date('Y-m-d H:i:s')|json_encode|raw }};
        window.endDate = {{ entity.endDate|date('Y-m-d H:i:s')|json_encode|raw }};
        window.mainUser = {{ entity.mainUser.id }};
    </script>
    {{ encore_entry_script_tags('vue_calendar') }}
{% endblock %}

{% block css %}
    {{ parent() }}
    {{ encore_entry_link_tags('vue_calendar') }}
{% endblock %}
