diff --git a/app/Resources/views/logged/angular/current.html.twig b/app/Resources/views/logged/angular/current.html.twig index aa5ad042..41c108c4 100755 --- a/app/Resources/views/logged/angular/current.html.twig +++ b/app/Resources/views/logged/angular/current.html.twig @@ -2,14 +2,21 @@
- Festival: +

+ + Festival:


- - Client actuel: - {{ activeSelling.length }} produits - + +

+ Client actuel: +

+ {{ activeSelling.length }} produit + + s + +
diff --git a/app/Resources/views/logged/angular/listing-products.html.twig b/app/Resources/views/logged/angular/listing-products.html.twig index e4a715ee..786bb9f4 100755 --- a/app/Resources/views/logged/angular/listing-products.html.twig +++ b/app/Resources/views/logged/angular/listing-products.html.twig @@ -5,6 +5,7 @@
+
{% include 'logged/angular/validate-button.html.twig' %} {% include 'logged/angular/current.html.twig' %} {#{% include 'logged/angular/paused.html.twig' %}#} +
diff --git a/assets/css/pages/global.scss b/assets/css/pages/global.scss index 95fc1b1a..ab855f46 100755 --- a/assets/css/pages/global.scss +++ b/assets/css/pages/global.scss @@ -18,3 +18,7 @@ thead { background: #000; color: #fff; } + +ul { + padding: 0; +} diff --git a/assets/js/parts/main.js b/assets/js/parts/main.js index c6c10293..a97f80f5 100755 --- a/assets/js/parts/main.js +++ b/assets/js/parts/main.js @@ -5,17 +5,18 @@ angular .controller('CaisseCtrl', ['$scope', '$http', function ($scope, $http, stuff) { $scope.productsFromDB = []; // loaded products $scope.categories = []; // product categories - $scope.sellingComment = "sellingComment"; // 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.paidAmount = 20; + $scope.paidAmount = 0; $scope.pausedSelling = []; + $scope.activeItemsSold = []; // list of products ID to sell $scope.activeSelling = []; // list of products to sell $scope.activeFestival = { // an event where selling take place name : "le festival", dateCreation: new Date(), - commentaire : "le com de festival" + commentaire : "" }; /** * get the sum of products prices @@ -38,6 +39,12 @@ angular return $scope.sumOfList($scope.activeSelling); }; + $scope.regenActiveSellingIds = function () { + $scope.activeItemsSold = []; + for (let obj in $scope.activeSelling) { + $scope.activeItemsSold.push(obj.id); + } + }; $scope.stuff = stuff; $scope.setActiveSelling = function (selling) { $scope.activeSelling = selling; @@ -47,20 +54,7 @@ angular }; $scope.addProduct = function (product) { $scope.activeSelling.push(product); - }; - $scope.fetchProductsFromDB = function () { - console.log('fetch products...'); - $http.get('get-my-products').then((rep) => { - - console.log('ok', rep); - $scope.categories = rep.data.categories; - $scope.recentSellings = rep.data.history; - $scope.initLoadDone = true; - $scope.addProduct($scope.categories[0].products[0]) - }, (err) => { - console.log(err); - $scope.initLoadDone = true; - }); + $scope.activeItemsSold.push(product.id); }; $scope.pauseSelling = function () { $scope.pausedSelling.push(angular.copy($scope.activeSelling)); @@ -75,6 +69,23 @@ angular $scope.sellingComment = ""; $scope.activeSelling = []; }; + + // http related calls + $scope.fetchProductsFromDB = function () { + console.log('fetch products...'); + $http.get('get-my-products').then((rep) => { + + console.log('ok', rep); + $scope.categories = rep.data.categories; + $scope.productsFromDB = rep.data.categories; + $scope.recentSellings = rep.data.history; + $scope.initLoadDone = true; + }, (err) => { + console.log(err); + $scope.initLoadDone = true; + }); + }; + $scope.sendForm = function () { let lesParams = { paidByClient : $scope.paidAmount,