Files
vision/templates/document/view.html.twig
2023-03-28 13:16:55 +00:00

120 lines
4.8 KiB
Twig

{% extends 'base.html.twig' %}
{% block title %}{{ ('documentType_' ~ document.classShort)|trans }}: {{ document.getTitle }}{% endblock %}
{% block subtitle %}#{{ document.id }}: {{ document.getTitle }} {% endblock %}
{% block body %}
{% set groupLogo = 'img/nologo.png' %}
{% if document.mainGroup %}
{% if document.mainGroup.imageSize != 0 %}
{% set groupLogo = 'uploads/groups/' ~ document.mainGroup.imageName %}
{% endif %}
{% endif %}
<div class="row p-2">
<div class="col-lg-8 col-xs-12">
{% if document.archive %}
<div class="card prod-p-card bg-primary background-pattern-white">
<div class="card-body">
<div class="row align-items-center m-b-0">
<div class="col">
<h6 class="m-b-5 text-white">{% trans %}title_document_archived{% endtrans %}</h6>
</div>
<div class="col-auto">
<i class="fas fa-archive text-white"></i>
</div>
</div>
</div>
</div>
{% endif %}
{% if shared is not defined %}
{% if document.AllowShare %}
<div class="card prod-p-card bg-danger background-pattern-white">
<div class="card-body">
<div class="row align-items-center m-b-0">
<div class="col">
<h6 class="m-b-5 text-white">{% trans %}title_document_shared{% endtrans %}</h6>
</div>
<div class="col-auto">
<i class="fas fa-exclamation-triangle text-white"></i>
</div>
</div>
</div>
</div>
{% endif %}
{% endif %}
<div class="document-container p-2 mt-2">
<div class="row align-items-center">
<div class="col-12 col-xl-3">
<img src="{{ asset(groupLogo) }}" alt="{{document.mainGroup.shortname}}" class="img-fluid document-group-logo">
</div>
<div class="col">
<h1 style="color:beige;">{{document.mainGroup.name}}</h1>
<h2 style="color:beige;">{{ ('documentType_' ~ document.classShort)|trans }} #{{ document.getId }} : {{ document.getTitle }}</h2>
</div>
</div>
<hr>
<div class="row p-2">
<div class="col-12">
{% include 'document/types/' ~ document.classShort ~ '.html.twig' with {'document': document} %}
</div>
</div>
<hr>
<div class="row mb-2">
<div class="col-12 col-md-6">
{% if shared is not defined and history |length > 1 %}
<p>{% trans %}title_document_edited{% endtrans %} {{ history |length -1 }} {% trans %}since_its_creation{% endtrans %}. <a href="{{path('document_history', {'id': document.id})}}">{% trans %}button_view_history{% endtrans %}</a></p>
{% endif %}
</div>
<div class="col-12 col-md-6">
{{ document.creator.fullname }}, {% trans %}for{% endtrans %} {{ document.mainGroup.name }} <br>{% trans %}title_created_at{% endtrans %} {{ document.createdAt|date('_datetime.format'|trans) }}
{% if shared is not defined %}<span class="float-end">{% include '_cells/documentActions.html.twig' with {'document': document} %}</span> {% endif %}
</div>
</div>
</div>
<div class="row mt-5">
<div class="col-12">
<h3>{% trans %}title_comments{% endtrans %} {% if shared is not defined %}<a href="#addcomment"><span class="badge rounded-pill bg-success"><i class="fa fa-plus"></i> {% trans %}button_add_comment{% endtrans %}</span></a>{% endif %}</h3><hr>
<ul class="timeline">
{% for c in document.comments %}
<li>
{{ c.creator.fullname }} {{c.creator.mainGroup ? c.creator.mainGroup.shortname : 'No Group'}}, {% trans %}title_created_at{% endtrans %} {{ c.createdAt|date('_datetime.format'|trans) }}
<hr>
{{ c.content | raw }}
<span class="float-end">{% if shared is not defined %}{% include '_cells/commentActions.html.twig' with {'comment': c} %}{% endif %}</span>
</li>
{% endfor %}
</ul>
</div>
{% if shared is not defined %}
<div class="col-12" id="addcomment">
<h3>{% trans %}title_comment_add{% endtrans %}</h3><hr>
{{ form(formComment) }}
</div>
{% endif %}
</div>
</div>
<div class="col-lg-4 col-xs-12">
{% if document.directory is defined and document.directory is not null %}
<h3>{% trans %}title_directory_linked{% endtrans %}</h3><hr>
{% include '_cells/directoryCard.html.twig' with {'directory': document.directory} %}
{% endif %}
{% if document.user is defined and document.user is not null %}
<h3>{% trans %}title_user_linked{% endtrans %}</h3><hr>
{% include '_cells/userInformations.html.twig' with {'user': document.user} %}
{% endif %}
</div>
</div>
{% endblock %}