update,
This commit is contained in:
@@ -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
|
@@ -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
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
|
@@ -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}
|
||||
|
Reference in New Issue
Block a user