controller as syntax
This commit is contained in:
parent
a6193371e5
commit
502bcea117
|
@ -36,7 +36,9 @@
|
||||||
<i class="fa fa-file-archive-o"></i>
|
<i class="fa fa-file-archive-o"></i>
|
||||||
Catégories
|
Catégories
|
||||||
|
|
||||||
|
<span class="badge">
|
||||||
{{ app.user.categories|length }}
|
{{ app.user.categories|length }}
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
@ -47,7 +49,9 @@
|
||||||
{% endif %}" href="{{ path('product_index') }}" data-toggle="tab">
|
{% endif %}" href="{{ path('product_index') }}" data-toggle="tab">
|
||||||
<i class="fa fa-gears"></i>
|
<i class="fa fa-gears"></i>
|
||||||
Produits
|
Produits
|
||||||
|
<span class="badge">
|
||||||
{{ app.user.products|length }}
|
{{ app.user.products|length }}
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
@ -59,7 +63,9 @@
|
||||||
data-toggle="tab">
|
data-toggle="tab">
|
||||||
<i class="fa fa-th-large"></i>
|
<i class="fa fa-th-large"></i>
|
||||||
Festivals
|
Festivals
|
||||||
|
<span class="badge">
|
||||||
{{ app.user.festivals|length }}
|
{{ app.user.festivals|length }}
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -16,14 +16,19 @@
|
||||||
<th>Id</th>
|
<th>Id</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Datecreation</th>
|
<th>Datecreation</th>
|
||||||
|
<th>Tous Frais</th>
|
||||||
<th>Clients</th>
|
<th>Clients</th>
|
||||||
<th>fond caisse avant</th>
|
<th>fond caisse avant</th>
|
||||||
<th>fond caisse apres</th>
|
<th>fond caisse apres</th>
|
||||||
<th>chiffre affaire</th>
|
<th>chiffre affaire</th>
|
||||||
|
<th>fond caisse + CA</th>
|
||||||
|
<th>diff</th>
|
||||||
|
<th>bénefices CA - frais</th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
{% for festival in festivals %}
|
{% for festival in festivals %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
@ -32,11 +37,24 @@
|
||||||
</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.fraisInscription + festival.fraisTransport + festival.fraisRepas + festival.fraisHebergement }}
|
||||||
|
€
|
||||||
|
</td>
|
||||||
|
|
||||||
<td>{{ festival.sellRecords|length }}</td>
|
<td>{{ festival.sellRecords|length }}</td>
|
||||||
<td>{{ festival.fondDeCaisseAvant }}</td>
|
<td>{{ festival.fondDeCaisseAvant }}€</td>
|
||||||
<td>{{ festival.fondDeCaisseApres }}</td>
|
<td>{{ festival.fondDeCaisseApres }}€</td>
|
||||||
<td>{{ festival.chiffreAffaire }}</td>
|
<td>{{ festival.chiffreAffaire }}€</td>
|
||||||
|
<td>{{ festival.fondDeCaisseAvant + festival.chiffreAffaire }}€</td>
|
||||||
|
<td
|
||||||
|
class="{% if (festival.chiffreAffaire - festival.fondDeCaisseApres) != 0 %}
|
||||||
|
bg-warning
|
||||||
|
{% else %}
|
||||||
|
bg-success
|
||||||
|
{% endif %}"
|
||||||
|
>{{ festival.chiffreAffaire - festival.fondDeCaisseApres }}€
|
||||||
|
</td>
|
||||||
|
<td>{{ festival.chiffreAffaire - (festival.fraisInscription + festival.fraisTransport + festival.fraisRepas + festival.fraisHebergement ) }}</td>
|
||||||
<td>
|
<td>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -6,7 +6,11 @@
|
||||||
<h2>
|
<h2>
|
||||||
|
|
||||||
Festival:
|
Festival:
|
||||||
<span class="badge badge-success">{{ activeFestival.chiffreAffaire }} €</span>
|
<span class="badge" title="fond de caisse + chiffre d'affaire. veillez à vider votre fond de caisse ailleurs lorsqu'il devient trop important, par exemple au dela de 200€" ng-class="{'badge-warning': activeFestival.fondDeCaisseAvant + activeFestival.chiffreAffaire > 200}">
|
||||||
|
<i class="fa fa-archive"></i>
|
||||||
|
{{ activeFestival.fondDeCaisseAvant + activeFestival.chiffreAffaire}} €
|
||||||
|
</span>
|
||||||
|
<span class="badge badge-success">CA {{ activeFestival.chiffreAffaire }} €</span>
|
||||||
<span class="badge badge-success">{{ activeFestival.clientsCount }} <i class="fa fa-user"></i></span>
|
<span class="badge badge-success">{{ activeFestival.clientsCount }} <i class="fa fa-user"></i></span>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
@ -14,14 +18,29 @@
|
||||||
<input type="text" ng-model="activeFestival.commentaire" placeholder="commentaire">
|
<input type="text" ng-model="activeFestival.commentaire" placeholder="commentaire">
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<h2>
|
|
||||||
|
<div>
|
||||||
|
<div class="row-fluid">
|
||||||
<i class="fa fa-user"></i> Client actuel:
|
<i class="fa fa-user"></i> Client actuel:
|
||||||
</h2>
|
|
||||||
{{ activeSelling.length }} produit<span ng-if="activeSelling.length>1">s</span>
|
{{ activeSelling.length }} produit<span ng-if="activeSelling.length>1">s</span>
|
||||||
<input id="sellingComment" name="sellingComment" class="input input-lg" type="text" ng-model="sellingComment" placeholder="nom ou commentaire">
|
<div>
|
||||||
|
<input id="sellingCommentInput" type="text" ng-model="MainCtrl.sellingComment" placeholder="nom ou commentaire">
|
||||||
<button class="btn btn-default" ng-click="clearSellingComment()">
|
<button class="btn btn-default" ng-click="clearSellingComment()">
|
||||||
<i class="fa fa-times"></i>
|
<i class="fa fa-times"></i>
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-default" ng-click="MainCtrl.sellingComment = 'boobbbbbb'">
|
||||||
|
<i class="fa fa-arrow-right"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<ul>
|
<ul>
|
||||||
<li ng-repeat="p in activeSelling track by $index">
|
<li ng-repeat="p in activeSelling track by $index">
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
<div class="selling-history">
|
<div class="selling-history">
|
||||||
<h4>
|
{#<h4>#}
|
||||||
Ventes récentes
|
{#Ventes récentes#}
|
||||||
</h4>
|
{#</h4>#}
|
||||||
{% if recentSells %}
|
{#{% if recentSells %}#}
|
||||||
<ul>
|
{#<ul>#}
|
||||||
{% for s in recentSells %}
|
{#{% for s in recentSells %}#}
|
||||||
<li>{{ s.date|date('Y/m/d H:i:s') }} {{ s.amount }}€</li>
|
{#<li>{{ s.date|date('Y/m/d H:i:s') }} {{ s.sellingComment }} | {{ s.amount }}€</li>#}
|
||||||
{% endfor %}
|
{#{% endfor %}#}
|
||||||
</ul>
|
{#</ul>#}
|
||||||
{% else %}
|
{#{% else %}#}
|
||||||
aucune
|
{#aucune#}
|
||||||
{% endif %}
|
{#{% endif %}#}
|
||||||
|
{% verbatim %}
|
||||||
|
<div ng-repeat="s in recentSelling track by $index">
|
||||||
|
{{s.id}} )
|
||||||
|
{{s.amount}} €
|
||||||
|
</div>
|
||||||
|
{% endverbatim %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
<div class="caisse-main row"
|
|
||||||
ng-app="caisse"
|
|
||||||
ng-controller="CaisseCtrl"
|
|
||||||
>
|
|
||||||
|
|
||||||
{% verbatim %}
|
{% verbatim %}
|
||||||
|
|
||||||
|
@ -12,4 +9,3 @@
|
||||||
</div>
|
</div>
|
||||||
{% endverbatim %}
|
{% endverbatim %}
|
||||||
{% include 'logged/angular/loaded-caisse.html.twig' %}
|
{% include 'logged/angular/loaded-caisse.html.twig' %}
|
||||||
</div>
|
|
||||||
|
|
|
@ -5,9 +5,16 @@
|
||||||
<div id="container" class="container">
|
<div id="container" class="container">
|
||||||
|
|
||||||
<div id="caisse-now" class="tab-pane fade in active">
|
<div id="caisse-now" class="tab-pane fade in active">
|
||||||
|
<div class="caisse-main row"
|
||||||
|
ng-app="caisse"
|
||||||
|
ng-controller="CaisseCtrl as MainCtrl"
|
||||||
|
>
|
||||||
|
|
||||||
|
sellingComment:
|
||||||
|
{% verbatim %} {{ MainCtrl.sellingComment }}{% endverbatim %}
|
||||||
{% include 'logged/caisse-main.html.twig' %}
|
{% include 'logged/caisse-main.html.twig' %}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div id="categories" class="tab-pane fade">
|
<div id="categories" class="tab-pane fade">
|
||||||
<h2>Catégories</h2>
|
<h2>Catégories</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -67,7 +67,6 @@ angular
|
||||||
$scope.activeSelling.push(product);
|
$scope.activeSelling.push(product);
|
||||||
$scope.activeItemsSold.push(product.id);
|
$scope.activeItemsSold.push(product.id);
|
||||||
$scope.regenActiveSellingIds();
|
$scope.regenActiveSellingIds();
|
||||||
|
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* remove from current sell list
|
* remove from current sell list
|
||||||
|
@ -89,11 +88,11 @@ angular
|
||||||
|
|
||||||
$scope.clearSellingComment = function () {
|
$scope.clearSellingComment = function () {
|
||||||
$scope.sellingComment = '';
|
$scope.sellingComment = '';
|
||||||
document.querySelector('#sellingComment').focus();
|
document.querySelector('#sellingCommentInput').focus();
|
||||||
}
|
};
|
||||||
$scope.clearCurrentSelling = function () {
|
$scope.clearCurrentSelling = function () {
|
||||||
$scope.paidAmount = 0;
|
$scope.paidAmount = 0;
|
||||||
$scope.sellingComment = "";
|
// $scope.sellingComment = "";
|
||||||
$scope.activeSelling = [];
|
$scope.activeSelling = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -105,13 +104,15 @@ angular
|
||||||
console.log('ok', rep);
|
console.log('ok', rep);
|
||||||
$scope.categories = rep.data.categories;
|
$scope.categories = rep.data.categories;
|
||||||
$scope.productsFromDB = rep.data.categories;
|
$scope.productsFromDB = rep.data.categories;
|
||||||
$scope.recentSellings = rep.data.history;
|
// $scope.recentSellings = rep.data.history;
|
||||||
// festoche
|
// festoche
|
||||||
$scope.activeFestival.id = rep.data.lastFestival.id;
|
$scope.activeFestival.id = rep.data.lastFestival.id;
|
||||||
$scope.activeFestival.name = rep.data.lastFestival.name;
|
$scope.activeFestival.name = rep.data.lastFestival.name;
|
||||||
$scope.activeFestival.dateCreation = rep.data.lastFestival.dateCreation;
|
$scope.activeFestival.dateCreation = rep.data.lastFestival.dateCreation;
|
||||||
$scope.activeFestival.commentaire = rep.data.lastFestival.commentaire;
|
$scope.activeFestival.commentaire = rep.data.lastFestival.commentaire;
|
||||||
$scope.activeFestival.chiffreAffaire = rep.data.lastFestival.chiffreAffaire;
|
$scope.activeFestival.chiffreAffaire = rep.data.lastFestival.chiffreAffaire;
|
||||||
|
$scope.activeFestival.fondDeCaisseAvant = rep.data.lastFestival.fondDeCaisseAvant;
|
||||||
|
$scope.activeFestival.fondDeCaisseApres = rep.data.lastFestival.fondDeCaisseApres;
|
||||||
$scope.activeFestival.clientsCount = rep.data.lastFestival.clientsCount;
|
$scope.activeFestival.clientsCount = rep.data.lastFestival.clientsCount;
|
||||||
//done
|
//done
|
||||||
$scope.initLoadDone = true;
|
$scope.initLoadDone = true;
|
||||||
|
@ -125,14 +126,24 @@ angular
|
||||||
$scope.addProduct(product);
|
$scope.addProduct(product);
|
||||||
$scope.sendForm();
|
$scope.sendForm();
|
||||||
};
|
};
|
||||||
|
$scope.recentId = 0;
|
||||||
$scope.sendForm = function () {
|
$scope.sendForm = function () {
|
||||||
console.log('$scope.sellingComment', $scope.sellingComment);
|
console.log('$scope.sellingComment', this.sellingComment);
|
||||||
let lesParams = {
|
let lesParams = {
|
||||||
paidByClient : $scope.paidAmount,
|
paidByClient : this.paidAmount,
|
||||||
sellingComment: $scope.sellingComment,
|
sellingComment: this.sellingComment,
|
||||||
activeSelling : $scope.activeSelling,
|
activeSelling : this.activeSelling,
|
||||||
activeFestival: $scope.activeFestival
|
activeFestival: this.activeFestival
|
||||||
};
|
};
|
||||||
|
$scope.recentSellings.push({
|
||||||
|
id : this.recentId++,
|
||||||
|
amount : this.CurrentSellingTotal(),
|
||||||
|
paidAmount: this.paidAmount,
|
||||||
|
products :
|
||||||
|
angular
|
||||||
|
.copy(this.activeSelling)
|
||||||
|
});
|
||||||
|
console.log('$scope.recentSellings', this.recentSellings);
|
||||||
$scope.lesParams = lesParams;
|
$scope.lesParams = lesParams;
|
||||||
$http({
|
$http({
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
|
|
|
@ -58,7 +58,7 @@ class DefaultController extends Controller {
|
||||||
$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();
|
||||||
$recentSells = $sellingRepo->findBy( [], [ 'id' => 'desc' ], 0, 5 );
|
$recentSells = $sellingRepo->findBy( ['user'=>$currentUser->getId()], [ 'id' => 'desc' ], 0, 5 );
|
||||||
|
|
||||||
return $this->render( 'logged/dashboard.html.twig',
|
return $this->render( 'logged/dashboard.html.twig',
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in New Issue