notif when saved or error

This commit is contained in:
ty kayn 2019-07-03 17:15:58 +02:00
parent 39c18197c3
commit 41cbd4784c
3 changed files with 59 additions and 14 deletions

View File

@ -40,12 +40,13 @@
</button> </button>
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<div class="row"> <div class="row">{% verbatim %}
<div class="client-now text-right padded"> <div class="client-now text-right padded">
<div class="col-xs-12"> <div class="col-xs-12">
<i class="fa fa-user"></i> <i class="fa fa-user"></i>
Client actuel: Client actuel:
</div> {% verbatim %} </div>
<div class="col-xs-10"> <div class="col-xs-10">
<div class="input-group"> <div class="input-group">
@ -57,16 +58,27 @@
<div> <div>
{{ activeSelling.length }} produit<span ng-if="activeSelling.length!=1">s</span> {{ activeSelling.length }} produit<span ng-if="activeSelling.length!=1">s</span>
</div>{% endverbatim %}
</div> </div>
<!--é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é!
</div>
<div class="selling-ok alert-error alert block" ng-if="sellingError" ng-click="sellingError = false">
<i class="fa fa-warning"></i>
Problème de sauvegarde (pas de réseau ?)
</div>
{% endverbatim %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="row"> <div class="row">
{% include 'logged/caisse-main.html.twig' %} {% include 'logged/caisse-main.html.twig' %}
</div> </div>
</div> </div>
@ -79,8 +91,9 @@
<div id="history" class="tab-pane fade"> <div id="history" class="tab-pane fade">
<h2>Historique</h2> <h2>Historique</h2>
</div> </div>
</div>
</div>
{#</div>#} {#</div>#}
{#</div>#} {#</div>#}

View File

@ -86,12 +86,27 @@
height: 70vh; height: 70vh;
overflow: auto; overflow: auto;
} }
.sellings{
.remove-item{ .sellings {
.remove-item {
margin-left: 1em; margin-left: 1em;
} }
} }
#not_loaded{
#not_loaded {
width: 100%; width: 100%;
height: 75vh; height: 75vh;
} }
.selling-ok {
position: fixed;
bottom: 0;
left: 2em;
z-index: 10;
}
.block{
display: block;
width: calc(100% - 2em);
text-align:center;
}

View File

@ -10,7 +10,7 @@ require('bootstrap-sass');
$(document).ready(function () { $(document).ready(function () {
$('[data-toggle="popover"]').popover(); $('[data-toggle="popover"]').popover();
$('#menu_button').on('click', function(){ $('#menu_button').on('click', function () {
$('#menu-dashboard').toggleClass('shown'); $('#menu-dashboard').toggleClass('shown');
}) })
}); });
@ -87,7 +87,6 @@ angular
} }
}); });
$scope.activeSellingFiltered = soldObjectsIdsCount; $scope.activeSellingFiltered = soldObjectsIdsCount;
} }
/** /**
@ -283,22 +282,40 @@ angular
} }
}, function (rep) { }, function (rep) {
console.log('nope! ', rep.data); console.log('nope! ', rep.data);
$scope.showTemporaryErrorMessage();
}) })
; ;
}; };
$scope.sellingOk = false; $scope.sellingOk = false;
$scope.sellingError = false;
$scope.tempMessage = {}; $scope.tempMessage = {};
$scope.showTemporaryMessage = function () { $scope.showTemporaryMessage = function () {
console.log('show message');
if ($scope.sellingOk) { if ($scope.sellingOk) {
$scope.sellingOk = false;
return; return;
} }
$scope.sellingOk = true; $scope.sellingOk = true;
$timeout.cancel($scope.tempMessage); $timeout.cancel($scope.tempMessage);
$scope.tempMessage = $timeout(function () { $scope.tempMessage = $timeout(function () {
console.log('hide message');
$scope.sellingOk = false; $scope.sellingOk = false;
}, 2000) }, 2000)
}; };
$scope.showTemporaryErrorMessage = function () {
console.log('show message');
if ($scope.sellingError) {
$scope.sellingError = false;
return;
}
$scope.sellingError = true;
$timeout.cancel($scope.tempMessage);
$scope.tempMessage = $timeout(function () {
console.log('hide message');
$scope.sellingError = false;
}, 2000)
};
$scope.init = (function () { $scope.init = (function () {
$scope.fetchProductsFromDB(); $scope.fetchProductsFromDB();
})(); })();