express sell mode
This commit is contained in:
parent
f2ac806dc1
commit
03c8d9b968
@ -1,20 +1,31 @@
|
||||
{% verbatim %}
|
||||
<button
|
||||
title="la vente express vous permet d'enregistrer une vente pour un seul article sans remplir le formulaire de détail"
|
||||
class="btn" ng-class="{'btn-success': expressSelling, 'btn-disabled':!expressSelling}" ng-click="expressSelling = !expressSelling"><i class="fa fa-shopping-cart"></i> mode vente express
|
||||
<span ng-if=expressSelling>activé</span>
|
||||
</button>
|
||||
<div class="category-listing well" ng-repeat="c in categories">
|
||||
|
||||
<h2>
|
||||
{{ c.name }}
|
||||
</h2>
|
||||
<button ng-repeat="p in c.products track by p.id"
|
||||
<div ng-repeat="p in c.products track by p.id"
|
||||
class="btn btn-default"
|
||||
ng-class="{ 'btn-primary' : activeItemsSold.indexOf(p.id) !==-1}"
|
||||
ng-click="addProduct( p )">
|
||||
>
|
||||
<button ng-click="addProduct( p )">
|
||||
<img class="product-image" src="{{p.image}}" alt="image" ng-if="p.image.length">
|
||||
<span class="product-name">
|
||||
{{ p.name }}
|
||||
</span>
|
||||
|
||||
<span class="badge">
|
||||
{{ p.price }} €
|
||||
</span>
|
||||
</button>
|
||||
<button ng-if="expressSelling" ng-click="expressSell(p)">
|
||||
<i class="fa fa-shopping-cart"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endverbatim %}
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user