Commit 365482be authored by Mat's avatar Mat

on ne peut pas trier les éléments si il n'y a pas de sortForm

parent bc92bfb9
...@@ -111,8 +111,10 @@ class InfoRepository extends \Doctrine\ORM\EntityRepository ...@@ -111,8 +111,10 @@ class InfoRepository extends \Doctrine\ORM\EntityRepository
public function findAllForLettreReadInfos($id) public function findAllForLettreReadInfos($id)
{ {
$qb = $this->createQueryBuilder('i') $qb = $this->createQueryBuilder('i')
->select('i.id', 'i.title', 'i.subtitle', 'i.text', 'i.color', 'i.status')
->join('i.lettres', 'l') ->join('i.lettres', 'l')
->where('i.lettres = :id') ->addSelect('l.id id_lettre')
->where('l.id = :id')
->setParameters(array( ->setParameters(array(
':id' => $id, ':id' => $id,
)) ))
......
...@@ -51,12 +51,21 @@ reloadGridInfos(); ...@@ -51,12 +51,21 @@ reloadGridInfos();
reloadButton(function(){ reloadGridInfos(); }); reloadButton(function(){ reloadGridInfos(); });
if (sortForm)
/* {
* Un form 'sorted' affiche en console /*
* un tableau avec l'ordre souhaité * jQuery-ui Sortable
*/ */
if (sortForm) { $( function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
} );
/*
* Un form 'sorted' affiche en console
* un tableau avec l'ordre souhaité
*/
sortForm.addEventListener('submit', function(e) sortForm.addEventListener('submit', function(e)
{ {
let list = []; let list = [];
...@@ -83,17 +92,8 @@ if (sortForm) { ...@@ -83,17 +92,8 @@ if (sortForm) {
form form
); );
}); });
}
/*
* jQuery-ui Sortable
*/
$( function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
} );
}
...@@ -118,15 +118,15 @@ function reloadBlocLettre() ...@@ -118,15 +118,15 @@ function reloadBlocLettre()
function(request) { function(request) {
let json = JSON.parse(request.responseText); let json = JSON.parse(request.responseText);
let listStatus = { 'draft': 'En préparation', 'current': 'Pour relecture', 'sent': 'Envoyé', 'trash': 'Poubelle' }; let listStatus = { 'draft': 'En préparation', 'current': 'Pour relecture', 'sent': 'Envoyée', 'closed': 'Archivée', 'trash': 'Poubelle' };
let couleurs = {'draft': 'secondary', 'current': 'warning', 'sent': 'success', 'trash': 'danger'}; let colors = {'draft': 'secondary', 'current': 'warning', 'sent': 'success', 'closed': 'secondary', 'trash': 'danger'};
fieldsLettre[0].textContent = formatStringDateTime(json.created_at, true, true, false, false); 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[1].textContent = json.updated_at ? formatStringDateTime(json.updated_at, true, true, false, false) : null;
fieldsLettre[2].textContent = 'Groupe ' + json.groupe.nom; fieldsLettre[2].textContent = 'Groupe ' + json.groupe.nom;
fieldsLettre[3].textContent = json.subject; fieldsLettre[3].textContent = json.subject;
fieldsLettre[4].textContent = formatStringDate(json.started_at, true, true, false, false); fieldsLettre[4].textContent = formatStringDate(json.started_at, true, true, false, false);
fieldsLettre[5].textContent = formatStringDate(json.ended_at, true, true, false, false); fieldsLettre[5].textContent = formatStringDate(json.ended_at, true, true, false, false);
fieldsLettre[6].innerHTML = buildColorSquare(json.status, couleurs) + listStatus[json.status]; fieldsLettre[6].innerHTML = buildColorSquare(json.status, colors) + listStatus[json.status];
} }
); );
} }
......
...@@ -90,12 +90,21 @@ reloadGridLegumes(); ...@@ -90,12 +90,21 @@ reloadGridLegumes();
reloadButton(function(){ reloadGridLegumes(); }); reloadButton(function(){ reloadGridLegumes(); });
if (sortForm)
/* {
* Un form 'sorted' affiche en console /*
* un tableau avec l'ordre souhaité * jQuery-ui Sortable
*/ */
if (sortForm) { $( function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
} );
/*
* Un form 'sorted' affiche en console
* un tableau avec l'ordre souhaité
*/
sortForm.addEventListener('submit', function(e) sortForm.addEventListener('submit', function(e)
{ {
let list = []; let list = [];
...@@ -124,14 +133,6 @@ if (sortForm) { ...@@ -124,14 +133,6 @@ if (sortForm) {
} }
/*
* jQuery-ui Sortable
*/
$( function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
} );
...@@ -157,11 +158,11 @@ function reloadBlocOffre() ...@@ -157,11 +158,11 @@ function reloadBlocOffre()
function(request) { function(request) {
let json = JSON.parse(request.responseText); let json = JSON.parse(request.responseText);
let listStatus = { 'draft': 'Brouillon', 'posted': 'Publié', 'trash': 'Poubelle' }; let listStatus = { 'draft': 'Brouillon', 'current': 'Publiée', 'closed': 'Expirée', 'trash': 'Poubelle' };
let couleurs = {'draft': 'warning', 'posted': 'success', 'trash': 'danger'}; let colors = {'draft': 'warning', 'current': 'success', 'closed': 'secondary', 'trash': 'danger'};
fieldsOffre[0].textContent = formatStringDateTime(json.createdAt, true, true, false, false); fieldsOffre[0].textContent = formatStringDateTime(json.createdAt, true, true, false, false);
fieldsOffre[1].textContent = json.updatedAt ? formatStringDateTime(json.updatedAt, true, true, false, false) : null; fieldsOffre[1].textContent = json.updatedAt ? formatStringDateTime(json.updatedAt, true, true, false, false) : null;
fieldsOffre[2].innerHTML = buildColorSquare(json.status, couleurs) + listStatus[json.status]; fieldsOffre[2].innerHTML = buildColorSquare(json.status, colors) + listStatus[json.status];
fieldsOffre[3].textContent = formatStringDateTime(json.endedAt, true, true, false, false); fieldsOffre[3].textContent = formatStringDateTime(json.endedAt, true, true, false, false);
} }
); );
......
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