This commit is contained in:
2ManyProjects 2025-04-26 11:22:40 -05:00
parent 4dcd03c426
commit b6447d4d21

View file

@ -37,8 +37,9 @@ import {
import { useAdminUsers, useUpdateUser } from '@hooks/adminHooks';
import { format } from 'date-fns';
import EmailDialog from '@components/EmailDialog';
import { useAuth } from '@hooks/reduxHooks';
const AdminCustomersPage = () => {
const { user, isAuthenticated } = useAuth();
const [page, setPage] = useState(0);
const [rowsPerPage, setRowsPerPage] = useState(10);
const [search, setSearch] = useState('');
@ -328,24 +329,25 @@ const AdminCustomersPage = () => {
<Switch
checked={formData.is_disabled}
onChange={handleFormChange}
disabled={user === currentUser.id}
name="is_disabled"
color="error"
/>
}
label={formData.is_disabled ? "Account is disabled" : "Account is active"}
label={`${formData.is_disabled ? "Account is disabled" : "Account is active"}` + `${user === currentUser.id && formData.is_admin? " (Current user can\'t disabled themselves)" : "" }`}
sx={{ my: 2, display: 'block' }}
/>
<FormControlLabel
control={
<Switch
checked={formData.is_admin}
onChange={handleFormChange}
disabled={user === currentUser.id && formData.is_admin}
name="is_admin"
color="error"
/>
}
label={formData.is_admin ? "Account is Admin" : "Account is not Admin"}
label={`${formData.is_admin ? "Account is Admin" : "Account is not Admin"}` + `${user === currentUser.id && formData.is_admin? " (Admin can't downgrade themselves)" : "" }`}
sx={{ my: 2, display: 'block' }}
/>