minor
This commit is contained in:
parent
4dcd03c426
commit
b6447d4d21
1 changed files with 6 additions and 4 deletions
|
|
@ -37,8 +37,9 @@ import {
|
||||||
import { useAdminUsers, useUpdateUser } from '@hooks/adminHooks';
|
import { useAdminUsers, useUpdateUser } from '@hooks/adminHooks';
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
import EmailDialog from '@components/EmailDialog';
|
import EmailDialog from '@components/EmailDialog';
|
||||||
|
import { useAuth } from '@hooks/reduxHooks';
|
||||||
const AdminCustomersPage = () => {
|
const AdminCustomersPage = () => {
|
||||||
|
const { user, isAuthenticated } = useAuth();
|
||||||
const [page, setPage] = useState(0);
|
const [page, setPage] = useState(0);
|
||||||
const [rowsPerPage, setRowsPerPage] = useState(10);
|
const [rowsPerPage, setRowsPerPage] = useState(10);
|
||||||
const [search, setSearch] = useState('');
|
const [search, setSearch] = useState('');
|
||||||
|
|
@ -328,24 +329,25 @@ const AdminCustomersPage = () => {
|
||||||
<Switch
|
<Switch
|
||||||
checked={formData.is_disabled}
|
checked={formData.is_disabled}
|
||||||
onChange={handleFormChange}
|
onChange={handleFormChange}
|
||||||
|
disabled={user === currentUser.id}
|
||||||
name="is_disabled"
|
name="is_disabled"
|
||||||
color="error"
|
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' }}
|
sx={{ my: 2, display: 'block' }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={
|
control={
|
||||||
<Switch
|
<Switch
|
||||||
checked={formData.is_admin}
|
checked={formData.is_admin}
|
||||||
onChange={handleFormChange}
|
onChange={handleFormChange}
|
||||||
|
disabled={user === currentUser.id && formData.is_admin}
|
||||||
name="is_admin"
|
name="is_admin"
|
||||||
color="error"
|
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' }}
|
sx={{ my: 2, display: 'block' }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue