When creating a new user it asks for all information (Phone number, email address, name and role) instead of just name and role
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
- **`n`**: Open the "Add Task" modal from the main dashboard (disabled while typing in inputs).
|
||||
24. **Drag-and-Drop Stability:** Fixed a bug where tasks would "disappear" if dropped in an invalid area. Tasks now remain visible at their original position if a drop is cancelled.
|
||||
25. **User Deletion Safety:** Implemented a backend check to prevent deleting users who have assigned tasks or notes. Upgraded the frontend `ApiService` to correctly parse and display these descriptive error messages from the backend.
|
||||
26. **Enhanced User Creation:** Added email and phone number fields to the "Add User" form in the workspace settings, ensuring full contact profiles are created for new team members.
|
||||
|
||||
### Phase 3: Advanced Features
|
||||
- **Real-time Notifications:** Explore WebSockets for task assignments.
|
||||
|
||||
@@ -374,6 +374,8 @@ function App() {
|
||||
id,
|
||||
name: u.name,
|
||||
role: u.role,
|
||||
email: u.email,
|
||||
phone: u.phone,
|
||||
hue: Math.floor(Math.random() * 360),
|
||||
initials: u.name.split(' ').map(s=>s[0]).join('').slice(0,2).toUpperCase(),
|
||||
account_type: u.account_type,
|
||||
|
||||
+18
-2
@@ -1183,6 +1183,8 @@ function WorkspaceTab({ user, isAdmin, dbUsers = [], onSwitchUser, onCreateUser,
|
||||
const [adding, setAdding] = React.useState(false);
|
||||
const [newName, setNewName] = React.useState('');
|
||||
const [newRole, setNewRole] = React.useState('');
|
||||
const [newEmail, setNewEmail] = React.useState('');
|
||||
const [newPhone, setNewPhone] = React.useState('');
|
||||
const [newType, setNewType] = React.useState('standard');
|
||||
const [wsName, setWsName] = React.useState(workspace ? workspace.name : '');
|
||||
const [wsTz, setWsTz] = React.useState(workspace ? workspace.timezone : '');
|
||||
@@ -1217,8 +1219,14 @@ function WorkspaceTab({ user, isAdmin, dbUsers = [], onSwitchUser, onCreateUser,
|
||||
|
||||
const submit = () => {
|
||||
if (!newName.trim()) return;
|
||||
onCreateUser({ name: newName.trim(), role: newRole.trim() || 'Team member', account_type: newType });
|
||||
setNewName(''); setNewRole(''); setNewType('standard'); setAdding(false);
|
||||
onCreateUser({
|
||||
name: newName.trim(),
|
||||
role: newRole.trim() || 'Team member',
|
||||
account_type: newType,
|
||||
email: newEmail.trim(),
|
||||
phone: newPhone.trim()
|
||||
});
|
||||
setNewName(''); setNewRole(''); setNewEmail(''); setNewPhone(''); setNewType('standard'); setAdding(false);
|
||||
};
|
||||
|
||||
const handleUpdateWorkspace = async () => {
|
||||
@@ -1268,6 +1276,14 @@ function WorkspaceTab({ user, isAdmin, dbUsers = [], onSwitchUser, onCreateUser,
|
||||
<span className="field__label">Role / title</span>
|
||||
<input className="field__input" value={newRole} onChange={e => setNewRole(e.target.value)} placeholder="Apprentice" />
|
||||
</label>
|
||||
<label className="field">
|
||||
<span className="field__label">Email</span>
|
||||
<input className="field__input" value={newEmail} onChange={e => setNewEmail(e.target.value)} placeholder="jamie@murchison-auto.co" />
|
||||
</label>
|
||||
<label className="field">
|
||||
<span className="field__label">Phone</span>
|
||||
<input className="field__input" value={newPhone} onChange={e => setNewPhone(e.target.value)} placeholder="+64 27 ..." />
|
||||
</label>
|
||||
</div>
|
||||
<div className="field">
|
||||
<span className="field__label">Account type</span>
|
||||
|
||||
Reference in New Issue
Block a user