feat: add start_date and end_date fields to advertisements with transformation and display in forms

This commit is contained in:
Ardeman
2025-03-14 12:47:43 +08:00
parent 273add293e
commit f04ad1a8f8
6 changed files with 150 additions and 2 deletions
+16 -1
View File
@@ -14,6 +14,7 @@ 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.advertisements._index'
import { formatDate } from '~/utils/formatter'
export const AdvertisementsPage = () => {
const loaderData = useRouteLoaderData<typeof loader>(
@@ -36,6 +37,20 @@ export const AdvertisementsPage = () => {
},
{ title: 'Banner', data: 'image_url' },
{ title: 'Link', data: 'url' },
{
title: 'Tanggal Mulai',
data: 'start_date',
render: (data: string) => {
return formatDate(data)
},
},
{
title: 'Tanggal Berakhir',
data: 'end_date',
render: (data: string) => {
return formatDate(data)
},
},
{
title: 'Action',
data: 'id',
@@ -51,7 +66,7 @@ export const AdvertisementsPage = () => {
/>
)
},
3: (value: string, _type: unknown, data: TAdResponse) => (
5: (value: string, _type: unknown, data: TAdResponse) => (
<div className="flex space-x-2">
<Button
as="a"