Monteur-Dropdown + VenDoc-Spaltennamen im CSV-Export angepasst
Monteur ist jetzt ein Dropdown (Michael/Daniel/Dietmar/Fidelis) mit freiem Textfeld für "Andere". CSV-Export nutzt jetzt VenDocs eigene Spaltennamen (Position/EH/Positionstext/Aufmaß), ermittelt aus einem echten VenDoc- Aufmaßblatt-Export des Nutzers; Art.-Nr. wird wie dort im Positionstext eingebettet, da VenDoc keine eigene Artikelnummer-Spalte führt. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
8a4ce769a0
commit
18a3a636dd
@@ -0,0 +1,42 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
export const MONTEURE = ['Michael', 'Daniel', 'Dietmar', 'Fidelis'];
|
||||
|
||||
interface Props {
|
||||
value: string;
|
||||
onChange: (v: string) => void;
|
||||
onCommit?: (v: string) => void;
|
||||
}
|
||||
|
||||
export default function MonteurField({ value, onChange, onCommit }: Props) {
|
||||
const [customMode, setCustomMode] = useState(() => value !== '' && !MONTEURE.includes(value));
|
||||
|
||||
function handleSelect(v: string) {
|
||||
if (v === '__custom__') {
|
||||
setCustomMode(true);
|
||||
return;
|
||||
}
|
||||
setCustomMode(false);
|
||||
onChange(v);
|
||||
onCommit?.(v);
|
||||
}
|
||||
|
||||
return (
|
||||
<label className="field">Monteur
|
||||
<select value={customMode ? '__custom__' : value} onChange={e => handleSelect(e.target.value)}>
|
||||
<option value="">— wählen —</option>
|
||||
{MONTEURE.map(m => <option key={m} value={m}>{m}</option>)}
|
||||
<option value="__custom__">Andere …</option>
|
||||
</select>
|
||||
{customMode && (
|
||||
<input
|
||||
style={{ marginTop: 8 }}
|
||||
value={value}
|
||||
onChange={e => onChange(e.target.value)}
|
||||
onBlur={e => onCommit?.(e.target.value)}
|
||||
placeholder="Name eingeben"
|
||||
/>
|
||||
)}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user