{% extends "./layout/default" %}

{% block breadcrumbs %}
    {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
{% endblock %}

{% block content %}
    <form method="POST" action="{{ route('tags.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store">
        <input name="_token" type="hidden" value="{{ csrf_token() }}">
        <div class="row">
            <div class="col-lg-5 col-md-5 col-sm-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">{{ 'mandatoryFields'|_ }}</h3>
                    </div>
                    <div class="box-body">
                        {{ ExpandedForm.text('tag') }}
                        {{ ExpandedForm.multiRadio('tagMode',tagOptions) }}
                    </div>
                </div>
            </div>

            <div class="col-lg-7 col-md-7 col-sm-12">

                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">{{ 'optionalFields'|_ }}</h3>
                    </div>
                    <div class="box-body">
                        {{ ExpandedForm.date('date') }}
                        {{ ExpandedForm.textarea('description') }}
                        {{ ExpandedForm.location('tagPosition') }}
                    </div>
                </div>

                <!-- panel for options -->
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">{{ 'options'|_ }}</h3>
                    </div>
                    <div class="box-body">
                        {{ ExpandedForm.optionsList('create','tag') }}
                    </div>
                    <div class="box-footer">
                        <button type="submit" class="btn btn-success pull-right">
                            {{ 'store_new_tag'|_ }}
                        </button>
                    </div>
                </div>

            </div>
        </div>
    </form>
{% endblock %}
{% block scripts %}
    <script type="text/javascript">
        var latitude;
        {% if Input.old('latitude') %}
        latitude = "{{ Input.old('latitude') }}";
        {% else %}
        latitude = "52.3167";
        {% endif %}

        var doPlaceMarker;
        {% if Input.old('latitude') and Input.old('longitude') and Input.old('zoomLevel') %}
        doPlaceMarker = true;
        {% else %}
        doPlaceMarker = false;
        {% endif %}

        {% if Input.old('longitude') %}
        var longitude = "{{ Input.old('longitude') }}";
        {% else %}
        var longitude = "5.5500";
        {% endif %}

        {% if Input.old('zoomLevel') %}
        var zoomLevel = {{ Input.old('zoomLevel') }};
        {% else %}
        var zoomLevel = 6;
        {% endif %}

        var apiKey = "{{ apiKey }}";

    </script>
    <script src="https://maps.googleapis.com/maps/api/js?v=3&amp;key={{ apiKey }}"></script>
    <script type="text/javascript" src="js/lib/modernizr-custom.js"></script>
    <script type="text/javascript" src="js/lib/jquery-ui.min.js"></script>
    <script src="js/ff/tags/create-edit.js"></script>
{% endblock %}
{% block styles %}
    <link href="css/jquery-ui/jquery-ui.structure.min.css" type="text/css" rel="stylesheet" media="all">
    <link href="css/jquery-ui/jquery-ui.theme.min.css" type="text/css" rel="stylesheet" media="all">
{% endblock %}
