localizing dependencies for serviceWorker

This commit is contained in:
TLRZ Seyfferth
2018-01-15 13:16:29 +01:00
parent 0607663efd
commit ee717318ee
27 changed files with 10995 additions and 160 deletions
+2
View File
@@ -1,5 +1,7 @@
<?php
require "localconf.php";
if ($_SERVER['REQUEST_METHOD'] != "POST") {
echo "Sorry, ich spreche kein GET.";
return;
+13
View File
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+8 -10
View File
@@ -6,10 +6,8 @@
<title>Inventur</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-alpha.3/css/materialize.min.css">
<link rel="stylesheet" href="css/lib/materialize.min.css">
<link rel="manifest" href="manifest.json">
</head>
@@ -160,14 +158,14 @@
</div>
</div>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-alpha.3/js/materialize.min.js"></script>
<script src="js/moment-with-locales.min.js"></script>
<script src="js/accounting.min.js"></script>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-resource"></script>
<script src="js/lib/jquery.min.js"></script>
<script src="js/lib/materialize.min.js"></script>
<script src="js/lib/moment-with-locales.min.js"></script>
<script src="js/lib/accounting.min.js"></script>
<script src="js/lib/vue-dev.js"></script>
<script src="js/lib/vue-resource.min.js"></script>
<script src="js/site.js"></script>
<script src="js/app.js"></script>
<script src="js/vue.js"></script>
<script src="js/model/article.js"></script>
<script src="js/model/inventory_article.js"></script>
<script>
+90 -19
View File
@@ -1,24 +1,95 @@
accounting.settings = {
currency: {
symbol: "€",
format: "%v %s",
decimal: ",",
thousand: ".",
precision: 2
Vue.filter('currency', function(money){
return accounting.formatMoney(money);
});
Vue.filter('number', function(number, precision = 2){
return accounting.formatNumber(number, precision);
});
var app = new Vue({
el: "#app",
data : {
dimensions: [
'l',
'Stk.',
'Gl.',
'Fl.',
'T.',
],
articles : [],
inventory : {
ug : [],
mob : [],
stud : []
},
number: {
precision : 2, // default precision on numbers is 0
thousand: ".",
decimal : ","
bon: [],
view: 'inventur',
ready: false,
},
computed: {
sales_ug: function (){
var total_sales = this.inventory.ug.reduce(function(total, item ) {
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;
}
};
$(document).ready(function(){
$('.tabs').tabs({
swipeable: true,
responsiveThreshold: 640
},
methods: {
addArticle: function() {
this.articles.push(new Article());
},
storeArticles: function() {
this.$http.post('./backend?controller=Article&action=store', JSON.stringify(this.articles))
.then(response => {
M.toast({html: response.body});
})
},
loadArticles: function() {
this.$http.get('./data/test_articles.json')
.then(response => { return response.json();})
.then(json => {
json.forEach(element => {
this.articles.push(Article.thaw(element));
});
$('.fixed-action-btn').floatingActionButton();
$('.tooltipped').tooltip();
}).then( x => {
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 => {
M.updateTextFields();
this.ready = true;
});
},
resetBon: function(article) {
this.bon.forEach(function (item){
item.count = 0;
});
},
bonned: function (items) {
return items.filter(function (item) {
return item.count > 0;
});
}
},
created: function(){
this.loadArticles();
}
});
View File
+4
View File
File diff suppressed because one or more lines are too long
+6
View File
File diff suppressed because one or more lines are too long
+10798
View File
File diff suppressed because it is too large Load Diff
+7
View File
File diff suppressed because one or more lines are too long
+6
View File
File diff suppressed because one or more lines are too long
+21
View File
@@ -0,0 +1,21 @@
accounting.settings = {
currency: {
symbol: "€",
format: "%v %s",
decimal: ",",
thousand: ".",
precision: 2
},
number: {
precision : 2, // default precision on numbers is 0
thousand: ".",
decimal : ","
}
};
$(document).ready(function(){
$('.tabs').tabs();
$('.fixed-action-btn').floatingActionButton();
$('.tooltipped').tooltip();
});
-95
View File
@@ -1,95 +0,0 @@
Vue.filter('currency', function(money){
return accounting.formatMoney(money);
});
Vue.filter('number', function(number, precision = 2){
return accounting.formatNumber(number, precision);
});
var app = new Vue({
el: "#app",
data : {
dimensions: [
'l',
'Stk.',
'Gl.',
'Fl.',
'T.',
],
articles : [],
inventory : {
ug : [],
mob : [],
stud : []
},
bon: [],
view: 'inventur',
ready: false,
},
computed: {
sales_ug: function (){
var total_sales = this.inventory.ug.reduce(function(total, item ) {
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() {
this.articles.push(new Article());
},
storeArticles: function() {
this.$http.post('./backend?controller=Article&action=store', JSON.stringify(this.articles))
.then(response => {
M.toast({html: response.body});
})
},
loadArticles: function() {
this.$http.get('./data/test_articles.json')
.then(response => { return response.json();})
.then(json => {
json.forEach(element => {
this.articles.push(Article.thaw(element));
});
}).then( x => {
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 => {
M.updateTextFields();
this.ready = true;
});
},
resetBon: function(article) {
this.bon.forEach(function (item){
item.count = 0;
});
},
bonned: function (items) {
return items.filter(function (item) {
return item.count > 0;
});
}
},
created: function(){
this.loadArticles();
}
});
+8
View File
@@ -0,0 +1,8 @@
<?php
$database = [
'server' => 'localhost',
'user' => 'inventur',
'password' => '*inv2018#',
'db' => 'inventur'
];
+8
View File
@@ -0,0 +1,8 @@
<?php
$database = [
'server' => 'localhost',
'user' => 'inventur',
'password' => '*inv2018#',
'db' => 'inventur'
];
+1 -1
View File
@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "chrosey.de Inventur",
"version": "1.0",
"version": "1.1",
"default_locale": "de",
"description": "Inventur-Helfer",
+16 -28
View File
@@ -1,19 +1,23 @@
var CACHE_NAME = "inventur_cache-v1";
var APP_SHELL_CACHE = "inventur_shell-v2";
var urlsToCache = [
'.',
'js/app.js',
'js/vue.js',
'js/accounting.min.js',
'js/moment-with-locales.min.js',
'js/model/article.js',
'js/model/inventory_article.js'
'css/lib/materialize.min.css',
'js/lib/materialize.min.js',
'js/lib/accounting.min.js',
'js/lib/moment-with-locales.min.js',
'js/lib/jquery.min.js',
'js/lib/vue-dev.js',
'js/lib/vue.min.js',
'js/lib/vue-resource.min.js',
'fonts/Roboto/*',
//'js/model/inventory_article.js'
];
self.addEventListener('install', function(event){
event.waitUntil(
caches.open(CACHE_NAME)
caches.open(APP_SHELL_CACHE)
.then(function(cache){
console.log("Cache opened");
console.log("[Cache] opened: ", APP_SHELL_CACHE);
return cache.addAll(urlsToCache);
})
);
@@ -21,28 +25,12 @@ self.addEventListener('install', function(event){
self.addEventListener('fetch', function(event){
event.respondWith(
caches.match(event.request)
caches.open(APP_SHELL_CACHE).then(function(cache) {
return fetch(event.request)
.then(function(response){
if (response) {
cache.put(event.request, response.clone());
return response;
}
var fetchRequest = event.request.clone();
return fetch(fetchRequest).then(
function(response){
if(!response || response.status !== 200 || response.type !== 'basic') {
return response;
}
var responseToCache = response.clone();
caches.open(CACHE_NAME)
.then(function(cache){
cache.put(event.request, responseToCache);
});
return response;
}
)
})
);
});