integreat_cms/cms/templates/organizations/organization_form.html
{% extends "_base.html" %}
{% load i18n %}
{% load static %}
{% load widget_tweaks %}
{% load content_filters %}
{% load page_filters %}
{% load tree_filters %}
{% block content %}
<form method="post" enctype="multipart/form-data" data-unsaved-warning>
{% csrf_token %}
<div class="flex justify-between mb-4">
<h1 class="heading">
{% if form.instance.id %}
{% blocktranslate trimmed with organization_name=form.instance.name %}
Edit organization "{{ organization_name }}"
{% endblocktranslate %}
{% else %}
{% translate "Create new organization" %}
{% endif %}
</h1>
<div class="flex flex-wrap justify-between gap-4">
{% if form.instance.id and perms.cms.delete_organization %}
<div class="flex flex-wrap gap-4">
{% if form.instance.is_used %}
<button title="{{ cannot_delete_title }}" class="btn" disabled>
<i icon-name="trash-2" class="mr-2"></i>
{% translate "Delete" %}
</button>
{% else %}
<button type="button"
title="{% translate "Delete organization" %}"
class="btn confirmation-button btn-red"
data-confirmation-title="{{ delete_dialog_title }}"
data-confirmation-text="{{ delete_dialog_text }}"
data-confirmation-subject="{{ form.name.value }}"
data-action="{% url "delete_organization" region_slug=request.region.slug organization_id=form.instance.id %}">
<i icon-name="trash-2" class="mr-2"></i>
{% translate "Delete" %}
</button>
{% endif %}
</div>
{% endif %}
{% if perms.cms.change_organization %}
<div class="flex flex-wrap gap-4">
{% if form.instance.id %}
<button class="btn">
{% translate "Update" %}
</button>
{% else %}
<button class="btn">
{% translate "Create" %}
</button>
{% endif %}
</div>
{% endif %}
</div>
</div>
<div class="grid xl:grid-cols-2 gap-4">
<div class="mb-4 rounded border border-solid border-blue-500 shadow-2xl bg-white">
<div class="p-4 rounded bg-water-500">
<h3 class="heading font-bold text-black">
<i icon-name="umbrella" class="mr-2"></i> {% translate "General Settings" %}
</h3>
</div>
<div class="px-4 pb-4">
<!-- General Options for organization management -->
<label for="{{ form.name.id_for_label }}">
{{ form.name.label }}
</label>
{% render_field form.name|add_error_class:"border-red-500" %}
<label for="{{ form.website.id_for_label }}">
{{ form.website.label }}
</label>
{% render_field form.website %}
</div>
</div>
<div class="mb-4 rounded border border-solid border-blue-500 shadow-2xl bg-white">
<div class="p-4 rounded bg-water-500">
<h3 class="heading font-bold text-black">
<i icon-name="settings" class="mr-2"></i> {% translate "Extended Settings" %}
</h3>
</div>
<div class="px-4 pb-4">
<label for="{{ form.icon.id_for_label }}">
{{ form.icon.label }}
</label>
{% render_field form.icon label=form.icon.label %}
</div>
</div>
</div>
{% if form.instance.id %}
{% get_current_language as LANGUAGE_CODE %}
{% get_language LANGUAGE_CODE as backend_language %}
{% with request.region.default_language as region_default_language %}
<div class="grid xl:grid-cols-2 gap-4">
<div class="mb-4 rounded border border-solid border-blue-500 shadow-2xl bg-white">
<div class="p-4 rounded bg-water-500">
<h3 class="heading font-bold text-black">
<i icon-name="layout" class="mr-2"></i>
{% translate "Pages and locations" %}
</h3>
</div>
{% include "../_related_contents_table.html" with contents=form.instance.pages.all table_title=_("Pages") no_content_message=_("This organization currently has no maintained pages.") %}
{% include "../_related_contents_table.html" with contents=form.instance.pois.all table_title=_("Locations") no_content_message=_("This organization currently has no maintained locations.") %}
</div>
{% endwith %}
<div class="mb-4 rounded border border-solid border-blue-500 shadow-2xl bg-white">
<div class="p-4 rounded bg-water-500">
<h3 class="heading font-bold text-black">
<i icon-name="users" class="mr-2"></i>
{% translate "Members" %}
</h3>
</div>
<div class="table-listing w-full px-4 pb-4">
<table class="w-full mt-4 rounded border border-solid border-gray-200 shadow bg-white">
<thead>
<tr class="border-b border-solid border-gray-200">
<th class="text-sm text-left uppercase py-3 pl-4 pr-2">
{% translate "Username" %}
</th>
<th class="text-sm text-left uppercase py-3 pl-4 pr-2">
{% translate "Role" %}
</th>
</tr>
</thead>
<tbody>
{% for member in form.instance.members.all %}
<tr class="border-b border-solid border-gray-200">
<td class="text-sm text-left py-3 pl-4 pr-2 text-ellipsis text-gray-800">
{{ member.username }}
</td>
<td class="text-sm text-left py-3 pl-4 pr-2 text-ellipsis text-gray-800">
{{ member.role }}
</td>
</tr>
{% empty %}
<tr>
<td colspan="6" class="px-4 py-3">
{% translate "This organization currently has no members." %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
</form>
{% include "generic_confirmation_dialog.html" %}
{{ media_config_data|json_script:"media_config_data" }}
{% endblock content %}