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
880652df04
commit
652d5dba9a
@ -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()): [];
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ $('.listeoeuvre').click(function(event) {
|
||||
if (data.length == 0 )
|
||||
$("#oeuvrePic").append("Aucune Oeuvre");
|
||||
else {
|
||||
$("#oeuvrePic").append('<select multiple="multiple" id="my_selection" class="image-picker show-html">');
|
||||
$("#oeuvrePic").append('<select multiple="multiple" id="my_selection" name="my_selection" class="image-picker show-html">');
|
||||
for (el in data)
|
||||
{
|
||||
$('#my_selection').append('<option data-img-src="http://www.augustins.org/documents/10180/156407/' + data[el].urlPhoto + '" value="'+ data[el].id + '"></option>');
|
||||
@ -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('<div class="alert alert-danger">'
|
||||
+'<strong>Oouups!</strong> Il y a un problème.<br><br>'
|
||||
+'<ul>'
|
||||
+'<li>Erreur lors de la Suppression</li>'
|
||||
+'</ul>'
|
||||
+'</div>');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Afficher résultat de recherche d'oeuvre
|
||||
$('#search_button, #previous, #next').click(function(event) {
|
||||
event.preventDefault();
|
||||
|
@ -65,12 +65,14 @@
|
||||
<!-- TAKE ALL THAT'S INSIDE THIS DIV FOR "MY SELECTION" -->
|
||||
<div id="selection">
|
||||
<span style="float: right"><a href="">Sélectionner tout</a> -- <a href="">Annuler sélection</a></span><br>
|
||||
<input type="hidden" id="_tokenRemoveFromSelection" name="_token" value="{{{ csrf_token() }}}" />
|
||||
<div class="panel-body" id="oeuvrePic">
|
||||
|
||||
<!-- TODO -->
|
||||
|
||||
</div>
|
||||
<button style="float: right" class="btn btn-primary" id="enregistrer">Enregistrer</button>
|
||||
<!-- <button style="float: right" class="btn btn-primary" id="enregistrer">Enregistrer</button> -->
|
||||
<button type="button" style="float: right" class="btn btn-warning" id="removeFromSelection">Supprimer</button>
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user