Suche-Druck: eigenes Standard-Template je Typ (format_templates.search_default)
Neues Boolean-Feld search_default an format_templates: je ein Brief- und ein Kuvert-Template als Standard für den Schnelldruck im Suche-Reiter markieren. Der Schnelldruck bevorzugt dieses Template, sonst das dem Auftragsformat zugeordnete Standard (default_format), sonst den Fallback. Kann bewusst dasselbe Template wie das normale Standard sein. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -413,6 +413,7 @@ const collections = [
|
|||||||
f('name', 'string', { interface: 'input', required: true }),
|
f('name', 'string', { interface: 'input', required: true }),
|
||||||
dropdown('type', ['brief', 'umschlag', 'signatur'], { default: 'brief' }),
|
dropdown('type', ['brief', 'umschlag', 'signatur'], { default: 'brief' }),
|
||||||
f('default_format', 'string', { interface: 'input', note: 'Standard-Template für dieses Format (Format-Key: a4, a6_hoch, a6_quer, dinlang, c6). Leer = kein Standard.' }),
|
f('default_format', 'string', { interface: 'input', note: 'Standard-Template für dieses Format (Format-Key: a4, a6_hoch, a6_quer, dinlang, c6). Leer = kein Standard.' }),
|
||||||
|
f('search_default', 'boolean', { interface: 'boolean', default: false, note: 'Als Standard-Template für den Schnelldruck im Suche-Reiter verwenden (je ein Brief- und ein Kuvert-Template markieren). Kann dasselbe wie das normale Standard sein.' }),
|
||||||
f('width', 'float', { interface: 'input', note: 'Zoll' }),
|
f('width', 'float', { interface: 'input', note: 'Zoll' }),
|
||||||
f('height', 'float', { interface: 'input', note: 'Zoll' }),
|
f('height', 'float', { interface: 'input', note: 'Zoll' }),
|
||||||
f('xpos', 'float', { interface: 'input', default: 0 }),
|
f('xpos', 'float', { interface: 'input', default: 0 }),
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ const Board = defineComponent({
|
|||||||
} }),
|
} }),
|
||||||
ladeJobs(),
|
ladeJobs(),
|
||||||
ladeMachines(),
|
ladeMachines(),
|
||||||
api.get('/items/format_templates', { params: { limit: -1, fields: 'id,key,name,type,width,height,xpos,ypos,scale,rotation,default_format' } }),
|
api.get('/items/format_templates', { params: { limit: -1, fields: 'id,key,name,type,width,height,xpos,ypos,scale,rotation,default_format,search_default' } }).catch(() => api.get('/items/format_templates', { params: { limit: -1, fields: 'id,key,name,type,width,height,xpos,ypos,scale,rotation,default_format' } })),
|
||||||
api.get('/items/muster_settings', { params: { fields: 'text_du,text_sie' } }).catch(() => ({ data: { data: { text_du: '', text_sie: '' } } })),
|
api.get('/items/muster_settings', { params: { fields: 'text_du,text_sie' } }).catch(() => ({ data: { data: { text_du: '', text_sie: '' } } })),
|
||||||
api.get('/items/muster_texts', { params: { limit: -1, filter: { active: { _eq: true } }, sort: 'sort', fields: 'id,label,text' } }).catch(() => ({ data: { data: [] } })),
|
api.get('/items/muster_texts', { params: { limit: -1, filter: { active: { _eq: true } }, sort: 'sort', fields: 'id,label,text' } }).catch(() => ({ data: { data: [] } })),
|
||||||
]);
|
]);
|
||||||
@@ -482,15 +482,18 @@ const Board = defineComponent({
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
|
// In den Einstellungen als „Standard für Suche-Druck" markiertes Template je
|
||||||
|
// Typ. Hat beim Schnelldruck Vorrang (kann dasselbe wie default_format sein).
|
||||||
|
const tplSuchStandard = (typ) => templates.value.find((t) => t.type === typ && t.search_default) || null;
|
||||||
// Schnelldruck: NUR den gewählten Empfänger (Briefnummer) des Typs in die
|
// Schnelldruck: NUR den gewählten Empfänger (Briefnummer) des Typs in die
|
||||||
// Warteschlange geben. Das Template kommt aus der in den Einstellungen dem
|
// Warteschlange geben. Template-Reihenfolge: eigenes Suche-Standard-Template →
|
||||||
// Auftragsformat zugeordneten Vorlage (default_format), sonst der Fallback.
|
// dem Auftragsformat zugeordnetes Standard (default_format) → Fallback.
|
||||||
async function schnelldruck(o, nr, typ) {
|
async function schnelldruck(o, nr, typ) {
|
||||||
const machine = aktiveMaschinen.value[0]?.id || null;
|
const machine = aktiveMaschinen.value[0]?.id || null;
|
||||||
if (!machine) { fehler.value = 'Keine aktive Maschine verfügbar.'; return; }
|
if (!machine) { fehler.value = 'Keine aktive Maschine verfügbar.'; return; }
|
||||||
const tpl = typ === 'umschlag'
|
const tpl = typ === 'umschlag'
|
||||||
? (tplForFormat(o.envelope_format, 'umschlag') || tplByKey(ENVELOPE_TPL[o.envelope_format] || 'kuvert_a_v1', 'umschlag'))
|
? (tplSuchStandard('umschlag') || tplForFormat(o.envelope_format, 'umschlag') || tplByKey(ENVELOPE_TPL[o.envelope_format] || 'kuvert_a_v1', 'umschlag'))
|
||||||
: (tplForFormat(o.format?.key, 'brief') || tplByKey(LETTER_TPL[o.format?.key] || 'a4_single', 'brief'));
|
: (tplSuchStandard('brief') || tplForFormat(o.format?.key, 'brief') || tplByKey(LETTER_TPL[o.format?.key] || 'a4_single', 'brief'));
|
||||||
if (!tpl?.id) {
|
if (!tpl?.id) {
|
||||||
fehler.value = `Kein Standard-Template für ${typ === 'umschlag' ? 'Kuvert' : 'Schriftstück'} hinterlegt – bitte in den Einstellungen (Format-Templates) ein Standardformat zuordnen.`;
|
fehler.value = `Kein Standard-Template für ${typ === 'umschlag' ? 'Kuvert' : 'Schriftstück'} hinterlegt – bitte in den Einstellungen (Format-Templates) ein Standardformat zuordnen.`;
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user