diff --git a/app/Resources/views/logged/angular/listing-products.html.twig b/app/Resources/views/logged/angular/listing-products.html.twig
index 66d2cadd..af3c9d5b 100755
--- a/app/Resources/views/logged/angular/listing-products.html.twig
+++ b/app/Resources/views/logged/angular/listing-products.html.twig
@@ -1,20 +1,31 @@
{% verbatim %}
+
+
{{ c.name }}
-
-
- {{ p.price }} €
-
-
{% endverbatim %}
diff --git a/assets/js/parts/main.js b/assets/js/parts/main.js
index 30a90337..ce22451d 100755
--- a/assets/js/parts/main.js
+++ b/assets/js/parts/main.js
@@ -10,6 +10,7 @@ angular
$scope.recentSellings = [];
$scope.lesParams = {};
$scope.paidAmount = 0;
+ $scope.expressSelling = false;
$scope.pausedSelling = [];
$scope.activeItemsSold = []; // list of products ID to sell
$scope.activeSelling = []; // list of products to sell
@@ -102,10 +103,15 @@ angular
});
};
+ $scope.expressSell = function (product) {
+ $scope.addProduct(product);
+ $scope.sendForm();
+ };
$scope.sendForm = function () {
+ console.log('$scope.sellingComment', $scope.sellingComment);
let lesParams = {
paidByClient : $scope.paidAmount,
- sellingComment: angular.copy($scope.sellingComment),
+ sellingComment: $scope.sellingComment,
activeSelling : $scope.activeSelling,
activeFestival: $scope.activeFestival
};
diff --git a/src/AppBundle/Controller/DefaultController.php b/src/AppBundle/Controller/DefaultController.php
index 2290e9b8..c45e55df 100755
--- a/src/AppBundle/Controller/DefaultController.php
+++ b/src/AppBundle/Controller/DefaultController.php
@@ -195,7 +195,7 @@ class DefaultController extends Controller {
$newProductSold->setImage( "image mock" );
$newProductSold->setUser( $currentUser );
$newProductSold->setPrice( $record[ 'price' ] );
- $newProductSold->setComment( "default comment" );
+ $newProductSold->setComment( $json[ 'sellingComment' ] );
$newProductSold->setProduct( $productModel );
$newProductSold->setSellRecords( $newSellRecord );
// link selling record with user, festival
diff --git a/src/AppBundle/Entity/Festival.php~ b/src/AppBundle/Entity/Festival.php~
index 2fe96164..a9c45fbc 100755
--- a/src/AppBundle/Entity/Festival.php~
+++ b/src/AppBundle/Entity/Festival.php~
@@ -66,6 +66,19 @@ class Festival {
*/
private $chiffreAffaire;
+
+ public function recalculateChiffreAffaire() {
+ $sellings = $this->getSellRecords();
+ $newChiffreAffaire = 0;
+ foreach ( $sellings as $selling ) {
+ $newChiffreAffaire += $selling->getAmount();
+ }
+
+ $this->setChiffreAffaire( $newChiffreAffaire );
+
+ return $this;
+ }
+
/**
* Get id
*
diff --git a/src/AppBundle/Entity/Product.php b/src/AppBundle/Entity/Product.php
index 720f144d..19882f7f 100644
--- a/src/AppBundle/Entity/Product.php
+++ b/src/AppBundle/Entity/Product.php
@@ -16,6 +16,11 @@ class Product {
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
+ /**
+ * number of items available
+ * @ORM\Column(name="stock_count", type="integer")
+ */
+ private $stockCount;
/**
* @ORM\Column(type="string", length=100)
@@ -137,4 +142,28 @@ class Product {
public function getUser() {
return $this->user;
}
+
+ /**
+ * Set stockCount.
+ *
+ * @param int $stockCount
+ *
+ * @return Product
+ */
+ public function setStockCount($stockCount)
+ {
+ $this->stockCount = $stockCount;
+
+ return $this;
+ }
+
+ /**
+ * Get stockCount.
+ *
+ * @return int
+ */
+ public function getStockCount()
+ {
+ return $this->stockCount;
+ }
}
diff --git a/src/AppBundle/Entity/Product.php~ b/src/AppBundle/Entity/Product.php~
index 38d86b62..6411e1ec 100755
--- a/src/AppBundle/Entity/Product.php~
+++ b/src/AppBundle/Entity/Product.php~
@@ -16,6 +16,11 @@ class Product {
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
+ /**
+ * number of items available
+ * @ORM\Column(name="stock_count", type="integer")
+ */
+ private $stockCount;
/**
* @ORM\Column(type="string", length=100)
@@ -40,4 +45,101 @@ class Product {
use Sellable;
use Commentable;
+
+ /**
+ * Get id.
+ *
+ * @return int
+ */
+ public function getId() {
+ return $this->id;
+ }
+
+ /**
+ * Set name.
+ *
+ * @param string $name
+ *
+ * @return Product
+ */
+ public function setName( $name ) {
+ $this->name = $name;
+
+ return $this;
+ }
+
+ /**
+ * Get name.
+ *
+ * @return string
+ */
+ public function getName() {
+ return $this->name;
+ }
+
+ /**
+ * Set image.
+ *
+ * @param string|null $image
+ *
+ * @return Product
+ */
+ public function setImage( $image = null ) {
+ $this->image = $image;
+
+ return $this;
+ }
+
+ /**
+ * Get image.
+ *
+ * @return string|null
+ */
+ public function getImage() {
+ return $this->image;
+ }
+
+ /**
+ * Set category.
+ *
+ * @param \AppBundle\Entity\ProductCategory|null $category
+ *
+ * @return Product
+ */
+ public function setCategory( \AppBundle\Entity\ProductCategory $category = null ) {
+ $this->category = $category;
+
+ return $this;
+ }
+
+ /**
+ * Get category.
+ *
+ * @return \AppBundle\Entity\ProductCategory|null
+ */
+ public function getCategory() {
+ return $this->category;
+ }
+
+ /**
+ * Set user.
+ *
+ * @param \AppBundle\Entity\User|null $user
+ *
+ * @return Product
+ */
+ public function setUser( \AppBundle\Entity\User $user = null ) {
+ $this->user = $user;
+
+ return $this;
+ }
+
+ /**
+ * Get user.
+ *
+ * @return \AppBundle\Entity\User|null
+ */
+ public function getUser() {
+ return $this->user;
+ }
}