mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Add vizualisation of public views in the workflow history
This commit is contained in:
parent
b99ea3b17a
commit
40b8fae8ba
@ -183,8 +183,45 @@ class EntityWorkflowSend implements TrackCreationInterface
|
||||
return $this->views->count() > 0;
|
||||
}
|
||||
|
||||
public function isExpired(\DateTimeImmutable $now): bool
|
||||
public function isExpired(?\DateTimeImmutable $now = null): bool
|
||||
{
|
||||
return $now >= $this->expireAt;
|
||||
return ($now ?? new \DateTimeImmutable('now')) >= $this->expireAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the most recent view.
|
||||
*
|
||||
* @return EntityWorkflowSendView|null returns the last view or null if there are no views
|
||||
*/
|
||||
public function getLastView(): ?EntityWorkflowSendView
|
||||
{
|
||||
$last = null;
|
||||
foreach ($this->views as $view) {
|
||||
if (null === $last) {
|
||||
$last = $view;
|
||||
} else {
|
||||
if ($view->getViewAt() > $last->getViewAt()) {
|
||||
$last = $view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $last;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an array of views grouped by their remote IP address.
|
||||
*
|
||||
* @return array<string, list<EntityWorkflowSendView>> an associative array where the keys are IP addresses and the values are arrays of views associated with those IPs
|
||||
*/
|
||||
public function getViewsByIp(): array
|
||||
{
|
||||
$views = [];
|
||||
|
||||
foreach ($this->getViews() as $view) {
|
||||
$views[$view->getRemoteIp()][] = $view;
|
||||
}
|
||||
|
||||
return $views;
|
||||
}
|
||||
}
|
||||
|
@ -134,6 +134,13 @@
|
||||
{{ include('@ChillMain/Workflow/_signature_list.html.twig', {'signatures': step.signatures, is_small: true }) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if step.sends|length > 0 %}
|
||||
<div>
|
||||
<p><b>{{ 'workflow.sent_through_secured_link'|trans }}</b></p>
|
||||
|
||||
{{ include('@ChillMain/Workflow/_send_views_list.html.twig', {'sends': step.sends}) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
|
@ -0,0 +1,35 @@
|
||||
<div class="container">
|
||||
{% for send in sends %}
|
||||
<div class="row row-hover align-items-center">
|
||||
<div class="col-sm-12 col-md-5">
|
||||
{% if send.destineeKind == 'thirdParty' %}
|
||||
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
|
||||
action: 'show', displayBadge: true,
|
||||
targetEntity: { name: 'thirdParty', id: send.destineeThirdParty.id },
|
||||
buttonText: send.destineeThirdParty|chill_entity_render_string,
|
||||
} %}
|
||||
{% else %}
|
||||
<a href="mailto:{{ send.destineeEmail }}">{{ send.destineeEmail }}</a>
|
||||
{% endif %}
|
||||
{% if not send.expired %}
|
||||
<p><small>{{ 'workflow.send_external_message.document_available_until'|trans({'expiration': send.expireAt}) }}</small></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-7 text-end">
|
||||
<p><small>{{ 'workflow.external_views.number_of_views'|trans({'numberOfViews': send.views|length}) }}</small></p>
|
||||
{% if send.views|length > 0 %}
|
||||
<p><small>{{ 'workflow.external_views.last_view_at'|trans({'at': send.lastView.viewAt }) }}</small></p>
|
||||
<p>
|
||||
<small>
|
||||
<b>{{ 'workflow.public_views_by_ip'|trans }} :</b>
|
||||
{%- for ip, vs in send.viewsByIp -%}
|
||||
<span title="{% for v in vs %}{{ v.viewAt|format_datetime('short', 'short')|escape('html_attr') }}{% if not loop.last %}{{ ', '|escape('html_attr') }}{% endif %}{% endfor %}">{{ ip }} ({{ vs|length }}x)</span>
|
||||
{%- endfor -%}
|
||||
</small>
|
||||
</p>
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
@ -1,12 +1,11 @@
|
||||
{% extends '@ChillMain/layout.html.twig' %}
|
||||
|
||||
{% block title %}
|
||||
{% block title -%}
|
||||
{{ 'Workflow'|trans }}
|
||||
{% endblock %}
|
||||
{%- endblock %}
|
||||
|
||||
{% block js %}
|
||||
{{ parent() }}
|
||||
{{ encore_entry_script_tags('mod_async_upload') }}
|
||||
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
||||
{{ encore_entry_script_tags('mod_entity_workflow_subscribe') }}
|
||||
{{ encore_entry_script_tags('page_workflow_show') }}
|
||||
|
@ -69,6 +69,14 @@ workflow:
|
||||
}
|
||||
send_external_message:
|
||||
document_available_until: Le lien sera valable jusqu'au {expiration, date, long} à {expiration, time, short}.
|
||||
external_views:
|
||||
last_view_at: Dernière vue le {at, date, long} à {at, time, short}
|
||||
number_of_views: >-
|
||||
{numberOfViews, plural,
|
||||
=0 {Le partage n'a jamais été visualisé}
|
||||
=1 {Le partage a été visualisé une fois}
|
||||
other {Le partage a été visualisé # fois}
|
||||
}
|
||||
public_link:
|
||||
shared_explanation_until_remaining: >-
|
||||
Ce partage sera actif jusqu'au {expireAt, time, short} à {expireAt, time, short}. {viewsCount, plural,
|
||||
|
@ -564,14 +564,13 @@ workflow:
|
||||
transition_destinee_add_emails: Ajouter une adresse de courriel
|
||||
transition_destinee_remove_emails: Supprimer
|
||||
transition_destinee_emails_help: Le lien sécurisé sera envoyé à chaque adresse indiquée
|
||||
sent_through_secured_link: Envoi par lien sécurisé
|
||||
public_views_by_ip: Visualisation par adresse IP
|
||||
|
||||
public_link:
|
||||
expired_link_title: Lien expiré
|
||||
expired_link_explanation: Le lien a expiré, vous ne pouvez plus visualiser ce document.
|
||||
|
||||
|
||||
|
||||
|
||||
signature_zone:
|
||||
title: Signatures électroniques
|
||||
button_sign: Signer
|
||||
|
Loading…
x
Reference in New Issue
Block a user