<commit_before>{% extends 'ApplicationDefaultBundle:Redesign:layout.html.twig' %}

{% set firstEvent = events|first %}
{% set fistLink = url('event_show_redesign', {'eventSlug' : firstEvent.slug, 'ref': code}) %}

{% block content %}
    <!--BEGIN cabinet-head-->
    <div class="cabinet-head">
        <div class="container">
            <div class="cabinet-head__wrap">
                <div class="cabinet-head__left">
                    <div class="cabinet-head__label">{{ 'menu.events.my'|trans }}</div>
                </div>
                <div class="cabinet-head__right">
                {% if is_mobile() %}
                    <a href="{{ path('fos_user_profile_edit') }}" class="cabinet-head__link">{{ 'menu.profile.my'|trans }}</a>
                {% else %}
                    <a data-remodal-target="modal-profile" href="#" class="cabinet-head__link">{{ 'menu.profile.my'|trans }}</a>
                {% endif %}
                    <a href="{{ path('fos_user_security_logout') }}" class="cabinet-head__link">{{ 'menu.logout'|trans }}</a>
                </div>
            </div>
        </div>
    </div>
    <!--END cabinet-head-->

    <!--BEGIN events-->
    {%- if user_active_events|length > 0 -%}
        <section class="events">
            <div class="container">
                <div class="events__box">
                    {% for event in user_active_events %}
                        {% if (event.adminOnly and is_granted('ROLE_ADMIN')) or (event.adminOnly != true) %}
                            {% include '@ApplicationDefault/Redesign/Event/event.card.html.twig' with {'event': event} %}
                        {% endif %}
                    {% endfor %}
                </div>
            </div>
        </section>
    {%- endif -%}
    <!--END events-->

    <!--BEGIN share-->
    {% set bonus = constant('Application\\Bundle\\DefaultBundle\\Service\\ReferralService::REFERRAL_BONUS') %}
    {% set special_bonus = constant('Application\\Bundle\\DefaultBundle\\Service\\ReferralService::SPECIAL_REFERRAL_BONUS') %}

    <section class="share">
        <div class="container">
            <div class="share-banner">
                <div class="share-banner__info">
                    <h2 class="h2 h2--white share-banner__title">{{ 'referral.invaite.title2'|trans }}</h2>
                    <div class="share-banner__hint-show">{{ 'referral.program.conditions.title'|trans }}</div>
                    {% set current_bonus = 'js-fwdays-2019' == firstEvent.slug ? special_bonus : bonus %}
                    <div id="bonus_text" class="share-banner__hint">
                        {{ 'referral.program.conditions.text'|trans({'%referal_bonus%':current_bonus }) }}
                    </div>
                    <div class="share-banner__balance">{{ 'referral.balance.redesign'|trans({'%user_balance%': user.balance}) }}</div>
                </div>
                <div class="share-ref">
                    <div class="share-ref__top">
                        <div class="share-ref__label">{{ 'referral.invaite.link.text'|trans }}</div>
                        <div class="share-ref__dropdown">
                            <div id="ref-selected" class="share-ref__dropdown-selected">{{ firstEvent.name }}</div>
                            <select id="ref-dropdown" name="" class="share-ref__select">
                                {% for event in events %}
                                    {% if (event.adminOnly and is_granted('ROLE_ADMIN')) or (event.adminOnly != true) %}
                                        {% if firstEvent.logoFile is not empty %}
                                            {% set image = absolute_url(vich_uploader_asset(event, 'logoFile')) %}
                                        {% else %}
                                            {% set image = '' %}
                                        {% endif %}
                                        <option value="{{ loop.index }}"
                                            data-ref="{{ url('event_show_redesign', {'eventSlug' : event.slug, 'ref': code}) }}"
                                            data-bonus="{% if 'js-fwdays-2019' == event.slug %}{{ special_bonus }}{% else %}{{ bonus }}{% endif %}"
                                            data-image="{{ image }}">
                                        {{ event.name }}
                                        </option>
                                    {% endif %}
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                    <div class="share-ref__bottom">
                        <div class="share-ref__field">
                            <input id="ref-input" class="input share-ref__input" type="text"
                                   value="{{ url('event_show_redesign', {'eventSlug' : firstEvent.slug, 'ref': code}) }}"
                                   readonly>
                            <button id="ref-copy" class="share-ref__copy tooltip-copy" type="button"
                                    data-copy="{{ 'referral.link.copied'|trans }}">
                                <i class="icon-copy share-ref__copy-icon"></i>
                            </button>
                        </div>
                        <a id="share-ref__facebook" class="btn btn--md share-ref__facebook" target="_blank"
                           data-layout="button" data-size="large" data-mobile-iframe="true">
                            <i class="btn__icon icon-facebook"></i>{{ 'referral.share.title'|trans }}
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!--END share-->

    {%- if user_past_events|length > 0 -%}
        <div class="cabinet-head">
            <div class="container">
                <div class="cabinet-head__wrap">
                    <div class="cabinet-head__left">
                        <div class="cabinet-head__label">{{ 'menu.past_events.my'|trans }}</div>
                    </div>
                </div>
            </div>
        </div>
        <section class="events">
            <div class="container">
                <div class="events__box">
                    {% for event in user_past_events %}
                        {% if (event.adminOnly and is_granted('ROLE_ADMIN')) or (event.adminOnly != true) %}
                            {% include '@ApplicationDefault/Redesign/Event/event.card.html.twig' with {'event': event} %}
                        {% endif %}
                    {% endfor %}
                </div>
            </div>
        </section>
    {%- endif -%}

{% endblock content%}

{% block popups %}
    {{ parent() }}
    <!--BEGIN profile-popup-->
    <div class="remodal remodal--md" data-remodal-id="modal-profile" data-remodal-options="hashTracking: false">
        <button data-remodal-action="close" class="remodal-close icon-close"></button>
        <div class="remodal__body">
            <div class="remodal__head">
                <div class="h2 remodal__title">{{ 'menu.user.info'|trans }}</div>
            </div>
            {% include '@ApplicationDefault/Redesign/profile_form.html.twig' %}
        </div>
    </div>
    <!--END profile-popup-->
{% endblock popups %}

{% block scripts %}
    {{ parent() }}
    <script>
        var bonus_translate = '{{ 'referral.program.conditions.text'|trans }}';
        $(document).ready(function () {
            $('#ref-dropdown').on('change', function () {
                var bonus = $('option:selected', this).data('bonus');
                var bonus_text = bonus_translate.replace('%referal_bonus%', bonus);
                console.log(bonus);
                console.log(bonus_text);
                $('#bonus_text').text(bonus_text);
            });
        })
    </script>
{% endblock %}<commit_msg>remove console log<commit_after>{% extends 'ApplicationDefaultBundle:Redesign:layout.html.twig' %}

{% set firstEvent = events|first %}
{% set fistLink = url('event_show_redesign', {'eventSlug' : firstEvent.slug, 'ref': code}) %}

{% block content %}
    <!--BEGIN cabinet-head-->
    <div class="cabinet-head">
        <div class="container">
            <div class="cabinet-head__wrap">
                <div class="cabinet-head__left">
                    <div class="cabinet-head__label">{{ 'menu.events.my'|trans }}</div>
                </div>
                <div class="cabinet-head__right">
                {% if is_mobile() %}
                    <a href="{{ path('fos_user_profile_edit') }}" class="cabinet-head__link">{{ 'menu.profile.my'|trans }}</a>
                {% else %}
                    <a data-remodal-target="modal-profile" href="#" class="cabinet-head__link">{{ 'menu.profile.my'|trans }}</a>
                {% endif %}
                    <a href="{{ path('fos_user_security_logout') }}" class="cabinet-head__link">{{ 'menu.logout'|trans }}</a>
                </div>
            </div>
        </div>
    </div>
    <!--END cabinet-head-->

    <!--BEGIN events-->
    {%- if user_active_events|length > 0 -%}
        <section class="events">
            <div class="container">
                <div class="events__box">
                    {% for event in user_active_events %}
                        {% if (event.adminOnly and is_granted('ROLE_ADMIN')) or (event.adminOnly != true) %}
                            {% include '@ApplicationDefault/Redesign/Event/event.card.html.twig' with {'event': event} %}
                        {% endif %}
                    {% endfor %}
                </div>
            </div>
        </section>
    {%- endif -%}
    <!--END events-->

    <!--BEGIN share-->
    {% set bonus = constant('Application\\Bundle\\DefaultBundle\\Service\\ReferralService::REFERRAL_BONUS') %}
    {% set special_bonus = constant('Application\\Bundle\\DefaultBundle\\Service\\ReferralService::SPECIAL_REFERRAL_BONUS') %}

    <section class="share">
        <div class="container">
            <div class="share-banner">
                <div class="share-banner__info">
                    <h2 class="h2 h2--white share-banner__title">{{ 'referral.invaite.title2'|trans }}</h2>
                    <div class="share-banner__hint-show">{{ 'referral.program.conditions.title'|trans }}</div>
                    {% set current_bonus = 'js-fwdays-2019' == firstEvent.slug ? special_bonus : bonus %}
                    <div id="bonus_text" class="share-banner__hint">
                        {{ 'referral.program.conditions.text'|trans({'%referal_bonus%':current_bonus }) }}
                    </div>
                    <div class="share-banner__balance">{{ 'referral.balance.redesign'|trans({'%user_balance%': user.balance}) }}</div>
                </div>
                <div class="share-ref">
                    <div class="share-ref__top">
                        <div class="share-ref__label">{{ 'referral.invaite.link.text'|trans }}</div>
                        <div class="share-ref__dropdown">
                            <div id="ref-selected" class="share-ref__dropdown-selected">{{ firstEvent.name }}</div>
                            <select id="ref-dropdown" name="" class="share-ref__select">
                                {% for event in events %}
                                    {% if (event.adminOnly and is_granted('ROLE_ADMIN')) or (event.adminOnly != true) %}
                                        {% if firstEvent.logoFile is not empty %}
                                            {% set image = absolute_url(vich_uploader_asset(event, 'logoFile')) %}
                                        {% else %}
                                            {% set image = '' %}
                                        {% endif %}
                                        <option value="{{ loop.index }}"
                                            data-ref="{{ url('event_show_redesign', {'eventSlug' : event.slug, 'ref': code}) }}"
                                            data-bonus="{% if 'js-fwdays-2019' == event.slug %}{{ special_bonus }}{% else %}{{ bonus }}{% endif %}"
                                            data-image="{{ image }}">
                                        {{ event.name }}
                                        </option>
                                    {% endif %}
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                    <div class="share-ref__bottom">
                        <div class="share-ref__field">
                            <input id="ref-input" class="input share-ref__input" type="text"
                                   value="{{ url('event_show_redesign', {'eventSlug' : firstEvent.slug, 'ref': code}) }}"
                                   readonly>
                            <button id="ref-copy" class="share-ref__copy tooltip-copy" type="button"
                                    data-copy="{{ 'referral.link.copied'|trans }}">
                                <i class="icon-copy share-ref__copy-icon"></i>
                            </button>
                        </div>
                        <a id="share-ref__facebook" class="btn btn--md share-ref__facebook" target="_blank"
                           data-layout="button" data-size="large" data-mobile-iframe="true">
                            <i class="btn__icon icon-facebook"></i>{{ 'referral.share.title'|trans }}
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!--END share-->

    {%- if user_past_events|length > 0 -%}
        <div class="cabinet-head">
            <div class="container">
                <div class="cabinet-head__wrap">
                    <div class="cabinet-head__left">
                        <div class="cabinet-head__label">{{ 'menu.past_events.my'|trans }}</div>
                    </div>
                </div>
            </div>
        </div>
        <section class="events">
            <div class="container">
                <div class="events__box">
                    {% for event in user_past_events %}
                        {% if (event.adminOnly and is_granted('ROLE_ADMIN')) or (event.adminOnly != true) %}
                            {% include '@ApplicationDefault/Redesign/Event/event.card.html.twig' with {'event': event} %}
                        {% endif %}
                    {% endfor %}
                </div>
            </div>
        </section>
    {%- endif -%}

{% endblock content%}

{% block popups %}
    {{ parent() }}
    <!--BEGIN profile-popup-->
    <div class="remodal remodal--md" data-remodal-id="modal-profile" data-remodal-options="hashTracking: false">
        <button data-remodal-action="close" class="remodal-close icon-close"></button>
        <div class="remodal__body">
            <div class="remodal__head">
                <div class="h2 remodal__title">{{ 'menu.user.info'|trans }}</div>
            </div>
            {% include '@ApplicationDefault/Redesign/profile_form.html.twig' %}
        </div>
    </div>
    <!--END profile-popup-->
{% endblock popups %}

{% block scripts %}
    {{ parent() }}
    <script>
        var bonus_translate = '{{ 'referral.program.conditions.text'|trans }}';
        $(document).ready(function () {
            $('#ref-dropdown').on('change', function () {
                var bonus = $('option:selected', this).data('bonus');
                var bonus_text = bonus_translate.replace('%referal_bonus%', bonus);
                $('#bonus_text').text(bonus_text);
            });
        })
    </script>
{% endblock %}
{'fraction_non_alphanumeric': 0.1565637310967086, 'fraction_numerical': 0.002033295209048164, 'mean_word_length': 1.4367549156216133, 'pattern_counts': {'":': 0, '<': 209, '<?xml version=': 0, '>': 213, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 56, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3439702', 'n_tokens_mistral': 4419, 'n_tokens_neox': 4088, 'n_words': 722}