Files
votianng/frontend/src/PhotoSets.ts
T
Sven 363bc27c26 Erweitere VoTiAn NG um Auftrags-, Stamm- und Verwaltungsfunktionen
Ergänzt Auftragserfassung und -bearbeitung, Unternehmerbelege, Stornos, Lagerkorrekturen, Stammdaten, Abrechnung, CRM, Formulare, Berichte und Preisverwaltung auf Basis der aktuellen PHP-Anwendung.

Enthält Integrations- und Oberflächentests sowie dokumentierte Abgleiche und Prüfstände.
2026-10-13 20:31:31 +02:00

13 lines
995 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export type PhotoWorkflow = {number:number;name:string;defaultWorkflow:boolean;min:number;max:number;stationScope:string;positions:string[]};
export type PhotoSet = {number:number;name:string;defaultSet:boolean;workflows:PhotoWorkflow[]};
export type PhotoOptions = {configured:boolean;sets:PhotoSet[]};
export function photoFlows(set:PhotoSet|null,type:"PICKUP"|"DELIVERY"|"BOTH") {
// Match PHP photoScopeMatches on stored tr_ware_from_to (PICKUP=2, DELIVERY=1).
return (set?.workflows??[]).filter(f=>type==="BOTH" || f.stationScope==="ALL" || (["PICKUP_ONLY","EXCEPT_DELIVERY"].includes(f.stationScope)?type==="DELIVERY":type==="PICKUP"));
}
export function defaultPhoto(flows:PhotoWorkflow[],index:number,count:number) {
const position=index===count-1?"LAST":index===0?"FIRST":"MIDDLE";
return flows.find(f=>f.positions.includes(position))??flows.find(f=>f.defaultWorkflow);
}
export const photoLabel=(f:PhotoWorkflow)=>`${f.name} · ${f.min===f.max?f.min:`${f.min}–${f.max}`} Fotos`;