fix(admin): "Material hinzufügen" in die Kartenspalte verschoben
Saß bisher als volle Bar über Sidebar+Kartenspalte (Screenshot-Fund) - jetzt Teil der rechten Kartenspalte, direkt über der Positionsliste. Sidebar wird nur noch gerendert, wenn Positionen existieren (Edge-Case: leeres Objekt konnte bisher kein erstes Material bekommen, da der ganze Bereich hinter positionen.length>0 hing). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
This commit is contained in:
@@ -152,66 +152,66 @@ export function ObjektPositionenPanel({ objektId, vorlageId, materialien, onFehl
|
||||
const verfuegbareMaterialien = materialien.filter((m) => !vorhandeneMaterialIds.has(m.id));
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="row" style={{ flexWrap: "wrap", marginBottom: "1rem" }}>
|
||||
<select
|
||||
className="input"
|
||||
value={neuesMaterialId}
|
||||
onChange={(e) => setNeuesMaterialId(Number(e.target.value) || "")}
|
||||
>
|
||||
<option value="">Material hinzufügen…</option>
|
||||
{verfuegbareMaterialien.map((m) => (
|
||||
<option key={m.id} value={m.id}>
|
||||
{m.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
className="input"
|
||||
style={{ maxWidth: "8rem" }}
|
||||
placeholder="Sollmenge"
|
||||
value={neueSollmenge}
|
||||
onChange={(e) => setNeueSollmenge(e.target.value)}
|
||||
/>
|
||||
<button
|
||||
className="btn btn-secondary"
|
||||
onClick={materialHinzufuegen}
|
||||
disabled={neuesMaterialId === "" || !neueSollmenge || wirdHinzugefuegt}
|
||||
>
|
||||
Hinzufügen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{positionen.length === 0 && <p className="text-muted">Keine Positionen in diesem Objekt.</p>}
|
||||
|
||||
<div style={{ display: "flex", flexDirection: "row", alignItems: "flex-start", gap: "1.25rem" }}>
|
||||
{positionen.length > 0 && (
|
||||
<div style={{ display: "flex", flexDirection: "row", alignItems: "flex-start", gap: "1.25rem" }}>
|
||||
<nav
|
||||
className="card"
|
||||
style={{ flex: "0 0 12rem", width: "12rem", boxSizing: "border-box", padding: "0.5rem" }}
|
||||
<nav
|
||||
className="card"
|
||||
style={{ flex: "0 0 12rem", width: "12rem", boxSizing: "border-box", padding: "0.5rem" }}
|
||||
>
|
||||
<button
|
||||
className={aktivesFach === null ? "btn btn-primary btn-block" : "btn btn-secondary btn-block"}
|
||||
style={{ marginBottom: "0.3rem" }}
|
||||
onClick={() => setAktivesFach(null)}
|
||||
>
|
||||
Alle ({positionen.length})
|
||||
</button>
|
||||
{fachGruppen.map(([fach, gruppenPositionen]) => (
|
||||
<button
|
||||
className={aktivesFach === null ? "btn btn-primary btn-block" : "btn btn-secondary btn-block"}
|
||||
key={fach}
|
||||
className={aktivesFach === fach ? "btn btn-primary btn-block" : "btn btn-secondary btn-block"}
|
||||
style={{ marginBottom: "0.3rem" }}
|
||||
onClick={() => setAktivesFach(null)}
|
||||
onClick={() => setAktivesFach(fach)}
|
||||
>
|
||||
Alle ({positionen.length})
|
||||
{fach} ({gruppenPositionen.length})
|
||||
</button>
|
||||
{fachGruppen.map(([fach, gruppenPositionen]) => (
|
||||
<button
|
||||
key={fach}
|
||||
className={aktivesFach === fach ? "btn btn-primary btn-block" : "btn btn-secondary btn-block"}
|
||||
style={{ marginBottom: "0.3rem" }}
|
||||
onClick={() => setAktivesFach(fach)}
|
||||
>
|
||||
{fach} ({gruppenPositionen.length})
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
))}
|
||||
</nav>
|
||||
)}
|
||||
|
||||
<div style={{ flex: "1 1 0%", minWidth: 0 }}>
|
||||
<div className="row" style={{ flexWrap: "wrap", marginBottom: "1rem" }}>
|
||||
<select
|
||||
className="input"
|
||||
value={neuesMaterialId}
|
||||
onChange={(e) => setNeuesMaterialId(Number(e.target.value) || "")}
|
||||
>
|
||||
<option value="">Material hinzufügen…</option>
|
||||
{verfuegbareMaterialien.map((m) => (
|
||||
<option key={m.id} value={m.id}>
|
||||
{m.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
className="input"
|
||||
style={{ maxWidth: "8rem" }}
|
||||
placeholder="Sollmenge"
|
||||
value={neueSollmenge}
|
||||
onChange={(e) => setNeueSollmenge(e.target.value)}
|
||||
/>
|
||||
<button
|
||||
className="btn btn-secondary"
|
||||
onClick={materialHinzufuegen}
|
||||
disabled={neuesMaterialId === "" || !neueSollmenge || wirdHinzugefuegt}
|
||||
>
|
||||
Hinzufügen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{positionen.length === 0 && <p className="text-muted">Keine Positionen in diesem Objekt.</p>}
|
||||
|
||||
<div style={{ flex: "1 1 0%", minWidth: 0 }}>
|
||||
<ul className="card-list">
|
||||
{sichtbarePositionen.map((p) => {
|
||||
const typ = materialtyp(p.material_id);
|
||||
@@ -295,9 +295,7 @@ export function ObjektPositionenPanel({ objektId, vorlageId, materialien, onFehl
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user