Zeitplan: einfacherer Dialog, Rhythmus alle n Wochen, Ersteller, eigene Einträge bearbeiten
- Dialog: Beginn und Ende einmal; Wiederholung keine oder wöchentlich mit
Wochentagen, Rhythmus (jede, alle 2/3/4 Wochen) und Enddatum; dauerhaft
nur noch über die Kommandozeile; Rechnerauswahl bei Pins auf mehreren Sparks
- Weekly.every (Spalte every in schedule und quotas), gezählt ab der Woche
von from; Konfliktprüfung über das kgV der Rhythmen; CLI --every
- schedule.created_by; Kalender, Details und Liste zeigen den Ersteller
- PUT /omega/api/schedule/{id} für eigene Einträge, geprüft ohne die alte Fassung
- CLI: --weekly ohne --time gilt ganztags
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8e61b77ffa
commit
fe069d91f0
11 files changed
+404
-131
No files matched your search
@@ -237,6 +237,7 @@ input[type=date].field, input[type=time].field, input[type=datetime-local].field
|
||||
.ev { position: absolute; right: 4px; border-radius: 6px; padding: 4px 6px; font: 11px/1.3 var(--sans); text-align: left; overflow: hidden; display: flex; flex-direction: column; gap: 1px; cursor: pointer; z-index: 1; }
|
||||
.ev:hover { filter: brightness(1.2); }
|
||||
.ev .ev-kind { font-weight: 600; }
|
||||
.ev .ev-by { opacity: .75; }
|
||||
.ev.pin, .swatch.ev-pin { background: #2c2117; border: 1px solid #8a5a32; color: #ffe2c6; }
|
||||
.ev.exclusive, .swatch.ev-exclusive { background: rgba(180,140,240,.16); border: 1px solid rgba(180,140,240,.55); color: #e3d6fb; }
|
||||
.ev.window, .swatch.ev-window { background: rgba(79,209,197,.12); border: 1px solid rgba(79,209,197,.5); color: #b8f0ea; }
|
||||
|
||||
+146
-55
@@ -991,17 +991,21 @@ function occurrences(e, dayStart) {
|
||||
const w = e.time.weekly;
|
||||
if (!w) return clip([dayStart, dayEnd]);
|
||||
const code = (d) => WEEKDAYS[(d.getDay() + 6) % 7][2];
|
||||
// Alle n Wochen: zählt die Woche, in der ein Abschnitt beginnt, ab der Woche des Beginns
|
||||
const monday = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate() - ((d.getDay() + 6) % 7));
|
||||
const inRhythm = (day) => w.every <= 1 || !from
|
||||
|| Math.round((monday(day) - monday(from)) / (7 * 86400000)) % w.every === 0;
|
||||
const result = [];
|
||||
const start = w.start.slice(0, 5);
|
||||
const end = w.end.slice(0, 5);
|
||||
if (w.days.includes(code(dayStart))) {
|
||||
if (w.days.includes(code(dayStart)) && inRhythm(dayStart)) {
|
||||
const a = atTime(dayStart, start);
|
||||
const b = end > start ? atTime(dayStart, end) : dayEnd;
|
||||
result.push(...clip([a, b]));
|
||||
}
|
||||
// Über Mitternacht: der Rest vom Vortag
|
||||
const prev = new Date(dayStart.getTime() - 86400000);
|
||||
if (end < start && w.days.includes(code(prev))) result.push(...clip([dayStart, atTime(dayStart, end)]));
|
||||
if (end < start && w.days.includes(code(prev)) && inRhythm(prev)) result.push(...clip([dayStart, atTime(dayStart, end)]));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1014,6 +1018,8 @@ async function schedulePage() {
|
||||
const permanent = entries.filter((e) => !e.time.from && !e.time.until && !e.time.weekly);
|
||||
const shiftWeek = (d) => { state.week = d === 0 ? 0 : (state.week || 0) + d; render(); };
|
||||
const newEntry = (preset) => openOverlay('Neuer Eintrag', (close) => scheduleForm(models, groups, preset, close));
|
||||
const editEntry = (e) => openOverlay('Eintrag bearbeiten', (close) => scheduleForm(models, groups, null, close, e));
|
||||
const creator = (e) => e.creator || (e.created_by ? '#' + e.created_by : 'Kommandozeile');
|
||||
|
||||
// Kalender: eine Spalte je Tag, eine Zeile je Stunde. Ziehen markiert einen Zeitraum, ein Klick eine Stunde.
|
||||
const HOUR = 22;
|
||||
@@ -1038,9 +1044,9 @@ async function schedulePage() {
|
||||
const top = (from - dayStart) / 3600000 * HOUR;
|
||||
const height = Math.max(16, (to - from) / 3600000 * HOUR);
|
||||
col.append(h('button', { type: 'button', class: 'ev ' + e.kind.kind, style: { top: top + 'px', height: height + 'px', left: (4 + lane * 6) + 'px' },
|
||||
title: e.subject + ' · ' + e.describe, onpointerdown: (ev) => ev.stopPropagation(), onclick: () => showEntry(e) },
|
||||
title: e.subject + ' · ' + e.describe + ' · von ' + creator(e), onpointerdown: (ev) => ev.stopPropagation(), onclick: () => showEntry(e) },
|
||||
h('span', { class: 'ev-kind' }, KIND_LABEL[e.kind.kind]), h('span', { class: 'mono' }, e.subject),
|
||||
e.note ? h('span', {}, e.note) : null, h('span', { class: 'mono' }, hhmm(from) + '–' + (to.getTime() === dayStart.getTime() + 86400000 ? '24:00' : hhmm(to)))));
|
||||
e.note ? h('span', {}, e.note) : null, h('span', { class: 'ev-by' }, 'von ' + creator(e)), h('span', { class: 'mono' }, hhmm(from) + '–' + (to.getTime() === dayStart.getTime() + 86400000 ? '24:00' : hhmm(to)))));
|
||||
lane = (lane + 1) % 3;
|
||||
}
|
||||
}
|
||||
@@ -1090,9 +1096,11 @@ async function schedulePage() {
|
||||
h('dl', { class: 'facts' },
|
||||
h('dt', {}, 'Wann'), h('dd', {}, e.describe),
|
||||
h('dt', {}, 'Stand'), h('dd', {}, e.active ? 'gerade aktiv' : 'gerade nicht aktiv'),
|
||||
h('dt', {}, 'Angelegt von'), h('dd', { class: 'mono' }, creator(e)),
|
||||
e.note ? [h('dt', {}, 'Anmerkung'), h('dd', {}, e.note)] : null),
|
||||
h('div', { class: 'actions' },
|
||||
h('button', { class: 'btn', type: 'button', onclick: close }, 'Schließen'),
|
||||
e.editable ? h('button', { class: 'btn', type: 'button', onclick: () => editEntry(e) }, 'Bearbeiten') : null,
|
||||
h('button', { class: 'btn danger', type: 'button', onclick: () => { close(); act(() => api('DELETE', '/schedule/' + e.id), 'Eintrag entfernt.'); } }, 'Entfernen'))));
|
||||
}
|
||||
|
||||
@@ -1110,13 +1118,15 @@ async function schedulePage() {
|
||||
h('section', { class: 'card cal-card' }, grid),
|
||||
h('section', { class: 'card' }, h('h2', {}, 'Alle Einträge'),
|
||||
entries.length ? h('div', { class: 'table-wrap' }, h('table', {},
|
||||
h('thead', {}, h('tr', {}, h('th', {}, 'Art'), h('th', {}, 'Was'), h('th', {}, 'Wann'), h('th', {}, 'Stand'), h('th', {}, 'Anmerkung'), h('th', {}, h('span', { class: 'sr-only' }, 'Aktionen')))),
|
||||
h('thead', {}, h('tr', {}, h('th', {}, 'Art'), h('th', {}, 'Was'), h('th', {}, 'Wann'), h('th', {}, 'Stand'), h('th', {}, 'Anmerkung'), h('th', {}, 'Von'), h('th', {}, h('span', { class: 'sr-only' }, 'Aktionen')))),
|
||||
h('tbody', {}, entries.map((e) => h('tr', {},
|
||||
h('td', {}, h('span', { class: 'chip' + (e.kind.kind === 'pin' ? ' accent' : '') }, KIND_LABEL[e.kind.kind] || e.kind.kind)),
|
||||
h('td', { class: 'mono wrap' }, e.subject), h('td', { class: 'wrap' }, e.describe),
|
||||
h('td', {}, e.active ? h('span', { class: 'status' }, h('span', { class: 'dot good' }), 'aktiv') : h('span', { class: 'muted' }, 'inaktiv')),
|
||||
h('td', { class: 'wrap' }, e.note),
|
||||
h('td', {}, h('button', { class: 'btn small danger', type: 'button', onclick: () => act(() => api('DELETE', '/schedule/' + e.id), 'Eintrag entfernt.') }, 'Entfernen')))))))
|
||||
h('td', { class: 'wrap' }, e.note), h('td', { class: 'mono' }, creator(e)),
|
||||
h('td', {}, h('div', { class: 'actions' },
|
||||
e.editable ? h('button', { class: 'btn small', type: 'button', onclick: () => editEntry(e) }, 'Bearbeiten') : null,
|
||||
h('button', { class: 'btn small danger', type: 'button', onclick: () => act(() => api('DELETE', '/schedule/' + e.id), 'Eintrag entfernt.') }, 'Entfernen'))))))))
|
||||
: h('p', { class: 'empty' }, 'Der Zeitplan ist leer.')));
|
||||
}
|
||||
|
||||
@@ -1129,44 +1139,112 @@ function localValue(day, minutes) {
|
||||
return d.getFullYear() + '-' + p(d.getMonth() + 1) + '-' + p(d.getDate()) + 'T' + p(d.getHours()) + ':' + p(d.getMinutes());
|
||||
}
|
||||
|
||||
/** Formular für einen Zeitplaneintrag; `preset` ist der im Kalender markierte Zeitraum */
|
||||
function scheduleForm(models, groups, preset, close) {
|
||||
const dateOf = (v) => v.slice(0, 10);
|
||||
const timeOf = (v) => v.slice(11, 16);
|
||||
const fromUnix = (ts) => { const d = new Date(ts * 1000); return localValue(d, d.getHours() * 60 + d.getMinutes()); };
|
||||
|
||||
/** Beginn und Ende eines bestehenden Eintrags für das Formular: bei wöchentlichen der erste Termin */
|
||||
function entryTimes(e) {
|
||||
const w = e.time.weekly;
|
||||
if (!w) return { from: e.time.from ? fromUnix(e.time.from) : '', until: e.time.until ? fromUnix(e.time.until) : '' };
|
||||
const first = e.time.from ? new Date(e.time.from * 1000) : new Date();
|
||||
const [sh, sm] = w.start.split(':').map(Number);
|
||||
const [eh, em] = w.end.split(':').map(Number);
|
||||
const start = sh * 60 + sm;
|
||||
let end = eh * 60 + em;
|
||||
if (end <= start) end += 24 * 60; // über Mitternacht oder ganztags
|
||||
const repeatUntil = e.time.until ? dateOf(localValue(new Date((e.time.until - 86400) * 1000), 0)) : '';
|
||||
return { from: localValue(first, start), until: localValue(first, end), repeatUntil };
|
||||
}
|
||||
|
||||
/** Formular für einen Zeitplaneintrag: neu (mit dem im Kalender markierten Zeitraum) oder ein eigener zum Bearbeiten */
|
||||
function scheduleForm(models, groups, preset, close, entry) {
|
||||
const error = h('div', { class: 'notice error', role: 'alert', hidden: true });
|
||||
const fail = (text) => { error.textContent = text; error.hidden = false; };
|
||||
const subject = h('div', { class: 'stack small' });
|
||||
const repeat = h('select', { id: 's-repeat', name: 'repeat', class: 'field', onchange: () => showTime() },
|
||||
h('option', { value: 'once' }, 'einmalig'), h('option', { value: 'weekly' }, 'wöchentlich'), h('option', { value: 'permanent' }, 'dauerhaft'));
|
||||
const weekday = preset ? WEEKDAYS[(preset.day.getDay() + 6) % 7][0] : null;
|
||||
const days = dayToggles('s-days', weekday ? [weekday] : []);
|
||||
const once = h('div', { class: 'fields' },
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-from' }, 'Beginn'),
|
||||
h('input', { id: 's-from', name: 'from', type: 'datetime-local', class: 'field mono', value: preset ? localValue(preset.day, preset.start) : '' })),
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-until' }, 'Ende'),
|
||||
h('input', { id: 's-until', name: 'until', type: 'datetime-local', class: 'field mono', value: preset ? localValue(preset.day, preset.end) : '' })));
|
||||
const weekly = h('div', { class: 'stack small' }, days,
|
||||
const k = entry ? entry.kind : null;
|
||||
const times = entry ? entryTimes(entry) : {
|
||||
from: preset ? localValue(preset.day, preset.start) : '',
|
||||
until: preset ? localValue(preset.day, preset.end) : '',
|
||||
repeatUntil: '',
|
||||
};
|
||||
const w = entry && entry.time.weekly;
|
||||
const weekdayOf = (v) => (v ? WEEKDAYS[(new Date(dateOf(v) + 'T00:00').getDay() + 6) % 7][0] : null);
|
||||
const preDays = w ? WEEKDAYS.filter(([, , en]) => w.days.includes(en)).map(([code]) => code) : [weekdayOf(times.from)].filter(Boolean);
|
||||
|
||||
const fromInput = h('input', { id: 's-from', name: 'from', type: 'datetime-local', class: 'field mono', required: true, value: times.from });
|
||||
const untilInput = h('input', { id: 's-until', name: 'until', type: 'datetime-local', class: 'field mono', required: true, value: times.until });
|
||||
const repeat = h('select', { id: 's-repeat', name: 'repeat', class: 'field', onchange: () => showRepeat() },
|
||||
h('option', { value: 'none', selected: !w }, 'keine'), h('option', { value: 'weekly', selected: !!w }, 'wöchentlich'));
|
||||
const days = dayToggles('s-days', preDays);
|
||||
const every = h('select', { id: 's-every', name: 'every', class: 'field' },
|
||||
[[1, 'jede Woche'], [2, 'alle 2 Wochen (14-tägig)'], [3, 'alle 3 Wochen'], [4, 'alle 4 Wochen']]
|
||||
.map(([n, label]) => h('option', { value: n, selected: (w ? w.every : 1) === n }, label)));
|
||||
const weekly = h('div', { class: 'stack small' },
|
||||
h('div', { class: 'field-group' }, h('span', { class: 'label' }, 'an'), days),
|
||||
h('div', { class: 'fields' },
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-time-start' }, 'von'),
|
||||
h('input', { id: 's-time-start', name: 'time_start', type: 'time', class: 'field mono', value: preset ? mm(preset.start) : '' })),
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-time-end' }, 'bis'),
|
||||
h('input', { id: 's-time-end', name: 'time_end', type: 'time', class: 'field mono', value: preset ? mm(preset.end % (24 * 60)) : '' })),
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-valid-from' }, 'erstmals am'), h('input', { id: 's-valid-from', name: 'valid_from', type: 'date', class: 'field mono' })),
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-valid-until' }, 'letztmals am'), h('input', { id: 's-valid-until', name: 'valid_until', type: 'date', class: 'field mono' }))),
|
||||
h('span', { class: 'hint' }, 'Ohne Uhrzeit ganztags.'));
|
||||
function showTime() {
|
||||
once.hidden = repeat.value !== 'once';
|
||||
weekly.hidden = repeat.value !== 'weekly';
|
||||
}
|
||||
let kind = 'pin';
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-every' }, 'Rhythmus'), every),
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-repeat-until' }, 'wiederholen bis einschließlich'),
|
||||
h('input', { id: 's-repeat-until', name: 'repeat_until', type: 'date', class: 'field mono', value: times.repeatUntil || '' }))),
|
||||
h('span', { class: 'hint' }, 'Uhrzeit wie bei Beginn und Ende. Der Rhythmus zählt ab der Woche des Beginns. Ohne Enddatum wiederholt sich der Eintrag unbegrenzt.'));
|
||||
function showRepeat() { weekly.hidden = repeat.value !== 'weekly'; }
|
||||
// Beim Ändern des Beginns: Ende mitziehen und, solange nur ein Tag gewählt ist, den Wochentag anpassen
|
||||
let lastFrom = fromInput.value;
|
||||
fromInput.addEventListener('change', () => {
|
||||
const a = new Date(lastFrom);
|
||||
const b = new Date(fromInput.value);
|
||||
const u = new Date(untilInput.value);
|
||||
if (lastFrom && untilInput.value && !isNaN(b)) {
|
||||
const moved = new Date(u.getTime() + (b - a));
|
||||
untilInput.value = localValue(moved, moved.getHours() * 60 + moved.getMinutes());
|
||||
}
|
||||
const pressed = [...days.querySelectorAll('[aria-pressed=true]')];
|
||||
if (pressed.length <= 1 && fromInput.value) {
|
||||
for (const btn of days.children) btn.setAttribute('aria-pressed', String(btn.dataset.day === weekdayOf(fromInput.value)));
|
||||
}
|
||||
lastFrom = fromInput.value;
|
||||
});
|
||||
|
||||
// Gegenstand: Modell (Pin), Gruppen und Personen (Exklusiv), Modelle (Zeitfenster)
|
||||
const subject = h('div', { class: 'stack small' });
|
||||
let kind = k ? k.kind : 'pin';
|
||||
function showSubject() {
|
||||
if (kind === 'pin') subject.replaceChildren(h('span', { class: 'label' }, 'Modell'), modelPicker(models, 's-model', false));
|
||||
if (kind === 'exclusive') subject.replaceChildren(h('span', { class: 'label' }, 'Gruppen'),
|
||||
groups.length ? h('div', { class: 'model-picker' }, groups.map((g) => h('label', { class: 'check' }, h('input', { type: 'checkbox', name: 's-group', value: g.name }), h('span', { class: 'mono' }, g.name), h('span', { class: 'hint' }, g.owner || ''))))
|
||||
: h('p', { class: 'empty' }, 'Keine Gruppen.'),
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-users' }, 'Personen (Benutzernamen)'), h('input', { id: 's-users', name: 'users', class: 'field mono', placeholder: 'hofmannol, mueller' })));
|
||||
if (kind === 'window') subject.replaceChildren(h('span', { class: 'label' }, 'Nur diese Modelle'), modelPicker(models, 's-model', true));
|
||||
if (kind === 'pin') {
|
||||
const nodeBox = h('div', { class: 'field-group', hidden: true });
|
||||
const picker = modelPicker(models, 's-model', false);
|
||||
const showNodes = () => {
|
||||
const m = models.find((x) => x.id === checkedValues(picker, 's-model')[0]);
|
||||
nodeBox.hidden = !m || m.nodes.length < 2;
|
||||
if (!m) return;
|
||||
const chosen = k && k.kind === 'pin' && m.id === k.engine + '/' + k.model ? k.node : m.nodes[0];
|
||||
nodeBox.replaceChildren(h('label', { for: 's-node' }, 'auf Rechner'),
|
||||
h('select', { id: 's-node', name: 'node', class: 'field mono' }, m.nodes.map((n) => h('option', { value: n, selected: n === chosen }, n))));
|
||||
};
|
||||
picker.addEventListener('change', showNodes);
|
||||
if (k && k.kind === 'pin') {
|
||||
for (const i of picker.querySelectorAll('input')) i.checked = i.value === k.engine + '/' + k.model;
|
||||
}
|
||||
showNodes();
|
||||
subject.replaceChildren(h('span', { class: 'label' }, 'Modell'), picker, nodeBox);
|
||||
}
|
||||
if (kind === 'exclusive') {
|
||||
const names = (entry && entry.names) || { users: [], groups: [] };
|
||||
subject.replaceChildren(h('span', { class: 'label' }, 'Gruppen'),
|
||||
groups.length ? h('div', { class: 'model-picker' }, groups.map((g) => h('label', { class: 'check' },
|
||||
h('input', { type: 'checkbox', name: 's-group', value: g.name, checked: names.groups.includes(g.name) }),
|
||||
h('span', { class: 'mono' }, g.name), h('span', { class: 'hint' }, g.owner || ''))))
|
||||
: h('p', { class: 'empty' }, 'Keine Gruppen.'),
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-users' }, 'Personen (Benutzernamen)'),
|
||||
h('input', { id: 's-users', name: 'users', class: 'field mono', placeholder: 'hofmannol, mueller', value: names.users.join(', ') })));
|
||||
}
|
||||
if (kind === 'window') {
|
||||
const picker = modelPicker(models, 's-model', true);
|
||||
if (k && k.kind === 'window') for (const i of picker.querySelectorAll('input')) i.checked = k.models.includes(i.value);
|
||||
subject.replaceChildren(h('span', { class: 'label' }, 'Nur diese Modelle'), picker);
|
||||
}
|
||||
}
|
||||
showSubject();
|
||||
showTime();
|
||||
showRepeat();
|
||||
|
||||
const form = h('form', {
|
||||
class: 'stack small',
|
||||
onsubmit: async (ev) => {
|
||||
@@ -1179,27 +1257,36 @@ function scheduleForm(models, groups, preset, close) {
|
||||
if (!m) return fail('Ein Modell auswählen.');
|
||||
body.model = m;
|
||||
const nodes = (models.find((x) => x.id === m) || { nodes: [] }).nodes;
|
||||
if (nodes.length > 1) body.node = nodes[0];
|
||||
if (nodes.length > 1) body.node = d.node || nodes[0];
|
||||
}
|
||||
if (kind === 'exclusive') {
|
||||
Object.assign(body, { groups: checkedValues(form, 's-group'), users: list(d.users) });
|
||||
if (k && k.kind === 'exclusive' && k.keys.length) body.keys = k.keys;
|
||||
}
|
||||
if (kind === 'exclusive') Object.assign(body, { groups: checkedValues(form, 's-group'), users: list(d.users) });
|
||||
if (kind === 'window') {
|
||||
body.models = checkedValues(form, 's-model');
|
||||
if (!body.models.length) return fail('Mindestens ein Modell auswählen.');
|
||||
}
|
||||
if (d.repeat === 'once') {
|
||||
if (!d.from || !d.until) return fail('Beginn und Ende angeben.');
|
||||
Object.assign(body, { from: apiTime(d.from), until: apiTime(d.until) });
|
||||
}
|
||||
if (d.repeat === 'weekly') {
|
||||
if (!d.from || !d.until) return fail('Beginn und Ende angeben.');
|
||||
const span = new Date(d.until) - new Date(d.from);
|
||||
if (span <= 0) return fail('Das Ende muss nach dem Beginn liegen.');
|
||||
if (d.repeat === 'none') Object.assign(body, { from: apiTime(d.from), until: apiTime(d.until) });
|
||||
else {
|
||||
if (span > 86400000) return fail('Ein wöchentlicher Termin dauert höchstens 24 Stunden.');
|
||||
if (!days.value()) return fail('Mindestens einen Wochentag auswählen.');
|
||||
if (!d.time_start !== !d.time_end) return fail('Für die Uhrzeit Beginn und Ende angeben.');
|
||||
Object.assign(body, { weekly: days.value(), time: d.time_start ? d.time_start + '-' + d.time_end : undefined, from: optional(d.valid_from), until: dayAfter(d.valid_until) });
|
||||
if (d.repeat_until && d.repeat_until < dateOf(d.from)) return fail('„Wiederholen bis“ liegt vor dem Beginn.');
|
||||
const wholeDay = span === 86400000 && timeOf(d.from) === '00:00';
|
||||
if (span === 86400000 && !wholeDay) return fail('Ein wöchentlicher Termin über 24 Stunden muss um 00:00 beginnen (ganztags).');
|
||||
Object.assign(body, {
|
||||
weekly: days.value(), time: wholeDay ? undefined : timeOf(d.from) + '-' + timeOf(d.until),
|
||||
every: Number(d.every), from: dateOf(d.from), until: dayAfter(d.repeat_until),
|
||||
});
|
||||
}
|
||||
// Fehler bleiben im Overlay, damit die Eingaben erhalten bleiben
|
||||
try {
|
||||
const created = await api('POST', '/schedule', body);
|
||||
const saved = await api(entry ? 'PUT' : 'POST', '/schedule' + (entry ? '/' + entry.id : ''), body);
|
||||
close();
|
||||
state.flash = { kind: 'ok', text: 'Eintrag angelegt: ' + created.subject + ', ' + created.describe };
|
||||
state.flash = { kind: 'ok', text: (entry ? 'Eintrag geändert: ' : 'Eintrag angelegt: ') + saved.subject + ', ' + saved.describe };
|
||||
render();
|
||||
} catch (e) {
|
||||
fail(e.message);
|
||||
@@ -1207,16 +1294,20 @@ function scheduleForm(models, groups, preset, close) {
|
||||
},
|
||||
},
|
||||
h('div', { class: 'field-group' }, h('span', { class: 'label' }, 'Art des Eintrags'),
|
||||
segmented('s-kind', [['pin', 'Pinnen'], ['exclusive', 'Exklusiv'], ['window', 'Zeitfenster']], 'pin', (v) => { kind = v; showSubject(); })),
|
||||
segmented('s-kind', [['pin', 'Pinnen'], ['exclusive', 'Exklusiv'], ['window', 'Zeitfenster']], kind, (v) => { kind = v; showSubject(); })),
|
||||
subject,
|
||||
h('div', { class: 'fields' },
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-from' }, 'Beginn'), fromInput),
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-until' }, 'Ende'), untilInput)),
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-repeat' }, 'Wiederholung'), repeat),
|
||||
once, weekly,
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-note' }, 'Anmerkung'), h('input', { id: 's-note', name: 'note', class: 'field', placeholder: 'z. B. Vorlesung KI' })),
|
||||
weekly,
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-note' }, 'Anmerkung'),
|
||||
h('input', { id: 's-note', name: 'note', class: 'field', placeholder: 'z. B. Vorlesung KI', value: entry ? entry.note : '' })),
|
||||
h('span', { class: 'hint' }, 'Der Proxy lehnt Einträge ab, die nicht in den Speicher passen oder sich widersprechen, und nennt den Grund.'),
|
||||
error,
|
||||
h('div', { class: 'actions' },
|
||||
h('button', { class: 'btn', type: 'button', onclick: close }, 'Abbrechen'),
|
||||
h('button', { class: 'btn primary', type: 'submit' }, 'Speichern')));
|
||||
h('button', { class: 'btn primary', type: 'submit' }, entry ? 'Änderungen speichern' : 'Speichern')));
|
||||
return form;
|
||||
}
|
||||
|
||||
@@ -1361,7 +1452,7 @@ const ACTIONS = {
|
||||
'group.create': 'Gruppe angelegt', 'group.delete': 'Gruppe gelöscht', 'group.add': 'Mitglied aufgenommen', 'group.remove': 'Mitglied entfernt',
|
||||
'quota.create': 'Kontingent angelegt', 'quota.remove': 'Kontingent entfernt',
|
||||
'key.create': 'Key angelegt', 'key.revoke': 'Key widerrufen', 'key.quota': 'Kontingent eines Keys geändert',
|
||||
'schedule.add': 'Zeitplan: Eintrag angelegt', 'schedule.remove': 'Zeitplan: Eintrag entfernt',
|
||||
'schedule.add': 'Zeitplan: Eintrag angelegt', 'schedule.update': 'Zeitplan: Eintrag geändert', 'schedule.remove': 'Zeitplan: Eintrag entfernt',
|
||||
'model.load': 'Modell geladen', 'model.unload': 'Modell entladen', 'model.load_failed': 'Laden gescheitert', 'pin.load_failed': 'Gepinntes Modell nicht geladen',
|
||||
'recording.start': 'Aufzeichnung gestartet', 'recording.end': 'Aufzeichnung beendet', 'recording.ready': 'Aufzeichnung bereitgestellt',
|
||||
'recording.download': 'Aufzeichnung heruntergeladen', 'recording.delete': 'Aufzeichnung gelöscht',
|
||||
|
||||
Reference in new issue
Block a user