listing current selling ok
This commit is contained in:
parent
85e578477c
commit
0d7b46f5f1
|
@ -2,14 +2,21 @@
|
||||||
<div class="current-selling">
|
<div class="current-selling">
|
||||||
|
|
||||||
<form action="#">
|
<form action="#">
|
||||||
Festival:
|
<h2>
|
||||||
|
|
||||||
|
Festival:</h2>
|
||||||
<input type="text" ng-model="activeFestival.name" placeholder="nom du festival">
|
<input type="text" ng-model="activeFestival.name" placeholder="nom du festival">
|
||||||
<input type="text" ng-model="activeFestival.commentaire" placeholder="commentaire">
|
<input type="text" ng-model="activeFestival.commentaire" placeholder="commentaire">
|
||||||
<hr>
|
<hr>
|
||||||
<i class="fa fa-user"></i>
|
|
||||||
Client actuel:
|
<h2>
|
||||||
{{ activeSelling.length }} produits
|
<i class="fa fa-user"></i> Client actuel:
|
||||||
<input type="text" ng-model="sellingComment" placeholder="commentaire">
|
</h2>
|
||||||
|
{{ activeSelling.length }} produit
|
||||||
|
<span ng-if="activeSelling.length>1">
|
||||||
|
s
|
||||||
|
</span>
|
||||||
|
<input class="input input-lg" type="text" ng-model="sellingComment" placeholder="nom ou commentaire">
|
||||||
<hr>
|
<hr>
|
||||||
<ul>
|
<ul>
|
||||||
<li ng-repeat="p in activeSelling track by $index">
|
<li ng-repeat="p in activeSelling track by $index">
|
||||||
|
@ -17,10 +24,10 @@
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-6">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" ng-model="p.name">
|
<input type="text" ng-model="p.name">
|
||||||
<div class="btn btn-warning input-group-addon"
|
<span class="btn btn-warning input-group-addon remove-itm"
|
||||||
ng-click="activeSelling.splice($index,1)">
|
ng-click="activeSelling.splice($index,1); regenActiveSellingIds()">
|
||||||
<i class="fa fa-trash"></i>
|
<i class="fa fa-trash"></i>
|
||||||
</div>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6 text-right">
|
<div class="col-xs-6 text-right">
|
||||||
|
@ -37,7 +44,11 @@
|
||||||
<h3>Total: </h3>
|
<h3>Total: </h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-6">
|
||||||
<strong>{{ CurrentSellingTotal() }}€</strong>
|
<h3>
|
||||||
|
<strong>
|
||||||
|
|
||||||
|
{{ CurrentSellingTotal() }} </strong>€
|
||||||
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
</h2>
|
</h2>
|
||||||
<button ng-repeat="p in c.products track by p.id"
|
<button ng-repeat="p in c.products track by p.id"
|
||||||
class="btn btn-default"
|
class="btn btn-default"
|
||||||
|
ng-class="{ 'btn-primary' : activeItemsSold.indexOf(p.id)}"
|
||||||
ng-click="addProduct( p )">
|
ng-click="addProduct( p )">
|
||||||
<span class="product-name">
|
<span class="product-name">
|
||||||
{{ p.name }}
|
{{ p.name }}
|
||||||
|
|
|
@ -10,10 +10,12 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="sellings col-xs-5">
|
<div class="sellings col-xs-5">
|
||||||
|
<div class="well">
|
||||||
|
|
||||||
{% include 'logged/angular/validate-button.html.twig' %}
|
{% include 'logged/angular/validate-button.html.twig' %}
|
||||||
{% include 'logged/angular/current.html.twig' %}
|
{% include 'logged/angular/current.html.twig' %}
|
||||||
{#{% include 'logged/angular/paused.html.twig' %}#}
|
{#{% include 'logged/angular/paused.html.twig' %}#}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="other_time">
|
<div id="other_time">
|
||||||
|
|
|
@ -18,3 +18,7 @@ thead {
|
||||||
background: #000;
|
background: #000;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
|
@ -5,17 +5,18 @@ angular
|
||||||
.controller('CaisseCtrl', ['$scope', '$http', function ($scope, $http, stuff) {
|
.controller('CaisseCtrl', ['$scope', '$http', function ($scope, $http, stuff) {
|
||||||
$scope.productsFromDB = []; // loaded products
|
$scope.productsFromDB = []; // loaded products
|
||||||
$scope.categories = []; // product categories
|
$scope.categories = []; // product categories
|
||||||
$scope.sellingComment = "sellingComment"; // comment about the client or the current selling
|
$scope.sellingComment = ""; // comment about the client or the current selling
|
||||||
$scope.initLoadDone = false; // becames true after first init of product loading
|
$scope.initLoadDone = false; // becames true after first init of product loading
|
||||||
$scope.recentSellings = [];
|
$scope.recentSellings = [];
|
||||||
$scope.lesParams = {};
|
$scope.lesParams = {};
|
||||||
$scope.paidAmount = 20;
|
$scope.paidAmount = 0;
|
||||||
$scope.pausedSelling = [];
|
$scope.pausedSelling = [];
|
||||||
|
$scope.activeItemsSold = []; // list of products ID to sell
|
||||||
$scope.activeSelling = []; // list of products to sell
|
$scope.activeSelling = []; // list of products to sell
|
||||||
$scope.activeFestival = { // an event where selling take place
|
$scope.activeFestival = { // an event where selling take place
|
||||||
name : "le festival",
|
name : "le festival",
|
||||||
dateCreation: new Date(),
|
dateCreation: new Date(),
|
||||||
commentaire : "le com de festival"
|
commentaire : ""
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* get the sum of products prices
|
* get the sum of products prices
|
||||||
|
@ -38,6 +39,12 @@ angular
|
||||||
return $scope.sumOfList($scope.activeSelling);
|
return $scope.sumOfList($scope.activeSelling);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.regenActiveSellingIds = function () {
|
||||||
|
$scope.activeItemsSold = [];
|
||||||
|
for (let obj in $scope.activeSelling) {
|
||||||
|
$scope.activeItemsSold.push(obj.id);
|
||||||
|
}
|
||||||
|
};
|
||||||
$scope.stuff = stuff;
|
$scope.stuff = stuff;
|
||||||
$scope.setActiveSelling = function (selling) {
|
$scope.setActiveSelling = function (selling) {
|
||||||
$scope.activeSelling = selling;
|
$scope.activeSelling = selling;
|
||||||
|
@ -47,20 +54,7 @@ angular
|
||||||
};
|
};
|
||||||
$scope.addProduct = function (product) {
|
$scope.addProduct = function (product) {
|
||||||
$scope.activeSelling.push(product);
|
$scope.activeSelling.push(product);
|
||||||
};
|
$scope.activeItemsSold.push(product.id);
|
||||||
$scope.fetchProductsFromDB = function () {
|
|
||||||
console.log('fetch products...');
|
|
||||||
$http.get('get-my-products').then((rep) => {
|
|
||||||
|
|
||||||
console.log('ok', rep);
|
|
||||||
$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;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
$scope.pauseSelling = function () {
|
$scope.pauseSelling = function () {
|
||||||
$scope.pausedSelling.push(angular.copy($scope.activeSelling));
|
$scope.pausedSelling.push(angular.copy($scope.activeSelling));
|
||||||
|
@ -75,6 +69,23 @@ angular
|
||||||
$scope.sellingComment = "";
|
$scope.sellingComment = "";
|
||||||
$scope.activeSelling = [];
|
$scope.activeSelling = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// http related calls
|
||||||
|
$scope.fetchProductsFromDB = function () {
|
||||||
|
console.log('fetch products...');
|
||||||
|
$http.get('get-my-products').then((rep) => {
|
||||||
|
|
||||||
|
console.log('ok', rep);
|
||||||
|
$scope.categories = rep.data.categories;
|
||||||
|
$scope.productsFromDB = rep.data.categories;
|
||||||
|
$scope.recentSellings = rep.data.history;
|
||||||
|
$scope.initLoadDone = true;
|
||||||
|
}, (err) => {
|
||||||
|
console.log(err);
|
||||||
|
$scope.initLoadDone = true;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.sendForm = function () {
|
$scope.sendForm = function () {
|
||||||
let lesParams = {
|
let lesParams = {
|
||||||
paidByClient : $scope.paidAmount,
|
paidByClient : $scope.paidAmount,
|
||||||
|
|
Loading…
Reference in New Issue