{% extends 'creme_core/bricks/base/paginated-list.html' %} {% load i18n creme_widgets creme_bricks %} {% load has_perm_to url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} creme_config-customforms-brick{% endblock %} {% block brick_script %} {% endblock %} {% block brick_header_title %} {% brick_header_title title=_('{count} Configured type of resource') plural=_('{count} Configured types of resource') icon='config' %} {% endblock %} {% block brick_content %} {% has_perm_to admin 'creme_core' as admin_perm %}{% url 'creme_config__delete_custom_form' as delete_url %}{% url 'creme_config__reset_custom_form' as reset_url %} {% for ctw in page.object_list %} {% with ctype=ctw.ctype %}
{% widget_icon ctype=ctype size='brick-list' class='customform-config-type-icon' %}{{ctype}} {% translate 'Show details' %} {% translate 'Hide details' %}

{% translate 'Drag and drop the groups to order them.' %}

{% for descriptor in ctw.descriptors %}
{{descriptor.verbose_name}} {% if descriptor.items|length < max_conf_count %} {% brick_action id='add' url='creme_config__create_custom_form'|url:descriptor.id label=_('Add a form for a role') display='both' enabled=admin_perm %} {% endif %}
{% for item in descriptor.items %}
{{item.verbose_name}} {% brick_action id='delete' url=reset_url __id=item.id label=_('Reset this form') help_text=_('Set the configuration the form gets after a fresh installation') icon='refresh' display='both' enabled=admin_perm %} {% if item.can_be_deleted %}{% brick_action id='delete' url=delete_url __id=item.id label=_('Delete this form') help_text=_('Delete this configuration of the form') display='both' enabled=admin_perm %}{% endif %}
{% url 'creme_config__delete_custom_form_cell' item.id as delete_cell_url %}
{% for group in item.groups %} {% with form_group_id=forloop.counter0 layout=group.layout %}{% url 'creme_config__setlayout_custom_form_group' item.id form_group_id as layout_url %} {% endwith %} {% endfor %}
{% if layout == LAYOUT_REGULAR %} {% brick_action id='update' url=layout_url __layout='dual_second' icon='next' label=_('Display this group on the second half only') enabled=admin_perm %} {% elif layout == LAYOUT_DUAL_SECOND %} {% brick_action id='update' url=layout_url __layout='regular' icon='previous' label=_('Display this group on the whole width') enabled=admin_perm %} {% endif %} {{group.name}} {% if not group.extra_group_id %}{% url 'creme_config__edit_custom_form_group' item.id form_group_id as edit_url %} {% brick_action id='edit' url=edit_url label=_('Edit this group') enabled=admin_perm %} {% endif %} {% brick_action id='delete' url='creme_config__delete_custom_form_group'|url:item.id __group_id=form_group_id label=_('Delete this group') enabled=admin_perm %} {% if layout == LAYOUT_REGULAR %} {% brick_action id='update' url=layout_url __layout='dual_first' icon='previous' label=_('Display this group on the first half only') enabled=admin_perm %} {% elif layout == LAYOUT_DUAL_FIRST %} {% brick_action id='update' url=layout_url __layout='regular' icon='next' label=_('Display this group on the whole width') enabled=admin_perm %} {% endif %}
{% for cell in group.cells %} {% endfor %}
{{cell}} {% brick_action id='delete' url=delete_cell_url __cell_key=cell.key label=_('Delete this field') enabled=admin_perm %}
{% brick_action id='add' url='creme_config__add_custom_form_group'|url:item.id label=_('Add a group') display='both' enabled=admin_perm %} {% if item.has_extra_groups %} {% brick_action id='add' url='creme_config__add_custom_form_extra_group'|url:item.id label=_('Add a special group') display='both' enabled=admin_perm %} {% endif %}
{% with errors=item.errors %} {% if errors %}
    {% for error in errors %}
  • {{error}}
  • {% endfor %}
{% endif %} {% endwith %}
{% endfor %}
{% endfor %}
{% endwith %} {% endfor %} {% endblock %} {% block brick_list_empty %} {% translate 'No custom form' %} {% endblock %}