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
439888f0db
commit
9edc7af7d3
@ -13,6 +13,7 @@ use App\Models\Technique;
|
|||||||
use App\Models\Oeuvre;
|
use App\Models\Oeuvre;
|
||||||
use App\Models\Jeu;
|
use App\Models\Jeu;
|
||||||
use Response;
|
use Response;
|
||||||
|
use Session;
|
||||||
|
|
||||||
|
|
||||||
class ReferentController extends Controller {
|
class ReferentController extends Controller {
|
||||||
@ -95,6 +96,10 @@ class ReferentController extends Controller {
|
|||||||
|
|
||||||
public function showListeOeuvres($id)
|
public function showListeOeuvres($id)
|
||||||
{
|
{
|
||||||
|
if (Session::has('listeoeuvre_current'))
|
||||||
|
Session::forget('listeoeuvre_current');
|
||||||
|
|
||||||
|
Session::put('listeoeuvre_current', $id);
|
||||||
return Response::json(ListeOeuvre::find($id)->oeuvres->toArray());
|
return Response::json(ListeOeuvre::find($id)->oeuvres->toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,4 +151,18 @@ class ReferentController extends Controller {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateAssoGames() {
|
||||||
|
|
||||||
|
$idListeOeuvre = Session::get('listeoeuvre_current', 'default');
|
||||||
|
$res = Input::get('data', array());
|
||||||
|
$ListeOeuvre = ListeOeuvre::find($idListeOeuvre);
|
||||||
|
|
||||||
|
$table = [];
|
||||||
|
foreach ($res as $key => $value){
|
||||||
|
if($value == 'true')
|
||||||
|
array_push($table, $key);
|
||||||
|
}
|
||||||
|
$ListeOeuvre->jeux()->sync($table);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ Route::group(['middleware' => 'auth'], function ()
|
|||||||
Route::post('setListOeuvres', 'ReferentController@setListOeuvres');
|
Route::post('setListOeuvres', 'ReferentController@setListOeuvres');
|
||||||
Route::post('search', 'ReferentController@search');
|
Route::post('search', 'ReferentController@search');
|
||||||
Route::post('addItemsToList', 'ReferentController@addItemsToList');
|
Route::post('addItemsToList', 'ReferentController@addItemsToList');
|
||||||
|
Route::post('updateAssoGames', 'ReferentController@updateAssoGames');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group(['middleware' => 'admin'], function ()
|
Route::group(['middleware' => 'admin'], function ()
|
||||||
|
@ -131,6 +131,7 @@ $('#search_button, #previous, #next').click(function(event) {
|
|||||||
// Mettre à jour les jeux associés à la liste d'oeuvre
|
// Mettre à jour les jeux associés à la liste d'oeuvre
|
||||||
$('.checkbox').click(function(event) {
|
$('.checkbox').click(function(event) {
|
||||||
|
|
||||||
|
// Recuperation des données necessaire au traitement
|
||||||
var searchIDs = $("input#idGame").map(function(){
|
var searchIDs = $("input#idGame").map(function(){
|
||||||
return $(this).val();
|
return $(this).val();
|
||||||
}).get();
|
}).get();
|
||||||
@ -144,7 +145,14 @@ $('.checkbox').click(function(event) {
|
|||||||
r[searchIDs[i]] = searchValues[i];
|
r[searchIDs[i]] = searchValues[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(r);
|
dataSend = { _token : $('#_tokenRes').val(), data: r };
|
||||||
|
$.post('updateAssoGames', dataSend, function() {
|
||||||
|
// Nada
|
||||||
|
}, "json" )
|
||||||
|
|
||||||
|
.fail(function() {
|
||||||
|
// Nada
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -25,8 +25,12 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($listeoeuvres as $listeoeuvre)
|
@foreach ($listeoeuvres as $index => $listeoeuvre)
|
||||||
|
@if ($index == 0)
|
||||||
<tr class="active listeoeuvre">
|
<tr class="active listeoeuvre">
|
||||||
|
@else
|
||||||
|
<tr class="listeoeuvre">
|
||||||
|
@endif
|
||||||
<form method="POST" role="form" action="deleteListeOeuvre">
|
<form method="POST" role="form" action="deleteListeOeuvre">
|
||||||
<input type="hidden" name="idUser" value="{{ $me->id }}">
|
<input type="hidden" name="idUser" value="{{ $me->id }}">
|
||||||
<input type="hidden" class="idListeOeuvre" name="idListeOeuvre" value="{{ $listeoeuvre->id }}">
|
<input type="hidden" class="idListeOeuvre" name="idListeOeuvre" value="{{ $listeoeuvre->id }}">
|
||||||
|
Reference in New Issue
Block a user