{% load static %}
{% load i18n %}


<div class="carrier-card {% if route.highlight_color %} highlight-color {% endif %}" data-number-of-route="{{ route.id }}">
{#<div class="carrier-card"{% if route.highlight_color %} style="border: 5px solid {{ route.highlight_color }};"{% endif %} data-number-of-route="{{ route.id }}">#}
    <div class="left-part-carrier-card">
{#        <div class="first-line-card-carrier">#}
{#            <div class="carrier-title">#}
{#                Перевозчик:#}
{#            </div>#}
{#            <div class="type_transportation_carrier">#}
{#                {{ route.get_type_transport_display }}#}
{#            </div>#}
{#            <div class="clear_both"></div>#}
{#        </div>#}
                <div class="route_info_about">
                    <span class="cargo_type_disp">
                        {% translate "Тип: " %}{{ route.get_cargo_type_display }}
                    </span>

                    <span class="cargo_weight">
                       {% translate "Вес: " %}{{ route.weight }} {% translate "кг" %}
                    </span>

                    <span class="cargo_type_trans">

                        {% if route.type_transport == 'road' %}
                            <img class="inf_carrier_icon" src="{% static "/img/svg/Car.svg" %}"/>
                            {% elif route.type_transport == 'avia'%}
                            <img class="inf_carrier_icon" src="{% static "/img/svg/Airplane.svg" %}"/>
                        {% endif %}

                        {{ route.get_type_transport_display }}
                    </span>

                </div>
        <div class="from-to-country-container-carrier">
            <div class="from-to-country-text left fl-left txt-al-right" title="{{ route.from_country_n_city_str }}">
                {{ route.from_country_n_city_str }}
            </div>
            <div class="splitter-from-to-country"></div>
            <div class="from-to-country-text right fl-right txt-al-left" title="{{ route.to_country_n_city_str }}">
                {{ route.to_country_n_city_str }}
            </div>
        </div>
        {% include "small_INCLUDES/carrier_card/inf_about_moving.html" %}

    </div>

    <div class="inf_carrier_container">

         <div
             class="control_frame"
             id="control_frame_{{ route.id }}"
         >
             <div class="success_rising" id="success_rising_{{ route.id }}">
                 <div class="success_rising_text">
                    {% trans "Объявление поднято!" %}
                 </div>
                 <button class="close_success_rising" onclick="showControlFrame(this, {{ route.id }})">{% trans "Закрыть" %}</button>
             </div>

             <form class="upd_form" id="upd_form_{{ route.id }}" method="post">
                  {% csrf_token %}

                 <div class="checkbox_wrapper">
                        <input type="radio"
                               name="route_option"
                               data-routeid="{{ route.id }}"
                               class="custom-checkbox round"
                                {% if remains_route_rising_count == 0%}
                                    disabled
                               {% endif %}
                               id="raise_route_{{ route.id }}">
                        <label for="raise_route_{{ route.id }}" class="route_label">
                            <div class="label_text">{% trans "Поднять объявление" %}</div>
                        </label>
                 </div>
                 <div class="sub_label_text">{% trans "Осталось поднятий " %} <span id="remains_route_rising_count">{{ remains_route_rising_count }}</span></div>

                 <div class="checkbox_wrapper">
                        <input type="radio"
                               name="route_option"
                               data-routeid="{{ route.id }}"
                               class="custom-checkbox round"
                               {% if remains_route_highlight_count == 0%}
                                    disabled
                               {% endif %}
{#                                    checked="checked"#}
                               id="highlight_route_{{ route.id }}">
                        <label for="highlight_route_{{ route.id }}" class="route_label">
                            <div class="label_text">{% trans "Выделить объявление цветом " %}</div>
                        </label>
                </div>
                <div class="sub_label_text">{% trans "Осталось выделений " %}<span id="remains_route_highlight_count">{{ remains_route_highlight_count }}</span></div>

                <button
                        onclick="confirmUpgrade(this,{{ route.id }} )"
                        id="send_upgrade"
                        class="send_upgrade_{{ route.id }}">{% trans "Подтвердить" %}</button>

             </form>

         </div>

        <div
                class="title_container_inf_carrier"
                {% if route.owner_type == 'mover' %}
                   id="mover_title_color"
                {% elif route.owner_type == 'customer'%}
                   id="customer_title_color"
               {% endif %}
        >
            {% translate 'Контакты' %}
            {% if route.owner_type == 'mover' %}
                {% translate "перевозчика" %}
                <img class="inf_carrier_icon" src="{% static "/img/svg/mover.svg" %}"/>
            {% elif route.owner_type == 'customer'%}
                {% translate "отправителя" %}
                <img class="inf_carrier_icon" src="{% static "/img/svg/cargo.svg" %}"/>
            {% endif %}
        </div>

        <div name="form_carrier">


            <div class="inf_carrier">

                <img class="route_contact_avatar {% if route.owner == user %} active{% endif %}" {% if route.owner.user_profile.avatar %}
                    src="{{ route.owner.user_profile.avatar.url }}"
                    {% else %}src="{% static "img/svg/user_icon_standart.png" %}"{% endif %}>
                <span class="name_carrier{% if route.owner == user %} active{% endif %}">{{ route.owner.last_name }} {{ route.owner.first_name }}</span>

                <a class="phones_carrier" href="tel:{{ route.phone }}">
                    <img class="inf_carrier_icon" src="{% static "/img/svg/phone.svg" %}"/>
                    <span class="phones_carrier_span{% if route.owner == user %} active{% endif %} el_for_open_el">{{ route.phone }}</span>
                    <input value="{{ route.phone }}">
                    <div class="clear_both"></div>
                </a>
                <a class="email_carrier" href="mailto:{{ route.owner.email }}">
                    <img class="inf_carrier_icon" src="{% static "/img/svg/email.svg" %}">
                    <span class="email_carrier_span{% if route.owner == user %} active{% endif %} el_for_open_el">{{ route.owner.email }}</span>
                    <input value="{{ route.owner.email }}">
                    <div class="clear_both"></div>
                </a>

             <div class="button_raise_route">



                    <button
{#                           onclick="editRoute({{ route.id }})"#}
                           onclick="showControlFrame(this, {{ route.id }})"
                            id="raise_route">
                            {% translate "Увеличить просмотры" %}
                    </button>
                </div>



                <div class="button_remove_route">
                     <button
                         onclick="editRoute({{ route.id }})"
                         class="edit_route {% if route.highlight_color %} highlight-color {% endif %}"
                         id="edit_route_{{ route.id }}">
                        {% translate "Редактировать" %}
                     </button>
                     <button
                             onclick="confirmRemove(this, {{ route.id }})"
                             class="remove_route"
                             id="remove_route_{{ route.id }}">
                            {% translate "Удалить" %}
                    </button>

                    <button
                            onclick="removeRoute(this,{{ route.id }},{once: true})"
                            class="confirm_remove"
                            id="confirm_remove_{{ route.id }}">
                        {% translate "Подтвердить удаление" %}
                    </button>

                    <button
                            onclick="cancelRemove({{ route.id }})"
                            class="cancel_remove"
                            id="cancel_remove_{{ route.id }}">
                        {% translate "Отменить удаление" %}
                    </button>

                </div>
            </div>
            {% if route.owner != user %}
                <button class="open_chat_carrier" onclick="open_chat({{ route.owner_id }})">
                    <img src="{% static "img/svg/Logo.svg" %}" width="30px">
                    <span >{% translate "Написать сообщение" %}</span>
                    <img src="{% static "/img/svg/email.svg" %}" width="25px" style="position:relative;left: 3px;">
                </button>
                <button class="open_inf_carrier" onclick="show_inf_carrier(this)">{% translate "Открыть контакт" %}</button>
            {% endif %}
        </div>


    </div>
    <div class="clear_both"></div>

</div>