This commit is contained in:
louiscklaw
2025-05-08 17:19:43 +08:00
parent 7105bc85e3
commit 5640d4d4f6
46 changed files with 520 additions and 268 deletions

View File

@@ -123,7 +123,7 @@ export const layoutConfig = {
},
{
key: 'teachers',
title: 'teachers',
title: 'teachers.nav-title',
icon: 'users',
items: [
{ key: 'teachers', title: 'List', href: paths.dashboard.teachers.list },
@@ -138,8 +138,8 @@ export const layoutConfig = {
icon: 'users',
items: [
{ key: 'students', title: 'List students', href: paths.dashboard.students.list },
{ key: 'students:create', title: 'Create student', href: paths.dashboard.students.create },
{ key: 'students:details', title: 'Student details', href: paths.dashboard.students.view('1') },
// { key: 'students:create', title: 'Create student', href: paths.dashboard.students.create },
// { key: 'students:details', title: 'Student details', href: paths.dashboard.students.view('1') },
],
},
// {

View File

@@ -0,0 +1 @@
this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/components/dashboard/student/confirm-delete-modal.tsx.draft` to handle `Student` record thanks, modify comments/variables/paths/functions name please

View File

@@ -83,12 +83,12 @@ export default function ConfirmDeleteModal({
</Avatar>
<Stack spacing={3}>
<Stack spacing={1}>
<Typography variant="h5">{t('Delete Lesson Type ?')}</Typography>
<Typography variant="h5">{t('Delete Student ?')}</Typography>
<Typography
color="text.secondary"
variant="body2"
>
{t('Are you sure you want to delete lesson type ?')}
{t('Are you sure you want to delete this student record?')}
</Typography>
</Stack>
<Stack

View File

@@ -4,7 +4,7 @@
//
import * as React from 'react';
import { useRouter } from 'next/navigation';
import { getAllCustomersCount } from '@/db/Customers/GetAllCount';
import { getAllStudentsCount } from '@/db/Students/GetAllCount';
import Button from '@mui/material/Button';
import Chip from '@mui/material/Chip';
@@ -22,18 +22,19 @@ import { FilterButton } from '@/components/core/filter-button';
import { Option } from '@/components/core/option';
import { useStudentsSelection } from './students-selection-context';
import GetBlockedCount from '@/db/Customers/GetBlockedCount';
import GetPendingCount from '@/db/Customers/GetPendingCount';
import GetActiveCount from '@/db/Customers/GetActiveCount';
import GetBlockedCount from '@/db/Students/GetBlockedCount';
import GetPendingCount from '@/db/Students/GetPendingCount';
import GetActiveCount from '@/db/Students/GetActiveCount';
import PhoneFilterPopover from './phone-filter-popover';
import EmailFilterPopover from './email-filter-popover';
import type { CustomersFiltersProps, Filters, SortDir } from './type.d';
import type { StudentFiltersProps, Filters, SortDir } from './type.d';
export function StudentsFilters({
filters = {},
sortDir = 'desc',
fullData,
}: CustomersFiltersProps): React.JSX.Element {
//
}: StudentFiltersProps): React.JSX.Element {
const { t } = useTranslation();
const { email, phone, status } = filters;
@@ -129,7 +130,7 @@ export function StudentsFilters({
React.useEffect(() => {
const fetchCount = async (): Promise<void> => {
try {
const tc = await getAllCustomersCount();
const tc = await getAllStudentsCount();
setTotalCount(tc);
const bc = await GetBlockedCount();

View File

@@ -25,12 +25,12 @@ export const StudentsSelectionContext = React.createContext<StudentsSelectionCon
interface StudentsSelectionProviderProps {
children: React.ReactNode;
customers: Student[];
students: Student[];
}
export function StudentsSelectionProvider({
children,
customers = [],
students: customers = [],
}: StudentsSelectionProviderProps): React.JSX.Element {
const customerIds = React.useMemo(() => customers.map((customer) => customer.id), [customers]);
const selection = useSelection(customerIds);

View File

@@ -39,7 +39,10 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef<Student
spacing={1}
sx={{ alignItems: 'center' }}
>
<Avatar src={row.avatar} />{' '}
<Avatar
src={`http://127.0.0.1:8090/api/files/${row.collectionId}/${row.id}/${row.avatar}`}
variant="rounded"
/>
<div>
<Link
color="inherit"
@@ -89,8 +92,6 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef<Student
{
formatter: (row): React.JSX.Element => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const mapping = {
active: {
label: 'Active',
@@ -172,7 +173,7 @@ export interface StudentsTableProps {
}
export function StudentsTable({ rows, reloadRows }: StudentsTableProps): React.JSX.Element {
const { t } = useTranslation(['customers']);
const { t } = useTranslation(['students']);
const { deselectAll, deselectOne, selectAll, selectOne, selected } = useStudentsSelection();
const [idToDelete, setIdToDelete] = React.useState('');
@@ -213,7 +214,7 @@ export function StudentsTable({ rows, reloadRows }: StudentsTableProps): React.J
variant="body2"
>
{/* TODO: update this */}
{t('no-record-found')}
{t('no-student-found')}
</Typography>
</Box>
) : null}

View File

@@ -144,7 +144,7 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef<Teacher
//
color="secondary"
component={RouterLink}
href={paths.dashboard.teachers.details(row.id)}
href={paths.dashboard.teachers.view(row.id)}
>
<PencilSimpleIcon size={24} />
</LoadingButton>
@@ -167,13 +167,13 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef<Teacher
];
}
export interface CustomersTableProps {
export interface TeachersTableProps {
rows: Teacher[];
reloadRows: () => void;
}
export function TeachersTable({ rows, reloadRows }: CustomersTableProps): React.JSX.Element {
const { t } = useTranslation(['customers']);
export function TeachersTable({ rows, reloadRows }: TeachersTableProps): React.JSX.Element {
const { t } = useTranslation(['teachers']);
const { deselectAll, deselectOne, selectAll, selectOne, selected } = useTeachersSelection();
const [idToDelete, setIdToDelete] = React.useState('');