From 3642e128f98b5208609009d46bfa34d30eba80b7 Mon Sep 17 00:00:00 2001 From: Kayn Ty Date: Fri, 6 Apr 2018 15:54:59 +0200 Subject: [PATCH] descriptions in js, start to test record --- .../views/logged/angular/current.html.twig | 9 ++++++-- .../logged/angular/loaded-caisse.html.twig | 16 +------------- .../views/logged/angular/recent.html.twig | 14 +++++++++++++ .../views/logged/caisse-main.html.twig | 4 ++-- assets/css/pages/global.scss | 2 +- assets/js/parts/main.js | 21 ++++++++++--------- src/AppBundle/Entity/SellRecord.php | 15 ++++++++----- 7 files changed, 46 insertions(+), 35 deletions(-) create mode 100644 app/Resources/views/logged/angular/recent.html.twig diff --git a/app/Resources/views/logged/angular/current.html.twig b/app/Resources/views/logged/angular/current.html.twig index b1e732b3..ae5d4500 100644 --- a/app/Resources/views/logged/angular/current.html.twig +++ b/app/Resources/views/logged/angular/current.html.twig @@ -1,10 +1,15 @@ {% verbatim %}
- Festival: {{ activeFestival.name }} - + Festival: + +
+ Client actuel: {{ activeSelling.length }} produits + +
+
  • diff --git a/app/Resources/views/logged/angular/loaded-caisse.html.twig b/app/Resources/views/logged/angular/loaded-caisse.html.twig index 051bad34..63b5a3a1 100644 --- a/app/Resources/views/logged/angular/loaded-caisse.html.twig +++ b/app/Resources/views/logged/angular/loaded-caisse.html.twig @@ -12,24 +12,10 @@
    {% include 'logged/angular/current.html.twig' %} {% include 'logged/angular/paused.html.twig' %} + {% include 'logged/angular/recent.html.twig' %} -
    -

    - Ventes récentes -

    - {% if recentSells %} -
      - {% for s in recentSells %} -
    • {{ s.date|date('Y/m/d H:i:s') }} {{ s.amount }}€
    • - {% endfor %} -
    - {% else %} - aucune - {% endif %} - -
diff --git a/app/Resources/views/logged/angular/recent.html.twig b/app/Resources/views/logged/angular/recent.html.twig new file mode 100644 index 00000000..7a6c1569 --- /dev/null +++ b/app/Resources/views/logged/angular/recent.html.twig @@ -0,0 +1,14 @@ +
+

+ Ventes récentes +

+ {% if recentSells %} + + {% else %} + aucune + {% endif %} +
diff --git a/app/Resources/views/logged/caisse-main.html.twig b/app/Resources/views/logged/caisse-main.html.twig index 4412057f..62082d44 100644 --- a/app/Resources/views/logged/caisse-main.html.twig +++ b/app/Resources/views/logged/caisse-main.html.twig @@ -7,9 +7,9 @@
- Chargement en cours de vos produits + Chargement en cours de vos produits
{% endverbatim %} - {% include 'logged/angular/loaded-caisse.html.twig' %} + {% include 'logged/angular/loaded-caisse.html.twig' %} diff --git a/assets/css/pages/global.scss b/assets/css/pages/global.scss index 3692f280..407957e0 100644 --- a/assets/css/pages/global.scss +++ b/assets/css/pages/global.scss @@ -9,6 +9,6 @@ filter: alpha(opacity=20); width: 100vw; height: 100vh; - position: absolute; + position: fixed; overflow: hidden; } diff --git a/assets/js/parts/main.js b/assets/js/parts/main.js index d9d1d5e1..dcd13f39 100644 --- a/assets/js/parts/main.js +++ b/assets/js/parts/main.js @@ -3,18 +3,14 @@ var stuff = ['initialstuff']; angular .module('caisse', []) .controller('CaisseCtrl', ['$scope', '$http', function ($scope, $http, stuff) { - $scope.productsFromDB = [ - {id: 1, name: "truc 1", price: 8, category: 1}, - {id: 2, name: "truc 2", price: 2, category: 1}, - {id: 3, name: "truc 3", price: 4, category: 2}, - {id: 4, name: "truc 4", price: 1, category: 2}, - ]; - $scope.categories = []; - $scope.initLoadDone = false; + $scope.productsFromDB = []; // loaded products + $scope.categories = []; // product categories + $scope.commentaire = []; // comment about the client or the current selling + $scope.initLoadDone = false; // becames true after first init of product loading $scope.recentSellings = []; $scope.pausedSelling = []; - $scope.activeSelling = []; - $scope.activeFestival = { + $scope.activeSelling = []; // list of products to sell + $scope.activeFestival = { // an event where selling take place name : "le festival", dateCreation: new Date(), commentaire : "" @@ -71,8 +67,13 @@ angular $scope.activeSelling = angular.copy(sellingList); $scope.pausedSelling.splice(index, 1); }; + $scope.clearCurrentSelling = function () { + $scope.commentaire = ""; + $scope.activeSelling = []; + }; $scope.sendForm = function () { let lesParams = { + sellingComment: $scope.commentaire, activeSelling : $scope.activeSelling, activeFestival: $scope.activeFestival }; diff --git a/src/AppBundle/Entity/SellRecord.php b/src/AppBundle/Entity/SellRecord.php index 0592e12a..23673be1 100644 --- a/src/AppBundle/Entity/SellRecord.php +++ b/src/AppBundle/Entity/SellRecord.php @@ -11,11 +11,6 @@ use Doctrine\ORM\Mapping as ORM; class SellRecord { use Commentable; - /** - * @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="sellRecords") - */ - private $productsSold; - /** * @ORM\Id * @ORM\GeneratedValue @@ -23,11 +18,20 @@ class SellRecord { */ private $id; /** + * liste des produits de la vente + * @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="sellRecords") + */ + private $productsSold; + + + /** + * creation date * @ORM\Column(type="datetime") */ private $date; /** + * total * @ORM\Column(type="decimal", scale=2, nullable=true) */ private $amount; @@ -39,6 +43,7 @@ class SellRecord { private $festival; /** + * owner of the selling account * @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="sellRecords") */ private $user;