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] }}
</span>
</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>
</button>
</span>

View File

@ -9,7 +9,7 @@
<!--états de sauvegarde-->
<div class="selling-ok alert-success alert block" ng-if="sellingOk" ng-click="sellingOk = false">
<i class="fa fa-save"></i>
Sauvegardé!
Sauvegardé! WOHOOOOOO +{{recentSellings[recentSellings.length -1].amount}}{{sellingComment}}
</div>
<div class="selling-ok alert-error alert block" ng-if="sellingError" ng-click="sellingError = false">
<i class="fa fa-warning"></i>
@ -30,11 +30,11 @@
<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">
ng-class="{'btn-success': show_config.expressSelling, 'btn-disabled':! show_config.expressSelling}"
ng-click="show_config.expressSelling = !show_config.expressSelling">
<i class="fa fa-shopping-cart"></i>
mode vente express
<span ng-if=expressSelling>
vente express
<span ng-if=show_config.show_config.expressSelling>
<i class="fa fa-check-circle"></i></span>
</button>
<button
@ -87,12 +87,20 @@
<div class="col-xs-12 col-md-6">
<div id="client-now" class="client-now padded">
<i class="fa fa-user"></i>
<form action="#">
<label for="sellingComment">
Client actuel: {{ activeSelling.length }} produit<span ng-if="activeSelling.length!=1">s</span>
</label>
<button type="button" class="deleter pull-right" ng-click="sellingComment = ''">
<i class="fa fa-times"></i>
</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();
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
angular
.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.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.recentSellings = [];
$scope.lesParams = {};
$scope.countProductsSoldForActiveFestival = {};
$scope.simpleDisplay = false;
$scope.paidAmount = 0;
$scope.expressSelling = true;
$scope.pausedSelling = [];
$scope.show_config = {
expressSelling: true,
stock_count: false,
sold : true,
sold : false,
};
$scope.activeItemsSold = []; // list of products ID to sell
$scope.activeSelling = []; // list of products to sell
@ -38,6 +38,7 @@ angular
$scope.activeFestival = { // an event where selling take place
id : null,
name : "le festival",
productComment : "",
dateCreation : new Date(),
chiffreAffaire: 0,
clientsCount : 0,
@ -191,8 +192,10 @@ angular
};
$scope.clearSellingComment = function () {
console.log(' $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.paidAmount = 0;
@ -251,10 +254,12 @@ angular
};
$scope.sendForm = function () {
console.log('$scope.sellingComment', $scope.sellingComment);
console.log('$rootScope.sellingComment', $rootScope.sellingComment);
console.log('$scope.sellingComment done');
console.log("$scope.activeSelling", $scope.activeSelling);
let lesParams = {
paidByClient : $scope.paidAmount,
sellingComment: $scope.sellingComment,
sellingComment: $scope.activeFestival.productComment,
activeSelling : $scope.activeSelling,
activeFestival: $scope.activeFestival
};
@ -266,6 +271,7 @@ angular
angular
.copy($scope.activeSelling)
});
console.log('lesParams sellingComment', lesParams.sellingComment);
console.log('$scope.recentSellings', $scope.recentSellings);
$scope.lesParams = lesParams;
$http({
@ -277,13 +283,14 @@ angular
data : lesParams // pass in data as strings
}).then(function (rep) {
$scope.clearCurrentSelling();
// if successful, bind success message to message
$scope.successMessage = rep.data.message;
$scope.activeFestival.chiffreAffaire = rep.data.newChiffreAffaire;
$scope.activeFestival.clientsCount = rep.data.clientsCount;
$scope.countProductsSoldForActiveFestival = rep.data.activeFestival.sold;
$scope.showTemporaryMessage();
$scope.clearCurrentSelling();
console.log(rep);
if (!rep.success) {
// if not successful, bind errors to error variables