feat(customers): add customer-level and device-level update/upgrade buttons with automatic license date calculation for update discount
This commit is contained in:
@@ -104,6 +104,13 @@ export default function CustomerDetailPage({ params }: { params: Promise<{ id: s
|
||||
Kunden-ID: <span className="font-mono">{customer.id.slice(0, 8)}…</span>
|
||||
</p>
|
||||
</div>
|
||||
{!customer.is_anonymized && (
|
||||
<Link href={`/order?customer_id=${customer.id}`} className="ml-auto">
|
||||
<Button size="sm" className="bg-primary hover:bg-primary/90 text-white font-bold gap-2 shadow-[0_0_15px_rgba(59,130,246,0.3)] text-xs">
|
||||
<ShoppingBag className="w-4 h-4" /> Kunde updaten / bestellen
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
{customer.is_anonymized && (
|
||||
<Badge className="bg-red-500/10 text-red-400 border-red-500/20 gap-1 ml-auto">
|
||||
<AlertTriangle className="w-3 h-3" /> Anonymisiert
|
||||
|
||||
@@ -138,6 +138,10 @@ async function OrderDataWrapper({
|
||||
companies = await getCompanies().catch(() => [])
|
||||
}
|
||||
|
||||
const initialLastLicenseDate = initialOrder
|
||||
? (initialOrder.order_data?.last_license_date || (initialOrder.created_at ? new Date(initialOrder.created_at).toISOString().split('T')[0] : ''))
|
||||
: ''
|
||||
|
||||
return (
|
||||
<OrderWizard
|
||||
products={products}
|
||||
@@ -150,6 +154,7 @@ async function OrderDataWrapper({
|
||||
upgradeMode={mode === 'upgrade'}
|
||||
initialEndCustomerId={customerId || null}
|
||||
lockedDeviceId={deviceId ? decodeURIComponent(deviceId) : null}
|
||||
initialLastLicenseDate={initialLastLicenseDate}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user