Email plein ecran avec suggestions d'adresses precedentes

- Formulaire email : overlay fullscreen au lieu d'inline (debordait de l'ecran)
- Historique emails : stocke chaque adresse dans data/emails_history.json
- Suggestions : affiche les emails deja saisis en pills cliquables,
  filtrees au fur et a mesure de la saisie
- API GET /api/emails/historique + DELETE pour reset

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 18:57:28 +02:00
parent e730b6bc8b
commit 0b7b55f57b
5 changed files with 108 additions and 7 deletions

View File

@@ -674,10 +674,16 @@ html, body {
}
.form-email {
position: fixed;
inset: 0;
z-index: 200;
background: var(--fond);
display: flex;
gap: 0.8rem;
flex-direction: column;
align-items: center;
margin: 1rem 0;
justify-content: center;
gap: 0.5rem;
padding: 1rem;
}
.form-email input {
@@ -686,8 +692,9 @@ html, body {
border-radius: 12px;
padding: 0.8rem 1.2rem;
color: var(--texte);
font-size: 1.1rem;
width: 300px;
font-size: 1.2rem;
width: min(90vw, 500px);
text-align: center;
outline: none;
}
@@ -695,6 +702,30 @@ html, body {
border-color: var(--primaire);
}
.email-suggestions {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
justify-content: center;
max-width: 90vw;
max-height: 4.5rem;
overflow-y: auto;
}
.email-suggestions button {
background: rgba(255,255,255,0.08);
border: 1px solid rgba(255,255,255,0.15);
border-radius: 20px;
color: var(--texte);
padding: 0.3rem 0.8rem;
font-size: 0.85rem;
cursor: pointer;
}
.email-suggestions button:active {
background: var(--primaire);
}
.zone-qr {
margin: 1rem 0;
}

View File

@@ -157,6 +157,7 @@
</div>
<div id="form-email" class="form-email cache">
<input type="email" id="input-email" placeholder="votre@email.com" autocomplete="off" readonly>
<div id="email-suggestions" class="email-suggestions"></div>
<div class="clavier-virtuel" id="clavier-email">
<div class="clavier-ligne">
<button onclick="clavierTape('1')">1</button>

View File

@@ -89,9 +89,10 @@ async function lancerImpression() {
}
}
function ouvrirEmail() {
async function ouvrirEmail() {
document.getElementById('form-email').classList.remove('cache');
document.getElementById('input-email').value = '';
await chargerSuggestionsEmail();
}
function fermerEmail() {
@@ -99,14 +100,39 @@ function fermerEmail() {
document.getElementById('input-email').value = '';
}
async function chargerSuggestionsEmail() {
const container = document.getElementById('email-suggestions');
container.innerHTML = '';
const data = await apiGet('/api/emails/historique').catch(() => null);
if (!data || !data.emails || data.emails.length === 0) return;
for (const email of data.emails) {
const btn = document.createElement('button');
btn.textContent = email;
btn.onclick = () => {
document.getElementById('input-email').value = email;
};
container.appendChild(btn);
}
}
function clavierTape(car) {
const input = document.getElementById('input-email');
input.value += car;
filtrerSuggestionsEmail();
}
function clavierEffacer() {
const input = document.getElementById('input-email');
input.value = input.value.slice(0, -1);
filtrerSuggestionsEmail();
}
function filtrerSuggestionsEmail() {
const val = document.getElementById('input-email').value.toLowerCase();
const btns = document.querySelectorAll('#email-suggestions button');
btns.forEach(btn => {
btn.style.display = (!val || btn.textContent.includes(val)) ? '' : 'none';
});
}
async function envoyerEmail() {