<commit_before>{% extends "CanalTPMttBundle::modal.html.twig" %}

{% block open_form %}
    {{ form_start(form) }}
{% endblock %}

{% block modal_title %}
    {{'network.create'|trans({}, 'default')}}
{% endblock %}


{% block modal_body %}
    {{ form_errors(form) }}

    {{ form_row(form.external_coverage_id) }}

    {{ form_label(form.external_id, null, { 'label_attr': {'style': 'display:none;'} }) }}
    {{ form_widget(form.external_id, { 'attr': {'style': 'display:none;'} }) }}
{% endblock %}

{% block modal_actions %}
    <button type="submit" class="btn btn-success">
        <span class="glyphicon glyphicon-pencil"></span> {{'global.save'|trans}}
    </button>
    {{ form_end(form) }}
    <script type="text/javascript">
    require(['navitia'], function(Navitia){
        var nav_api = new Navitia({
            host: '{{ navitia_url }}',
            version: 'v1',
            api: 'coverage',
        });
        $('#mtt_network_external_coverage_id').change(function(){
            var $select = $(this);
            if ($select.val() != '') {
                nav_api.getCoverageNetworks(
                    $select.val(), 
                    function(networks){
                        var $networkSelect = $('#mtt_network_external_id').empty();
                        for (var i in networks) {
                            $networkSelect.append('<option value="' + networks[i].id + '">' + networks[i].name + '</option>');
                        }
                        $networkSelect.show().siblings('label').show();
                    }
                );<commit_msg>Refs #METH-145 ~ JS form for perimeters updated.<commit_after>{% extends "CanalTPMttBundle::modal.html.twig" %}

{% block open_form %}
    {{ form_start(form) }}
{% endblock %}

{% block modal_title %}
    {{'network.create'|trans({}, 'default')}}
{% endblock %}


{% block modal_body %}
    {{ form_errors(form) }}

    {{ form_row(form.external_coverage_id) }}

    {{ form_label(form.external_id, null, { 'label_attr': {'style': 'display:none;'} }) }}
    {{ form_widget(form.external_id, { 'attr': {'style': 'display:none;'} }) }}
{% endblock %}

{% block modal_actions %}
    <button type="submit" class="btn btn-success">
        <span class="glyphicon glyphicon-pencil"></span> {{'global.save'|trans}}
    </button>
    {{ form_end(form) }}
    <script type="text/javascript">
    require(['navitia'], function(Navitia){
        var nav_api = new Navitia({
            host: '{{ navitia_url }}',
            version: 'v1',
            api: 'coverage',
        });
        $('#mtt_network_external_coverage_id').change(function(){
            var $select = $(this);

            if ($select.val() != null) {
                nav_api.getCoverageNetworks(
                    $select.val(), 
                    function(networks){
                        var $networkSelect = $('#mtt_network_external_id').empty();
                        for (var i in networks) {
                            $networkSelect.append('<option value="' + networks[i].id + '">' + networks[i].name + '</option>');
                        }
                        $networkSelect.show().siblings('label').show();
                    }
                );
{'fraction_non_alphanumeric': 0.18080495356037152, 'fraction_numerical': 0.0015479876160990713, 'mean_word_length': 2.1521951219512196, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5510495', 'n_tokens_mistral': 1003, 'n_tokens_neox': 938, 'n_words': 157}