diff --git a/SRC/app/Http/Controllers/ReferentController.php b/SRC/app/Http/Controllers/ReferentController.php index f8a32a3..7d827ce 100755 --- a/SRC/app/Http/Controllers/ReferentController.php +++ b/SRC/app/Http/Controllers/ReferentController.php @@ -128,6 +128,16 @@ class ReferentController extends Controller { return Response::json(array()); } + public function removeFromSelection() { + + $idListeOeuvre = Session::get('listeoeuvre_current'); + $ListeOeuvre = ListeOeuvre::find($idListeOeuvre); + + $oeuvresToDelete = Input::get('oeuvres'); + $ListeOeuvre->oeuvres()->detach($oeuvresToDelete); + return Response::json(array()); + } + public function search() { $auteurs = (Input::get('auteur', array()))?Input::get('auteur', array()): []; diff --git a/SRC/app/Http/routes.php b/SRC/app/Http/routes.php index 9461af3..1e2d9b7 100755 --- a/SRC/app/Http/routes.php +++ b/SRC/app/Http/routes.php @@ -45,6 +45,7 @@ Route::group(['middleware' => 'auth'], function () Route::post('search', 'ReferentController@search'); Route::post('addItemsToList', 'ReferentController@addItemsToList'); Route::post('updateAssoGames', 'ReferentController@updateAssoGames'); + Route::post('removeFromSelection', 'ReferentController@removeFromSelection'); Route::get('getAssoGames/{id}', 'ReferentController@getAssoGames'); Route::get('showPic/{file}', 'ReferentController@getImage'); }); diff --git a/SRC/public/js/ListeOeuvre.js b/SRC/public/js/ListeOeuvre.js index 8ffd051..d5b14e0 100755 --- a/SRC/public/js/ListeOeuvre.js +++ b/SRC/public/js/ListeOeuvre.js @@ -50,7 +50,7 @@ $('.listeoeuvre').click(function(event) { if (data.length == 0 ) $("#oeuvrePic").append("Aucune Oeuvre"); else { - $("#oeuvrePic").append(''); for (el in data) { $('#my_selection').append(''); @@ -93,6 +93,33 @@ $('#enregistrer').click(function() { }); +// Suppression des n oeuvres selectionnés +$('#removeFromSelection').click(function() { + + url = "removeFromSelection"; + dataSend = { + _token : $('#_tokenRemoveFromSelection').val(), + oeuvres : $('#my_selection').val()}; + $.post(url, + dataSend, + function( data ) { + ; + }, "json") + .done(function() { + ; + }) + .fail(function() { + $("#oeuvrePic").append('
' + +'Oouups! Il y a un problème.

' + +'' + +'
'); + }); +}); + + + // Afficher résultat de recherche d'oeuvre $('#search_button, #previous, #next').click(function(event) { event.preventDefault(); diff --git a/SRC/resources/views/referent.blade.php b/SRC/resources/views/referent.blade.php index 195baa6..e101809 100755 --- a/SRC/resources/views/referent.blade.php +++ b/SRC/resources/views/referent.blade.php @@ -65,12 +65,14 @@
Sélectionner tout -- Annuler sélection
+
- + +