localizing dependencies for serviceWorker
This commit is contained in:
parent
0607663efd
commit
ee717318ee
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
require "localconf.php";
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != "POST") {
|
if ($_SERVER['REQUEST_METHOD'] != "POST") {
|
||||||
echo "Sorry, ich spreche kein GET.";
|
echo "Sorry, ich spreche kein GET.";
|
||||||
return;
|
return;
|
||||||
|
|||||||
13
css/lib/materialize.min.css
vendored
Normal file
13
css/lib/materialize.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
fonts/roboto/Roboto-Bold.woff
Normal file
BIN
fonts/roboto/Roboto-Bold.woff
Normal file
Binary file not shown.
BIN
fonts/roboto/Roboto-Bold.woff2
Normal file
BIN
fonts/roboto/Roboto-Bold.woff2
Normal file
Binary file not shown.
BIN
fonts/roboto/Roboto-Light.woff
Normal file
BIN
fonts/roboto/Roboto-Light.woff
Normal file
Binary file not shown.
BIN
fonts/roboto/Roboto-Light.woff2
Normal file
BIN
fonts/roboto/Roboto-Light.woff2
Normal file
Binary file not shown.
BIN
fonts/roboto/Roboto-Medium.woff
Normal file
BIN
fonts/roboto/Roboto-Medium.woff
Normal file
Binary file not shown.
BIN
fonts/roboto/Roboto-Medium.woff2
Normal file
BIN
fonts/roboto/Roboto-Medium.woff2
Normal file
Binary file not shown.
BIN
fonts/roboto/Roboto-Regular.woff
Normal file
BIN
fonts/roboto/Roboto-Regular.woff
Normal file
Binary file not shown.
BIN
fonts/roboto/Roboto-Regular.woff2
Normal file
BIN
fonts/roboto/Roboto-Regular.woff2
Normal file
Binary file not shown.
BIN
fonts/roboto/Roboto-Thin.woff
Normal file
BIN
fonts/roboto/Roboto-Thin.woff
Normal file
Binary file not shown.
BIN
fonts/roboto/Roboto-Thin.woff2
Normal file
BIN
fonts/roboto/Roboto-Thin.woff2
Normal file
Binary file not shown.
18
index.html
18
index.html
@ -6,10 +6,8 @@
|
|||||||
<title>Inventur</title>
|
<title>Inventur</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
<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">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<!--Import materialize.css-->
|
<link rel="stylesheet" href="css/lib/materialize.min.css">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-alpha.3/css/materialize.min.css">
|
|
||||||
<link rel="manifest" href="manifest.json">
|
<link rel="manifest" href="manifest.json">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -160,14 +158,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
<script src="js/lib/jquery.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/lib/materialize.min.js"></script>
|
||||||
<script src="js/moment-with-locales.min.js"></script>
|
<script src="js/lib/moment-with-locales.min.js"></script>
|
||||||
<script src="js/accounting.min.js"></script>
|
<script src="js/lib/accounting.min.js"></script>
|
||||||
<script src="https://unpkg.com/vue/dist/vue.js"></script>
|
<script src="js/lib/vue-dev.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/vue-resource"></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/app.js"></script>
|
||||||
<script src="js/vue.js"></script>
|
|
||||||
<script src="js/model/article.js"></script>
|
<script src="js/model/article.js"></script>
|
||||||
<script src="js/model/inventory_article.js"></script>
|
<script src="js/model/inventory_article.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
113
js/app.js
113
js/app.js
@ -1,24 +1,95 @@
|
|||||||
accounting.settings = {
|
Vue.filter('currency', function(money){
|
||||||
currency: {
|
return accounting.formatMoney(money);
|
||||||
symbol: "€",
|
});
|
||||||
format: "%v %s",
|
Vue.filter('number', function(number, precision = 2){
|
||||||
decimal: ",",
|
|
||||||
thousand: ".",
|
|
||||||
precision: 2
|
|
||||||
},
|
|
||||||
number: {
|
|
||||||
precision : 2, // default precision on numbers is 0
|
|
||||||
thousand: ".",
|
|
||||||
decimal : ","
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
return accounting.formatNumber(number, precision);
|
||||||
$('.tabs').tabs({
|
|
||||||
swipeable: true,
|
|
||||||
responsiveThreshold: 640
|
|
||||||
});
|
|
||||||
$('.fixed-action-btn').floatingActionButton();
|
|
||||||
$('.tooltipped').tooltip();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
4
js/lib/jquery.min.js
vendored
Normal file
4
js/lib/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
js/lib/materialize.min.js
vendored
Normal file
6
js/lib/materialize.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10798
js/lib/vue-dev.js
Normal file
10798
js/lib/vue-dev.js
Normal file
File diff suppressed because it is too large
Load Diff
7
js/lib/vue-resource.min.js
vendored
Normal file
7
js/lib/vue-resource.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
js/lib/vue.min.js
vendored
Normal file
6
js/lib/vue.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
21
js/site.js
Normal file
21
js/site.js
Normal 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
js/vue.js
95
js/vue.js
@ -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
localconf.php
Normal file
8
localconf.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$database = [
|
||||||
|
'server' => 'localhost',
|
||||||
|
'user' => 'inventur',
|
||||||
|
'password' => '*inv2018#',
|
||||||
|
'db' => 'inventur'
|
||||||
|
];
|
||||||
8
localconf.php.template
Normal file
8
localconf.php.template
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$database = [
|
||||||
|
'server' => 'localhost',
|
||||||
|
'user' => 'inventur',
|
||||||
|
'password' => '*inv2018#',
|
||||||
|
'db' => 'inventur'
|
||||||
|
];
|
||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 1,
|
"manifest_version": 1,
|
||||||
"name": "chrosey.de Inventur",
|
"name": "chrosey.de Inventur",
|
||||||
"version": "1.0",
|
"version": "1.1",
|
||||||
|
|
||||||
"default_locale": "de",
|
"default_locale": "de",
|
||||||
"description": "Inventur-Helfer",
|
"description": "Inventur-Helfer",
|
||||||
|
|||||||
@ -1,19 +1,23 @@
|
|||||||
var CACHE_NAME = "inventur_cache-v1";
|
var APP_SHELL_CACHE = "inventur_shell-v2";
|
||||||
var urlsToCache = [
|
var urlsToCache = [
|
||||||
'.',
|
'.',
|
||||||
'js/app.js',
|
'css/lib/materialize.min.css',
|
||||||
'js/vue.js',
|
'js/lib/materialize.min.js',
|
||||||
'js/accounting.min.js',
|
'js/lib/accounting.min.js',
|
||||||
'js/moment-with-locales.min.js',
|
'js/lib/moment-with-locales.min.js',
|
||||||
'js/model/article.js',
|
'js/lib/jquery.min.js',
|
||||||
'js/model/inventory_article.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){
|
self.addEventListener('install', function(event){
|
||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
caches.open(CACHE_NAME)
|
caches.open(APP_SHELL_CACHE)
|
||||||
.then(function(cache){
|
.then(function(cache){
|
||||||
console.log("Cache opened");
|
console.log("[Cache] opened: ", APP_SHELL_CACHE);
|
||||||
return cache.addAll(urlsToCache);
|
return cache.addAll(urlsToCache);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -21,29 +25,13 @@ self.addEventListener('install', function(event){
|
|||||||
|
|
||||||
self.addEventListener('fetch', function(event){
|
self.addEventListener('fetch', function(event){
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches.match(event.request)
|
caches.open(APP_SHELL_CACHE).then(function(cache) {
|
||||||
.then(function(response){
|
return fetch(event.request)
|
||||||
if (response) {
|
.then(function(response){
|
||||||
|
cache.put(event.request, response.clone());
|
||||||
return response;
|
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;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user