feat: implement category creation and update pages with routing adjustments
This commit is contained in:
parent
df41e4050c
commit
80711e744b
@ -1,7 +1,7 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
import { HttpServer } from '~/libs/http-server'
|
import { HttpServer } from '~/libs/http-server'
|
||||||
import type { TCategorySchema } from '~/pages/category-create'
|
import type { TCategorySchema } from '~/pages/dashboard-category-create'
|
||||||
|
|
||||||
const categoryResponseSchema = z.object({
|
const categoryResponseSchema = z.object({
|
||||||
data: z.object({
|
data: z.object({
|
||||||
|
|||||||
@ -33,6 +33,10 @@ export const CategoriesPage = () => {
|
|||||||
title: 'Code Katgeori',
|
title: 'Code Katgeori',
|
||||||
data: 'code',
|
data: 'code',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Action',
|
||||||
|
data: 'id',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const dataOptions = {
|
const dataOptions = {
|
||||||
@ -42,6 +46,18 @@ export const CategoriesPage = () => {
|
|||||||
info: true,
|
info: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dataSlot = {
|
||||||
|
3: (value: string) => (
|
||||||
|
<Button
|
||||||
|
as="a"
|
||||||
|
href={`/lg-admin/category/update/${value}`}
|
||||||
|
className="text-md rounded-md"
|
||||||
|
size="sm"
|
||||||
|
>
|
||||||
|
Lihat Detail
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<TitleDashboard title="Kategori" />
|
<TitleDashboard title="Kategori" />
|
||||||
@ -61,6 +77,7 @@ export const CategoriesPage = () => {
|
|||||||
data={dataTable}
|
data={dataTable}
|
||||||
columns={dataColumns}
|
columns={dataColumns}
|
||||||
options={dataOptions}
|
options={dataOptions}
|
||||||
|
slots={dataSlot}
|
||||||
title="Daftar Katgeori"
|
title="Daftar Katgeori"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
5
app/pages/dashboard-category-update/index.tsx
Normal file
5
app/pages/dashboard-category-update/index.tsx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
export const UpdateCategoryPage = () => {
|
||||||
|
return <div>UpdateCategoryPage</div>
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { CreateCategoryPage } from '~/pages/category-create'
|
import { CreateCategoryPage } from '~/pages/dashboard-category-create'
|
||||||
|
|
||||||
const DashboardCategoryLayout = () => <CreateCategoryPage />
|
const DashboardCategoryLayout = () => <CreateCategoryPage />
|
||||||
export default DashboardCategoryLayout
|
export default DashboardCategoryLayout
|
||||||
|
|||||||
@ -0,0 +1,4 @@
|
|||||||
|
import { UpdateCategoryPage } from '~/pages/dashboard-category-update'
|
||||||
|
|
||||||
|
const DashboardCategoryUpdateLayout = () => <UpdateCategoryPage />
|
||||||
|
export default DashboardCategoryUpdateLayout
|
||||||
@ -1,2 +1,34 @@
|
|||||||
const DashboardSettingsLayout = () => <div>Settings Page</div>
|
import { Button } from '~/components/ui/button'
|
||||||
|
|
||||||
|
const DashboardSettingsLayout = () => (
|
||||||
|
<div>
|
||||||
|
{/* action sementara kategory */}
|
||||||
|
<div className="flex space-x-2">
|
||||||
|
<Button
|
||||||
|
as="a"
|
||||||
|
href={`/lg-admin/categories`}
|
||||||
|
className="text-md rounded-md"
|
||||||
|
size="sm"
|
||||||
|
>
|
||||||
|
List Kategory
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
as="a"
|
||||||
|
href={`/lg-admin/category/create`}
|
||||||
|
className="text-md rounded-md"
|
||||||
|
size="sm"
|
||||||
|
>
|
||||||
|
Create Category
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
as="a"
|
||||||
|
href={`/lg-admin/category/update/1`}
|
||||||
|
className="text-md rounded-md"
|
||||||
|
size="sm"
|
||||||
|
>
|
||||||
|
Update Category
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
export default DashboardSettingsLayout
|
export default DashboardSettingsLayout
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { handleCookie } from '~/libs/cookies'
|
|||||||
import {
|
import {
|
||||||
createCategorySchema,
|
createCategorySchema,
|
||||||
type TCategorySchema,
|
type TCategorySchema,
|
||||||
} from '~/pages/category-create'
|
} from '~/pages/dashboard-category-create'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.register'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user