modifié : SRC/public/js/ListeOeuvre.js
This commit is contained in:
parent
77544b7ed4
commit
61f4439942
@ -62,73 +62,63 @@ $('#enregistrer').click(function() {
|
|||||||
|
|
||||||
// Afficher résultat de recherche d'oeuvre
|
// Afficher résultat de recherche d'oeuvre
|
||||||
$('#search_button, #previous, #next').click(function(event) {
|
$('#search_button, #previous, #next').click(function(event) {
|
||||||
|
event.preventDefault();
|
||||||
event.preventDefault();
|
if(this.id == $('#next').attr('id') && $("#next").parent().hasClass('disabled') || this.id == $('#previous').attr('id') && $("#previous").parent().hasClass('disabled'))
|
||||||
|
return 0;
|
||||||
if(this.id == $('#next').attr('id') && $("#next").parent().hasClass('disabled') || this.id == $('#previous').attr('id') && $("#previous").parent().hasClass('disabled'))
|
if (this.id == $('#next').attr('id')) {
|
||||||
return 0;
|
str = $("#next").attr('href');
|
||||||
|
url = "/search?page="+/([0-9]+)/.exec(/page=([0-9]+)/.exec(str)[0])[0];
|
||||||
if (this.id == $('#next').attr('id')) {
|
}else
|
||||||
str = $("#next").attr('href');
|
if (this.id == $('#previous').attr('id')) {
|
||||||
url = "/search?page="+/([0-9]+)/.exec(/page=([0-9]+)/.exec(str)[0])[0];
|
|
||||||
}else if (this.id == $('#previous').attr('id')) {
|
|
||||||
str = $("#previous").attr('href');
|
str = $("#previous").attr('href');
|
||||||
url = "/search?page="+/([0-9]+)/.exec(/page=([0-9]+)/.exec(str)[0])[0];
|
url = "/search?page="+/([0-9]+)/.exec(/page=([0-9]+)/.exec(str)[0])[0];
|
||||||
}else {
|
}else {
|
||||||
url = "/search";
|
url = "/search";
|
||||||
}
|
}
|
||||||
|
$('#oeuvreRes').empty();
|
||||||
$('#oeuvreRes').empty();
|
dataSend = {
|
||||||
dataSend = "_token = $('#_tokenRes').val(),"
|
_token : $('#_tokenRes').val(),
|
||||||
+"auteur = ('#auteur').val(),"
|
auteur: $('#auteur').val(),
|
||||||
+"designation = $('#designation').val(),"
|
designation: $('#designation').val(),
|
||||||
+"matiere = $('#matiere').val(),"
|
matiere: $('#matiere').val(),
|
||||||
+"domaine = $('#domaine').val(),"
|
domaine: $('#domaine').val(),
|
||||||
+"technique = $('#technique').val(),"
|
technique: $('#technique').val(),
|
||||||
+"debut = $('#debut').val(),"
|
debut: $('#debut').val(),
|
||||||
+"fin = $('#fin').val()";
|
fin: $('#fin').val()
|
||||||
|
};
|
||||||
var r = new XMLHttpRequest();
|
$.post(url,
|
||||||
r.open("POST", url, true);
|
dataSend,
|
||||||
r.onreadystatechange = function () {
|
function( data ) {
|
||||||
if (r.readyState != 4 || r.status != 200)
|
if (data.length == 0 )
|
||||||
{
|
$("#oeuvreRes").append("Aucune Oeuvre Trouvé..");
|
||||||
$("#oeuvreRes").append('<div class="alert alert-danger">'
|
data.data.forEach( function(el) {
|
||||||
+'<strong>Oouups!</strong> Il y a un problème.<br><br>'
|
$("#oeuvreRes").append('<div class="col-xs-4 col-md-3">'
|
||||||
+'<ul>'
|
+'<a href="#" class="thumbnail">'
|
||||||
+'<li>Erreur lors de la récupération</li>'
|
+'<img src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '"/>'
|
||||||
+'</ul>'
|
+'</a></div>');
|
||||||
+'</div>'
|
});
|
||||||
);
|
if(data.prev_page_url == null) {
|
||||||
|
$("#previous").parent().addClass('disabled');
|
||||||
return;
|
}else {
|
||||||
}
|
$("#previous").attr('href', data.prev_page_url);
|
||||||
data = r.responseText;
|
$("#previous").parent().removeClass('disabled');
|
||||||
if (data.length == 0 )
|
}
|
||||||
$("#oeuvreRes").append("Aucune Oeuvre Trouvé..");
|
if(data.next_page_url == null) {
|
||||||
data.data.forEach( function(el) {
|
$("#next").parent().addClass('disabled');
|
||||||
$("#oeuvreRes").append('<div class="col-xs-4 col-md-3">'
|
}else {
|
||||||
+'<a href="#" class="thumbnail">'
|
$("#next").attr('href', data.next_page_url);
|
||||||
+'<img src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '"/>'
|
$("#next").parent().removeClass('disabled');
|
||||||
+'</a></div>');
|
}
|
||||||
});
|
}, "json" )
|
||||||
|
.fail(function() {
|
||||||
if(data.prev_page_url == null) {
|
$("#oeuvreRes").append('<div class="alert alert-danger">'
|
||||||
$("#previous").parent().addClass('disabled');
|
+'<strong>Oouups!</strong> Il y a un problème.<br><br>'
|
||||||
}else {
|
+'<ul>'
|
||||||
$("#previous").attr('href', data.prev_page_url);
|
+'<li>Erreur lors de la récupération</li>'
|
||||||
$("#previous").parent().removeClass('disabled');
|
+'</ul>'
|
||||||
}
|
+'</div>'
|
||||||
|
);
|
||||||
if(data.next_page_url == null) {
|
});
|
||||||
$("#next").parent().addClass('disabled');
|
|
||||||
}else {
|
|
||||||
$("#next").attr('href', data.next_page_url);
|
|
||||||
$("#next").parent().removeClass('disabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
r.send(dataSend);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user