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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user