{% extends 'fleetpings/base.html' %}

{% load i18n %}
{% load fleetpings_versioned_static %}

{% block details %}
    <div class="aa-fleetpings row">
        <div class="col-md-6">
            <div class="panel panel-default">
                <div class="panel-heading aa-fleetpings-ping-header">
                    <span class="panel-title">{% translate "Fleet Information" %}</span>
                </div>
                <div class="panel-body">
                    {% include "fleetpings/partials/form/form.html" %}
                </div>
            </div>
        </div>

        <div class="col-md-6 aa-fleetpings-pingtext">
            <div class="panel panel-default">
                <div class="panel-heading aa-fleetpings-ping-header">
                    <span class="panel-title">{% translate "Formatted Ping Text" %}</span>
                </div>
                <div class="panel-body">
                    {% include 'fleetpings/partials/ping/ping.html' %}
                </div>
            </div>
        </div>

        <script type="application/javascript">
            const fleetpingsSettings = {
                dateTimeLocale: '{{ LANGUAGE_CODE }}',
                optimerInstalled: {{ optimer_installed|yesno:"true,false" }},
                srpModuleAvailableToUser: {{ srp_module_available_to_user|yesno:"true,false" }},
                url: {
                    fleetPing: '{% url "fleetpings:ajax_create_fleet_ping" %}',
                    pingTargets: '{% url "fleetpings:ajax_get_ping_targets" %}',
                    pingWebhooks: '{% url "fleetpings:ajax_get_webhooks" %}',
                    fleetTypes: '{% url "fleetpings:ajax_get_fleet_types" %}',
                    formupLocations: '{% url "fleetpings:ajax_get_formup_locations" %}',
                    fleetComms: '{% url "fleetpings:ajax_get_fleet_comms" %}',
                    fleetDoctrines: '{% url "fleetpings:ajax_get_fleet_doctrines" %}'
                }
            };

            const fleetpingsTranslations = {
                optimer: {
                    error: {
                        missingFields: '{% translate "Mandatory information is missing. To create an optimer, you need to provide all of the following information:<br>» FC Name<br>» Fleet Name<br>» Formup Location<br>» Formup Time<br>» Ships / Doctrine" %}'
                    }
                },
                srp: {
                    error: {
                        missingFields: '{% translate "Mandatory information is missing. To create an SRP link, you need to provide all of the following information:<br>» Fleet Name<br>» Ships / Doctrine" %}'
                    }
                },
                copyToClipboard: {
                    error: '{% translate "Error! Your ping was not copied to your clipboard. Maybe your browser doesn&apos;t support this feature." %}',
                    success: '{% translate "Success! Your ping text has been copied to your clipboard. Now be a good FC and throw it in your chat so you actually get some people in fleet." %}'
                }
            };
        </script>
    </div>
{% endblock %}

{% block extra_javascript %}
    {% include 'bundles/jquery-datetimepicker-js.html' %}
    {% include 'bundles/clipboard-js.html' %}

    <script type="application/javascript" src="{% fleetpings_static 'fleetpings/js/fleetpings.min.js' %}"></script>
{% endblock %}

{% block extra_css %}
    <link rel="stylesheet" type="text/css" href="{% fleetpings_static 'fleetpings/css/fleetpings.min.css' %}">

    {% include 'bundles/jquery-datetimepicker-css.html' %}
{% endblock %}
