update categories,

This commit is contained in:
louiscklaw
2025-04-17 07:09:02 +08:00
parent c4c392b91b
commit 36cc5b9095
11 changed files with 165 additions and 27 deletions

View File

@@ -0,0 +1,37 @@
import { dayjs } from '@/lib/dayjs';
import type { CreateForm, LessonCategory } from './type';
export const defaultLessonCategory: LessonCategory = {
isEmpty: false,
id: 'default-id',
cat_name: 'default-category-name',
cat_image_url: undefined,
cat_image: undefined,
pos: 0,
visible: 'hidden',
lesson_id: 'default-lesson-id',
description: 'default-description',
remarks: 'default-remarks',
//
createdAt: dayjs('2099-01-01').toDate(),
//
name: '',
avatar: '',
email: '',
phone: '',
quota: 0,
status: 'NA',
};
export const LessonCategoryCreateFormDefault: CreateForm = {
name: '',
type: '',
pos: 1,
visible: 'visible',
};
export const emptyLessonCategory: LessonCategory = {
...defaultLessonCategory,
isEmpty: true,
};

View File

@@ -4,8 +4,11 @@ import * as React from 'react';
import { useSelection } from '@/hooks/use-selection';
import type { Selection } from '@/hooks/use-selection';
import type { LessonCategory } from './type';
// import type { LessonCategory } from './lesson-categories-table';
import type { LessonCategory } from '@/components/dashboard/lesson_category/interfaces';
// import type { LessonCategory } from '@/components/dashboard/lesson_category/interfaces';
function noop(): void {
return undefined;

View File

@@ -26,8 +26,9 @@ import { DataTable } from '@/components/core/data-table';
import type { ColumnDef } from '@/components/core/data-table';
import ConfirmDeleteModal from './confirm-delete-modal';
import type { LessonCategory } from './interfaces';
// import type { LessonCategory } from './interfaces.1ts';
import { useLessonCategoriesSelection } from './lesson-categories-selection-context';
import { LessonCategory } from './type';
function columns(handleDeleteClick: (testId: string) => void): ColumnDef<LessonCategory>[] {
return [

View File

@@ -0,0 +1,28 @@
export interface LessonCategory {
isEmpty?: boolean;
//
id: string;
cat_name: string;
cat_image_url?: string;
cat_image?: string;
pos: number;
visible: string;
lesson_id: string;
description: string;
remarks: string;
//
name: string;
avatar: string;
email: string;
phone: string;
quota: number;
status: 'pending' | 'active' | 'blocked' | 'NA';
createdAt: Date;
}
export interface CreateForm {
name: string;
type: string;
pos: number;
visible: string;
}