controller as syntax

This commit is contained in:
Kayn Ty 2018-04-20 12:15:53 +02:00
parent a6193371e5
commit 502bcea117
8 changed files with 105 additions and 42 deletions

View File

@ -36,7 +36,9 @@
<i class="fa fa-file-archive-o"></i>
Catégories
<span class="badge">
{{ app.user.categories|length }}
</span>
</a>
</li>
<li>
@ -47,7 +49,9 @@
{% endif %}" href="{{ path('product_index') }}" data-toggle="tab">
<i class="fa fa-gears"></i>
Produits
{{ app.user.products|length }}
<span class="badge">
{{ app.user.products|length }}
</span>
</a>
</li>
<li>
@ -59,7 +63,9 @@
data-toggle="tab">
<i class="fa fa-th-large"></i>
Festivals
<span class="badge">
{{ app.user.festivals|length }}
</span>
</a>
</li>
<li>

View File

@ -16,14 +16,19 @@
<th>Id</th>
<th>Name</th>
<th>Datecreation</th>
<th>Tous Frais</th>
<th>Clients</th>
<th>fond caisse avant</th>
<th>fond caisse apres</th>
<th>chiffre affaire</th>
<th>fond caisse + CA</th>
<th>diff</th>
<th>bénefices CA - frais</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for festival in festivals %}
<tr>
<td>
@ -32,11 +37,24 @@
</td>
<td>{{ festival.name }}</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.fondDeCaisseAvant }}</td>
<td>{{ festival.fondDeCaisseApres }}</td>
<td>{{ festival.chiffreAffaire }}</td>
<td>{{ festival.fondDeCaisseAvant }}€</td>
<td>{{ festival.fondDeCaisseApres }}€</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>
<ul>
<li>

View File

@ -6,7 +6,11 @@
<h2>
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>
</h2>
@ -14,14 +18,29 @@
<input type="text" ng-model="activeFestival.commentaire" placeholder="commentaire">
<hr>
<h2>
<i class="fa fa-user"></i> Client actuel:
</h2>
{{ 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">
<button class="btn btn-default" ng-click="clearSellingComment()">
<i class="fa fa-times"></i>
</button>
<div>
<div class="row-fluid">
<i class="fa fa-user"></i> Client actuel:
{{ activeSelling.length }} produit<span ng-if="activeSelling.length>1">s</span>
<div>
<input id="sellingCommentInput" type="text" ng-model="MainCtrl.sellingComment" placeholder="nom ou commentaire">
<button class="btn btn-default" ng-click="clearSellingComment()">
<i class="fa fa-times"></i>
</button>
</div>
<button class="btn btn-default" ng-click="MainCtrl.sellingComment = 'boobbbbbb'">
<i class="fa fa-arrow-right"></i>
</button>
</div>
</div>
</div>
<hr>
<ul>
<li ng-repeat="p in activeSelling track by $index">

View File

@ -1,14 +1,20 @@
<div class="selling-history">
<h4>
Ventes récentes
</h4>
{% if recentSells %}
<ul>
{% for s in recentSells %}
<li>{{ s.date|date('Y/m/d H:i:s') }} {{ s.amount }}€</li>
{% endfor %}
</ul>
{% else %}
aucune
{% endif %}
{#<h4>#}
{#Ventes récentes#}
{#</h4>#}
{#{% if recentSells %}#}
{#<ul>#}
{#{% for s in recentSells %}#}
{#<li>{{ s.date|date('Y/m/d H:i:s') }} {{ s.sellingComment }} | {{ s.amount }}€</li>#}
{#{% endfor %}#}
{#</ul>#}
{#{% else %}#}
{#aucune#}
{#{% endif %}#}
{% verbatim %}
<div ng-repeat="s in recentSelling track by $index">
{{s.id}} )
{{s.amount}}
</div>
{% endverbatim %}
</div>

View File

@ -1,7 +1,4 @@
<div class="caisse-main row"
ng-app="caisse"
ng-controller="CaisseCtrl"
>
{% verbatim %}
@ -12,4 +9,3 @@
</div>
{% endverbatim %}
{% include 'logged/angular/loaded-caisse.html.twig' %}
</div>

View File

@ -5,8 +5,15 @@
<div id="container" class="container">
<div id="caisse-now" class="tab-pane fade in active">
<div class="caisse-main row"
ng-app="caisse"
ng-controller="CaisseCtrl as MainCtrl"
>
{% include 'logged/caisse-main.html.twig' %}
sellingComment:
{% verbatim %} {{ MainCtrl.sellingComment }}{% endverbatim %}
{% include 'logged/caisse-main.html.twig' %}
</div>
</div>
<div id="categories" class="tab-pane fade">
<h2>Catégories</h2>

View File

@ -67,7 +67,6 @@ angular
$scope.activeSelling.push(product);
$scope.activeItemsSold.push(product.id);
$scope.regenActiveSellingIds();
};
/**
* remove from current sell list
@ -89,11 +88,11 @@ angular
$scope.clearSellingComment = function () {
$scope.sellingComment = '';
document.querySelector('#sellingComment').focus();
}
document.querySelector('#sellingCommentInput').focus();
};
$scope.clearCurrentSelling = function () {
$scope.paidAmount = 0;
$scope.sellingComment = "";
// $scope.sellingComment = "";
$scope.activeSelling = [];
};
@ -105,13 +104,15 @@ angular
console.log('ok', rep);
$scope.categories = rep.data.categories;
$scope.productsFromDB = rep.data.categories;
$scope.recentSellings = rep.data.history;
// $scope.recentSellings = rep.data.history;
// festoche
$scope.activeFestival.id = rep.data.lastFestival.id;
$scope.activeFestival.name = rep.data.lastFestival.name;
$scope.activeFestival.dateCreation = rep.data.lastFestival.dateCreation;
$scope.activeFestival.commentaire = rep.data.lastFestival.commentaire;
$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;
//done
$scope.initLoadDone = true;
@ -125,14 +126,24 @@ angular
$scope.addProduct(product);
$scope.sendForm();
};
$scope.recentId = 0;
$scope.sendForm = function () {
console.log('$scope.sellingComment', $scope.sellingComment);
console.log('$scope.sellingComment', this.sellingComment);
let lesParams = {
paidByClient : $scope.paidAmount,
sellingComment: $scope.sellingComment,
activeSelling : $scope.activeSelling,
activeFestival: $scope.activeFestival
paidByClient : this.paidAmount,
sellingComment: this.sellingComment,
activeSelling : this.activeSelling,
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;
$http({
method : 'POST',

View File

@ -58,7 +58,7 @@ class DefaultController extends Controller {
$categRepo = $m->getRepository( 'AppBundle:ProductCategory' );
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
$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',
[