nineskeletor/templates/Audit/render.html.twig

68 lines
2.5 KiB
Twig

<div class="card mt-3" >
<div class="card-header" onClick="switchAudit()">
<i class="fas fa-eye fa-fw"></i> Audit
<div id="btnaudit" class="btn btn-secondary float-end btn-sm" style="font-family:var(--fontbody)">
{%if not app.session.get("fgaudit")%}Afficher{%else%}Masquer{%endif%}</div>
</div>
<div id="bodyaudit" class="card-body" style="{%if not app.session.get("fgaudit")%}display:none;{%endif%}">
<table class="table table-striped table-bordered table-hover dataTable" style="width:100%; zoom:80%">
<thead>
<tr>
<th>Date</th>
<th>Par</th>
<th>Action</th>
<th>Détail</th>
</tr>
</thead>
<tbody>
{% for audit in audits|reverse %}
<tr>
<td>{{audit.datesubmit|date("d/m/Y H:i")}}</td>
<td>{{audit.username}}</td>
<td>{{audit.description}}</td>
<td>
<small>
{% for key, detail in audit.detail %}
{% if audit.description=="UPDATE" %}
<strong>{{key}}</strong> =
de {%if detail[0] is empty%}null {%else%}{{detail[0]|join(', ')}}{%endif%}
à {%if detail[1] is empty%}null {%else%} {{detail[1]|join(', ')}}{%endif%}
</br>
{% else %}
<strong>id</strong> {{detail}}
{% endif %}
{% endfor %}
</small>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script>
function switchAudit() {
{% if app.user %}
$.ajax({
method: "POST",
url: "{{ path('app_all_preference') }}",
data: {
id:0,
key:'fgaudit',
value: !($("#bodyaudit").is(":visible"))
},
success: function() {
}
});
$("#bodyaudit").toggle();
if($("#bodyaudit").is(":visible"))
$("#btnaudit").html("Masquer");
else
$("#btnaudit").html("Afficher");
{% endif %}
}
</script>