workflows: add freeze mechanism on breadcrumbs, edit document button, and history

This commit is contained in:
Mathieu Jaumotte 2022-01-21 23:23:52 +01:00
parent ab23290599
commit 917dd49d07
4 changed files with 54 additions and 28 deletions

View File

@ -21,24 +21,28 @@
</div> </div>
</div> </div>
{% set freezed = false %}
{% for step in entity_workflow.stepsChained %}
{% if loop.last %}
{% if step.previous is not null and step.previous.freezeAfter == true %}
{% set freezed = true %}
{% endif %}
{% endif %}
{% endfor %}
{% if display_action is defined and display_action == true %} {% if display_action is defined and display_action == true %}
<ul class="record_actions"> <ul class="record_actions">
<li> <li>
{{ m.download_button(document.object, document.title) }} {{ m.download_button(document.object, document.title) }}
</li> </li>
<li> <li>
{% if not freezed %}
{# {% set button = {
data-button is optional ! 'changeIcon': 'fa-unlock',
OPTIONS: } %}{#
'changeIcon' string
'changeClass' string 'changeClass' string
'noText' boolean 'noText' boolean
#}
#}{% set button = {
'changeIcon': 'fa-unlock',
} %}
{# vue component #} {# vue component #}
<span <span
data-module="wopi-link" data-module="wopi-link"
@ -47,6 +51,11 @@
data-doc-type="{{ document.object.type|e('html_attr') }}" data-doc-type="{{ document.object.type|e('html_attr') }}"
data-button="{{ button|json_encode }}" data-button="{{ button|json_encode }}"
></span> ></span>
{% else %}
<a class="btn btn-update change-icon disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
<i class="fa fa-lock me-2"></i>{{ 'Update document'|trans }}
</a>
{% endif %}
</li> </li>
</ul> </ul>
{% endif %} {% endif %}

View File

@ -4,26 +4,34 @@
{% for step in entity_workflow.stepsChained %} {% for step in entity_workflow.stepsChained %}
<div class="item-bloc {{ 'bloc' ~ step.id }} {% if loop.first %}initial{% endif %}"> <div class="item-bloc {{ 'bloc' ~ step.id }} {% if loop.first %}initial{% endif %}">
<div class="item-row"> <div class="item-row">
{% if loop.first and step.next is null %} {% if loop.first and step.next is null %}
<div class="item-col"> <div class="item-col">
{{ 'workflow.No transitions'|trans }} {{ 'workflow.No transitions'|trans }}
</div> </div>
{% endif %} {% else %}
<div class="item-col flex-column align-items-end"> <div class="item-col">
<div class="decided"> {% if step.previous is not null and step.previous.freezeAfter == true %}
{% if not loop.first %} <i class="fa fa-snowflake-o fa-sm me-1" title="{{ 'workflow.Freezed'|trans }}"></i>
<i class="fa fa-check fa-fw text-success"></i>
{% endif %} {% endif %}
{{ step.currentStep }}
</div> </div>
{# <div class="item-col flex-column align-items-end">
<div class="decided"> <div class="decided">
<i class="fa fa-times fa-fw text-danger"></i> {% if not loop.first %}
Refusé <i class="fa fa-check fa-fw text-success"></i>
{% endif %}
{{ step.currentStep }}
</div>
{#
<div class="decided">
<i class="fa fa-times fa-fw text-danger"></i>
Refusé
</div>
#}
</div> </div>
#} {% endif %}
</div>
</div> </div>
{% if step.next is not null %} {% if step.next is not null %}
<div class="item-row separator"> <div class="item-row separator">

View File

@ -11,14 +11,18 @@
</ul> </ul>
{% endmacro %} {% endmacro %}
{% macro popoverTitle(step) %}
{% if step.previous is not null and step.previous.freezeAfter == true %}
<i class="fa fa-snowflake-o fa-sm me-1" title="{{ 'workflow.Freezed'|trans }}"></i>
{% endif %}
{{ step.currentStep }}
{% endmacro %}
{% macro breadcrumb(_ctx) %} {% macro breadcrumb(_ctx) %}
<div class="breadcrumb"> <div class="breadcrumb">
{% for step in _ctx.entity_workflow.stepsChained %} {% for step in _ctx.entity_workflow.stepsChained %}
{% set popTitle = _self.popoverTitle(step) %}
{% if step.previous is null %} {% if step.previous is null %}
{#
{% set popContent = "Point de départ du workflow" %}
{{ dump(step) }}
#}
{% set popContent = _self.popoverContent(step) %} {% set popContent = _self.popoverContent(step) %}
{% else %} {% else %}
{% set popContent = _self.popoverContent(step.previous) %} {% set popContent = _self.popoverContent(step.previous) %}
@ -29,12 +33,15 @@
data-bs-toggle="popover" data-bs-toggle="popover"
data-bs-placement="bottom" data-bs-placement="bottom"
data-bs-custom-class="workflow-transition" data-bs-custom-class="workflow-transition"
title="{{ step.currentStep }}" title="{{ popTitle|e('html_attr') }}"
data-bs-content="{{ popContent|e('html_attr') }}" data-bs-content="{{ popContent|e('html_attr') }}"
> >
{% if step.currentStep == 'initial' %} {% if step.currentStep == 'initial' %}
<i class="fa fa-circle me-1 text-chill-yellow"></i> <i class="fa fa-circle me-1 text-chill-yellow"></i>
{% endif %} {% endif %}
{% if step.previous is not null and step.previous.freezeAfter == true %}
<i class="fa fa-snowflake-o fa-sm me-1" title="{{ 'workflow.Freezed'|trans }}"></i>
{% endif %}
{{ step.currentStep }} {{ step.currentStep }}
</span> </span>
{% if not loop.last %} {% if not loop.last %}

View File

@ -371,6 +371,8 @@ workflow:
Transition: Prochaine étape Transition: Prochaine étape
dest for next steps: Utilisateurs qui valideront la prochaine étape dest for next steps: Utilisateurs qui valideront la prochaine étape
Freeze: Geler Freeze: Geler
Freezed: Gelé
freezed document: Le document est gelé
The associated element will be freezed: L'élément associé sera gelé et ne pourra plus être modifié après cette décision. The associated element will be freezed: L'élément associé sera gelé et ne pourra plus être modifié après cette décision.
Finalize: Étape finale Finalize: Étape finale
The workflow will be finalized: Le suivi est clôturé lors de cette décision. The workflow will be finalized: Le suivi est clôturé lors de cette décision.