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:
Malibu 2015-03-09 18:36:03 +01:00
parent 7290e0696f
commit 26a0828f26
4 changed files with 48 additions and 6 deletions

View File

@ -190,9 +190,20 @@ class ReferentController extends Controller {
return Response::json($ListeOeuvre->jeux()->get()->toArray());
}
public function getImage($filename) {
public function updateSessionState() {
$idListeOeuvre = Input::get('idListeOeuvre');
$value = (Input::get('value') == 'true')? 1: 0;
// TODO
$listeoeuvres = ListeOeuvre::currentUser()->get();
foreach ($listeoeuvres as $el)
{
if($el->id != $idListeOeuvre)
$el->etat = 0;
else
$el->etat = $value;
$el->save();
}
return Response::json(array());
}
}

View File

@ -47,7 +47,7 @@ Route::group(['middleware' => 'auth'], function ()
Route::post('updateAssoGames', 'ReferentController@updateAssoGames');
Route::post('removeFromSelection', 'ReferentController@removeFromSelection');
Route::get('getAssoGames/{id}', 'ReferentController@getAssoGames');
Route::get('showPic/{file}', 'ReferentController@getImage');
Route::post('updateSessionState', 'ReferentController@updateSessionState');
});
Route::group(['middleware' => 'admin'], function ()

View File

@ -257,6 +257,37 @@ $('.checkbox').click(function(event) {
});
// Mettre à jour l'état des liste d'oeuvres
$('.checkboxSession').click(function(event) {
el = $(this).attr('id');
valueCheckbox = $(this).is(":checked");
$(".checkboxSession").map(function(){
if (el != $(this).attr('id'))
$(this).attr("checked", false);
});
dataSend = { _token : $('#_tokenRes').val(), idListeOeuvre: el, value: valueCheckbox};
$.post('updateSessionState', dataSend, function() {
// Nada
}, "json" )
.fail(function() {
// Nada
});
});
//swicth onglets de bg ma selection /ajouter
$('#liSelection').click(function() {

View File

@ -8,7 +8,7 @@
<div class="listg">
<legend>Créer une liste oeuvre:</legend>
<form class="form-inline" method="POST" role="form" action="addListeOeuvre">
<input type="hidden" name="idUser" value="{{ $me->id }}">
<input type="hidden" name="idUser" id="idUser" value="{{ $me->id }}">
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
<div >
<div >
@ -35,7 +35,7 @@
<td class="sessionName">{{$listeoeuvre->nom}}</td>
<td>
<label class="ios7-switch">
<input class="activeSession" type="checkbox" @if ($listeoeuvre->etat == 1) checked="checked" @endif>
<input class="activeSession checkboxSession" id="{{$listeoeuvre->id}}" type="checkbox" @if ($listeoeuvre->etat == 1) checked="checked" @endif>
<span></span>
</label>
</td>