modified: SRC/app/Http/Controllers/ReferentController.php
modified: SRC/app/Http/routes.php modified: SRC/public/js/ListeOeuvre.js modified: SRC/resources/views/referent.blade.php
This commit is contained in:
parent
695adc5d3a
commit
8a0f8a5b3c
@ -12,6 +12,7 @@ use App\Models\Matiere;
|
||||
use App\Models\Technique;
|
||||
use App\Models\Oeuvre;
|
||||
use Response;
|
||||
use Illuminate\Pagination\Paginator as Paginator;
|
||||
|
||||
|
||||
class ReferentController extends Controller {
|
||||
@ -44,9 +45,6 @@ class ReferentController extends Controller {
|
||||
$dataSearch['matiere'] = Matiere::orderBy('nom')->get();
|
||||
$dataSearch['technique'] = Technique::orderBy('nom')->get();
|
||||
|
||||
//$ListeOeuvre = ListeOeuvre::find(2);
|
||||
//$ListeOeuvre->oeuvres()->attach([22, 23, 24, 25, 26]);
|
||||
|
||||
$listeoeuvres = ListeOeuvre::currentUser()->get();
|
||||
return view('referent', ['nameRoute' => 'Référent', 'me' => $me, 'listeoeuvres' => $listeoeuvres, 'data' => $dataSearch]);
|
||||
}
|
||||
@ -137,7 +135,7 @@ class ReferentController extends Controller {
|
||||
->matiereFilter($matieres)
|
||||
->debutFilter($debut)
|
||||
->finFilter($fin)
|
||||
->get();
|
||||
->paginate(15);
|
||||
|
||||
return Response::json($res->toArray());
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ Route::group(['middleware' => 'auth'], function ()
|
||||
Route::post('addListeOeuvre', 'ReferentController@addListeOeuvre');
|
||||
Route::get('showListOeuvres/{id}', 'ReferentController@showListeOeuvres');
|
||||
Route::post('setListOeuvres', 'ReferentController@setListOeuvres');
|
||||
Route::post('search', 'ReferentController@search');
|
||||
Route::post('search/', 'ReferentController@search');
|
||||
});
|
||||
|
||||
Route::group(['middleware' => 'admin'], function ()
|
||||
|
@ -57,9 +57,22 @@ $('#enregistrer').click(function() {
|
||||
|
||||
|
||||
// Afficher résultat de recherche d'oeuvre
|
||||
$('#search_button').click(function() {
|
||||
$('#search_button, #previous, #next').click(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if (this.id == $('#next').attr('id')) {
|
||||
str = $("#next").attr('href');
|
||||
console.log(/([0-9]+)/.exec(str));
|
||||
url = "/search?page="+/([0-9]+)/.exec(str)[0];
|
||||
}else if (this.id == $('#previous').attr('id')) {
|
||||
str = $("#previous").attr('href');
|
||||
url = "/search?page="+/([0-9]+)/.exec(str)[0];
|
||||
}else {
|
||||
url = "/search";
|
||||
}
|
||||
|
||||
$('#oeuvreRes').empty();
|
||||
url = "/search";
|
||||
dataSend = {
|
||||
_token : $('#_tokenRes').val(),
|
||||
auteur: $('#auteur').val(),
|
||||
@ -74,14 +87,29 @@ $('#search_button').click(function() {
|
||||
dataSend,
|
||||
function( data ) {
|
||||
console.log(data);
|
||||
if (data.length == 0 )
|
||||
$("#oeuvreRes").append("Aucune Oeuvre Trouvé..");
|
||||
data.forEach( function(el) {
|
||||
$("#oeuvreRes").append('<div class="col-xs-4 col-md-3">'
|
||||
+'<a href="#" class="thumbnail">'
|
||||
+'<img src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '"/>'
|
||||
+'</a></div>');
|
||||
})
|
||||
if (data.length == 0 )
|
||||
$("#oeuvreRes").append("Aucune Oeuvre Trouvé..");
|
||||
data.data.forEach( function(el) {
|
||||
$("#oeuvreRes").append('<div class="col-xs-4 col-md-3">'
|
||||
+'<a href="#" class="thumbnail">'
|
||||
+'<img src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '"/>'
|
||||
+'</a></div>');
|
||||
});
|
||||
|
||||
if(data.prev_page_url == null) {
|
||||
$("#previous").parent().addClass('disabled');
|
||||
}else {
|
||||
$("#previous").attr('href', data.prev_page_url);
|
||||
$("#previous").parent().removeClass('disabled');
|
||||
}
|
||||
|
||||
if(data.next_page_url == null) {
|
||||
$("#next").parent().addClass('disabled');
|
||||
}else {
|
||||
$("#next").attr('href', data.next_page_url);
|
||||
$("#next").parent().removeClass('disabled');
|
||||
}
|
||||
|
||||
}, "json" )
|
||||
|
||||
.fail(function() {
|
||||
|
@ -198,7 +198,14 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<button style="float: right" class="btn btn-primary" id="enregistrer">Enregistrer</button>
|
||||
|
||||
<nav>
|
||||
<ul class="pager">
|
||||
<li class="previous disabled"><a id="previous" href=""><span aria-hidden="true">←</span> Précédent</a></li>
|
||||
<li class="next disabled"><a id="next" href="">Suivant <span aria-hidden="true">→</span></a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<button style="float: right" class="btn btn-primary" id="ajouter">Ajouter à ma liste d'oeuvre</button>
|
||||
</div>
|
||||
|
||||
@endsection
|
Reference in New Issue
Block a user