feat: define Activity interface and centralize type exports for activity logs
This commit is contained in:
parent
26eaaf6d66
commit
37960a9dc5
@ -1,8 +1,8 @@
|
||||
import { Head } from '@inertiajs/react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { DataTable } from '@/components/data-table';
|
||||
import { useState } from 'react';
|
||||
import { getColumns, Activity } from './partials/columns';
|
||||
import { getColumns } from './partials/columns';
|
||||
import { Activity } from '@/types';
|
||||
|
||||
interface Props {
|
||||
activities: Activity[];
|
||||
@ -37,6 +37,7 @@ export default function ActivityLogIndex({ activities }: Props) {
|
||||
]
|
||||
}
|
||||
]}
|
||||
showSelection={false}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@ -1,16 +1,6 @@
|
||||
import { ColumnDef } from '@tanstack/react-table';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
|
||||
export interface Activity {
|
||||
id: number;
|
||||
description: string;
|
||||
module: string;
|
||||
subject_id: number | string | null;
|
||||
causer: string;
|
||||
properties: any;
|
||||
created_at: string;
|
||||
date: string;
|
||||
}
|
||||
import { Activity } from '@/types';
|
||||
|
||||
export function getColumns(): ColumnDef<Activity>[] {
|
||||
return [
|
||||
@ -29,7 +19,7 @@ export function getColumns(): ColumnDef<Activity>[] {
|
||||
header: 'Aksi',
|
||||
cell: ({ row }) => {
|
||||
const label = row.original.description;
|
||||
|
||||
|
||||
if (label === 'TAMBAH') {
|
||||
return (
|
||||
<Badge className="bg-green-50 text-green-700 dark:bg-green-950 dark:text-green-300 uppercase text-[10px]">
|
||||
|
||||
10
resources/js/types/activity.ts
Normal file
10
resources/js/types/activity.ts
Normal file
@ -0,0 +1,10 @@
|
||||
export interface Activity {
|
||||
id: number;
|
||||
description: string;
|
||||
module: string;
|
||||
subject_id: number | string | null;
|
||||
causer: string;
|
||||
properties: any;
|
||||
created_at: string;
|
||||
date: string;
|
||||
}
|
||||
@ -7,4 +7,5 @@ export type * from './expense';
|
||||
export type * from './payroll';
|
||||
export type * from './purchase';
|
||||
export type * from './general-setting';
|
||||
export type * from './activity';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user