blabla
This commit is contained in:
parent
6c7f24206c
commit
d22f90d8ce
@ -1,10 +0,0 @@
|
|||||||
<?php namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class AssoListeAJeu extends Model {
|
|
||||||
|
|
||||||
protected $table = 'assolisteajeu';
|
|
||||||
|
|
||||||
public $timestamps = false;
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
<?php namespace App;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class AssoListeAOeuvre extends Model {
|
|
||||||
|
|
||||||
protected $table = 'assolisteaoeuvre';
|
|
||||||
|
|
||||||
public $timestamps = false;
|
|
||||||
}
|
|
@ -30,11 +30,11 @@ class ReferentController extends Controller {
|
|||||||
$me = User::current();
|
$me = User::current();
|
||||||
$user = User::all();
|
$user = User::all();
|
||||||
|
|
||||||
$sessions = [];
|
// $ListeOeuvre = ListeOeuvre::find(1);
|
||||||
// List Oeuvre of one user
|
// $ListeOeuvre->oeuvres()->attach([22, 23, 24, 25, 26]);
|
||||||
//$sessions = ListeOeuvre::currentUser()->get();
|
|
||||||
|
|
||||||
return view('referent', ['nameRoute' => 'Référent', 'me' => $me, 'sessions' => $sessions]);
|
$listeoeuvres = ListeOeuvre::currentUser()->get();
|
||||||
|
return view('referent', ['nameRoute' => 'Référent', 'me' => $me, 'listeoeuvres' => $listeoeuvres]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,38 +67,27 @@ class ReferentController extends Controller {
|
|||||||
* create a new session
|
* create a new session
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function addSession()
|
public function addListeOeuvre()
|
||||||
{
|
{
|
||||||
// TODO
|
|
||||||
$ListeOeuvre = new ListeOeuvre;
|
$ListeOeuvre = new ListeOeuvre;
|
||||||
$ListeOeuvre->iduser = 2;
|
$ListeOeuvre->iduser = Input::get('idUser');
|
||||||
$ListeOeuvre->nom = "Linux";
|
$ListeOeuvre->nom = Input::get('name');
|
||||||
$ListeOeuvre->etat = 1;
|
$ListeOeuvre->etat = 0;
|
||||||
$ListeOeuvre->save();
|
$ListeOeuvre->save();
|
||||||
|
|
||||||
$assolistaoeuvre = new AssoListeAOeuvre;
|
return redirect('/referent');
|
||||||
$assolistaoeuvre->liste_oeuvre_id = 1;
|
|
||||||
$assolistaoeuvre->oeuvre_id = 1;
|
|
||||||
$assolistaoeuvre->save();
|
|
||||||
|
|
||||||
$assolistaoeuvre2 = new AssoListeAOeuvre;
|
|
||||||
$assolistaoeuvre2->liste_oeuvre_id = 1;
|
|
||||||
$assolistaoeuvre2->oeuvre_id = 2;
|
|
||||||
$assolistaoeuvre2->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
public function showListeOeuvres($id)
|
||||||
* get all user sessions
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function getSessions()
|
|
||||||
{
|
{
|
||||||
// TODO
|
return $listeoeuvres = ListeOeuvre::currentUser()->get()[0]->oeuvres()->toJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deleteListeOeuvre()
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,9 @@ Route::group(['middleware' => 'auth'], function ()
|
|||||||
Route::get('referent', 'ReferentController@index');
|
Route::get('referent', 'ReferentController@index');
|
||||||
Route::get('logout', 'LoginController@logout');
|
Route::get('logout', 'LoginController@logout');
|
||||||
Route::post('update', 'ReferentController@update');
|
Route::post('update', 'ReferentController@update');
|
||||||
|
Route::post('deleteListeOeuvre', 'ReferentController@deleteListeOeuvre');
|
||||||
|
Route::post('addListeOeuvre', 'ReferentController@addListeOeuvre');
|
||||||
|
Route::get('showListOeuvres/{id}', 'ReferentController@showListeOeuvres');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group(['middleware' => 'admin'], function ()
|
Route::group(['middleware' => 'admin'], function ()
|
||||||
|
19
SRC/public/js/getListeOeuvre.js
Normal file
19
SRC/public/js/getListeOeuvre.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
$(document).ready( function() {
|
||||||
|
|
||||||
|
$( '.listeoeuvre' ).click(function(this) {
|
||||||
|
id = $(this).$('.idListeOeuvre').val();
|
||||||
|
$.get("showListOeuvres/"+id, function( data ) {
|
||||||
|
data.forEach( function(el) {
|
||||||
|
$("#oeuvrePic").append('<div class="col-xs-4 col-md-3">')
|
||||||
|
.append('<div class="col-xs-4 col-md-3">')
|
||||||
|
.append('<a href="#" class="thumbnail">')
|
||||||
|
.append('<img src="http://www.augustins.org/documents/10180/156407/').append(el.urlPhoto).append('">')
|
||||||
|
.append('</a></div>');
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//prevent the form from actually submitting in browser
|
||||||
|
return false;
|
||||||
|
} );
|
||||||
|
|
||||||
|
} );
|
@ -30,5 +30,8 @@
|
|||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Scripts Jquery -->
|
||||||
|
<script type="text/javascript" src="js/getListeOeuvre.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -5,24 +5,31 @@
|
|||||||
<br>
|
<br>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
|
|
||||||
<legend>Créer une session:</legend>
|
<legend>Créer une listeoeuvre:</legend>
|
||||||
<form class="form-inline">
|
<form class="form-inline" method="POST" role="form" action="addListeOeuvre">
|
||||||
|
<input type="hidden" name="idUser" value="{{ $me->id }}">
|
||||||
|
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" id="exampleInputAmount" placeholder="Ajouter une session">
|
<input type="text" class="form-control" required="required" name="name" placeholder="Ajouter une liste d'oeuvre">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Ajouter</button>
|
<button type="submit" class="btn btn-primary">Ajouter</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
<legend>Mes sessions:</legend>
|
<legend>Mes listes d'oeuvres:</legend>
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
@foreach ($sessions as $session)
|
@foreach ($listeoeuvres as $listeoeuvre)
|
||||||
<tr class="active">
|
<tr class="active listeoeuvre">
|
||||||
<td>{{$session->nom}}</td>
|
<form method="POST" role="form" action="deleteSession">
|
||||||
<td>Supprimer</td>
|
<input type="hidden" name="idUser" value="{{ $me->id }}">
|
||||||
|
<input type="hidden" class="idListeOeuvre" name="idListeOeuvre" value="{{ $listeoeuvre->id }}">
|
||||||
|
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
|
||||||
|
<td>{{$listeoeuvre->nom}}</td>
|
||||||
|
<td><button type="submit" class="btn btn-sm btn-danger"><span class="glyphicon glyphicon-trash"></span></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</form>
|
||||||
@endforeach
|
@endforeach
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@ -30,23 +37,15 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<legend>Falbala: (Activer ou Désactiver la session)</legend>
|
<legend>Falbala: (Activer ou Désactiver la listeoeuvre)</legend>
|
||||||
|
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
|
|
||||||
<span style="float: right">Sélectionner tout -- Annuler sélection</span><br>
|
<span style="float: right">Sélectionner tout -- Annuler sélection</span><br>
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-body">
|
<div class="panel-body" id="oeuvrePic">
|
||||||
|
|
||||||
@if ($sessions != [])
|
<!-- // TODO -->
|
||||||
@foreach ($sessions[0]->oeuvres()->get() as $oeuvre)
|
|
||||||
<div class="col-xs-4 col-md-3">
|
|
||||||
<a href="#" class="thumbnail">
|
|
||||||
<img src="http://www.augustins.org/documents/10180/156407/{{ $oeuvre->urlPhoto }}">
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<button style="float: right" class="btn btn-primary">Enregistrer</button>
|
<button style="float: right" class="btn btn-primary">Enregistrer</button>
|
||||||
</div>
|
</div>
|
||||||
@ -105,3 +104,4 @@
|
|||||||
|
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user