eo_conges: add copy report button (#80250)
gitea/barbacompta/pipeline/head This commit looks good Details

This commit is contained in:
Valentin Deniaud 2023-08-03 13:54:41 +02:00
parent 1449ce2bc3
commit 5ef6a010ef
2 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,14 @@
const button = document.getElementById('copy-report');
button.addEventListener("click", (event) => {
var text = '';
document.querySelectorAll('.worker').forEach(el => {
el.querySelectorAll('span').forEach(el => {
text += el.textContent + '\n';
})
text += '\n';
})
navigator.clipboard.writeText(text.trim());
button.innerHTML = 'Copié !';
button.removeAttribute('href');
});

View File

@ -6,6 +6,11 @@
<link rel="stylesheet" type="text/css" href="{% static "css/conges.css" %}"/>
{% endblock %}
{% block extrahead %}
{{ block.super }}
<script type="text/javascript" src="{% static "js/conges.js" %}" defer></script>
{% endblock %}
{% block content %}
<a href="{{ view.get_previous_month_url }}">Mois précédent</span></a> -
<a href="{{ view.get_next_month_url }}">Mois suivant</span></a>
@ -21,6 +26,7 @@
{% endif %}
<h2>Rapport :</h2>
<p><a id="copy-report" href="">Copier le rapport</a></p>
{% for worker in workers %}
<p class='worker'>
<span>{{ worker.display_name }} (matricule {{ worker.number }})</span>