feat: link end customers directly to companies
All checks were successful
Staging Build / build (push) Successful in 3m37s

This commit is contained in:
DanielS
2026-07-04 15:17:04 +02:00
parent d3bf4b1db9
commit 5f65f890ee
5 changed files with 110 additions and 72 deletions

View File

@@ -98,7 +98,7 @@ export default function CompanyCustomersPage() {
setZip(customer ? customer.zip || '' : '')
setCity(customer ? customer.city || '' : '')
setVatId(customer ? customer.vat_id || '' : '')
setPartnerId(customer ? customer.partner_id || '' : companyId)
setPartnerId(companyId)
setEmail(customer ? customer.email || '' : '')
setError(null)
setIsOpen(true)
@@ -106,15 +106,11 @@ export default function CompanyCustomersPage() {
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
if (!partnerId) {
setError('Bitte weisen Sie einen Partner zu.')
return
}
setLoadingAction(true)
setError(null)
try {
const payload = {
partner_id: partnerId,
partner_id: companyId,
company_name: companyName.trim(),
first_name: firstName.trim() || undefined,
last_name: lastName.trim() || undefined,
@@ -415,21 +411,14 @@ export default function CompanyCustomersPage() {
</div>
<div className="space-y-2">
<Label htmlFor="cust-partner">Zugeordneter Partner *</Label>
<select
<Label htmlFor="cust-partner">Zugeordnetes Unternehmen</Label>
<Input
id="cust-partner"
required
value={partnerId}
onChange={(e) => setPartnerId(e.target.value)}
className="flex h-9 w-full rounded-md border border-slate-200 dark:border-white/10 bg-slate-50 dark:bg-white/5 px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-indigo-500 disabled:cursor-not-allowed disabled:opacity-50 text-slate-900 dark:text-slate-200"
>
<option value="" disabled className="bg-white dark:bg-slate-950 text-slate-900 dark:text-white">Partner auswählen...</option>
{partners.map((p) => (
<option key={p.id} value={p.id} className="bg-white dark:bg-slate-950 text-slate-900 dark:text-white">
{p.name} ({p.email})
</option>
))}
</select>
type="text"
disabled
value={company ? company.name : ''}
className="bg-slate-100 dark:bg-white/10 border-slate-200 dark:border-white/10 cursor-not-allowed"
/>
</div>
</div>