feat: assign orders to companies directly and support admin reassignment
All checks were successful
Staging Build / build (push) Successful in 3m36s
All checks were successful
Staging Build / build (push) Successful in 3m36s
This commit is contained in:
@@ -3,6 +3,7 @@ import { createAdminClient } from '@/lib/supabase/admin'
|
||||
import { getProducts, getCategories } from '@/lib/actions/products'
|
||||
import { getEndCustomers } from '@/lib/actions/end-customers'
|
||||
import { OrderWizard } from '@/components/order-wizard'
|
||||
import { getCompanies } from '@/lib/actions/companies'
|
||||
import { redirect } from 'next/navigation'
|
||||
import { Suspense } from 'react'
|
||||
|
||||
@@ -121,5 +122,21 @@ async function OrderDataWrapper({ orderId }: { orderId?: string }) {
|
||||
console.error('Fehler beim Laden des Profils:', e)
|
||||
}
|
||||
|
||||
return <OrderWizard products={products} categories={categories} initialProfile={profile} initialEndCustomers={endCustomers} initialOrder={initialOrder} />
|
||||
// Fetch companies list for admin
|
||||
let companies: any[] = []
|
||||
if (userData?.role === 'admin') {
|
||||
companies = await getCompanies().catch(() => [])
|
||||
}
|
||||
|
||||
return (
|
||||
<OrderWizard
|
||||
products={products}
|
||||
categories={categories}
|
||||
initialProfile={profile}
|
||||
initialEndCustomers={endCustomers}
|
||||
initialOrder={initialOrder}
|
||||
isAdmin={userData?.role === 'admin'}
|
||||
companies={companies}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user