build cms ok,
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
// default variable value for customer
|
||||
// empty valur for customer
|
||||
|
||||
import { defaultBillingAddress } from '@/db/billingAddress/constant';
|
||||
|
||||
import { dayjs } from '@/lib/dayjs';
|
||||
|
||||
import type { Teacher } from './type.d';
|
||||
|
||||
export const defaultTeacher: Teacher = {
|
||||
@@ -14,6 +17,12 @@ export const defaultTeacher: Teacher = {
|
||||
quota: 0,
|
||||
status: 'pending',
|
||||
createdAt: dayjs().toDate(),
|
||||
billingAddress: defaultBillingAddress,
|
||||
state: 'pending',
|
||||
// timezone: '',
|
||||
// language: '',
|
||||
// currency: '',
|
||||
collectionId: '',
|
||||
};
|
||||
|
||||
export const emptyLpCategory: Teacher = {
|
||||
|
@@ -181,7 +181,9 @@ export function TeacherEditForm(): React.JSX.Element {
|
||||
//
|
||||
reset({ ...defaultValues, ...result });
|
||||
|
||||
setBillingAddressId(result.billingAddress.id);
|
||||
if (result?.billingAddress !== undefined) {
|
||||
setBillingAddressId(result.billingAddress.id);
|
||||
}
|
||||
|
||||
if (result.avatar) {
|
||||
const fetchResult = await fetch(getImageUrlFromFile(result.collectionId, result.id, result.avatar));
|
||||
|
@@ -1,5 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { BillingAddress } from '@/db/billingAddress/type';
|
||||
|
||||
// RULES: sorting direction for teacher lists
|
||||
export type SortDir = 'asc' | 'desc';
|
||||
|
||||
@@ -14,7 +16,10 @@ export interface Teacher {
|
||||
email: string;
|
||||
phone?: string;
|
||||
quota: number;
|
||||
|
||||
//
|
||||
// billingAddress: BillingAddress[] | [];
|
||||
billingAddress: BillingAddress | Record<string, never>;
|
||||
//
|
||||
// status is obsoleted, replace by state
|
||||
status: 'pending' | 'active' | 'blocked';
|
||||
state: 'pending' | 'active' | 'blocked';
|
||||
@@ -44,10 +49,13 @@ export interface CreateFormProps {
|
||||
timezone: string;
|
||||
language: string;
|
||||
currency: string;
|
||||
// NOTE: fix this to file, change outside world
|
||||
avatar?: File | null;
|
||||
// quota?: number;
|
||||
state?: 'pending' | 'active' | 'blocked';
|
||||
meta: Record<string, null>;
|
||||
|
||||
// TODO: obsolete
|
||||
meta?: Record<string, null>;
|
||||
}
|
||||
|
||||
// RULES: form data structure for editing existing teacher
|
Reference in New Issue
Block a user