choix de festival actuel ok
This commit is contained in:
parent
ffa183fa38
commit
43f9299aaa
@ -19,9 +19,10 @@
|
|||||||
<div id="bodyland">
|
<div id="bodyland">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{% include 'default/header.html.twig' %}
|
{% include 'default/header.html.twig' %}
|
||||||
|
{% block body %}
|
||||||
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% block body %}
|
|
||||||
{% endblock %}
|
|
||||||
</div>
|
</div>
|
||||||
{% block javascripts %}
|
{% block javascripts %}
|
||||||
<script src="{{ asset('build/app.js') }}"></script>
|
<script src="{{ asset('build/app.js') }}"></script>
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
{% extends 'base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>Festivals list</h1>
|
<div class="row">
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<h1>Festivals</h1></div>
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<a class="btn btn-primary" href="{{ path('festival_new') }}">Nouveau festival</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<table class="table-responsive table-striped table table-bordered table-light">
|
<table class="table-responsive table-striped table table-bordered table-light">
|
||||||
<thead>
|
<thead>
|
||||||
@ -9,6 +16,10 @@
|
|||||||
<th>Id</th>
|
<th>Id</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Datecreation</th>
|
<th>Datecreation</th>
|
||||||
|
<th>Clients</th>
|
||||||
|
<th>fond caisse avant</th>
|
||||||
|
<th>fond caisse apres</th>
|
||||||
|
<th>chiffre affaire</th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -21,8 +32,18 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ festival.name }}</td>
|
<td>{{ festival.name }}</td>
|
||||||
<td>{% if festival.dateCreation %}{{ festival.dateCreation|date('Y-m-d H:i:s') }}{% endif %}</td>
|
<td>{% if festival.dateCreation %}{{ festival.dateCreation|date('Y-m-d H:i:s') }}{% endif %}</td>
|
||||||
|
|
||||||
|
<td>{{ festival.sellRecords|length }}</td>
|
||||||
|
<td>{{ festival.fondDeCaisseAvant }}</td>
|
||||||
|
<td>{{ festival.fondDeCaisseApres }}</td>
|
||||||
|
<td>{{ festival.chiffreAffaire }}</td>
|
||||||
<td>
|
<td>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-success" href="{{ path('set_active_festival', { 'id': festival.id }) }}">
|
||||||
|
choisir comme actuel
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="btn btn-primary" href="{{ path('festival_show', { 'id': festival.id }) }}">voir
|
<a class="btn btn-primary" href="{{ path('festival_show', { 'id': festival.id }) }}">voir
|
||||||
</a>
|
</a>
|
||||||
@ -30,6 +51,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<a class="btn btn-primary" href="{{ path('festival_edit', { 'id': festival.id }) }}">
|
<a class="btn btn-primary" href="{{ path('festival_edit', { 'id': festival.id }) }}">
|
||||||
<i class="fa fa-pencil"></i>
|
<i class="fa fa-pencil"></i>
|
||||||
|
Modifier
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -39,9 +61,5 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<ul>
|
<a class="btn btn-primary" href="{{ path('festival_new') }}">Nouveau festival</a>
|
||||||
<li>
|
|
||||||
<a class="btn btn-primary" href="{{ path('festival_new') }}">Nouveau festival</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -10,16 +10,18 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="sellings col-xs-5">
|
<div class="sellings col-xs-5">
|
||||||
<div class="well">
|
<div class="well">
|
||||||
|
|
||||||
{% include 'logged/angular/validate-button.html.twig' %}
|
{% include 'logged/angular/validate-button.html.twig' %}
|
||||||
{% include 'logged/angular/current.html.twig' %}
|
{% include 'logged/angular/current.html.twig' %}
|
||||||
{#{% include 'logged/angular/paused.html.twig' %}#}
|
{#{% include 'logged/angular/paused.html.twig' %}#}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="other_time">
|
<div id="other_time">
|
||||||
|
|
||||||
|
Festival choisi par l'utilsateur:
|
||||||
|
{{ app.user.activeFestival.name }}
|
||||||
{% include 'logged/angular/recent.html.twig' %}
|
{% include 'logged/angular/recent.html.twig' %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
<div id="caisse-now" class="tab-pane fade in active">
|
<div id="caisse-now" class="tab-pane fade in active">
|
||||||
|
|
||||||
{% include 'default/header.html.twig' %}
|
|
||||||
{% include 'logged/caisse-main.html.twig' %}
|
{% include 'logged/caisse-main.html.twig' %}
|
||||||
</div>
|
</div>
|
||||||
<div id="categories" class="tab-pane fade">
|
<div id="categories" class="tab-pane fade">
|
||||||
|
@ -43,11 +43,15 @@ class DefaultController extends Controller {
|
|||||||
$m = $this->getDoctrine()->getManager();
|
$m = $this->getDoctrine()->getManager();
|
||||||
$currentUser = $this->getUser();
|
$currentUser = $this->getUser();
|
||||||
|
|
||||||
$lastFestival = $m->getRepository( 'AppBundle:Festival' )
|
|
||||||
->findOneBy( [ 'user' => $this->getUser()->getId() ],
|
$lastFestival = $currentUser->getActiveFestival();
|
||||||
[ 'id' => 'desc' ],
|
if(!$lastFestival){
|
||||||
0,
|
$lastFestival = $m->getRepository( 'AppBundle:Festival' )
|
||||||
1 );
|
->findOneBy( [ 'user' => $this->getUser()->getId() ],
|
||||||
|
[ 'id' => 'desc' ],
|
||||||
|
0,
|
||||||
|
1 );
|
||||||
|
}
|
||||||
$categRepo = $m->getRepository( 'AppBundle:ProductCategory' );
|
$categRepo = $m->getRepository( 'AppBundle:ProductCategory' );
|
||||||
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
|
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
|
||||||
$categories = $categRepo->findAll();
|
$categories = $categRepo->findAll();
|
||||||
@ -80,23 +84,23 @@ class DefaultController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$activeFestival = $currentUser->getActiveFestival();
|
$activeFestival = $currentUser->getActiveFestival();
|
||||||
if ( ! $activeFestival ) {
|
// if ( ! $activeFestival ) {
|
||||||
$activeFestival = $m->getRepository( 'AppBundle:Festival' )
|
// $activeFestival = $m->getRepository( 'AppBundle:Festival' )
|
||||||
->findOneBy( [ 'user' => $this->getUser()->getId() ],
|
// ->findOneBy( [ 'user' => $this->getUser()->getId() ],
|
||||||
[ 'id' => 'desc' ],
|
// [ 'id' => 'desc' ],
|
||||||
0,
|
// 0,
|
||||||
1 );
|
// 1 );
|
||||||
if ( ! $activeFestival ) {
|
// if ( ! $activeFestival ) {
|
||||||
$activeFestival = new Festival();
|
// $activeFestival = new Festival();
|
||||||
$activeFestival->setDateCreation( new \DateTime() );
|
// $activeFestival->setDateCreation( new \DateTime() );
|
||||||
$activeFestival->setName( 'default festival' );
|
// $activeFestival->setName( 'default festival' );
|
||||||
$activeFestival->setUser( $currentUser );
|
// $activeFestival->setUser( $currentUser );
|
||||||
}
|
// }
|
||||||
$currentUser->setActiveFestival( $activeFestival );
|
// $currentUser->setActiveFestival( $activeFestival );
|
||||||
$m->persist( $activeFestival );
|
// $m->persist( $activeFestival );
|
||||||
$m->persist( $currentUser );
|
// $m->persist( $currentUser );
|
||||||
$m->flush();
|
// $m->flush();
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
$categRepo = $m->getRepository( 'AppBundle:ProductCategory' );
|
$categRepo = $m->getRepository( 'AppBundle:ProductCategory' );
|
||||||
@ -342,4 +346,21 @@ class DefaultController extends Controller {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/set-active-festival/{id}", name="set_active_festival")
|
||||||
|
*/
|
||||||
|
public function setActiveFestivalAction( $id ) {
|
||||||
|
$currentUser = $this->getUser();
|
||||||
|
$m = $this->getDoctrine()->getManager();
|
||||||
|
$repo = $m->getRepository( 'AppBundle:Festival' );
|
||||||
|
|
||||||
|
$currentUser->setActiveFestival( $repo->find( $id ) );
|
||||||
|
$m->persist( $currentUser );
|
||||||
|
$m->flush();
|
||||||
|
|
||||||
|
// replace this example code with whatever you need
|
||||||
|
return $this->redirectToRoute( 'dashboard' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user