{% load i18n cosinnus_tags %}

{% comment %} {{current_page}} is one of: editgroup, groupdetails {% endcomment %}

{% if current_page == "editgroup" %}
    {% captureas is_editgroup %}True{% endcaptureas %}
{% elif current_page == "groupdetails" %}
    {% captureas is_groupdetails %}True{% endcaptureas %}
{% elif current_page == "groupdeactivate" %}
    {% captureas is_deactivategroup %}True{% endcaptureas %}
{% endif %}

{% if user|has_write_access:object %}
	{% captureas href %}{% group_url 'cosinnus:group-edit' group=group %}{% endcaptureas %}
	{% captureas label %}{% if group and group.type == 1 or group_model == "CosinnusSociety" %}{% trans "Edit Group" %}{% else %}{% trans "Edit Project" %}{% endif %}{% endcaptureas %}
	{% include "cosinnus/leftnav_button.html" with active=is_editgroup extra_classes="fine-space" icon="fa-info-circle" label=label href=href  %}
{% endif %}

{% captureas href %}{% group_url 'cosinnus:group-detail' group=group %}{% endcaptureas %}
{% captureas label %}{% trans "Members" %}{% endcaptureas %}
{% include "cosinnus/leftnav_button.html" with active=is_groupdetails extra_classes="large-space" icon="fa-users" label=label href=href  %}

{% include 'cosinnus/feedback/report_button_leftnav_btn.html' with object=group %}

{% if user|is_group_admin:group or user|is_superuser %}
	{% captureas href %}{% if activate %}{% url 'cosinnus:group-activate' group_id=group.id %}{% else %}{% url 'cosinnus:group-deactivate' group_id=group.id %}{% endif %}{% endcaptureas %}
	{% captureas label %}{% if group and group.type == 1 or group_model == "CosinnusSociety" %}{% if activate %}{% trans "Re-activate Group" %}{% else %}{% trans "Deactivate Group" %}{% endif %}{% else %}{% if activate %}{% trans "Activate Project" %}{% else %}{% trans "Deactivate Project" %}{% endif %}{% endif %}{% endcaptureas %}
	{% captureas icon %}{% if activate %}fa-flash{% else %}fa-times{% endif %}{% endcaptureas %}
	{% include "cosinnus/leftnav_button.html" with active=is_deactivategroup extra_classes="large-space" icon=icon label=label href=href  %}
{% endif %}

{% if user.pk in object.members or user.pk in object.admins %}
    {% captureas label %}{% trans "Leave" %}{% endcaptureas %}
    {% captureas extra_atts %}data-toggle="modal" data-target="#leave_join_group_modal"{% endcaptureas %}
    {% include "cosinnus/leftnav_button.html" with extra_classes="regular-space" icon="fa-sign-out" label=label href="#"  %}
    
    {% captureas label %}{% blocktrans with title=object.name %}Do you really want to leave „{{ title }}“?{% endblocktrans %}{% endcaptureas %}
    {% captureas title %}{% trans "Leave" %}{% endcaptureas %}
    {% captureas action %}{% group_url 'cosinnus:group-user-leave' group=group %}{% endcaptureas %}
    
    {% include "cosinnus/modal_box.html" with id="leave_join_group_modal" label=label title=title form_action=action %}
{% elif user.pk in group.pendings %}
    {% captureas label %}{% trans "Withdraw Request" %}{% endcaptureas %}
    {% captureas extra_atts %}data-toggle="modal" data-target="#leave_join_group_modal"{% endcaptureas %}
    {% include "cosinnus/leftnav_button.html" with extra_classes="regular-space" icon="fa-sign-out" label=label href="#"  %}
    
    {% captureas label %}{% blocktrans with title=group.name %}Do you really want to withdraw your join request to „{{ title }}“?{% endblocktrans %}{% endcaptureas %}
    {% captureas title %}{% trans "Withdraw Join Request" %}{% endcaptureas %}
    {% captureas action %}{% group_url 'cosinnus:group-user-withdraw' group=group %}{% endcaptureas %}
    
    {% include "cosinnus/modal_box.html" with id="leave_join_group_modal" label=label title=title form_action=action %}
{% elif object.members %}
    {% captureas label %}{% trans "Join" %}{% endcaptureas %}
    {% captureas extra_atts %}data-toggle="modal" data-target="#leave_join_group_modal"{% endcaptureas %}
    {% include "cosinnus/leftnav_button.html" with extra_classes="regular-space" icon="fa-sign-in" label=label href="#"  %}
    
    {% captureas label %}{% blocktrans with title=group.name %}Do you wish to request to join „{{ title }}“?{% endblocktrans %}{% endcaptureas %}
    {% captureas title %}{% trans "Join" %}{% endcaptureas %}
    {% captureas action %}{% group_url 'cosinnus:group-user-join' group=group %}{% endcaptureas %}
    
    {% include "cosinnus/modal_box.html" with id="leave_join_group_modal" label=label title=title form_action=action %}
{% endif %}

                