From 66ca3bdf3166ee139b85f8827c026888a87eab0b Mon Sep 17 00:00:00 2001 From: Tykayn Date: Wed, 26 Feb 2025 18:53:23 +0100 Subject: [PATCH] display recent sellings of current festival --- assets/js/parts/main.js | 27 +++++++++++++------ templates/festival/index.html.twig | 20 +++++++++++--- .../logged/angular/loaded-caisse.html.twig | 5 ---- templates/logged/angular/recent.html.twig | 9 +++++-- templates/product/_delete_form.html.twig | 5 +++- 5 files changed, 46 insertions(+), 20 deletions(-) diff --git a/assets/js/parts/main.js b/assets/js/parts/main.js index cc8a9a8c..b7548bd4 100755 --- a/assets/js/parts/main.js +++ b/assets/js/parts/main.js @@ -56,7 +56,7 @@ angular */ $scope.setRightAmountPaid = function () { // debugger; - $scope.paidAmount += $scope.sumOfList($scope.activeSelling); + $scope.paidAmount = $scope.sumOfList($scope.activeSelling); } /** * deduplicate the active selling items in the view, @@ -290,11 +290,15 @@ angular $scope.countProductsSoldForActiveFestival = rep.data.activeFestival.sold; $scope.showTemporaryMessage(); $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 not successful, bind errors to error variables $scope.errors = rep.errors; } + }, function (rep) { console.log('nope! ', rep.data); $scope.showTemporaryErrorMessage(); @@ -304,12 +308,16 @@ angular $scope.sellingOk = false; $scope.sellingError = false; - $scope.tempMessage = {}; + $scope.tempMessage; $scope.showTemporaryMessage = function () { $scope.sellingOk = true; - $timeout.cancel($scope.tempMessage); - $scope.tempMessage = $timeout(function () { + + if ($scope.tempMessage) { + $timeout.cancel($scope.tempMessage); + } + // $scope.tempMessage = + $timeout(function () { console.log('hide message'); $scope.sellingOk = false; }, 2000) @@ -326,8 +334,11 @@ angular return; } $scope.sellingError = true; - $timeout.cancel($scope.tempMessage); - $scope.tempMessage = $timeout(function () { + if ($scope.tempMessage) { + $timeout.cancel($scope.tempMessage); + } + // $scope.tempMessage = + $timeout(function () { console.log('hide message'); $scope.sellingError = false; }, 2000) diff --git a/templates/festival/index.html.twig b/templates/festival/index.html.twig index f46055a6..3fff983b 100644 --- a/templates/festival/index.html.twig +++ b/templates/festival/index.html.twig @@ -12,6 +12,8 @@ Name Date_start Date_end + Bénéfice + ChiffreAffaire FraisInscription FondDeCaisseAvant FondDeCaisseApres @@ -33,9 +35,17 @@ {{ festival.dateStart ? festival.dateStart|date('Y-m-d') : '' }} {{ festival.dateEnd ? festival.dateEnd|date('Y-m-d') : '' }} - {{ festival.fraisInscription }} - {{ festival.fondDeCaisseAvant }} - {{ festival.fondDeCaisseApres }} + + {% if festival.fraisInscription is null %} + {{ festival.chiffreAffaire }} € + {% else %} + {{ festival.chiffreAffaire - festival.fraisInscription }} € + {% endif %} + + {{ festival.chiffreAffaire }} € + + {{ festival.fondDeCaisseAvant | default('?') }} € + {{ festival.fondDeCaisseApres | default('?') }} € {{ festival.dateCreation ? festival.dateCreation|date('Y-m-d') : '' }} voir @@ -45,7 +55,9 @@ {{ festival.sellings|length }} - activer + + + activer {% else %} diff --git a/templates/logged/angular/loaded-caisse.html.twig b/templates/logged/angular/loaded-caisse.html.twig index e7c810d5..015afc04 100755 --- a/templates/logged/angular/loaded-caisse.html.twig +++ b/templates/logged/angular/loaded-caisse.html.twig @@ -5,18 +5,14 @@
{% include 'logged/angular/messages.html.twig' %} {% include 'logged/angular/listing-products.html.twig' %} -
-
- {% include 'logged/angular/validate-button.html.twig' %} {% if app.user.products |length %} {% include 'logged/angular/current.html.twig' %} {% endif %} - {% include 'logged/angular/paused.html.twig' %}
@@ -30,7 +26,6 @@
- ventes récentes {% include 'logged/angular/recent.html.twig' %}
diff --git a/templates/logged/angular/recent.html.twig b/templates/logged/angular/recent.html.twig index 077adc1c..969d0e77 100755 --- a/templates/logged/angular/recent.html.twig +++ b/templates/logged/angular/recent.html.twig @@ -1,8 +1,13 @@
{% verbatim %} -
+

+ {{recentSellings.length}} Ventes récentes +

+ +
{{s.id}} ) -{{s.amount}} € +{{s.sum}} € +{{s.note}}
{% endverbatim %}
diff --git a/templates/product/_delete_form.html.twig b/templates/product/_delete_form.html.twig index 00b9a7ef..43827bc3 100644 --- a/templates/product/_delete_form.html.twig +++ b/templates/product/_delete_form.html.twig @@ -1,4 +1,7 @@
- +