diff --git a/package-lock.json b/package-lock.json
index 53c8be6..b69f2db 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "Spritzschema",
- "version": "0.0.1",
+ "version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "Spritzschema",
- "version": "0.0.1",
+ "version": "1.0.0",
"dependencies": {
"cookie-parser": "~1.4.4",
"debug": "~2.6.9",
diff --git a/package.json b/package.json
index 274e19c..a076a8b 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "Spritzschema",
- "version": "1.0.0",
- "date": "2023-05-07",
+ "version": "1.1.0",
+ "date": "2023-05-13",
"private": true,
"scripts": {
"start": "node ./bin/www >>/var/log/spritzschema.log 2>&1"
diff --git a/public/javascripts/script.js b/public/javascripts/script.js
index fc4f45a..4187747 100644
--- a/public/javascripts/script.js
+++ b/public/javascripts/script.js
@@ -2,6 +2,9 @@ document.addEventListener('DOMContentLoaded', async function () {
const DateTime = luxon.DateTime
+ const DEFEINHEIT = 8
+ let curEinheit = 0
+
if (sysParams.doinit) {
await initSchema('2023-05-01')
}
@@ -10,7 +13,8 @@ document.addEventListener('DOMContentLoaded', async function () {
let schema = ret.data
fillSchema(schema)
- document.querySelector('#sptab').addEventListener('click', markField);
+ document.querySelector('#sptab').addEventListener('click', markField);
+ document.querySelector('#einheiten').addEventListener('change', enterEinheit);
async function markField (e) {
let field = e.target;
@@ -26,6 +30,22 @@ document.addEventListener('DOMContentLoaded', async function () {
}
}
+ async function enterEinheit (e) {
+ let field = e.target;
+ let d = schema.data[34].day
+ schema.data[parseInt(field.id.slice(2))-1].einheit = field.value
+ await storeData(schema)
+ }
+
+ function buildCellHtml(day, einheit) {
+ let x = `${day.toFormat('d')}
+
+
${day.setLocale('de').toFormat('ccc')}
+
${einheit !== 0 ? einheit : ''}
+
`
+ return x
+ }
+
function fillSchema(schema) {
const setArray = schema.data
let months = ''
@@ -43,9 +63,7 @@ document.addEventListener('DOMContentLoaded', async function () {
let sel = '#bt'+(i+1)
let day = DateTime.fromISO(setArray[i].day)
if (setArray[i].day !== '') {
- let x = `${day.toFormat('d')}
-
${day.setLocale('de').toFormat('ccc')}`
- document.querySelector(sel).innerHTML = x
+ document.querySelector(sel).innerHTML = buildCellHtml(day, setArray[i].einheit)
if (setArray[i].status) {
document.querySelector(sel).setAttribute('aria-label', 'x')
document.querySelector(sel).setAttribute('disabled', 'disabled')
@@ -56,6 +74,9 @@ document.addEventListener('DOMContentLoaded', async function () {
} else {
document.querySelector(sel).setAttribute('disabled', 'disabled')
}
+ if(setArray[i].einheit !== 0) {
+ document.getElementById("einheiten").value = setArray[i].einheit
+ }
}
}
@@ -84,6 +105,7 @@ document.addEventListener('DOMContentLoaded', async function () {
let k = 0
for(let i = 0; i < 35; i++) {
let elem = {status: false}
+ elem.einheit = curEinheit
if (i === 17) {
elem.day = ''
} else {
diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css
index bce6689..eca33c8 100644
--- a/public/stylesheets/style.css
+++ b/public/stylesheets/style.css
@@ -50,6 +50,17 @@ a {
color: gray;
}
+#infeld {
+ width: 91vmin;
+ margin: auto;
+ font-size: 200%;
+}
+
+#einheiten {
+ font-size: 130%;
+ margin-left: 30px;
+}
+
footer {
width: 91vmin;
margin: auto;
@@ -57,4 +68,9 @@ footer {
#v {
text-align: right;
margin-top: 30px;
-}
\ No newline at end of file
+}
+
+#lowline {
+ display: flex;
+ justify-content: space-between;
+}
diff --git a/views/index.pug b/views/index.pug
index d3fdf91..64ffece 100644
--- a/views/index.pug
+++ b/views/index.pug
@@ -44,3 +44,6 @@ block content
button#bt33
button#bt34
button#bt35
+ #infeld
+ label(for="einheiten") Einheiten:
+ input#einheiten(type="number" min="0" max="100" value="0")
\ No newline at end of file