history display and export

This commit is contained in:
ty kayn 2019-07-05 17:46:04 +02:00
parent fa5fdfa180
commit 5bb843de16
4 changed files with 31 additions and 14 deletions

View File

@ -28,7 +28,7 @@
{{ countProductsSoldForActiveFestival[p.id] }} {{ countProductsSoldForActiveFestival[p.id] }}
</span> </span>
</button> </button>
<button class="express-button" ng-if="expressSelling" ng-click="expressSell(p)" title="achat express sans compléter les infos du client"> <button class="express-button" ng-if="show_config.expressSelling" ng-click="expressSell(p)" title="achat express sans compléter les infos du client">
<i class="fa fa-shopping-cart"></i> <i class="fa fa-shopping-cart"></i>
</button> </button>
</span> </span>

View File

@ -9,7 +9,7 @@
<!--états de sauvegarde--> <!--états de sauvegarde-->
<div class="selling-ok alert-success alert block" ng-if="sellingOk" ng-click="sellingOk = false"> <div class="selling-ok alert-success alert block" ng-if="sellingOk" ng-click="sellingOk = false">
<i class="fa fa-save"></i> <i class="fa fa-save"></i>
Sauvegardé! Sauvegardé! WOHOOOOOO +{{recentSellings[recentSellings.length -1].amount}}{{sellingComment}}
</div> </div>
<div class="selling-ok alert-error alert block" ng-if="sellingError" ng-click="sellingError = false"> <div class="selling-ok alert-error alert block" ng-if="sellingError" ng-click="sellingError = false">
<i class="fa fa-warning"></i> <i class="fa fa-warning"></i>
@ -30,11 +30,11 @@
<button <button
title="la vente express vous permet d'enregistrer une vente pour un seul article sans remplir le formulaire de détail" title="la vente express vous permet d'enregistrer une vente pour un seul article sans remplir le formulaire de détail"
class="btn" class="btn"
ng-class="{'btn-success': expressSelling, 'btn-disabled':!expressSelling}" ng-class="{'btn-success': show_config.expressSelling, 'btn-disabled':! show_config.expressSelling}"
ng-click="expressSelling = !expressSelling"> ng-click="show_config.expressSelling = !show_config.expressSelling">
<i class="fa fa-shopping-cart"></i> <i class="fa fa-shopping-cart"></i>
mode vente express vente express
<span ng-if=expressSelling> <span ng-if=show_config.show_config.expressSelling>
<i class="fa fa-check-circle"></i></span> <i class="fa fa-check-circle"></i></span>
</button> </button>
<button <button
@ -87,12 +87,20 @@
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<div id="client-now" class="client-now padded"> <div id="client-now" class="client-now padded">
<i class="fa fa-user"></i> <i class="fa fa-user"></i>
<form action="#">
<label for="sellingComment">
Client actuel: {{ activeSelling.length }} produit<span ng-if="activeSelling.length!=1">s</span> Client actuel: {{ activeSelling.length }} produit<span ng-if="activeSelling.length!=1">s</span>
</label>
<button type="button" class="deleter pull-right" ng-click="sellingComment = ''"> <button type="button" class="deleter pull-right" ng-click="sellingComment = ''">
<i class="fa fa-times"></i> <i class="fa fa-times"></i>
</button> </button>
<input type="text" class="form-control" aria-label="Recipient's username" aria-describedby="basic-addon2" ng-model="sellingComment" placeholder="nom ou commentaire"> <input type="text" class="form-control" aria-label="Recipient's username"
id="sellingComment" aria-describedby="basic-addon2" ng-model="activeFestival.productComment" name="sellingComment" placeholder="nom ou commentaire">
( {{sellingComment}} )
</form>

View File

@ -93,4 +93,6 @@ $(document).ready(function () {
}) })
// $('#introjs_start').click(); // $('#introjs_start').click();
let inputClient = document.querySelector('.client-now input');
inputClient ? inputClient.focus() : false;
}); });

View File

@ -16,21 +16,21 @@ var stuff = ['initialstuff'];
// TODO split controllers in other files // TODO split controllers in other files
angular angular
.module('caisse', []) .module('caisse', [])
.controller('CaisseCtrl', ['$scope', '$http', '$timeout', function ($scope, $http, $timeout) { .controller('CaisseCtrl', ['$scope', '$http', '$timeout', '$rootScope', function ($scope, $http, $timeout,$rootScope) {
$scope.productsFromDB = []; // loaded products $scope.productsFromDB = []; // loaded products
$scope.categories = []; // product categories $scope.categories = []; // product categories
$scope.sellingComment = "un gens"; // 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.countProductsSoldForActiveFestival = {}; $scope.countProductsSoldForActiveFestival = {};
$scope.simpleDisplay = false; $scope.simpleDisplay = false;
$scope.paidAmount = 0; $scope.paidAmount = 0;
$scope.expressSelling = true;
$scope.pausedSelling = []; $scope.pausedSelling = [];
$scope.show_config = { $scope.show_config = {
expressSelling: true,
stock_count: false, stock_count: false,
sold : true, sold : false,
}; };
$scope.activeItemsSold = []; // list of products ID to sell $scope.activeItemsSold = []; // list of products ID to sell
$scope.activeSelling = []; // list of products to sell $scope.activeSelling = []; // list of products to sell
@ -38,6 +38,7 @@ angular
$scope.activeFestival = { // an event where selling take place $scope.activeFestival = { // an event where selling take place
id : null, id : null,
name : "le festival", name : "le festival",
productComment : "",
dateCreation : new Date(), dateCreation : new Date(),
chiffreAffaire: 0, chiffreAffaire: 0,
clientsCount : 0, clientsCount : 0,
@ -191,8 +192,10 @@ angular
}; };
$scope.clearSellingComment = function () { $scope.clearSellingComment = function () {
console.log(' $scope.sellingComment', $scope.sellingComment);
$scope.sellingComment = ''; $scope.sellingComment = '';
document.querySelector('.client-now input').focus(); // document.querySelector('.client-now input').focus();
document.querySelector('.client-now input').select();
}; };
$scope.clearCurrentSelling = function () { $scope.clearCurrentSelling = function () {
$scope.paidAmount = 0; $scope.paidAmount = 0;
@ -251,10 +254,12 @@ angular
}; };
$scope.sendForm = function () { $scope.sendForm = function () {
console.log('$scope.sellingComment', $scope.sellingComment); console.log('$scope.sellingComment', $scope.sellingComment);
console.log('$rootScope.sellingComment', $rootScope.sellingComment);
console.log('$scope.sellingComment done');
console.log("$scope.activeSelling", $scope.activeSelling); console.log("$scope.activeSelling", $scope.activeSelling);
let lesParams = { let lesParams = {
paidByClient : $scope.paidAmount, paidByClient : $scope.paidAmount,
sellingComment: $scope.sellingComment, sellingComment: $scope.activeFestival.productComment,
activeSelling : $scope.activeSelling, activeSelling : $scope.activeSelling,
activeFestival: $scope.activeFestival activeFestival: $scope.activeFestival
}; };
@ -266,6 +271,7 @@ angular
angular angular
.copy($scope.activeSelling) .copy($scope.activeSelling)
}); });
console.log('lesParams sellingComment', lesParams.sellingComment);
console.log('$scope.recentSellings', $scope.recentSellings); console.log('$scope.recentSellings', $scope.recentSellings);
$scope.lesParams = lesParams; $scope.lesParams = lesParams;
$http({ $http({
@ -277,13 +283,14 @@ angular
data : lesParams // pass in data as strings data : lesParams // pass in data as strings
}).then(function (rep) { }).then(function (rep) {
$scope.clearCurrentSelling();
// if successful, bind success message to message // if successful, bind success message to message
$scope.successMessage = rep.data.message; $scope.successMessage = rep.data.message;
$scope.activeFestival.chiffreAffaire = rep.data.newChiffreAffaire; $scope.activeFestival.chiffreAffaire = rep.data.newChiffreAffaire;
$scope.activeFestival.clientsCount = rep.data.clientsCount; $scope.activeFestival.clientsCount = rep.data.clientsCount;
$scope.countProductsSoldForActiveFestival = rep.data.activeFestival.sold; $scope.countProductsSoldForActiveFestival = rep.data.activeFestival.sold;
$scope.showTemporaryMessage(); $scope.showTemporaryMessage();
$scope.clearCurrentSelling();
console.log(rep); console.log(rep);
if (!rep.success) { if (!rep.success) {
// if not successful, bind errors to error variables // if not successful, bind errors to error variables