stuff done
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import {auth} from '@/auth'
|
||||
import AdminPermission from '@/components/(protected)/admin/auth/permission'
|
||||
import {CreateForm} from '@/components/(protected)/admin/category/create-form'
|
||||
import ProductCreateEditForm from '@/components/(protected)/admin/product/create-edit-form'
|
||||
import {dump} from '@/lib/utils'
|
||||
|
||||
export default async function Page({
|
||||
@@ -12,7 +14,12 @@ export default async function Page({
|
||||
|
||||
switch ((slug || [])[0]) {
|
||||
case 'create':
|
||||
return <CreateForm />
|
||||
return (
|
||||
<>
|
||||
<AdminPermission />
|
||||
<CreateForm />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
return <div>{dump(slug)}</div>
|
||||
|
||||
23
app/(protected)/admin/entity/[...slug]/page.tsx
Normal file
23
app/(protected)/admin/entity/[...slug]/page.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import AdminPermission from '@/components/(protected)/admin/auth/permission'
|
||||
import {EntityCrudForm} from '@/components/(protected)/admin/entity/crud-form'
|
||||
import {dump} from '@/lib/utils'
|
||||
|
||||
export default async function Page({
|
||||
params
|
||||
}: {
|
||||
params: Promise<{slug?: string[]}>
|
||||
}) {
|
||||
const {slug} = await params
|
||||
|
||||
switch ((slug || [])[0]) {
|
||||
case 'create':
|
||||
return (
|
||||
<>
|
||||
<AdminPermission />
|
||||
<EntityCrudForm />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
return <div>{dump(slug)}</div>
|
||||
}
|
||||
16
app/(protected)/admin/entity/page.tsx
Normal file
16
app/(protected)/admin/entity/page.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import Link from 'next/link'
|
||||
|
||||
import AdminPermission from '@/components/(protected)/admin/auth/permission'
|
||||
|
||||
export default function AdminEntityPage() {
|
||||
return (
|
||||
<div>
|
||||
<AdminPermission />
|
||||
<p>
|
||||
<Link href='/admin/entity/create'>
|
||||
Створити блок / статтю / сторінку
|
||||
</Link>
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
30
app/(protected)/admin/order/page.tsx
Normal file
30
app/(protected)/admin/order/page.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import {Order} from '@prisma/client'
|
||||
import Link from 'next/link'
|
||||
|
||||
import {getAllOrders} from '@/actions/admin/order'
|
||||
import AdminPermission from '@/components/(protected)/admin/auth/permission'
|
||||
import {dump} from '@/lib/utils'
|
||||
|
||||
export default async function AdminOrderPage() {
|
||||
const orders = await getAllOrders()
|
||||
|
||||
return (
|
||||
<div>
|
||||
<AdminPermission />
|
||||
{orders.map((order: Order) => (
|
||||
<div
|
||||
key={order.id}
|
||||
className='flex items-center justify-start gap-x-9 gap-y-6'
|
||||
>
|
||||
<div>{order.orderNo}</div>
|
||||
<div>
|
||||
{order.firstName} {order.surname}
|
||||
</div>
|
||||
<div>{order.phone}</div>
|
||||
<div>{order.email}</div>
|
||||
<div>{order.notes}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import AdminPermission from '@/components/(protected)/admin/auth/permission'
|
||||
import {EntityCrudForm} from '@/components/(protected)/admin/entity/crud-form'
|
||||
import ProductCreateEditForm from '@/components/(protected)/admin/product/create-edit-form'
|
||||
import {getProductById} from '@/lib/data/models/product'
|
||||
import {dump} from '@/lib/utils'
|
||||
@@ -21,9 +23,19 @@ export default async function Page({
|
||||
|
||||
switch (method) {
|
||||
case 'create':
|
||||
return <ProductCreateEditForm />
|
||||
return (
|
||||
<>
|
||||
<AdminPermission />
|
||||
<ProductCreateEditForm />
|
||||
</>
|
||||
)
|
||||
case 'update':
|
||||
return <ProductCreateEditForm data={data} />
|
||||
return (
|
||||
<>
|
||||
<AdminPermission />
|
||||
<ProductCreateEditForm data={data} />
|
||||
</>
|
||||
)
|
||||
default:
|
||||
return <div>{dump(slug)}</div>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user