Einheiten dazu - WIP **
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "Spritzschema",
|
"name": "Spritzschema",
|
||||||
"version": "0.0.1",
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "Spritzschema",
|
"name": "Spritzschema",
|
||||||
"version": "0.0.1",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cookie-parser": "~1.4.4",
|
"cookie-parser": "~1.4.4",
|
||||||
"debug": "~2.6.9",
|
"debug": "~2.6.9",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Spritzschema",
|
"name": "Spritzschema",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"date": "2023-05-07",
|
"date": "2023-05-13",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./bin/www >>/var/log/spritzschema.log 2>&1"
|
"start": "node ./bin/www >>/var/log/spritzschema.log 2>&1"
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ document.addEventListener('DOMContentLoaded', async function () {
|
|||||||
|
|
||||||
const DateTime = luxon.DateTime
|
const DateTime = luxon.DateTime
|
||||||
|
|
||||||
|
const DEFEINHEIT = 8
|
||||||
|
let curEinheit = 0
|
||||||
|
|
||||||
if (sysParams.doinit) {
|
if (sysParams.doinit) {
|
||||||
await initSchema('2023-05-01')
|
await initSchema('2023-05-01')
|
||||||
}
|
}
|
||||||
@@ -11,6 +14,7 @@ document.addEventListener('DOMContentLoaded', async function () {
|
|||||||
fillSchema(schema)
|
fillSchema(schema)
|
||||||
|
|
||||||
document.querySelector('#sptab').addEventListener('click', markField);
|
document.querySelector('#sptab').addEventListener('click', markField);
|
||||||
|
document.querySelector('#einheiten').addEventListener('change', enterEinheit);
|
||||||
|
|
||||||
async function markField (e) {
|
async function markField (e) {
|
||||||
let field = e.target;
|
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')}
|
||||||
|
<div id="lowline" class="small">
|
||||||
|
<div>${day.setLocale('de').toFormat('ccc')}</div>
|
||||||
|
<div>${einheit !== 0 ? einheit : ''}</div>
|
||||||
|
</div>`
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
|
||||||
function fillSchema(schema) {
|
function fillSchema(schema) {
|
||||||
const setArray = schema.data
|
const setArray = schema.data
|
||||||
let months = ''
|
let months = ''
|
||||||
@@ -43,9 +63,7 @@ document.addEventListener('DOMContentLoaded', async function () {
|
|||||||
let sel = '#bt'+(i+1)
|
let sel = '#bt'+(i+1)
|
||||||
let day = DateTime.fromISO(setArray[i].day)
|
let day = DateTime.fromISO(setArray[i].day)
|
||||||
if (setArray[i].day !== '') {
|
if (setArray[i].day !== '') {
|
||||||
let x = `${day.toFormat('d')}
|
document.querySelector(sel).innerHTML = buildCellHtml(day, setArray[i].einheit)
|
||||||
<br /><span class="small">${day.setLocale('de').toFormat('ccc')}</span>`
|
|
||||||
document.querySelector(sel).innerHTML = x
|
|
||||||
if (setArray[i].status) {
|
if (setArray[i].status) {
|
||||||
document.querySelector(sel).setAttribute('aria-label', 'x')
|
document.querySelector(sel).setAttribute('aria-label', 'x')
|
||||||
document.querySelector(sel).setAttribute('disabled', 'disabled')
|
document.querySelector(sel).setAttribute('disabled', 'disabled')
|
||||||
@@ -56,6 +74,9 @@ document.addEventListener('DOMContentLoaded', async function () {
|
|||||||
} else {
|
} else {
|
||||||
document.querySelector(sel).setAttribute('disabled', 'disabled')
|
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
|
let k = 0
|
||||||
for(let i = 0; i < 35; i++) {
|
for(let i = 0; i < 35; i++) {
|
||||||
let elem = {status: false}
|
let elem = {status: false}
|
||||||
|
elem.einheit = curEinheit
|
||||||
if (i === 17) {
|
if (i === 17) {
|
||||||
elem.day = ''
|
elem.day = ''
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -50,6 +50,17 @@ a {
|
|||||||
color: gray;
|
color: gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#infeld {
|
||||||
|
width: 91vmin;
|
||||||
|
margin: auto;
|
||||||
|
font-size: 200%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#einheiten {
|
||||||
|
font-size: 130%;
|
||||||
|
margin-left: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
width: 91vmin;
|
width: 91vmin;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
@@ -58,3 +69,8 @@ footer {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#lowline {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|||||||
@@ -44,3 +44,6 @@ block content
|
|||||||
button#bt33
|
button#bt33
|
||||||
button#bt34
|
button#bt34
|
||||||
button#bt35
|
button#bt35
|
||||||
|
#infeld
|
||||||
|
label(for="einheiten") Einheiten:
|
||||||
|
input#einheiten(type="number" min="0" max="100" value="0")
|
||||||
Reference in New Issue
Block a user