Compare commits
2 Commits
bec10610e1
...
38626a3a81
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38626a3a81 | ||
|
|
347e61a029 |
@@ -17,8 +17,6 @@ export default function AddOrEditUserForm({ onAdd, initialData, onCancel }) {
|
||||
tenantId: '',
|
||||
roleId: '',
|
||||
status: 'Active',
|
||||
companies: [],
|
||||
projects: [],
|
||||
sendInvitation: true,
|
||||
});
|
||||
|
||||
@@ -33,8 +31,6 @@ export default function AddOrEditUserForm({ onAdd, initialData, onCancel }) {
|
||||
tenantId: initialData.tenantId ?? '',
|
||||
roleId: initialData.roleId ?? '',
|
||||
status: initialData.status ?? 'Active',
|
||||
companies: Array.isArray(initialData.companies) ? initialData.companies : [],
|
||||
projects: Array.isArray(initialData.projects) ? initialData.projects : [],
|
||||
sendInvitation: true,
|
||||
});
|
||||
} else {
|
||||
@@ -44,11 +40,9 @@ export default function AddOrEditUserForm({ onAdd, initialData, onCancel }) {
|
||||
name: '',
|
||||
middleName: '',
|
||||
lastName: '',
|
||||
tenantId: '',
|
||||
roleId: '',
|
||||
tenantId: '6894f9ddfb7072bdfc881613',
|
||||
roleId: '68407642ec46a0e6fe1e8ec9',
|
||||
status: 'Active',
|
||||
companies: [],
|
||||
projects: [],
|
||||
sendInvitation: true,
|
||||
});
|
||||
}
|
||||
@@ -56,12 +50,7 @@ export default function AddOrEditUserForm({ onAdd, initialData, onCancel }) {
|
||||
|
||||
const handleChange = (e) => {
|
||||
const { name, value } = e.target;
|
||||
if (name === 'companies' || name === 'projects') {
|
||||
const arr = value.split(',').map(s => s.trim()).filter(s => s.length > 0);
|
||||
setFormData(prev => ({ ...prev, [name]: arr }));
|
||||
} else {
|
||||
setFormData(prev => ({ ...prev, [name]: value }));
|
||||
}
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
@@ -78,8 +67,6 @@ export default function AddOrEditUserForm({ onAdd, initialData, onCancel }) {
|
||||
lastName: formData.lastName,
|
||||
tenantId: formData.tenantId,
|
||||
roleId: formData.roleId,
|
||||
companies: formData.companies,
|
||||
projects: formData.projects,
|
||||
status: formData.status || 'Active',
|
||||
};
|
||||
await api.updateUser(payload);
|
||||
@@ -91,6 +78,7 @@ export default function AddOrEditUserForm({ onAdd, initialData, onCancel }) {
|
||||
middleName: formData.middleName,
|
||||
lastName: formData.lastName,
|
||||
roleId: formData.roleId,
|
||||
tenantId: formData.tenantId,
|
||||
sendInvitation: !!formData.sendInvitation,
|
||||
};
|
||||
await api.createUser(payload);
|
||||
@@ -113,7 +101,7 @@ export default function AddOrEditUserForm({ onAdd, initialData, onCancel }) {
|
||||
margin="normal"
|
||||
/>
|
||||
<TextField
|
||||
fullWidth
|
||||
fullWidth
|
||||
label="Name"
|
||||
name="name"
|
||||
value={formData.name}
|
||||
@@ -143,6 +131,7 @@ export default function AddOrEditUserForm({ onAdd, initialData, onCancel }) {
|
||||
value={formData.tenantId}
|
||||
onChange={handleChange}
|
||||
margin="normal"
|
||||
disabled={!initialData}
|
||||
/>
|
||||
<TextField
|
||||
fullWidth
|
||||
@@ -151,24 +140,7 @@ export default function AddOrEditUserForm({ onAdd, initialData, onCancel }) {
|
||||
value={formData.roleId}
|
||||
onChange={handleChange}
|
||||
margin="normal"
|
||||
/>
|
||||
<TextField
|
||||
fullWidth
|
||||
label="Companies"
|
||||
name="companies"
|
||||
value={formData.companies.join(', ')}
|
||||
onChange={handleChange}
|
||||
margin="normal"
|
||||
helperText="Comma-separated list"
|
||||
/>
|
||||
<TextField
|
||||
fullWidth
|
||||
label="Projects"
|
||||
name="projects"
|
||||
value={formData.projects.join(', ')}
|
||||
onChange={handleChange}
|
||||
margin="normal"
|
||||
helperText="Comma-separated list"
|
||||
disabled={!initialData}
|
||||
/>
|
||||
<TextField
|
||||
fullWidth
|
||||
|
||||
@@ -119,14 +119,12 @@ export default function UserManagement() {
|
||||
|
||||
const payload = {
|
||||
_Id: rowToDelete._id || rowToDelete._Id,
|
||||
Id: rowToDelete.id || rowToDelete.Id,
|
||||
email: rowToDelete.email ?? '',
|
||||
name: rowToDelete.name ?? '',
|
||||
middleName: rowToDelete.middleName ?? '',
|
||||
lastName: rowToDelete.lastName ?? '',
|
||||
roleId: rowToDelete.roleId ?? '',
|
||||
companies: Array.isArray(rowToDelete.companies) ? rowToDelete.companies : [],
|
||||
projects: Array.isArray(rowToDelete.projects) ? rowToDelete.projects : [],
|
||||
roleId: '68407642ec46a0e6fe1e8ec9',
|
||||
tenantId: '6894f9ddfb7072bdfc881613',
|
||||
status: 'Inactive',
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ const theme = createTheme({
|
||||
backgroundColor: '#f0eae3',
|
||||
},
|
||||
'&.Mui-selected': {
|
||||
backgroundColor: '#40120EFF',
|
||||
backgroundColor: '#d0b9a8',
|
||||
color: '#26201A',
|
||||
},
|
||||
'&.Mui-selected:hover': {
|
||||
@@ -31,7 +31,7 @@ const theme = createTheme({
|
||||
},
|
||||
cell: {
|
||||
'&:focus-within': {
|
||||
outline: '2px solid #40120EFF', // custom Fendi focus
|
||||
outline: '2px solid #d0b9a8', // custom Fendi focus
|
||||
outlineOffset: '-2px', // tighten the outline
|
||||
backgroundColor: '#f5f0eb', // optional subtle highlight
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user