was wurde gedruckt? Nummern ergänzt
This commit is contained in:
@@ -226,6 +226,28 @@ const Board = defineComponent({
|
|||||||
empfIndex.value = idx;
|
empfIndex.value = idx;
|
||||||
} catch { /* Suche läuft dann ohne Empfänger weiter */ }
|
} catch { /* Suche läuft dann ohne Empfänger weiter */ }
|
||||||
}
|
}
|
||||||
|
// Sende-Index über ALLE Jobs (auch bereits gedruckte): orderId →
|
||||||
|
// { brief:[…], umschlag:[…] } mit den eingegebenen Nummern-Bereichen.
|
||||||
|
// Zeigt am Auftrag „auf einen Blick", welche Nummern schon in den Druck
|
||||||
|
// gesendet wurden (leeres numbers = „alle"). Rein informativ, kein Status.
|
||||||
|
const sendIndex = ref({});
|
||||||
|
async function ladeSendIndex() {
|
||||||
|
try {
|
||||||
|
const r = await api.get('/items/jobs', { params: {
|
||||||
|
limit: -1, sort: 'date_created', fields: 'order,type,numbers',
|
||||||
|
} });
|
||||||
|
const idx = {};
|
||||||
|
for (const j of r.data?.data || []) {
|
||||||
|
const oid = String(j.order?.id ?? j.order ?? '');
|
||||||
|
if (!oid) continue;
|
||||||
|
const typ = j.type === 'umschlag' ? 'umschlag' : 'brief';
|
||||||
|
const num = (j.numbers && String(j.numbers).trim()) ? String(j.numbers).trim() : 'alle';
|
||||||
|
if (!idx[oid]) idx[oid] = { brief: [], umschlag: [] };
|
||||||
|
if (!idx[oid][typ].includes(num)) idx[oid][typ].push(num);
|
||||||
|
}
|
||||||
|
sendIndex.value = idx;
|
||||||
|
} catch { /* Anzeige läuft dann ohne „gesendet" weiter */ }
|
||||||
|
}
|
||||||
|
|
||||||
async function laden(leise = false) {
|
async function laden(leise = false) {
|
||||||
// leise = Hintergrund-Aktualisierung: kein Spinner, kein Fehlerbanner.
|
// leise = Hintergrund-Aktualisierung: kein Spinner, kein Fehlerbanner.
|
||||||
@@ -251,7 +273,7 @@ const Board = defineComponent({
|
|||||||
muster.value = ms.data?.data || { text_du: '', text_sie: '' };
|
muster.value = ms.data?.data || { text_du: '', text_sie: '' };
|
||||||
// Empfänger-Index nur beim vollen Laden neu bauen (nicht bei der 15-s-
|
// Empfänger-Index nur beim vollen Laden neu bauen (nicht bei der 15-s-
|
||||||
// Hintergrund-Aktualisierung) – im Hintergrund, blockiert das Board nicht.
|
// Hintergrund-Aktualisierung) – im Hintergrund, blockiert das Board nicht.
|
||||||
if (!leise) ladeEmpfIndex();
|
if (!leise) { ladeEmpfIndex(); ladeSendIndex(); }
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!leise) fehler.value = e?.response?.data?.errors?.[0]?.message || e?.message || 'Laden fehlgeschlagen.';
|
if (!leise) fehler.value = e?.response?.data?.errors?.[0]?.message || e?.message || 'Laden fehlgeschlagen.';
|
||||||
} finally { if (!leise) loading.value = false; }
|
} finally { if (!leise) loading.value = false; }
|
||||||
@@ -723,7 +745,7 @@ const Board = defineComponent({
|
|||||||
}, Object.entries(STATUS_LABEL).map(([k, v]) => h('option', { value: k, selected: (order.production_status || 'eingegangen') === k }, v)));
|
}, Object.entries(STATUS_LABEL).map(([k, v]) => h('option', { value: k, selected: (order.production_status || 'eingegangen') === k }, v)));
|
||||||
}
|
}
|
||||||
function orderCard(order, opts) {
|
function orderCard(order, opts) {
|
||||||
const o = order; const zeigeBadges = opts?.badges;
|
const o = order;
|
||||||
const kopf = h('div', { style: 'display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap;' }, [
|
const kopf = h('div', { style: 'display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap;' }, [
|
||||||
h('div', { style: 'display:flex;gap:10px;align-items:flex-start;' }, [
|
h('div', { style: 'display:flex;gap:10px;align-items:flex-start;' }, [
|
||||||
h('input', { type: 'checkbox', checked: istGewaehlt(o.id), onChange: () => toggleAuswahl(o.id),
|
h('input', { type: 'checkbox', checked: istGewaehlt(o.id), onChange: () => toggleAuswahl(o.id),
|
||||||
@@ -745,10 +767,14 @@ const Board = defineComponent({
|
|||||||
chip(o.payment_status === 'bezahlt' ? '✓ bezahlt' : (o.payment_status === 'storniert' ? 'storniert' : 'offen'),
|
chip(o.payment_status === 'bezahlt' ? '✓ bezahlt' : (o.payment_status === 'storniert' ? 'storniert' : 'offen'),
|
||||||
o.payment_status === 'bezahlt' ? 'var(--success-25,rgba(46,125,50,.15))' : 'var(--warning-25,rgba(230,160,0,.15))'),
|
o.payment_status === 'bezahlt' ? 'var(--success-25,rgba(46,125,50,.15))' : 'var(--warning-25,rgba(230,160,0,.15))'),
|
||||||
]);
|
]);
|
||||||
const badges = zeigeBadges ? h('div', { style: 'display:flex;gap:8px;margin-bottom:10px;' }, [
|
// „Auf einen Blick": welche Nummern wurden schon in den Druck gesendet
|
||||||
chip(o.brief_gedruckt ? '✓ Brief gedruckt' : '… Brief offen', o.brief_gedruckt ? 'var(--success-25,rgba(46,125,50,.15))' : 'var(--background-subdued)'),
|
// (aus den Jobs, inkl. bereits gedruckter). Kein Status, nur die Eingabe.
|
||||||
o.needs_envelope ? chip(o.kuvert_gedruckt ? '✓ Kuvert gedruckt' : '… Kuvert offen', o.kuvert_gedruckt ? 'var(--success-25,rgba(46,125,50,.15))' : 'var(--background-subdued)') : null,
|
const send = sendIndex.value[String(o.id)];
|
||||||
]) : null;
|
const badges = send && (send.brief.length || send.umschlag.length)
|
||||||
|
? h('div', { style: 'display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px;' }, [
|
||||||
|
send.brief.length ? chip('🖨 Brief gesendet: ' + send.brief.join(' · '), 'var(--primary-25,rgba(30,80,165,.14))') : null,
|
||||||
|
send.umschlag.length ? chip('✉ Kuvert gesendet: ' + send.umschlag.join(' · '), 'var(--primary-25,rgba(30,80,165,.14))') : null,
|
||||||
|
]) : null;
|
||||||
return h('div', { key: 'o' + o.id, style: CARD + `margin-bottom:14px;border-left:4px solid ${ACCENT};` }, [kopf, meta, badges, actionButtons(o)]);
|
return h('div', { key: 'o' + o.id, style: CARD + `margin-bottom:14px;border-left:4px solid ${ACCENT};` }, [kopf, meta, badges, actionButtons(o)]);
|
||||||
}
|
}
|
||||||
function requestCard(req) {
|
function requestCard(req) {
|
||||||
|
|||||||
Reference in New Issue
Block a user