From 5bb843de16ed08a5df23685eba3589d48bd6cc9a Mon Sep 17 00:00:00 2001 From: ty kayn Date: Fri, 5 Jul 2019 17:46:04 +0200 Subject: [PATCH] history display and export --- .../logged/angular/listing-products.html.twig | 2 +- .../views/logged/dashboard.html.twig | 20 ++++++++++++------ assets/js/parts/globalActions.js | 2 ++ assets/js/parts/main.js | 21 ++++++++++++------- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/app/Resources/views/logged/angular/listing-products.html.twig b/app/Resources/views/logged/angular/listing-products.html.twig index 30c13f21..c5453163 100755 --- a/app/Resources/views/logged/angular/listing-products.html.twig +++ b/app/Resources/views/logged/angular/listing-products.html.twig @@ -28,7 +28,7 @@ {{ countProductsSoldForActiveFestival[p.id] }} - diff --git a/app/Resources/views/logged/dashboard.html.twig b/app/Resources/views/logged/dashboard.html.twig index 200e63f6..e3e28b1d 100755 --- a/app/Resources/views/logged/dashboard.html.twig +++ b/app/Resources/views/logged/dashboard.html.twig @@ -9,7 +9,7 @@
- Sauvegardé! + Sauvegardé! WOHOOOOOO +{{recentSellings[recentSellings.length -1].amount}} € {{sellingComment}}
@@ -30,11 +30,11 @@ - + + ( {{sellingComment}} ) + diff --git a/assets/js/parts/globalActions.js b/assets/js/parts/globalActions.js index 48eb5d39..9bca4e8f 100644 --- a/assets/js/parts/globalActions.js +++ b/assets/js/parts/globalActions.js @@ -93,4 +93,6 @@ $(document).ready(function () { }) // $('#introjs_start').click(); + let inputClient = document.querySelector('.client-now input'); + inputClient ? inputClient.focus() : false; }); diff --git a/assets/js/parts/main.js b/assets/js/parts/main.js index c8f07e4a..81f26c99 100755 --- a/assets/js/parts/main.js +++ b/assets/js/parts/main.js @@ -16,21 +16,21 @@ var stuff = ['initialstuff']; // TODO split controllers in other files angular .module('caisse', []) - .controller('CaisseCtrl', ['$scope', '$http', '$timeout', function ($scope, $http, $timeout) { + .controller('CaisseCtrl', ['$scope', '$http', '$timeout', '$rootScope', function ($scope, $http, $timeout,$rootScope) { $scope.productsFromDB = []; // loaded products $scope.categories = []; // product categories - $scope.sellingComment = "un gens"; // comment about the client or the current selling + $scope.sellingComment = ""; // comment about the client or the current selling $scope.initLoadDone = false; // becames true after first init of product loading $scope.recentSellings = []; $scope.lesParams = {}; $scope.countProductsSoldForActiveFestival = {}; $scope.simpleDisplay = false; $scope.paidAmount = 0; - $scope.expressSelling = true; $scope.pausedSelling = []; $scope.show_config = { + expressSelling: true, stock_count: false, - sold : true, + sold : false, }; $scope.activeItemsSold = []; // list of products ID to sell $scope.activeSelling = []; // list of products to sell @@ -38,6 +38,7 @@ angular $scope.activeFestival = { // an event where selling take place id : null, name : "le festival", + productComment : "", dateCreation : new Date(), chiffreAffaire: 0, clientsCount : 0, @@ -191,8 +192,10 @@ angular }; $scope.clearSellingComment = function () { + console.log(' $scope.sellingComment', $scope.sellingComment); $scope.sellingComment = ''; - document.querySelector('.client-now input').focus(); + // document.querySelector('.client-now input').focus(); + document.querySelector('.client-now input').select(); }; $scope.clearCurrentSelling = function () { $scope.paidAmount = 0; @@ -251,10 +254,12 @@ angular }; $scope.sendForm = function () { console.log('$scope.sellingComment', $scope.sellingComment); + console.log('$rootScope.sellingComment', $rootScope.sellingComment); + console.log('$scope.sellingComment done'); console.log("$scope.activeSelling", $scope.activeSelling); let lesParams = { paidByClient : $scope.paidAmount, - sellingComment: $scope.sellingComment, + sellingComment: $scope.activeFestival.productComment, activeSelling : $scope.activeSelling, activeFestival: $scope.activeFestival }; @@ -266,6 +271,7 @@ angular angular .copy($scope.activeSelling) }); + console.log('lesParams sellingComment', lesParams.sellingComment); console.log('$scope.recentSellings', $scope.recentSellings); $scope.lesParams = lesParams; $http({ @@ -277,13 +283,14 @@ angular data : lesParams // pass in data as strings }).then(function (rep) { - $scope.clearCurrentSelling(); + // if successful, bind success message to message $scope.successMessage = rep.data.message; $scope.activeFestival.chiffreAffaire = rep.data.newChiffreAffaire; $scope.activeFestival.clientsCount = rep.data.clientsCount; $scope.countProductsSoldForActiveFestival = rep.data.activeFestival.sold; $scope.showTemporaryMessage(); + $scope.clearCurrentSelling(); console.log(rep); if (!rep.success) { // if not successful, bind errors to error variables