Add Kundennummer/Nummernkreise settings and settings dialog.
Add number & setting API endpoints, StorageManager caches, and a Settings dialog (tabs for settings keys and number ranges) reachable from the user menu. Show Kundennummer and creation date in the Kunde list, and refactor Neuer Kunde to show an auto-generated number with group select.
This commit is contained in:
@@ -9,9 +9,11 @@ import ListItemIcon from '@mui/material/ListItemIcon';
|
||||
import ListItemText from '@mui/material/ListItemText';
|
||||
import LogoutIcon from '@mui/icons-material/Logout';
|
||||
import BusinessIcon from '@mui/icons-material/Business';
|
||||
import SettingsIcon from '@mui/icons-material/Settings';
|
||||
import { StorageManagerContext } from '../api/storageManagerContext';
|
||||
import { logout } from '../store/authSlice';
|
||||
import CompanySettingsDialog from './CompanySettingsDialog';
|
||||
import SettingsDialog from './settings/SettingsDialog';
|
||||
import { notifyError } from '../utils/notify';
|
||||
|
||||
class UserMenu extends Component {
|
||||
@@ -22,12 +24,15 @@ class UserMenu extends Component {
|
||||
this.state = {
|
||||
anchorEl: null,
|
||||
settingsOpen: false,
|
||||
numbersOpen: false,
|
||||
user: null,
|
||||
};
|
||||
this.handleOpenMenu = this.handleOpenMenu.bind(this);
|
||||
this.handleCloseMenu = this.handleCloseMenu.bind(this);
|
||||
this.handleOpenSettings = this.handleOpenSettings.bind(this);
|
||||
this.handleCloseSettings = this.handleCloseSettings.bind(this);
|
||||
this.handleOpenNumbers = this.handleOpenNumbers.bind(this);
|
||||
this.handleCloseNumbers = this.handleCloseNumbers.bind(this);
|
||||
this.handleLogout = this.handleLogout.bind(this);
|
||||
}
|
||||
|
||||
@@ -60,6 +65,14 @@ class UserMenu extends Component {
|
||||
this.setState({ settingsOpen: false });
|
||||
}
|
||||
|
||||
handleOpenNumbers() {
|
||||
this.setState({ anchorEl: null, numbersOpen: true });
|
||||
}
|
||||
|
||||
handleCloseNumbers() {
|
||||
this.setState({ numbersOpen: false });
|
||||
}
|
||||
|
||||
async handleLogout() {
|
||||
this.setState({ anchorEl: null });
|
||||
try {
|
||||
@@ -71,7 +84,7 @@ class UserMenu extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { user, anchorEl, settingsOpen } = this.state;
|
||||
const { user, anchorEl, settingsOpen, numbersOpen } = this.state;
|
||||
const open = Boolean(anchorEl);
|
||||
|
||||
return (
|
||||
@@ -101,6 +114,12 @@ class UserMenu extends Component {
|
||||
</ListItemIcon>
|
||||
<ListItemText>Unternehmen</ListItemText>
|
||||
</MenuItem>
|
||||
<MenuItem disabled={!user?.selectedCompanyId} onClick={this.handleOpenNumbers}>
|
||||
<ListItemIcon>
|
||||
<SettingsIcon fontSize="small" />
|
||||
</ListItemIcon>
|
||||
<ListItemText>Einstellungen</ListItemText>
|
||||
</MenuItem>
|
||||
<MenuItem onClick={this.handleLogout}>
|
||||
<ListItemIcon>
|
||||
<LogoutIcon fontSize="small" />
|
||||
@@ -109,6 +128,7 @@ class UserMenu extends Component {
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<CompanySettingsDialog open={settingsOpen} onClose={this.handleCloseSettings} />
|
||||
<SettingsDialog open={numbersOpen} onClose={this.handleCloseNumbers} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user