display recent sellings of current festival

This commit is contained in:
Tykayn 2025-02-26 18:53:23 +01:00 committed by tykayn
parent 20611e96c2
commit 66ca3bdf31
5 changed files with 46 additions and 20 deletions

View File

@ -56,7 +56,7 @@ angular
*/ */
$scope.setRightAmountPaid = function () { $scope.setRightAmountPaid = function () {
// debugger; // debugger;
$scope.paidAmount += $scope.sumOfList($scope.activeSelling); $scope.paidAmount = $scope.sumOfList($scope.activeSelling);
} }
/** /**
* deduplicate the active selling items in the view, * deduplicate the active selling items in the view,
@ -290,11 +290,15 @@ angular
$scope.countProductsSoldForActiveFestival = rep.data.activeFestival.sold; $scope.countProductsSoldForActiveFestival = rep.data.activeFestival.sold;
$scope.showTemporaryMessage(); $scope.showTemporaryMessage();
$scope.clearCurrentSelling(); $scope.clearCurrentSelling();
console.log(rep); $scope.sellingComment = '';
// Focus sur le champ de commentaire pour la prochaine vente
document.querySelector('#sellingComment').focus();
if (!rep.success) { if (!rep.success) {
// if not successful, bind errors to error variables
$scope.errors = rep.errors; $scope.errors = rep.errors;
} }
}, function (rep) { }, function (rep) {
console.log('nope! ', rep.data); console.log('nope! ', rep.data);
$scope.showTemporaryErrorMessage(); $scope.showTemporaryErrorMessage();
@ -304,12 +308,16 @@ angular
$scope.sellingOk = false; $scope.sellingOk = false;
$scope.sellingError = false; $scope.sellingError = false;
$scope.tempMessage = {}; $scope.tempMessage;
$scope.showTemporaryMessage = function () { $scope.showTemporaryMessage = function () {
$scope.sellingOk = true; $scope.sellingOk = true;
if ($scope.tempMessage) {
$timeout.cancel($scope.tempMessage); $timeout.cancel($scope.tempMessage);
$scope.tempMessage = $timeout(function () { }
// $scope.tempMessage =
$timeout(function () {
console.log('hide message'); console.log('hide message');
$scope.sellingOk = false; $scope.sellingOk = false;
}, 2000) }, 2000)
@ -326,8 +334,11 @@ angular
return; return;
} }
$scope.sellingError = true; $scope.sellingError = true;
if ($scope.tempMessage) {
$timeout.cancel($scope.tempMessage); $timeout.cancel($scope.tempMessage);
$scope.tempMessage = $timeout(function () { }
// $scope.tempMessage =
$timeout(function () {
console.log('hide message'); console.log('hide message');
$scope.sellingError = false; $scope.sellingError = false;
}, 2000) }, 2000)

View File

@ -12,6 +12,8 @@
<th>Name</th> <th>Name</th>
<th>Date_start</th> <th>Date_start</th>
<th>Date_end</th> <th>Date_end</th>
<th>Bénéfice</th>
<th>ChiffreAffaire</th>
<th>FraisInscription</th> <th>FraisInscription</th>
<th>FondDeCaisseAvant</th> <th>FondDeCaisseAvant</th>
<th>FondDeCaisseApres</th> <th>FondDeCaisseApres</th>
@ -33,9 +35,17 @@
</td> </td>
<td>{{ festival.dateStart ? festival.dateStart|date('Y-m-d') : '' }}</td> <td>{{ festival.dateStart ? festival.dateStart|date('Y-m-d') : '' }}</td>
<td>{{ festival.dateEnd ? festival.dateEnd|date('Y-m-d') : '' }}</td> <td>{{ festival.dateEnd ? festival.dateEnd|date('Y-m-d') : '' }}</td>
<td>{{ festival.fraisInscription }}</td> <td class="text-right">
<td>{{ festival.fondDeCaisseAvant }}</td> {% if festival.fraisInscription is null %}
<td>{{ festival.fondDeCaisseApres }}</td> {{ festival.chiffreAffaire }}
{% else %}
{{ festival.chiffreAffaire - festival.fraisInscription }}
{% endif %}
</td>
<td class="text-right">{{ festival.chiffreAffaire }} €</td>
<td class="text-right">{{ festival.fondDeCaisseAvant | default('?') }} €</td>
<td class="text-right">{{ festival.fondDeCaisseApres | default('?') }} €</td>
<td>{{ festival.dateCreation ? festival.dateCreation|date('Y-m-d') : '' }}</td> <td>{{ festival.dateCreation ? festival.dateCreation|date('Y-m-d') : '' }}</td>
<td> <td>
<a href="{{ path('app_festival_show', {'id': festival.id}) }}">voir</a> <a href="{{ path('app_festival_show', {'id': festival.id}) }}">voir</a>
@ -45,7 +55,9 @@
<td>{{ festival.sellings|length }}</td> <td>{{ festival.sellings|length }}</td>
<td> <td>
<a href="{{ path('app_set_active_festival', {'id': festival.id}) }}">activer</a> <a href="{{ path('app_set_active_festival', {'id': festival.id}) }}">
<i class="fa fa-check"></i>
activer</a>
</td> </td>
</tr> </tr>
{% else %} {% else %}

View File

@ -5,18 +5,14 @@
<div id="listing-products" class="listing-products"> <div id="listing-products" class="listing-products">
{% include 'logged/angular/messages.html.twig' %} {% include 'logged/angular/messages.html.twig' %}
{% include 'logged/angular/listing-products.html.twig' %} {% include 'logged/angular/listing-products.html.twig' %}
</div> </div>
<div id="sellings" class="sellings"> <div id="sellings" class="sellings">
<div class="list-sell" ng-class="{'bg-success text-success': sellingOk }"> <div class="list-sell" ng-class="{'bg-success text-success': sellingOk }">
<button class="button btn btn-default">valider</button> <button class="button btn btn-default">valider</button>
{% include 'logged/angular/validate-button.html.twig' %} {% include 'logged/angular/validate-button.html.twig' %}
{% if app.user.products |length %} {% if app.user.products |length %}
{% include 'logged/angular/current.html.twig' %} {% include 'logged/angular/current.html.twig' %}
{% endif %} {% endif %}
{% include 'logged/angular/paused.html.twig' %} {% include 'logged/angular/paused.html.twig' %}
</div> </div>
</div> </div>
@ -30,7 +26,6 @@
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<div id="other_time"> <div id="other_time">
ventes récentes
{% include 'logged/angular/recent.html.twig' %} {% include 'logged/angular/recent.html.twig' %}
</div> </div>
</div> </div>

View File

@ -1,8 +1,13 @@
<div class="selling-history"> <div class="selling-history">
{% verbatim %} {% verbatim %}
<div ng-repeat="s in recentSelling track by $index"> <h2>
{{recentSellings.length}} Ventes récentes
</h2>
<div ng-repeat="s in recentSellings track by $index">
{{s.id}} ) {{s.id}} )
{{s.amount}} {{s.sum}}
{{s.note}}
</div> </div>
{% endverbatim %} {% endverbatim %}
</div> </div>

View File

@ -1,4 +1,7 @@
<form method="post" action="{{ path('app_product_delete', {'id': product.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');"> <form method="post" action="{{ path('app_product_delete', {'id': product.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ product.id) }}"> <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ product.id) }}">
<button class="btn">Delete</button> <button class="btn btn-danger delete-button">
<i class="fas fa-trash"></i>
Delete
</button>
</form> </form>