Commit 29c40459 authored by Mat's avatar Mat
Browse files

Lettre, améliore encore l'affichage des rangées

parent 28fc625f
......@@ -98,7 +98,7 @@
<tr>
<th scope="col">#</th>
<th scope="col">Statut</th>
<th scope="col">Contenu de l'infolettre</th>
<th scope="col">Contenu</th>
<th scope="col">Référence</th>
</tr>
</thead>
......@@ -115,7 +115,7 @@
<tr>
<th scope="col">#</th>
<th scope="col">Statut</th>
<th scope="col">Contenu de l'infolettre</th>
<th scope="col">Contenu</th>
<th scope="col">Référence</th>
</tr>
</thead>
......@@ -130,7 +130,7 @@
<tr>
<th scope="col">#</th>
<th scope="col">Statut</th>
<th scope="col">Contenu de l'infolettre</th>
<th scope="col">Contenu</th>
<th scope="col">Référence</th>
</tr>
</thead>
......
......@@ -51,7 +51,7 @@ function buildRowLettre(jsonRow)
td1.textContent = jsonRow.id;
tr.appendChild(td1);
let td7 = document.createElement('td');
let td2 = document.createElement('td');
let listStatus = { 'draft': 'En préparation', 'current': 'Prête', 'sent': 'Envoyée', 'closed': 'Archivée' };
for (let statut in listStatus)
{
......@@ -60,53 +60,54 @@ function buildRowLettre(jsonRow)
if (jsonRow.status === 'draft' || jsonRow.status === 'current'
&& typeof jsonRow.offre !== 'undefined')
{
td7.appendChild(changeStatus(jsonRow));
td2.appendChild(changeStatus(jsonRow));
}
else
{
let couleurs = {'draft': 'warning', 'current': 'danger', 'sent': 'success', 'closed': 'muted'};
let fa = buildColorSquare(jsonRow.status, couleurs);
td7.innerHTML = fa + listStatus[statut];
td2.innerHTML = fa + listStatus[statut];
}
}
}
tr.appendChild(td7);
tr.appendChild(td2);
let td4 = document.createElement('td');
td4.innerHTML = `<dl>
let offreLink = Routing.generate('potage_offre_legumes_ajax_display', {'id': jsonRow.offre.id });
let abonnes = jsonRow.groupe.utilisateurs.length + ' abonné' + (jsonRow.groupe.utilisateurs.length > 1 ? 's' : '');
let td3 = document.createElement('td');
td3.innerHTML = `<dl>
<dt>Pour:</dt>
<dd>
groupe ${jsonRow.groupe.nom}
<span class="details parenth"><i class="fas fa-user fa-fw"></i> ${jsonRow.groupe.utilisateurs.length}</span>
<span class="details parenth"><i class="fas fa-user fa-fw"></i> ${abonnes}</span>
</dd>
<dt>Sujet:</dt>
<dd>
${jsonRow.subject}
</dd>
<dt>Période:</dt>
<dd>
${formatStringDate(jsonRow.started_at, true, true, true, true)}
${formatStringDate(jsonRow.ended_at, true, true, true, true)}
${formatStringDate(jsonRow.started_at, true, true, false, false)}
${formatStringDate(jsonRow.ended_at, true, true, false, false)}
</dd>
<dt><i class="fas fa-paperclip fa-fw"></i></dt>
<dt>Offre:</dt>
<dd>
${jsonRow.offre.reference}
</dd>
<a href="${offreLink}" title="Voir l'offre" class="btn btn-outline-dark btn-sm">
<i class="fas fa-paperclip fa-fw"></i> ${jsonRow.offre.reference}</a>
</dd>
</dl>`;
tr.appendChild(td4);
tr.appendChild(td3);
let td6 = document.createElement('td');
let td4 = document.createElement('td');
let toolbarBtn = document.createElement('div');
toolbarBtn.classList.add('btn-toolbar');
toolbarBtn.appendChild(displayEditLettreLink(jsonRow));
(jsonRow.status === 'draft') ? toolbarBtn.appendChild(displayDeleteLettre(jsonRow)) : null;
td6.appendChild(toolbarBtn);
tr.appendChild(td6);
td4.appendChild(toolbarBtn);
tr.appendChild(td4);
return tr;
}
......
......@@ -72,6 +72,7 @@ function buildRowOffre(jsonRow)
tr.appendChild(td5);
let td6 = document.createElement('td');
let referenceBtn = document.createElement('a');
let href = Routing.generate('potage_offre_legumes_ajax_display', {'id': jsonRow.id });
referenceBtn.setAttribute('href', href);
......@@ -79,6 +80,7 @@ function buildRowOffre(jsonRow)
referenceBtn.classList.add('btn', 'btn-outline-dark', 'btn-sm', 'mb-1', 'mr-1');
referenceBtn.textContent = jsonRow.reference;
td6.appendChild(referenceBtn);
if (jsonRow.status === 'draft')
{
td6.appendChild(displayDeleteOffre(jsonRow));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment