standard_layout.html.twig 32.9 KB
Newer Older
Julien Jorry committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
{#

Modified for MLC from Sonata package.

(c) Julien Jorry <julien.jorry@gmail.com>

#}

{%- set _preview = block('preview') is defined ? block('preview')|trim : null %}
{% set _form = block('form') is defined ? block('form')|trim : null %}
{% set _show = block('show') is defined ? block('show')|trim : null %}
{% set _list_table = block('list_table') is defined ? block('list_table')|trim : null %}
{% set _list_filters = block('list_filters') is defined ? block('list_filters')|trim : null %}
{% set _tab_menu = block('tab_menu') is defined ? block('tab_menu')|trim : null %}
{% set _content = block('content') is defined ? block('content')|trim : null %}
{% set _title = block('title') is defined ? block('title')|trim : null %}
{% set _breadcrumb = block('breadcrumb') is defined ? block('breadcrumb')|trim : null %}
{% set _actions = block('actions') is defined ? block('actions')|trim : null %}
{% set _navbar_title = block('navbar_title') is defined ? block('navbar_title')|trim : null %}
{% set _list_filters_actions = block('list_filters_actions') is defined ? block('list_filters_actions')|trim : null -%}
{% set _skin = sonata_config.getOption('skin') %}
{% set _use_select2 = sonata_config.getOption('use_select2') %}
{% set _use_icheck = sonata_config.getOption('use_icheck') %}

<!DOCTYPE html>
<html {% block html_attributes %}class="no-js"{% endblock %}>
    <head>
        <title>{{title|default('Kohinos') }}</title>
29
        <meta name="is-tav-env" content="{{ tav_env }}" />
Julien Jorry committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
        <meta name="description" content="{{ description|default('Kohinos : Outil de gestion de monnaie locale complémentaire') }}" />
        <meta name="keywords" content="{{ keywords|default('Kohinos, mlc, mlcc, monnaie locale, monnaies locales') }}" />

        {% block meta_tags %}
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta charset="UTF-8">
            {% block favicon %}
                <link rel="apple-touch-icon" sizes="180x180" href="/images/favicon/apple-touch-icon.png">
                <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon/favicon-32x32.png">
                <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon/favicon-16x16.png">
            {% endblock favicon %}
            <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        {% endblock meta_tags %}

        <meta data-sonata-admin='{{ {
            config: {
                SKIN: _skin,
                CONFIRM_EXIT: sonata_config.getOption('confirm_exit'),
                USE_SELECT2: _use_select2,
                USE_ICHECK: _use_icheck,
                USE_STICKYFORMS: sonata_config.getOption('use_stickyforms'),
                DEBUG: sonata_config.getOption('js_debug'),
            },
            translations: {
                CONFIRM_EXIT: 'confirm_exit'|trans({}, 'SonataAdminBundle'),
            },
        }|json_encode()|raw }}'
        >

        {% block stylesheets %}
            <link rel="stylesheet" href="/leaflet/leaflet.css">
            {% for stylesheet in sonata_config.getOption('stylesheets', []) %}
                <link rel="stylesheet" href="{{ asset(stylesheet) }}">
            {% endfor %}
        {% endblock %}

        {% block javascripts %}
            {% block sonata_javascript_config %}
            {% endblock %}

            {% block sonata_javascript_pool %}
                {% for javascript in sonata_config.getOption('javascripts', []) %}
                    <script src="{{ asset(javascript) }}"></script>
                {% endfor %}
            {% endblock %}

            {# localize moment #}
            {% set localeForMoment = canonicalize_locale_for_moment() %}
            {% if localeForMoment %}
                <script src="{{ asset(
                    'bundles/sonatacore/vendor/moment/locale/' ~
                    localeForMoment ~
                    '.js'
                ) }}"></script>
            {% endif %}

            {# localize select2 #}
            {% if sonata_config.getOption('use_select2') %}
                {% set localeForSelect2 = canonicalize_locale_for_select2() %}
                {% if localeForSelect2 %}
                    <script src="{{ asset('bundles/sonatacore/vendor/select2/select2_locale_' ~ localeForSelect2 ~ '.js') }}"></script>
                {% endif %}
            {% endif %}
        {% endblock %}

        <title>
        {% block sonata_head_title %}
            {{ 'Admin'|trans({}, 'SonataAdminBundle') }}

            {% if _title is not empty %}
                {{ _title|striptags|raw }}
            {% else %}
                {% if action is defined %}
                    -
                    {% for menu in breadcrumbs_builder.breadcrumbs(admin, action) %}
                        {% if not loop.first %}
                            {% if loop.index != 2 %}
                                &gt;
                            {% endif %}

                            {%- set translation_domain = menu.extra('translation_domain', 'messages') -%}
                            {# We use method accessor instead of ".label" since `menu` implements `ArrayAccess` and could have a property called "label". #}
                            {%- set label = menu.getLabel() -%}
                            {%- if translation_domain is not same as(false) -%}
                                {%- set label = label|trans(menu.extra('translation_params', {}), translation_domain) -%}
                            {%- endif -%}

                            {{ label }}
                        {% endif %}
                    {% endfor %}
                {% endif %}
            {% endif %}
        {% endblock %}
        </title>
    </head>
    <body
            {% block body_attributes -%}
                class="sonata-bc {% block admin_lte_skin_class %}{{ _skin }}{% endblock %} fixed
                {% if _use_select2 %}sonata-select2{% endif %}
                {% if _use_icheck %}sonata-icheck{% endif %}
                {% if app.request.cookies.get('sonata_sidebar_hide') -%}
                    sidebar-collapse
                {%- endif -%}"
            {%- endblock -%}
    >

    <div class="wrapper">

        {# AJOUT POUR LES MLC #}
        <input type="hidden" name="koh_map_center" id="koh_map_center" value='{{KOH_MAP_CENTER|default('')}}' />
        <input type="hidden" name="koh_map_zoom" id="koh_map_zoom" value='{{KOH_MAP_ZOOM|default('')}}' />

        {% block sonata_header %}
            <header class="main-header">
                {% block sonata_header_noscript_warning %}
                    <noscript>
                        <div class="noscript-warning">
                            {{ 'noscript_warning'|trans({}, 'SonataAdminBundle') }}
                        </div>
                    </noscript>
                {% endblock %}
                {% block logo %}
                    {% apply spaceless %}
                        {# MLC : LIEN VERS LE FRONT SUR LE LOGO #}
                        {# <a class="logo" href="{{ path('index') }}"> #}
                        <a class="logo" href="{{ path('sonata_admin_dashboard') }}">
                            {% if 'single_image' == sonata_config.getOption('title_mode') or 'both' == sonata_config.getOption('title_mode') %}
                                <img src="{{ asset(sonata_config.logo) }}" alt="{{ sonata_config.title }}">
                            {% endif %}
                            {% if 'single_text' == sonata_config.getOption('title_mode') or 'both' == sonata_config.getOption('title_mode') %}
                                <span>{{ sonata_config.title }}</span>
                            {% endif %}
                        </a>
                    {% endapply %}
                {% endblock %}
                {% block sonata_nav %}
                    <nav class="navbar navbar-static-top" role="navigation">

                        {# MLC : AJOUT POUR LIEN VERS LE FRONT #}
                        {% block front %}
                            <a href="{{path('index')}}" class="sidebar-front"
                               data-toggle="tooltip" data-placement="bottom" title="{{ "Page d'accueil"|trans }}"
                               role="button" title="{{ "Page d'accueil"|trans({}, 'messages') }}">
                                <i class="fa fa-lg fa-home"></i>
                                <span class="sr-only">{{ "Page d'accueil"|trans({}, 'messages') }}</span>
                            </a>
                        {% endblock front %}
                        {% block bugreport %}
                            {% set printBugReport = KOH_BUG_REPORT|default('') %}
                            {% if app.user and (is_granted('ROLE_ADMIN') and printBugReport == 'ROLE_ADMIN') or (is_granted('ROLE_USER') and printBugReport == 'ROLE_USER') %}
180
                                <a class='sidebar-front' style='color:#a94442 !important;' href='{{ path('bugreport') }}' target='_blank' rel="noopener noreferrer">
Julien Jorry committed
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444
                                <i class="fa fa-lg fa-bug"></i>
                                <span class="sr-only">{{ "Reporter un bug"|trans({}, 'messages') }}</span>
                                </a>
                            {% endif %}
                        {% endblock %}

                        <a href="#" class="sidebar-toggle" data-toggle="offcanvas" 
                           role="button" title="{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}">
                            <i class="fa fa-bars"></i>
                            <span class="sr-only">{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}</span>
                        </a>

                        <div class="navbar-left">
                            {% block sonata_breadcrumb %}
                                <div class="hidden-xs">
                                    {% if _breadcrumb is not empty or action is defined %}
                                        <ol class="nav navbar-top-links breadcrumb">
                                            {% if _breadcrumb is empty %}
                                                {% if action is defined %}
                                                    {% for menu in breadcrumbs_builder.breadcrumbs(admin, action) %}
                                                        {%- set translation_domain = menu.extra('translation_domain', 'messages') -%}
                                                        {# We use method accessor instead of ".label" since `menu` implements `ArrayAccess` and could have a property called "label". #}
                                                        {%- set label = menu.getLabel() -%}
                                                        {%- if translation_domain is not same as(false) -%}
                                                            {%- set label = label|trans(menu.extra('translation_params', {}), translation_domain) -%}
                                                        {%- endif -%}

                                                        {% if not loop.last %}
                                                            <li>
                                                                {% if menu.uri is not empty %}
                                                                    <a href="{{ menu.uri }}">
                                                                        {% if menu.extra('safe_label', true) %}
                                                                            {{- label|raw -}}
                                                                        {% else %}
                                                                            {{- label|u.truncate(100, '...') -}}
                                                                        {% endif %}
                                                                    </a>
                                                                {% else %}
                                                                    <span>{{ label|u.truncate(100, '...') }}</span>
                                                                {% endif %}
                                                            </li>
                                                        {% else %}
                                                            <li class="active"><span>{{ label|u.truncate(100, '...') }}</span></li>
                                                        {% endif %}
                                                    {% endfor %}
                                                {% endif %}
                                            {% else %}
                                                {{ _breadcrumb|raw }}
                                            {% endif %}
                                        </ol>
                                    {% endif %}
                                </div>
                            {% endblock sonata_breadcrumb %}
                        </div>

                        {% block sonata_top_nav_menu %}
                            {% if app.user and is_granted(sonata_config.getOption('role_admin')) %}
                                <div class="navbar-custom-menu">
                                    <ul class="nav navbar-nav">
                                        {% block sonata_top_nav_menu_add_block %}
                                            <li class="dropdown">
                                                <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                                    <i class="fa fa-plus-square fa-fw" aria-hidden="true"></i> <i class="fa fa-caret-down" aria-hidden="true"></i>
                                                </a>
                                                {% include get_global_template('add_block') %}
                                            </li>
                                        {% endblock %}
                                        {% block sonata_top_nav_menu_user_block %}
                                            <li class="dropdown user-menu">
                                                <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                                    <i class="fa fa-user fa-fw" aria-hidden="true"></i> <i class="fa fa-caret-down" aria-hidden="true"></i>
                                                </a>
                                                <ul class="dropdown-menu dropdown-user">
                                                    {% include get_global_template('user_block') %}
                                                </ul>
                                            </li>
                                        {% endblock %}
                                    </ul>
                                </div>
                            {% endif %}
                            <div class="navbar-custom-menu">
                                <ul class="nav navbar-nav">
                                    {# @TODO MLC : COMMENT TRANSLATION CHANGE
                                    {% block sonata_top_nav_menu_locale_block %}
                                        <li class="dropdown">
                                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                                <i class="fa fa-flag fa-fw" aria-hidden="true"></i>
                                                <i class="fa fa-caret-down" aria-hidden="true"></i>
                                            </a>
                                            <div class="dropdown-menu multi-column dropdown-add">
                                                <div class="container-fluid">
                                                    <div class="row">
                                                        <ul class="dropdown-menu">
                                                            <li role="presentation" class="dropdown-header">
                                                                <i class="fa fa-language"></i>
                                                                {{ 'languages'|trans({}, 'SonataTranslationBundle') }}
                                                            </li>
                                                            {% for locale in sonata_translation_locales %}
                                                            <li role="presentation" class="{{ app.request.locale == locale ? 'active' : '' }}">
                                                                <a role="menuitem" tabindex="-1" href="{{ path('sonata.translation.locale', {'locale': locale}) }}">
                                                                    {{ locale|language(locale)|capitalize }}
                                                                </a>
                                                            </li>
                                                            {% endfor %}
                                                        </ul>
                                                    </div>
                                                </div>
                                            </div>
                                        </li>
                                    {% endblock %} #}
                                </ul>
                            </div>
                        {% endblock %}
                    </nav>
                {% endblock sonata_nav %}
            </header>
        {% endblock sonata_header %}

        {% block sonata_wrapper %}
            {% block sonata_left_side %}
                <aside class="main-sidebar">
                    <section class="sidebar">
                        {% block sonata_side_nav %}
                            {% block sonata_sidebar_search %}
                                {% if sonata_config.getOption('search') %}
                                    <form action="{{ path('sonata_admin_search') }}" method="GET" class="sidebar-form" role="search">
                                        <div class="input-group custom-search-form">
                                            <input type="text" name="q" value="{{ app.request.get('q') }}" class="form-control" placeholder="{{ 'search_placeholder'|trans({}, 'SonataAdminBundle') }}">
                                            <span class="input-group-btn">
                                                <button class="btn btn-flat" type="submit">
                                                    <i class="fa fa-search" aria-hidden="true"></i>
                                                </button>
                                            </span>
                                        </div>
                                    </form>
                                {% endif %}
                            {% endblock sonata_sidebar_search %}

                            {% block side_bar_before_nav %} {% endblock %}
                            {% block side_bar_nav %}
                                {{ knp_menu_render('sonata_admin_sidebar', {template: get_global_template('knp_menu_template')}) }}
                            {% endblock side_bar_nav %}
                            {% block side_bar_after_nav %}
                                <p class="text-center small" style="border-top: 1px solid #444444; padding-top: 10px">
                                    {% block side_bar_after_nav_content %}
                                    {% endblock %}
                                </p>
                            {% endblock %}
                        {% endblock sonata_side_nav %}
                    </section>
                </aside>
            {% endblock sonata_left_side %}

            <div class="content-wrapper">
                {% include '@kohinos/common/flash-messages.html.twig' %}
                {% block sonata_page_content %}
                    <section class="content-header">

                        {% block sonata_page_content_header %}
                            {% block sonata_page_content_nav %}
                                {% if _navbar_title is not empty
                                  or _tab_menu is not empty
                                  or _actions is not empty
                                  or _list_filters_actions is not empty
                                 %}
                                    <nav class="navbar navbar-default" role="navigation">
                                        <div class="container-fluid">
                                            {% block tab_menu_navbar_header %}
                                                {% if _navbar_title is not empty %}
                                                    <div class="navbar-header">
                                                        <a class="navbar-brand" href="#">{{ _navbar_title|raw }}</a>
                                                    </div>
                                                {% endif %}
                                            {% endblock %}

                                            <div class="navbar-collapse">
                                                {% if _tab_menu is not empty %}
                                                    <div class="navbar-left">
                                                        {{ _tab_menu|raw }}
                                                    </div>
                                                {% endif %}

                                                {% if admin is defined and action is defined and action == 'list' and admin.listModes|length > 1 %}
                                                    <div class="nav navbar-right btn-group">
                                                        {% for mode, settings in admin.listModes %}
                                                            <a href="{{ admin.generateUrl('list', app.request.query.all|merge({_list_mode: mode})) }}" class="btn btn-default navbar-btn btn-sm{% if admin.getListMode() == mode %} active{% endif %}"><i class="{{ settings.class }}"></i></a>
                                                        {% endfor %}
                                                    </div>
                                                {% endif %}

                                                {% block sonata_admin_content_actions_wrappers %}
                                                    {% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %}
                                                        <ul class="nav navbar-nav navbar-right">
                                                        {# MODIF MLC : #}
                                                        {# {% if _actions|split('</a>')|length > 2 %} #}
                                                        {% if _actions|split('</a>')|length > 3 %}
                                                            <li class="dropdown sonata-actions">
                                                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ 'link_actions'|trans({}, 'SonataAdminBundle') }} <b class="caret"></b></a>
                                                                <ul class="dropdown-menu" role="menu">
                                                                    {{ _actions|raw }}
                                                                </ul>
                                                            </li>
                                                        {% else %}
                                                            {{ _actions|raw }}
                                                        {% endif %}
                                                        </ul>
                                                    {% endif %}
                                                {% endblock sonata_admin_content_actions_wrappers %}

                                                {% if _list_filters_actions is not empty %}
                                                    {{ _list_filters_actions|raw }}
                                                {% endif %}
                                            </div>
                                        </div>
                                    </nav>
                                {% endif %}
                            {% endblock sonata_page_content_nav %}
                        {% endblock sonata_page_content_header %}
                    </section>

                    <section class="content">
                        {% block sonata_admin_content %}

                            {% block notice %}
                                {% include ['@SonataCore/FlashMessage/render.html.twig', '@SonataTwig/FlashMessage/render.html.twig'] %}
                            {% endblock notice %}

                            {% if _preview is not empty %}
                                <div class="sonata-ba-preview">{{ _preview|raw }}</div>
                            {% endif %}

                            {% if _content is not empty %}
                                <div class="sonata-ba-content">{{ _content|raw }}</div>
                            {% endif %}

                            {% if _show is not empty %}
                                <div class="sonata-ba-show">{{ _show|raw }}</div>
                            {% endif %}

                            {% if _form is not empty %}
                                <div class="sonata-ba-form">{{ _form|raw }}</div>
                            {% endif %}

                            {% if _list_filters is not empty %}
                                <div class="row">
                                    {{ _list_filters|raw }}
                                </div>
                            {% endif %}

                            {% if _list_table is not empty %}
                                <div class="row">
                                    {{ _list_table|raw }}
                                </div>
                            {% endif %}
                        {% endblock sonata_admin_content %}
                    </section>
                {% endblock sonata_page_content %}
            </div>
        {% endblock sonata_wrapper %}
    </div>

    {% if sonata_config.getOption('use_bootlint') %}
        {% block bootlint %}
            {# Bootlint - https://github.com/twbs/bootlint#in-the-browser #}
445
            <script>
Julien Jorry committed
446 447 448 449 450 451 452 453
                javascript:(function(){var s=document.createElement("script");s.onload=function(){bootlint.showLintReportForCurrentDocument([], {hasProblems: false, problemFree: false});};s.src="https://maxcdn.bootstrapcdn.com/bootlint/latest/bootlint.min.js";document.body.appendChild(s)})();
            </script>
        {% endblock %}
    {% endif %}

    {# MLC : AJOUT POUR EDITABLE BOOLEAN #}
    {% block js %}
        {{ encore_entry_script_tags('admin') }}
454
        <script>
Julien Jorry committed
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
        $('.viewChoiceGroup').on('click', function () {
            $('#roleGroupeModal').modal('show');
        });

        $('.validateAchatMonnaie').on('click', function (e) {
            // e.preventDefault();
            var self = $(this);
            var modal = $('#confirmValidationAchatModal');

            // Get relevant confirmation message div
            var message = modal.find('.modal-body');

            // Set data in modal
            message.find('.montant').text(self.data('montant'));
            message.find('.moyen').text(self.data('moyen'));
            message.find('.destinataire').text(self.data('destinataire'));
            message.find('.reference').text(self.data('reference'));
            message.find('.type').text(self.data('type'));

            // Show modal
            console.log(modal);
            console.log('showConfirmValidationAchatModal show modal');
            modal.modal('show');

            // Bind modal validation button with form submition
            $('#confirmValidationAchatModal #confirmAchatButton').off();
            $('#confirmValidationAchatModal #confirmAchatButton').on('click', function(e){
                $.ajax({
                    url : self.data('url'),
                    type: 'post',
                    success: function(data) {
                        if(data.status == 'success') {
                            self
                                .addClass('btn-secondary disabled')
                                .removeClass('btn-primary validateAchatMonnaie')
                                .attr('disabled', 'disabled')
                                .html('<i class="fa fa-check"></i> Validée !');
                        } else {
                            self.addClass('text-red');
                        }
                        modal.modal('hide');
                    },
                    error: function(data) {
                        modal.modal('hide');
                    }
                });
            });
        });
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558

        $('.helloassoAssociateButton').on('click', function (e) {
            // e.preventDefault();
            var self = $(this);
            var modal = $('#helloassoAssociateModal');
            modal.find('.error').html('');

            // Get relevant confirmation message div
            var message = modal.find('.modal-body');

            // Set data in modal
            message.find('.type').text(self.data('type'));
            message.find('.date').text(self.data('date'));
            message.find('.amount').text(self.data('amount'));
            message.find('.user').text(self.data('user'));
            message.find('.payer').text(self.data('payer'));

            // Show modal
            console.log('helloassoAssociateModal show modal');
            modal.modal('show');

            // Bind modal validation button with form submition
            $('#helloassoAssociateModal #confirmAssociateHelloassoButton').off();
            $('#helloassoAssociateModal #confirmAssociateHelloassoButton').on('click', function(e){
                var button = $(this);
                modal.find('.error').html('');
                $(this).attr('disabled', 'disabled').html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Loading...');
                $.ajax({
                    url : self.data('url'),
                    type: 'post',
                    data : {
                        'adherent': $('#helloasso_associate_adherent option:selected').val(),
                        'presta': $('#helloasso_associate_presta option:selected').val(),
                    },
                    success: function(data) {
                        if(data.status == 'success') {
                            self
                                .addClass('btn-secondary disabled')
                                .removeClass('btn-primary helloassoAssociateButton')
                                .attr('disabled', 'disabled')
                                .html('<i class="fa fa-check"></i> Validé !');
                            modal.modal('hide');
                            location.reload();
                        } else {
                            modal.find('.error').html(data.error);
                            button.removeAttr('disabled').html('Confirmer');
                        }
                        button.removeAttr('disabled').html('Confirmer');
                    },
                    error: function(data) {
                        modal.modal('hide');
                        button.removeAttr('disabled').html('Confirmer');
                    }
                });
            });
        });
Julien Jorry committed
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577
        $(document).ready(function() {
            $.datepicker.regional['fr'] = {
                closeText: 'Fermer',
                prevText: '&#x3c;Préc',
                nextText: 'Suiv&#x3e;',
                currentText: 'Aujourd\'hui',
                monthNames: ['Janvier','Fevrier','Mars','Avril','Mai','Juin',
                'Juillet','Aout','Septembre','Octobre','Novembre','Decembre'],
                monthNamesShort: ['Jan','Fev','Mar','Avr','Mai','Jun',
                'Jul','Aou','Sep','Oct','Nov','Dec'],
                dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
                dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
                dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
                weekHeader: 'Sm',
                dateFormat: 'yy-mm-dd',
                firstDay: 1,
                isRTL: false,
                showMonthAfterYear: false,
                yearSuffix: '',
578 579 580
                minDate: '-5Y',
                yearRange: 'c-5:c+3',
                maxDate: '+3Y',
Julien Jorry committed
581 582 583 584 585 586 587 588 589 590 591 592 593 594
                numberOfMonths: 2,
                showButtonPanel: true
                };
            $.datepicker.setDefaults($.datepicker.regional['fr']);
            // you may need to change this code if you are not using Bootstrap Datepicker
            $('.js-datepicker').datepicker({
                language: 'fr'
            });
        });
        </script>
    {% endblock js %}

    {% include '@kohinos/common/modale_choix_groupe.html.twig' %}
    {% include '@kohinos/admin/modale_validation_achat.html.twig' %}
595
    {% include '@kohinos/admin/modale_helloasso_associate.html.twig' %}
Julien Jorry committed
596 597 598 599
    {# FIN AJOUT #}

    </body>
</html>