Commit cda2a756 authored by Mat's avatar Mat
Browse files

LettreInfo, affiche la grille de div infos

parent 3a11ef5d
......@@ -120,12 +120,6 @@
let sortForm = document.querySelector('form[name=lettre_sorted]');
let input = sortForm.querySelector('input#lettre_sorted_sorted');
// jQuery-ui Sortable
$( function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
} );
{% include '@Potage/LettreInfos/ajaxDisplay.js' %}
{% include '@Potage/Lettre/dateSlider.js' %}
......
......@@ -13,9 +13,10 @@ function reloadGridInfos()
AJAX('GET', URL, function(request)
{
let json = JSON.parse(request.responseText);
for(let i = 0; i < json.length; i++ )
for(let i = 0; i < json.infos.length; i++ )
{
let div = buildItemLettreInfos(json[i]);
let div = buildItemLettreInfos(json.infos[i]);
sortable.appendChild(div);
}
});
......@@ -28,53 +29,13 @@ function reloadGridInfos()
*/
function buildItemLettreInfos(jsonRow)
{
//console.log(jsonRow);
console.log(jsonRow);
let div = document.createElement('div');
div.classList.add('ui-state-default');
div.dataset.lettreInfosId = jsonRow.id;
div.dataset.infoId = jsonRow.id;
let logo = document.createElement('div');
logo.classList.add('logo', 'lg');
let crop = document.createElement('div');
crop.classList.add('crop');
let img = document.createElement('img');
img.setAttribute('src', '/web/uploads/images/legumes/' + jsonRow.image);
crop.appendChild(img);
logo.appendChild(crop);
div.appendChild(logo);
let texte = document.createElement('div');
texte.classList.add('texte');
let title = document.createElement('h5');
title.innerHTML = jsonRow.nom;
texte.appendChild(title);
div.appendChild(texte);
let dprix = document.createElement('div');
dprix.classList.add('prix');
let prix = document.createElement('span');
prix.classList.add('prix');
prix.textContent = jsonRow.prixUnitaire;
dprix.appendChild(prix);
let devise = document.createElement('span');
devise.classList.add('devise');
devise.textContent = '';
dprix.appendChild(devise);
let unite = document.createElement('span');
unite.classList.add('unite');
unite.textContent = '/' + jsonRow.unite;
dprix.appendChild(unite);
div.appendChild(dprix);
return div;
}
......@@ -121,6 +82,14 @@ sortForm.addEventListener('submit', function(e)
});
/*
* jQuery-ui Sortable
*/
$( function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
} );
/*
*
......
......@@ -128,6 +128,8 @@
let id_offre = {{ id }};
let sortForm = document.querySelector('form[name=offre_sorted]');
let input = document.querySelector('input#offre_sorted_sorted');
{% include '@Potage/OffreLegumes/ajaxDisplay.js' %}
......
......@@ -96,7 +96,6 @@ reloadButton(function(){ reloadGridLegumes(); });
* un tableau avec l'ordre souhaité
*/
let sortForm = document.querySelector('form[name=offre_sorted]');
sortForm.addEventListener('submit', function(e)
{
let list = [];
......@@ -106,7 +105,6 @@ sortForm.addEventListener('submit', function(e)
list[i] = items[i].dataset.legumeId;
}
let input = document.querySelector('input#offre_sorted_sorted');
input.value = list;
let form = this;
......@@ -141,10 +139,10 @@ $( function() {
/*
*
*
* Modifier l'offre
*
*
* Modifier le bloc Offre (aside droite)
*
* read et update de l'offre
*
*/
......
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