update,
This commit is contained in:
@@ -37,9 +37,10 @@ import { PropertyItem } from '@/components/core/property-item';
|
|||||||
import { PropertyList } from '@/components/core/property-list';
|
import { PropertyList } from '@/components/core/property-list';
|
||||||
import { toast } from '@/components/core/toaster';
|
import { toast } from '@/components/core/toaster';
|
||||||
import ErrorDisplay from '@/components/dashboard/error';
|
import ErrorDisplay from '@/components/dashboard/error';
|
||||||
|
import { defaultLessonType } from '@/components/dashboard/lesson_type/_constants';
|
||||||
// import { getLessonTypeById } from '@/components/dashboard/lesson_type/http-actions';
|
// import { getLessonTypeById } from '@/components/dashboard/lesson_type/http-actions';
|
||||||
import { LessonTypeDefaultValue, type LessonType } from '@/components/dashboard/lesson_type/ILessonType';
|
import { LessonTypeDefaultValue, type LessonType } from '@/components/dashboard/lesson_type/ILessonType';
|
||||||
import { defaultLessonType } from '@/components/dashboard/lesson_type/interfaces';
|
// import { defaultLessonType } from '@/components/dashboard/lesson_type/interfaces';
|
||||||
import { Notifications } from '@/components/dashboard/lesson_type/notifications';
|
import { Notifications } from '@/components/dashboard/lesson_type/notifications';
|
||||||
import { Payments } from '@/components/dashboard/lesson_type/payments';
|
import { Payments } from '@/components/dashboard/lesson_type/payments';
|
||||||
import type { Address } from '@/components/dashboard/lesson_type/shipping-address';
|
import type { Address } from '@/components/dashboard/lesson_type/shipping-address';
|
||||||
|
@@ -18,8 +18,9 @@ import { logger } from '@/lib/default-logger';
|
|||||||
import { pb } from '@/lib/pb';
|
import { pb } from '@/lib/pb';
|
||||||
import { toast } from '@/components/core/toaster';
|
import { toast } from '@/components/core/toaster';
|
||||||
import ErrorDisplay from '@/components/dashboard/error';
|
import ErrorDisplay from '@/components/dashboard/error';
|
||||||
|
import { defaultLessonType } from '@/components/dashboard/lesson_type/_constants';
|
||||||
import type { LessonType } from '@/components/dashboard/lesson_type/ILessonType';
|
import type { LessonType } from '@/components/dashboard/lesson_type/ILessonType';
|
||||||
import { defaultLessonType, emptyLessonType, safeAssignment } from '@/components/dashboard/lesson_type/interfaces';
|
// import { defaultLessonType, emptyLessonType, safeAssignment } from '@/components/dashboard/lesson_type/interfaces';
|
||||||
import { LessonTypesFilters } from '@/components/dashboard/lesson_type/lesson-types-filters';
|
import { LessonTypesFilters } from '@/components/dashboard/lesson_type/lesson-types-filters';
|
||||||
import type { Filters } from '@/components/dashboard/lesson_type/lesson-types-filters';
|
import type { Filters } from '@/components/dashboard/lesson_type/lesson-types-filters';
|
||||||
import { LessonTypesPagination } from '@/components/dashboard/lesson_type/lesson-types-pagination';
|
import { LessonTypesPagination } from '@/components/dashboard/lesson_type/lesson-types-pagination';
|
||||||
|
@@ -4,25 +4,7 @@ import type { RecordModel } from 'pocketbase';
|
|||||||
import { dayjs } from '@/lib/dayjs';
|
import { dayjs } from '@/lib/dayjs';
|
||||||
|
|
||||||
import type { LessonType } from './ILessonType';
|
import type { LessonType } from './ILessonType';
|
||||||
|
import type { CreateForm } from './types';
|
||||||
export interface LessonTypeEditFormProps {
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
pos: number;
|
|
||||||
visible: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RestLessonTypeUpdateForm {
|
|
||||||
id: string;
|
|
||||||
data: LessonTypeEditFormProps;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CreateForm {
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
pos: number;
|
|
||||||
visible: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const LessonTypeCreateFormDefault: CreateForm = {
|
export const LessonTypeCreateFormDefault: CreateForm = {
|
||||||
name: '',
|
name: '',
|
@@ -36,7 +36,10 @@ import { pb } from '@/lib/pb';
|
|||||||
// import { Option } from '@/components/core/option';
|
// import { Option } from '@/components/core/option';
|
||||||
import { toast } from '@/components/core/toaster';
|
import { toast } from '@/components/core/toaster';
|
||||||
|
|
||||||
import { CreateForm, LessonTypeCreateFormDefault } from './interfaces';
|
import { LessonTypeCreateFormDefault } from './_constants';
|
||||||
|
import { CreateForm } from './types';
|
||||||
|
|
||||||
|
// import { CreateForm, LessonTypeCreateFormDefault } from './interfaces';
|
||||||
|
|
||||||
// import { createLessonType } from './http-actions';
|
// import { createLessonType } from './http-actions';
|
||||||
// import { LessonTypeCreateForm, LessonTypeCreateFormDefault } from './interfaces';
|
// import { LessonTypeCreateForm, LessonTypeCreateFormDefault } from './interfaces';
|
||||||
|
@@ -37,10 +37,13 @@ import { pb } from '@/lib/pb';
|
|||||||
import { toast } from '@/components/core/toaster';
|
import { toast } from '@/components/core/toaster';
|
||||||
import FormLoading from '@/components/loading';
|
import FormLoading from '@/components/loading';
|
||||||
|
|
||||||
|
import { defaultLessonType } from './_constants';
|
||||||
// import { getLessonTypeById, updateLessonType } from './http-actions';
|
// import { getLessonTypeById, updateLessonType } from './http-actions';
|
||||||
// TODO: this may be wrong
|
// TODO: this may be wrong
|
||||||
import type { LessonType } from './ILessonType';
|
import type { LessonType } from './ILessonType';
|
||||||
import { defaultLessonType, type LessonTypeEditFormProps } from './interfaces';
|
import { LessonTypeEditFormProps } from './types';
|
||||||
|
|
||||||
|
// import { defaultLessonType, type LessonTypeEditFormProps } from './interfaces';
|
||||||
|
|
||||||
// function fileToBase64(file: Blob): Promise<string> {
|
// function fileToBase64(file: Blob): Promise<string> {
|
||||||
// return new Promise((resolve, reject) => {
|
// return new Promise((resolve, reject) => {
|
||||||
|
44
002_source/cms/src/components/dashboard/lesson_type/types.d.ts
vendored
Normal file
44
002_source/cms/src/components/dashboard/lesson_type/types.d.ts
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import { NO_NUM, NO_VALUE } from '@/constants';
|
||||||
|
import type { RecordModel } from 'pocketbase';
|
||||||
|
|
||||||
|
import { dayjs } from '@/lib/dayjs';
|
||||||
|
|
||||||
|
import { defaultLessonType } from './_constants';
|
||||||
|
import type { LessonType } from './ILessonType';
|
||||||
|
|
||||||
|
export interface LessonTypeEditFormProps {
|
||||||
|
name: string;
|
||||||
|
type: string;
|
||||||
|
pos: number;
|
||||||
|
visible: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RestLessonTypeUpdateForm {
|
||||||
|
id: string;
|
||||||
|
data: LessonTypeEditFormProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateForm {
|
||||||
|
name: string;
|
||||||
|
type: string;
|
||||||
|
pos: number;
|
||||||
|
visible: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function safeAssignment(inTemp: LessonType | RecordModel): LessonType {
|
||||||
|
const { id, name, type, pos, visible, createdAt, email, quota, status } = { ...defaultLessonType, ...inTemp };
|
||||||
|
const oCreatedAt = dayjs(createdAt).toDate();
|
||||||
|
|
||||||
|
const output: LessonType = {
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
pos,
|
||||||
|
visible,
|
||||||
|
createdAt: oCreatedAt,
|
||||||
|
email,
|
||||||
|
quota,
|
||||||
|
status,
|
||||||
|
};
|
||||||
|
return output;
|
||||||
|
}
|
Reference in New Issue
Block a user