descriptions in js, start to test record

This commit is contained in:
Kayn Ty 2018-04-06 15:54:59 +02:00
parent 15cc66ab79
commit 3642e128f9
7 changed files with 46 additions and 35 deletions

View File

@ -1,10 +1,15 @@
{% verbatim %} {% verbatim %}
<div class="current-selling"> <div class="current-selling">
<form action="#"> <form action="#">
Festival: {{ activeFestival.name }} Festival:
<input type="text" ng-model="activeFestival.commentaire"> <input type="text" ng-model="activeFestival.name" placeholder="nom du festival">
<input type="text" ng-model="activeFestival.commentaire" placeholder="commentaire">
<hr> <hr>
Client actuel:
{{ activeSelling.length }} produits {{ activeSelling.length }} produits
<input type="text" ng-model="commentaire" placeholder="commentaire">
<hr>
<ul> <ul>
<li ng-repeat="p in activeSelling track by $index"> <li ng-repeat="p in activeSelling track by $index">
<div class="row"> <div class="row">

View File

@ -12,24 +12,10 @@
<div class="sellings col-xs-5"> <div class="sellings col-xs-5">
{% include 'logged/angular/current.html.twig' %} {% include 'logged/angular/current.html.twig' %}
{% include 'logged/angular/paused.html.twig' %} {% include 'logged/angular/paused.html.twig' %}
{% include 'logged/angular/recent.html.twig' %}
<div class="selling-history">
<h4>
Ventes récentes
</h4>
{% if recentSells %}
<ul>
{% for s in recentSells %}
<li>{{ s.date|date('Y/m/d H:i:s') }} {{ s.amount }}€</li>
{% endfor %}
</ul>
{% else %}
aucune
{% endif %}
</div> </div>
</div> </div>
</div> </div>
</div>

View File

@ -0,0 +1,14 @@
<div class="selling-history">
<h4>
Ventes récentes
</h4>
{% if recentSells %}
<ul>
{% for s in recentSells %}
<li>{{ s.date|date('Y/m/d H:i:s') }} {{ s.amount }}€</li>
{% endfor %}
</ul>
{% else %}
aucune
{% endif %}
</div>

View File

@ -7,7 +7,7 @@
<div id="not_loaded" ng-if="!initLoadDone"> <div id="not_loaded" ng-if="!initLoadDone">
<div class="well"> <div class="well">
<i class="fa fa-refresh fa-3x"></i> Chargement en cours de vos produits <i class="fa fa-refresh fa-spin fa-3x"></i> Chargement en cours de vos produits
</div> </div>
</div> </div>
{% endverbatim %} {% endverbatim %}

View File

@ -9,6 +9,6 @@
filter: alpha(opacity=20); filter: alpha(opacity=20);
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
position: absolute; position: fixed;
overflow: hidden; overflow: hidden;
} }

View File

@ -3,18 +3,14 @@ var stuff = ['initialstuff'];
angular angular
.module('caisse', []) .module('caisse', [])
.controller('CaisseCtrl', ['$scope', '$http', function ($scope, $http, stuff) { .controller('CaisseCtrl', ['$scope', '$http', function ($scope, $http, stuff) {
$scope.productsFromDB = [ $scope.productsFromDB = []; // loaded products
{id: 1, name: "truc 1", price: 8, category: 1}, $scope.categories = []; // product categories
{id: 2, name: "truc 2", price: 2, category: 1}, $scope.commentaire = []; // comment about the client or the current selling
{id: 3, name: "truc 3", price: 4, category: 2}, $scope.initLoadDone = false; // becames true after first init of product loading
{id: 4, name: "truc 4", price: 1, category: 2},
];
$scope.categories = [];
$scope.initLoadDone = false;
$scope.recentSellings = []; $scope.recentSellings = [];
$scope.pausedSelling = []; $scope.pausedSelling = [];
$scope.activeSelling = []; $scope.activeSelling = []; // list of products to sell
$scope.activeFestival = { $scope.activeFestival = { // an event where selling take place
name : "le festival", name : "le festival",
dateCreation: new Date(), dateCreation: new Date(),
commentaire : "" commentaire : ""
@ -71,8 +67,13 @@ angular
$scope.activeSelling = angular.copy(sellingList); $scope.activeSelling = angular.copy(sellingList);
$scope.pausedSelling.splice(index, 1); $scope.pausedSelling.splice(index, 1);
}; };
$scope.clearCurrentSelling = function () {
$scope.commentaire = "";
$scope.activeSelling = [];
};
$scope.sendForm = function () { $scope.sendForm = function () {
let lesParams = { let lesParams = {
sellingComment: $scope.commentaire,
activeSelling : $scope.activeSelling, activeSelling : $scope.activeSelling,
activeFestival: $scope.activeFestival activeFestival: $scope.activeFestival
}; };

View File

@ -11,11 +11,6 @@ use Doctrine\ORM\Mapping as ORM;
class SellRecord { class SellRecord {
use Commentable; use Commentable;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="sellRecords")
*/
private $productsSold;
/** /**
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue * @ORM\GeneratedValue
@ -23,11 +18,20 @@ class SellRecord {
*/ */
private $id; private $id;
/** /**
* liste des produits de la vente
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="sellRecords")
*/
private $productsSold;
/**
* creation date
* @ORM\Column(type="datetime") * @ORM\Column(type="datetime")
*/ */
private $date; private $date;
/** /**
* total
* @ORM\Column(type="decimal", scale=2, nullable=true) * @ORM\Column(type="decimal", scale=2, nullable=true)
*/ */
private $amount; private $amount;
@ -39,6 +43,7 @@ class SellRecord {
private $festival; private $festival;
/** /**
* owner of the selling account
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="sellRecords") * @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="sellRecords")
*/ */
private $user; private $user;