This commit is contained in:
TLRZ Seyfferth
2018-01-10 17:29:27 +01:00
parent 134137e3a4
commit 49146a8ba6
5 changed files with 148 additions and 402 deletions
+10 -1
View File
@@ -5,7 +5,16 @@ accounting.settings = {
decimal: ",",
thousand: ".",
precision: 2
}
},
number: {
precision : 2, // default precision on numbers is 0
thousand: ".",
decimal : ","
}
}
$(document).ready(function(){
$('.tabs').tabs();
$('.fixed-action-btn').floatingActionButton();
})
+4
View File
@@ -46,6 +46,10 @@ InventoryArticle.prototype = {
},
get Sale() {
return this.Sold * this.article.PortionPrice;
},
get StepSize() {
singlePack = this.article.Portions == 1;
return singlePack ? 1 : 0.05;
}
};
+34 -5
View File
@@ -1,3 +1,10 @@
Vue.filter('currency', function(money){
return accounting.formatMoney(money);
});
Vue.filter('number', function(number){
return accounting.formatNumber(number);
});
var app = new Vue({
el: "#app",
data : {
@@ -13,7 +20,8 @@ var app = new Vue({
ug : [],
mob : [],
stud : []
}
},
bon: []
},
computed: {
sales_ug: function (){
@@ -21,7 +29,19 @@ var app = new Vue({
return total + item.Sale;
}, 0);
return total_sales;
}
},
bon_price: function() {
var total = this.bon.reduce(function(total, item) {
return total + item.count * item.price;
}, 0);
return accounting.formatMoney(total);
},
bon_sum: function() {
var total = this.bon.reduce(function(total, item) {
return total + item.count;
}, 0);
return total;
}
},
methods: {
addArticle: function() {
@@ -30,7 +50,7 @@ var app = new Vue({
storeArticles: function() {
this.$http.post('./backend?controller=Article&action=store', JSON.stringify(this.articles))
.then(response => {
Materialize.toast(response.body, 2000);
M.toast({html: response.body});
})
},
loadArticles: function() {
@@ -41,15 +61,24 @@ var app = new Vue({
this.articles.push(Article.thaw(element));
});
}).then( x => {
Materialize.toast('Artikel wurden geladen.', 2000);
M.toast({ html: 'Artikel wurden geladen.'});
}).then( x => {
this.articles.forEach(a => {
ia = new InventoryArticle();
ia.article = a;
this.inventory.ug.push(ia);
this.bon.push({count: 0, name: a.name, price: a.portion.price});
});
}).then( x => {
Materialize.updateTextFields();
M.updateTextFields();
});
},
bonArticle: function(article) {
},
bonned: function (items) {
return items.filter(function (item) {
return item.count > 0;
});
}
},