add debug for record
This commit is contained in:
parent
013c990540
commit
8e4f494035
|
@ -1,5 +1,16 @@
|
|||
{% verbatim %}
|
||||
<div class="current-selling">
|
||||
<div class="well">
|
||||
<button class="btn btn-primary btn-block" id="validate_selling" ng-click="sendForm()"
|
||||
ng-disabled="!paidAmount">
|
||||
<i class="fa fa-check"></i>
|
||||
Valider
|
||||
</button>
|
||||
<pre>
|
||||
|
||||
{{lesParams|json}}
|
||||
</pre>
|
||||
</div>
|
||||
<form action="#">
|
||||
Festival:
|
||||
<input type="text" ng-model="activeFestival.name" placeholder="nom du festival">
|
||||
|
@ -7,7 +18,7 @@
|
|||
<hr>
|
||||
Client actuel:
|
||||
{{ activeSelling.length }} produits
|
||||
<input type="text" ng-model="commentaire" placeholder="commentaire">
|
||||
<input type="text" ng-model="sellingComment" placeholder="commentaire">
|
||||
<hr>
|
||||
|
||||
<ul>
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
<span class="badge">
|
||||
{{ p.price }}
|
||||
</span>
|
||||
<span class="badge">
|
||||
c
|
||||
{{ c.id }}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
{% endverbatim %}
|
||||
|
|
|
@ -11,4 +11,5 @@
|
|||
height: 100vh;
|
||||
position: fixed;
|
||||
overflow: hidden;
|
||||
z-index: -1;
|
||||
}
|
||||
|
|
|
@ -5,15 +5,17 @@ angular
|
|||
.controller('CaisseCtrl', ['$scope', '$http', function ($scope, $http, stuff) {
|
||||
$scope.productsFromDB = []; // loaded products
|
||||
$scope.categories = []; // product categories
|
||||
$scope.commentaire = []; // comment about the client or the current selling
|
||||
$scope.sellingComment = "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.pausedSelling = [];
|
||||
$scope.activeSelling = []; // list of products to sell
|
||||
$scope.activeFestival = { // an event where selling take place
|
||||
name : "le festival",
|
||||
dateCreation: new Date(),
|
||||
commentaire : ""
|
||||
commentaire : "le com de festival"
|
||||
};
|
||||
/**
|
||||
* get the sum of products prices
|
||||
|
@ -54,6 +56,7 @@ angular
|
|||
$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;
|
||||
|
@ -69,16 +72,17 @@ angular
|
|||
};
|
||||
$scope.clearCurrentSelling = function () {
|
||||
$scope.paidAmount = 0;
|
||||
$scope.commentaire = "";
|
||||
$scope.sellingComment = "";
|
||||
$scope.activeSelling = [];
|
||||
};
|
||||
$scope.sendForm = function () {
|
||||
let lesParams = {
|
||||
paidByClient : $scope.paidAmount,
|
||||
sellingComment: $scope.commentaire,
|
||||
sellingComment: $scope.sellingComment,
|
||||
activeSelling : $scope.activeSelling,
|
||||
activeFestival: $scope.activeFestival
|
||||
};
|
||||
$scope.lesParams = lesParams;
|
||||
$http({
|
||||
method : 'POST',
|
||||
url : 'add-selling',
|
||||
|
@ -87,6 +91,7 @@ angular
|
|||
},
|
||||
data : lesParams // pass in data as strings
|
||||
}).then(function (rep) {
|
||||
$scope.clearCurrentSelling();
|
||||
console.log(rep);
|
||||
if (!rep.success) {
|
||||
// if not successful, bind errors to error variables
|
||||
|
|
|
@ -120,11 +120,7 @@ class DefaultController extends Controller {
|
|||
* @return JsonResponse
|
||||
*/
|
||||
public function addSellingAction( Request $request ) {
|
||||
// var_dump( $request->request );
|
||||
// die();
|
||||
$json = json_decode( $request->getContent(), true );
|
||||
// var_dump( $json );
|
||||
// die();
|
||||
$json = json_decode( $request->getContent(), true );
|
||||
$currentUser = $this->getUser();
|
||||
$m = $this->getDoctrine()->getManager();
|
||||
$newSellRecord = new SellRecord();
|
||||
|
@ -141,24 +137,29 @@ class DefaultController extends Controller {
|
|||
$productsModelsByID[ $product->getId() ] = $product;
|
||||
}
|
||||
|
||||
$sumAmount = 0;
|
||||
foreach ( $json[ 'activeSelling' ] as $record ) {
|
||||
var_dump( $categoriesByID[ $record[ 'category' ] ] );
|
||||
var_dump( $record[ 'category' ] );
|
||||
var_dump( $categoriesByID[ $record[ 'category' ] ]->getName() );
|
||||
$productModel = $productsModelsByID[ $record[ 'id' ] ];
|
||||
$newProductSold = new ProductSold();
|
||||
// $newProductSold->setCategory( $categoriesByID[ $record[ 'category' ] ] );
|
||||
// $newProductSold->setCategory( $productModel->getCategory() );
|
||||
// $newProductSold->setCategory( 1 );
|
||||
$newProductSold->setName( $record[ 'name' ] );
|
||||
$newProductSold->setPrice( $record[ 'price' ] );
|
||||
$newProductSold->setProduct( $productsModelsByID[ $record[ 'id' ] ] );
|
||||
$newProductSold->setUser( $currentUser );
|
||||
$sumAmount += $record[ 'price' ];
|
||||
// $newProductSold->setProduct( $productsModelsByID[ $record[ 'id' ] ] );
|
||||
$newProductSold->setUser( $currentUser->getId() );
|
||||
$newProductSold->setSellRecords( $newSellRecord );
|
||||
// link selling record with user, festival
|
||||
$currentUser->addProductsSold( $newProductSold );
|
||||
// $currentUser->addProductsSold( $newProductSold );
|
||||
// persist all
|
||||
$m->persist( $newProductSold );
|
||||
}
|
||||
$newSellRecord->setPaidByClient( 0 );
|
||||
$newSellRecord->setAmount( 42 );
|
||||
// $newSellRecord->setPaidByClient( 0 );
|
||||
$newSellRecord->setAmount( $sumAmount );
|
||||
$newSellRecord->setDate( new \DateTime() );
|
||||
// $newSellRecord->setPaidByClient( $json[ 'paidByClient' ] );
|
||||
$newSellRecord->setPaidByClient( $json[ 'paidByClient' ] );
|
||||
|
||||
$currentUser->addSellRecords( $newSellRecord );
|
||||
|
||||
|
|
|
@ -116,5 +116,35 @@ class Festival {
|
|||
public function getSellRecords() {
|
||||
return $this->sellRecords;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return Festival
|
||||
*/
|
||||
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords->removeElement($sellRecord);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Festival
|
||||
*
|
||||
* @ORM\Table(name="festival")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\FestivalRepository")
|
||||
*/
|
||||
class Festival {
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="dateCreation", type="datetime")
|
||||
*/
|
||||
private $dateCreation;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SellRecord",mappedBy="festival")
|
||||
*/
|
||||
private $sellRecords;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Festival
|
||||
*/
|
||||
public function setName( $name ) {
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set dateCreation
|
||||
*
|
||||
* @param \DateTime $dateCreation
|
||||
*
|
||||
* @return Festival
|
||||
*/
|
||||
public function setDateCreation( $dateCreation ) {
|
||||
$this->dateCreation = $dateCreation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dateCreation
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getDateCreation() {
|
||||
return $this->dateCreation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sellRecords
|
||||
*
|
||||
* @param \stdClass $sellRecords
|
||||
*
|
||||
* @return Festival
|
||||
*/
|
||||
public function setSellRecords( $sellRecords ) {
|
||||
$this->sellRecords = $sellRecords;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sellRecords
|
||||
*
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function getSellRecords() {
|
||||
return $this->sellRecords;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return Festival
|
||||
*/
|
||||
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords->removeElement($sellRecord);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use AppBundle\Traits\Commentable;
|
||||
use AppBundle\Traits\Sellable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
|
@ -20,18 +22,51 @@ class Product {
|
|||
*/
|
||||
private $name;
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="decimal", scale=2, nullable=true)
|
||||
* @ORM\Column(type="string", length=256)
|
||||
*/
|
||||
private $price;
|
||||
private $image;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="ProductCategory", inversedBy="products")
|
||||
*/
|
||||
private $category;
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="SellRecord", mappedBy="products")
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="products")
|
||||
*/
|
||||
private $sellRecords;
|
||||
private $user;
|
||||
|
||||
use Sellable;
|
||||
use Commentable;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getImage() {
|
||||
return $this->image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $image
|
||||
*/
|
||||
public function setImage( $image ) {
|
||||
$this->image = $image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $user
|
||||
*/
|
||||
public function setUser( $user ) {
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
|
@ -88,45 +123,24 @@ class Product {
|
|||
public function setCategory( ProductCategory $category ) {
|
||||
$this->category = $category;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return Product
|
||||
*/
|
||||
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return Product
|
||||
*/
|
||||
public function addSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords->removeElement($sellRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sellRecords
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getSellRecords()
|
||||
{
|
||||
return $this->sellRecords;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,4 +118,28 @@ class ProductCategory {
|
|||
public function removeProduct( \AppBundle\Entity\Product $product ) {
|
||||
$this->products->removeElement( $product );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add user
|
||||
*
|
||||
* @param \AppBundle\Entity\User $user
|
||||
*
|
||||
* @return ProductCategory
|
||||
*/
|
||||
public function addUser(\AppBundle\Entity\User $user)
|
||||
{
|
||||
$this->users[] = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove user
|
||||
*
|
||||
* @param \AppBundle\Entity\User $user
|
||||
*/
|
||||
public function removeUser(\AppBundle\Entity\User $user)
|
||||
{
|
||||
$this->users->removeElement($user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,29 @@ class ProductCategory {
|
|||
*/
|
||||
private $products;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\User", mappedBy="categories")
|
||||
*/
|
||||
private $users;
|
||||
|
||||
public function __toString() {
|
||||
return $this->getName() . ' (' . count( $this->getProducts() ) . ' produits)';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUsers() {
|
||||
return $this->users;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $users
|
||||
*/
|
||||
public function setUsers( $users ) {
|
||||
$this->users = $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -95,4 +118,28 @@ class ProductCategory {
|
|||
public function removeProduct( \AppBundle\Entity\Product $product ) {
|
||||
$this->products->removeElement( $product );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add user
|
||||
*
|
||||
* @param \AppBundle\Entity\User $user
|
||||
*
|
||||
* @return ProductCategory
|
||||
*/
|
||||
public function addUser(\AppBundle\Entity\User $user)
|
||||
{
|
||||
$this->users[] = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove user
|
||||
*
|
||||
* @param \AppBundle\Entity\User $user
|
||||
*/
|
||||
public function removeUser(\AppBundle\Entity\User $user)
|
||||
{
|
||||
$this->users->removeElement($user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,13 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductRepository")
|
||||
*/
|
||||
class ProductSold extends Product {
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
|
||||
/**
|
||||
* the stack of products for one client at one time
|
||||
|
@ -21,6 +28,7 @@ class ProductSold extends Product {
|
|||
*/
|
||||
private $user;
|
||||
|
||||
|
||||
/**
|
||||
* references the product from whom this line is inspired
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Product", inversedBy="productsSold")
|
||||
|
@ -34,29 +42,15 @@ class ProductSold extends Product {
|
|||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCategory() {
|
||||
return $this->category;
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $category
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function setCategory( $category ) {
|
||||
$this->category = $category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSellRecords() {
|
||||
return $this->sellRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $sellRecords
|
||||
*/
|
||||
public function setSellRecords( $sellRecords ) {
|
||||
$this->sellRecords = $sellRecords;
|
||||
public function setId( $id ) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,15 +70,58 @@ class ProductSold extends Product {
|
|||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProduct() {
|
||||
return $this->product;
|
||||
public function getCategory() {
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $product
|
||||
* @param mixed $category
|
||||
*/
|
||||
public function setProduct( $product ) {
|
||||
$this->product = $product;
|
||||
public function setCategory( ProductCategory $category ) {
|
||||
$this->category = $category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sellRecords
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecords
|
||||
*
|
||||
* @return ProductSold
|
||||
*/
|
||||
public function setSellRecords( SellRecord $sellRecords = null ) {
|
||||
$this->sellRecords = $sellRecords;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sellRecords
|
||||
*
|
||||
* @return \AppBundle\Entity\SellRecord
|
||||
*/
|
||||
public function getSellRecords() {
|
||||
return $this->sellRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set product
|
||||
*
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
*
|
||||
* @return ProductSold
|
||||
*/
|
||||
public function setProduct( Product $product = null ) {
|
||||
$this->product = $product;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product
|
||||
*
|
||||
* @return \AppBundle\Entity\Product
|
||||
*/
|
||||
public function getProduct() {
|
||||
return $this->product;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductRepository")
|
||||
*/
|
||||
class ProductSold extends Product {
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* the stack of products for one client at one time
|
||||
* @ORM\ManyToOne(targetEntity="SellRecord", inversedBy="productsSold")
|
||||
*/
|
||||
public $sellRecords;
|
||||
|
||||
/**
|
||||
* person who recorded the sell
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="productsSold")
|
||||
*/
|
||||
private $user;
|
||||
|
||||
|
||||
/**
|
||||
* references the product from whom this line is inspired
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Product", inversedBy="productsSold")
|
||||
*/
|
||||
private $product;
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="ProductCategory", inversedBy="products")
|
||||
*/
|
||||
private $category;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $user
|
||||
*/
|
||||
public function setUser( $user ) {
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCategory() {
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $category
|
||||
*/
|
||||
public function setCategory( $category ) {
|
||||
$this->category = $category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sellRecords
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecords
|
||||
*
|
||||
* @return ProductSold
|
||||
*/
|
||||
public function setSellRecords( \AppBundle\Entity\SellRecord $sellRecords = null ) {
|
||||
$this->sellRecords = $sellRecords;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sellRecords
|
||||
*
|
||||
* @return \AppBundle\Entity\SellRecord
|
||||
*/
|
||||
public function getSellRecords() {
|
||||
return $this->sellRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set product
|
||||
*
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
*
|
||||
* @return ProductSold
|
||||
*/
|
||||
public function setProduct( \AppBundle\Entity\Product $product = null ) {
|
||||
$this->product = $product;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product
|
||||
*
|
||||
* @return \AppBundle\Entity\Product
|
||||
*/
|
||||
public function getProduct() {
|
||||
return $this->product;
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ class SellRecord {
|
|||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(name="id")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
/**
|
||||
|
@ -181,4 +181,32 @@ class SellRecord {
|
|||
$this->date = $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->productsSold = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add productsSold
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductSold $productsSold
|
||||
*
|
||||
* @return SellRecord
|
||||
*/
|
||||
public function addProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
|
||||
$this->productsSold[] = $productsSold;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove productsSold
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductSold $productsSold
|
||||
*/
|
||||
public function removeProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
|
||||
$this->productsSold->removeElement( $productsSold );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,26 +2,142 @@
|
|||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use AppBundle\Traits\Commentable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\SellRecordRepository")
|
||||
*/
|
||||
class SellRecord {
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Product", inversedBy="sellRecords")
|
||||
*/
|
||||
private $products;
|
||||
|
||||
|
||||
use Commentable;
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
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=false)
|
||||
*/
|
||||
private $amount;
|
||||
/**
|
||||
* amount paid by client
|
||||
* @ORM\Column(type="decimal", scale=2, nullable=true)
|
||||
*/
|
||||
private $paidByClient;
|
||||
|
||||
/**
|
||||
* @var
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Festival",inversedBy="sellRecords")
|
||||
*/
|
||||
private $festival;
|
||||
|
||||
/**
|
||||
* owner of the selling account
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="sellRecords")
|
||||
*/
|
||||
private $user;
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPaidByClient() {
|
||||
return $this->paidByClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $paidByClient
|
||||
*/
|
||||
public function setPaidByClient( $paidByClient ) {
|
||||
$this->paidByClient = $paidByClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getComment() {
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $comment
|
||||
*/
|
||||
public function setComment( $comment ) {
|
||||
$this->comment = $comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProductsSold() {
|
||||
return $this->productsSold;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $productsSold
|
||||
*/
|
||||
public function setProductsSold( $productsSold ) {
|
||||
$this->productsSold = $productsSold;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFestival() {
|
||||
return $this->festival;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $festival
|
||||
*/
|
||||
public function setFestival( $festival ) {
|
||||
$this->festival = $festival;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $user
|
||||
*/
|
||||
public function setUser( $user ) {
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAmount() {
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $amount
|
||||
*/
|
||||
public function setAmount( $amount ) {
|
||||
$this->amount = $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
|
@ -59,10 +175,38 @@ class SellRecord {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $date
|
||||
* @param \DateTime $date
|
||||
*/
|
||||
public function setDate( $date ) {
|
||||
public function setDate( \DateTime $date ) {
|
||||
$this->date = $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->productsSold = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add productsSold
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductSold $productsSold
|
||||
*
|
||||
* @return SellRecord
|
||||
*/
|
||||
public function addProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
|
||||
$this->productsSold[] = $productsSold;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove productsSold
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductSold $productsSold
|
||||
*/
|
||||
public function removeProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
|
||||
$this->productsSold->removeElement( $productsSold );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,4 +164,86 @@ class User extends BaseUser {
|
|||
public function getGoogleId() {
|
||||
return $this->googleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add product
|
||||
*
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addProduct(\AppBundle\Entity\Product $product)
|
||||
{
|
||||
$this->products[] = $product;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove product
|
||||
*
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
*/
|
||||
public function removeProduct(\AppBundle\Entity\Product $product)
|
||||
{
|
||||
$this->products->removeElement($product);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove productsSold
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductSold $productsSold
|
||||
*/
|
||||
public function removeProductsSold(\AppBundle\Entity\ProductSold $productsSold)
|
||||
{
|
||||
$this->productsSold->removeElement($productsSold);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add category
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductCategory $category
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addCategory(\AppBundle\Entity\ProductCategory $category)
|
||||
{
|
||||
$this->categories[] = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove category
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductCategory $category
|
||||
*/
|
||||
public function removeCategory(\AppBundle\Entity\ProductCategory $category)
|
||||
{
|
||||
$this->categories->removeElement($category);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords->removeElement($sellRecord);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,112 @@ class User extends BaseUser {
|
|||
|
||||
private $googleAccessToken;
|
||||
|
||||
/**
|
||||
* templates products
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Product", mappedBy="user")
|
||||
*/
|
||||
private $products;
|
||||
|
||||
/**
|
||||
* variabilised products sold
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="user")
|
||||
*/
|
||||
private $productsSold;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\ProductCategory", inversedBy="users")
|
||||
*/
|
||||
private $categories;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProductsSold() {
|
||||
return $this->productsSold;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function addProductsSold( $product ) {
|
||||
return $this->productsSold[] = $product;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $productsSold
|
||||
*/
|
||||
public function setProductsSold( $productsSold ) {
|
||||
$this->productsSold = $productsSold;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SellRecord", mappedBy="user")
|
||||
*/
|
||||
private $sellRecords;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSellRecords() {
|
||||
return $this->sellRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $sellRecords
|
||||
*/
|
||||
public function setSellRecords( $sellRecords ) {
|
||||
$this->sellRecords = $sellRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $sellRecords
|
||||
*/
|
||||
public function addSellRecords( $sellRecords ) {
|
||||
$this->sellRecords[] = $sellRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getGoogleAccessToken() {
|
||||
return $this->googleAccessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $googleAccessToken
|
||||
*/
|
||||
public function setGoogleAccessToken( $googleAccessToken ) {
|
||||
$this->googleAccessToken = $googleAccessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProducts() {
|
||||
return $this->products;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $products
|
||||
*/
|
||||
public function setProducts( $products ) {
|
||||
$this->products = $products;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCategories() {
|
||||
return $this->categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $categories
|
||||
*/
|
||||
public function setCategories( $categories ) {
|
||||
$this->categories = $categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
|
@ -37,27 +143,107 @@ class User extends BaseUser {
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set googleId
|
||||
*
|
||||
* @param string $googleId
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function setGoogleId( $googleId ) {
|
||||
$this->googleId = $googleId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get googleId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGoogleId() {
|
||||
return $this->googleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set googleId
|
||||
* Add product
|
||||
*
|
||||
* @param string $googleId
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function setGoogleId($googleId)
|
||||
public function addProduct(\AppBundle\Entity\Product $product)
|
||||
{
|
||||
$this->googleId = $googleId;
|
||||
$this->products[] = $product;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get googleId
|
||||
* Remove product
|
||||
*
|
||||
* @return string
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
*/
|
||||
public function getGoogleId()
|
||||
public function removeProduct(\AppBundle\Entity\Product $product)
|
||||
{
|
||||
return $this->googleId;
|
||||
$this->products->removeElement($product);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove productsSold
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductSold $productsSold
|
||||
*/
|
||||
public function removeProductsSold(\AppBundle\Entity\ProductSold $productsSold)
|
||||
{
|
||||
$this->productsSold->removeElement($productsSold);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add category
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductCategory $category
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addCategory(\AppBundle\Entity\ProductCategory $category)
|
||||
{
|
||||
$this->categories[] = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove category
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductCategory $category
|
||||
*/
|
||||
public function removeCategory(\AppBundle\Entity\ProductCategory $category)
|
||||
{
|
||||
$this->categories->removeElement($category);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords->removeElement($sellRecord);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue