Commit 2a14cfd0 authored by Mat's avatar Mat

Fix camelCase naming for js properties

parent 5922fc19
......@@ -12,7 +12,7 @@ parameters:
app.path.legume_images: /uploads/images/legumes
# Fixe le nommage des variables de plusieurs mots
# Attention, ça va disfonctionner, il faut repasser dans tous les javascripts !!!!
# jms_serializer.camel_case_naming_strategy.class: JMS\Serializer\Naming\IdenticalPropertyNamingStrategy
jms_serializer.camel_case_naming_strategy.class: JMS\Serializer\Naming\IdenticalPropertyNamingStrategy
framework:
#esi: ~
......
......@@ -75,11 +75,11 @@ function buildRowInfo(jsonRow)
let td3 = document.createElement('td');
td3.textContent =
(typeof jsonRow.posted_at !== 'undefined') ?
formatStringDateTime(jsonRow.posted_at, true) :
(typeof jsonRow.updated_at === 'undefined') ?
formatStringDateTime(jsonRow.created_at, true) :
formatStringDateTime(jsonRow.updated_at, true);
(typeof jsonRow.postedAt !== 'undefined') ?
formatStringDateTime(jsonRow.postedAt, true) :
(typeof jsonRow.updatedAt === 'undefined') ?
formatStringDateTime(jsonRow.createdAt, true) :
formatStringDateTime(jsonRow.updatedAt, true);
tr.appendChild(td3);
let subtitle;
......@@ -178,7 +178,7 @@ function displayEditInfo(jsonRow)
boolTriggerHideTarget(isPost, postDate);
form.querySelector('#info_postedAt').value =
(form.querySelector('#info_isPost').value === "1") ? formatDateTimeISO(json.posted_at) : null;
(form.querySelector('#info_isPost').value === "1") ? formatDateTimeISO(json.postedAt) : null;
form.querySelector('#info_title').value = json.title;
form.querySelector('#info_subtitle').value = json.subtitle ? json.subtitle : null ;
......
......@@ -90,14 +90,14 @@ function buildRowLegume(jsonRow)
(jsonRow.description ? jsonRow.description + '<br>' : '')
+ (jsonRow.origine ? '<span class="details">Origine: ' + jsonRow.origine + '</span><br>' : '')
+ '<span class="details">'
+ (jsonRow.quantite_min ? ' Min:' + jsonRow.quantite_min : '')
+ (jsonRow.quantite_max ? ' | Max:' + jsonRow.quantite_max : '')
+ (jsonRow.quantite_step ? ' | Step:' + jsonRow.quantite_step : '')
+ (jsonRow.quantiteMin ? ' Min:' + jsonRow.quantiteMin : '')
+ (jsonRow.quantiteMax ? ' | Max:' + jsonRow.quantiteMax : '')
+ (jsonRow.quantiteStep ? ' | Step:' + jsonRow.quantiteStep : '')
+ '</span>';
tr.appendChild(td4);
let td5 = document.createElement('td');
td5.textContent = jsonRow.prix_unitaire + '';
td5.textContent = jsonRow.prixUnitaire + '';
tr.appendChild(td5);
let td6 = document.createElement('td');
......@@ -142,11 +142,11 @@ function displayEditLegume(jsonRow)
boolTriggerHideTarget(legumeRevente, legumeOrigine);
form.querySelector('#legume_description').value = json.description;
form.querySelector('#legume_quantiteMin').value = json.quantite_min ? json.quantite_min : null;
form.querySelector('#legume_quantiteMax').value = json.quantite_max ? json.quantite_max : null;
form.querySelector('#legume_quantiteStep').value = json.quantite_step ? json.quantite_step : null;
form.querySelector('#legume_quantiteMin').value = json.quantiteMin ? json.quantiteMin : null;
form.querySelector('#legume_quantiteMax').value = json.quantiteMax ? json.quantiteMax : null;
form.querySelector('#legume_quantiteStep').value = json.quantiteStep ? json.quantiteStep : null;
form.querySelector('#legume_unite').value = json.unite;
form.querySelector('#legume_prixUnitaire').value = json.prix_unitaire;
form.querySelector('#legume_prixUnitaire').value = json.prixUnitaire;
});
});
return editBtn;
......@@ -229,10 +229,10 @@ function displayInsertLegume(jsonRow)
descriptionInsertForm.innerHTML = '<h5>' + jsonRow.nom + '</h5>'
+ '<p>' + jsonRow.description + '</p>'
+ (jsonRow.revente ? '<p>Origine: ' + jsonRow.origine + '</p>' : '')
+ '<p>' + (jsonRow.quantite_min ? ' Min: ' + jsonRow.quantite_min : '')
+ (jsonRow.quantite_max ? ' | Max: ' + jsonRow.quantite_max : '')
+ (jsonRow.quantite_step ? ' | Step: ' + jsonRow.quantite_step : '') + '</p>'
+ '<p>' + jsonRow.prix_unitaire + ' €/' + jsonRow.unite + '</p>'
+ '<p>' + (jsonRow.quantiteMin ? ' Min: ' + jsonRow.quantiteMin : '')
+ (jsonRow.quantiteMax ? ' | Max: ' + jsonRow.quantiteMax : '')
+ (jsonRow.quantiteStep ? ' | Step: ' + jsonRow.quantiteStep : '') + '</p>'
+ '<p>' + jsonRow.prixUnitaire + ' €/' + jsonRow.unite + '</p>'
;
AJAX('GET', submitURL, function()
......
......@@ -213,11 +213,11 @@ function displayEditLettre(jsonRow)
titleForm.textContent = 'Lettre # ' + lettreId;
form.querySelector('#lettre_subject').value = json.subject;
form.querySelector('#lettre_startedAt').value = formatDateISO(json.started_at);
form.querySelector('#lettre_endedAt').value = formatDateISO(json.ended_at);
form.querySelector('#lettre_startedAt').value = formatDateISO(json.startedAt);
form.querySelector('#lettre_endedAt').value = formatDateISO(json.endedAt);
$('.form-lettre-modal').on('shown.bs.modal', function (e) {
initDateRangeSlider(json.started_at, json.ended_at);
initDateRangeSlider(json.startedAt, json.endedAt);
});
form.querySelector('#lettre_groupe').value = json.groupe.id;
......
......@@ -74,7 +74,7 @@ function getDisplayOffreLegumes(id_lettre)
let offre = document.querySelector('div#offre');
let json = JSON.parse(request.responseText);
let jsonLegumes = json[0].offre.offre_legumes;
let jsonLegumes = json[0].offre.offreLegumes;
for (let i = 0; i < jsonLegumes.length; i++ )
{
......@@ -174,15 +174,15 @@ function reloadBlocLettre()
let listStatus = { 'draft': 'En préparation', 'current': 'Pour relecture', 'sent': 'Envoyée', 'closed': 'Archivée', 'trash': 'Poubelle' };
let colors = {'draft': 'warning', 'current': 'info', 'sent': 'success', 'closed': 'secondary', 'trash': 'danger'};
fieldsLettre[0].textContent = formatStringDateTime(json.created_at, true, true, false, false);
fieldsLettre[1].textContent = json.updated_at ? formatStringDateTime(json.updated_at, true, true, false, false) : null;
fieldsLettre[0].textContent = formatStringDateTime(json.createdAt, true, true, false, false);
fieldsLettre[1].textContent = json.updatedAt ? formatStringDateTime(json.updatedAt, true, true, false, false) : null;
fieldsLettre[2].innerHTML = displayPeriodAndOffre(json);
fieldsLettre[3].innerHTML = buildColorSquare(json.status, colors) + listStatus[json.status];
headerLettre.innerHTML = displayHeaderLettre(json, true);
introLettre.innerHTML =
`Semaine du <strong>${formatStringDate(json.started_at, true, true, false, false)}</strong><br>
au <strong>${formatStringDate(json.ended_at, true, true, false, false)}</strong>`;
`Semaine du <strong>${formatStringDate(json.startedAt, true, true, false, false)}</strong><br>
au <strong>${formatStringDate(json.endedAt, true, true, false, false)}</strong>`;
countAbonnes(json);
countLegumes(json);
}
......@@ -204,11 +204,11 @@ function editBlocLettre()
form.querySelector('#lettre_offre').value = json.offre.id;
form.querySelector('#lettre_subject').value = json.subject;
form.querySelector('#lettre_startedAt').value = formatDateISO(json.started_at);
form.querySelector('#lettre_endedAt').value = formatDateISO(json.ended_at);
form.querySelector('#lettre_startedAt').value = formatDateISO(json.startedAt);
form.querySelector('#lettre_endedAt').value = formatDateISO(json.endedAt);
$('.form-lettre-modal').on('shown.bs.modal', function (e) {
initDateRangeSlider(json.started_at, json.ended_at);
initDateRangeSlider(json.startedAt, json.endedAt);
});
form.querySelector('#lettre_status').value = json.status;
......
......@@ -44,7 +44,7 @@ function buildRowOffre(jsonRow)
{
if (statut === jsonRow.status)
{
if (jsonRow.status === 'draft' && jsonRow.offre_legumes.length > 0)
if (jsonRow.status === 'draft' && jsonRow.offreLegumes.length > 0)
{
td2.appendChild(changeStatus(jsonRow));
}
......@@ -59,16 +59,16 @@ function buildRowOffre(jsonRow)
tr.appendChild(td2);
let td3 = document.createElement('td');
td3.textContent = jsonRow.offre_legumes.length +
(jsonRow.offre_legumes.length > 1 ? ' légumes' : ' légume' );
td3.textContent = jsonRow.offreLegumes.length +
(jsonRow.offreLegumes.length > 1 ? ' légumes' : ' légume' );
tr.appendChild(td3);
let td4 = document.createElement('td');
td4.textContent = formatStringDate(jsonRow.created_at, true);
td4.textContent = formatStringDate(jsonRow.createdAt, true);
tr.appendChild(td4);
let td5 = document.createElement('td');
td5.textContent = formatStringDate(jsonRow.ended_at, true);
td5.textContent = formatStringDate(jsonRow.endedAt, true);
tr.appendChild(td5);
let td6 = document.createElement('td');
......
......@@ -292,8 +292,8 @@ function displayPeriodAndOffre(lettre)
let offreLink = Routing.generate('potage_offre_legumes_ajax_display', {'id': lettre.offre.id });
return `<dt>Période:</dt>
<dd>${formatStringDate(lettre.started_at, true, true, false, false)}
${formatStringDate(lettre.ended_at, true, true, false, false)}</dd>
<dd>${formatStringDate(lettre.startedAt, true, true, false, false)}
${formatStringDate(lettre.endedAt, true, true, false, false)}</dd>
<dt>Offre:</dt>
<dd><a href="${offreLink}" title="Voir l'offre" class="btn btn-outline-dark btn-sm">
<i class="fas fa-paperclip fa-fw"></i> ${lettre.offre.reference}</a>
......
Markdown is supported
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