Compare commits
No commits in common. "c91fe48eb960232805ed30715f5887c582f00f78" and "40a3f33ea3cfee3bd4993ce613118214b772736d" have entirely different histories.
c91fe48eb9
...
40a3f33ea3
@ -1,4 +1,4 @@
|
|||||||
import { ClipboardDocumentCheckIcon, TagIcon } from '@heroicons/react/20/solid'
|
import { ClipboardDocumentCheckIcon } from '@heroicons/react/20/solid'
|
||||||
import type { SVGProps } from 'react'
|
import type { SVGProps } from 'react'
|
||||||
|
|
||||||
import { ChartIcon } from '~/components/icons/chart'
|
import { ChartIcon } from '~/components/icons/chart'
|
||||||
@ -56,11 +56,6 @@ export const MENU: TMenu[] = [
|
|||||||
url: '/lg-admin/categories',
|
url: '/lg-admin/categories',
|
||||||
icon: ClipboardDocumentCheckIcon,
|
icon: ClipboardDocumentCheckIcon,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: 'Tag',
|
|
||||||
url: '/lg-admin/tags',
|
|
||||||
icon: TagIcon,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: 'Pengaturan',
|
title: 'Pengaturan',
|
||||||
url: '/lg-admin/settings',
|
url: '/lg-admin/settings',
|
||||||
|
|||||||
@ -1,87 +0,0 @@
|
|||||||
import DT from 'datatables.net-dt'
|
|
||||||
import DataTable from 'datatables.net-react'
|
|
||||||
import { Link, useRouteLoaderData } from 'react-router'
|
|
||||||
|
|
||||||
import { Button } from '~/components/ui/button'
|
|
||||||
import { UiTable } from '~/components/ui/table'
|
|
||||||
import { TitleDashboard } from '~/components/ui/title-dashboard'
|
|
||||||
import type { loader } from '~/routes/_admin.lg-admin._dashboard.tags._index'
|
|
||||||
|
|
||||||
export const TagsPage = () => {
|
|
||||||
const loaderData = useRouteLoaderData<typeof loader>(
|
|
||||||
'routes/_admin.lg-admin._dashboard.tags._index',
|
|
||||||
)
|
|
||||||
const tagsData = loaderData?.tagsData
|
|
||||||
const dataTable = tagsData
|
|
||||||
|
|
||||||
DataTable.use(DT)
|
|
||||||
const dataColumns = [
|
|
||||||
{
|
|
||||||
title: 'No',
|
|
||||||
render: (
|
|
||||||
data: unknown,
|
|
||||||
type: unknown,
|
|
||||||
row: unknown,
|
|
||||||
meta: { row: number },
|
|
||||||
) => {
|
|
||||||
return meta.row + 1
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Tag',
|
|
||||||
data: 'name',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Kode',
|
|
||||||
data: 'code',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Action',
|
|
||||||
data: 'id',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const dataOptions = {
|
|
||||||
paging: true,
|
|
||||||
searching: true,
|
|
||||||
ordering: true,
|
|
||||||
info: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
const dataSlot = {
|
|
||||||
3: (value: string) => (
|
|
||||||
<Button
|
|
||||||
as="a"
|
|
||||||
href={`/lg-admin/tags/update/${value}`}
|
|
||||||
className="text-md rounded-md"
|
|
||||||
size="sm"
|
|
||||||
>
|
|
||||||
Update Tag
|
|
||||||
</Button>
|
|
||||||
),
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<div className="relative">
|
|
||||||
<TitleDashboard title="Tags" />
|
|
||||||
<div className="mb-8 flex items-end justify-between gap-5">
|
|
||||||
<div className="flex-1">{/* TODO: Filter */}</div>
|
|
||||||
<Button
|
|
||||||
as={Link}
|
|
||||||
to="/lg-admin/tags/create"
|
|
||||||
className="text-md h-[42px] rounded-md"
|
|
||||||
size="lg"
|
|
||||||
>
|
|
||||||
Buat Tags
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<UiTable
|
|
||||||
data={dataTable}
|
|
||||||
columns={dataColumns}
|
|
||||||
options={dataOptions}
|
|
||||||
slots={dataSlot}
|
|
||||||
title="Daftar Katgeori"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
import { getTags } from '~/apis/common/get-tags'
|
|
||||||
import { handleCookie } from '~/libs/cookies'
|
|
||||||
import { TagsPage } from '~/pages/dashboard-tags'
|
|
||||||
|
|
||||||
import type { Route } from './+types/_admin.lg-admin._dashboard.tags._index'
|
|
||||||
export const loader = async ({ request }: Route.LoaderArgs) => {
|
|
||||||
const { staffToken } = await handleCookie(request)
|
|
||||||
const { data: tagsData } = await getTags({
|
|
||||||
accessToken: staffToken,
|
|
||||||
})
|
|
||||||
return { tagsData }
|
|
||||||
}
|
|
||||||
|
|
||||||
const DashboardTagsIndexLayout = () => <TagsPage />
|
|
||||||
export default DashboardTagsIndexLayout
|
|
||||||
Loading…
x
Reference in New Issue
Block a user