{% extends 'creme_core/bricks/base/paginated-list.html' %} {% load i18n creme_bricks creme_perms creme_widgets %} {% load uca_sort url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} creme_config-workflows-brick{% endblock %} {% block brick_header_title %} {% brick_header_title title=_('{count} Configurable type of resource') plural=_('{count} Configurable types of resource') empty=_('Configurable types of resource') %} {% endblock %} {% block brick_content %} {% with admin_perm=user|has_perm_to_admin:'creme_core' delete_url='creme_config__delete_workflow'|url %} {% for workflow_group in page.object_list %} {% with ctype=workflow_group.ctype %}
{% widget_icon ctype=ctype size='brick-list' class='workflow-config-type-icon' %} {{ctype}}
{% blocktranslate asvar creation_label %}Create a Workflow for «{{ctype}}»{% endblocktranslate %} {% brick_action id='add' url='creme_config__create_workflow'|url:ctype.id label=creation_label enabled=admin_perm %}
{% for workflow in workflow_group.workflows %}
{% if workflow.enabled %} {% brick_action id='update' url='creme_config__disable_workflow'|url:workflow.id label=_('Disable') display='text' enabled=admin_perm %} {% else %} {% brick_action id='update' url='creme_config__enable_workflow'|url:workflow.id label=_('Enable') display='text' enabled=admin_perm %} {% endif %} {% if workflow.is_custom %} {% brick_action id='delete' url=delete_url __id=workflow.id enabled=admin_perm %} {% endif %}

{{workflow.title}} {% brick_action id='edit' url='creme_config__rename_workflow'|url:workflow.id label=_('Rename') enabled=admin_perm %}

{% translate "Trigger" %}

{{workflow.trigger.description}}

{% translate "Conditions" %} {% if workflow.is_custom %} {% brick_action id='edit' url='creme_config__edit_workflow_conditions'|url:workflow.id label=_('Edit the conditions') enabled=admin_perm %} {% endif %}

{% with rendered_conditions=workflow.rendered_conditions %} {% if rendered_conditions %}
    {% for source_conditions in rendered_conditions %}
  • {{source_conditions}}
  • {% endfor %}
{% else %} {% translate 'No condition' %} {% endif %} {% endwith %}

{% blocktranslate count counter=workflow.rendered_actions|length %}{{counter}} Action{% plural %}{{counter}} Actions{% endblocktranslate %} {% if workflow.is_custom %} {% brick_action id='add' url='creme_config__add_workflow_action'|url:workflow.id label=_('Add an action') enabled=admin_perm %} {% endif %}

    {% with delete_action_url='creme_config__delete_workflow_action'|url:workflow.id %} {% for rendered_action in workflow.rendered_actions %}
  • {{rendered_action}}
    {% if workflow.is_custom %}
    {% url 'creme_config__edit_workflow_action' workflow.id forloop.counter0 as edit_action_url %} {% brick_action id='edit' url=edit_action_url label=_('Edit this action') enabled=admin_perm %} {% brick_action id='delete' url=delete_action_url __index=forloop.counter0 label=_('Delete this action') enabled=admin_perm %}
    {% endif %}
  • {% endfor %} {% endwith %}
{% empty %} {% translate 'No Workflow for this type of resource' %} {% endfor %}
{% endwith %} {% endfor %} {% endwith %} {% endblock %} {% block brick_table_empty %} {% translate 'No Workflow for the moment' %} {% endblock %}