Einheiten dazu - WIP **
This commit is contained in:
@@ -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')}
|
||||
<div id="lowline" class="small">
|
||||
<div>${day.setLocale('de').toFormat('ccc')}</div>
|
||||
<div>${einheit !== 0 ? einheit : ''}</div>
|
||||
</div>`
|
||||
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')}
|
||||
<br /><span class="small">${day.setLocale('de').toFormat('ccc')}</span>`
|
||||
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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
#lowline {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user