Enhance webpack configuration for improved performance and development experience. Add filesystem caching and watch options. Update KreditorSelector to handle prefilled data and improve state management. Refactor TransactionsTable to manage focus during dialog interactions. Update admin tables to manage focus restoration and improve dialog handling. Implement IBAN filtering in IbanSelectionFilter and enhance document rendering with Kreditor information. Update SQL schema to allow multiple IBANs for the same Kreditor and adjust API routes for better data handling.
This commit is contained in:
@@ -44,6 +44,11 @@ class BUTable extends Component {
|
||||
},
|
||||
};
|
||||
this.authService = new AuthService();
|
||||
|
||||
// Focus management refs
|
||||
this.triggerRef = React.createRef();
|
||||
this.dialogRef = React.createRef();
|
||||
this.confirmDialogRef = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -66,6 +71,9 @@ class BUTable extends Component {
|
||||
};
|
||||
|
||||
handleOpenDialog = (bu = null) => {
|
||||
// Store reference to the trigger element for focus restoration
|
||||
this.triggerRef.current = document.activeElement;
|
||||
|
||||
this.setState({
|
||||
dialogOpen: true,
|
||||
editingBU: bu,
|
||||
@@ -91,6 +99,13 @@ class BUTable extends Component {
|
||||
vst: '',
|
||||
},
|
||||
});
|
||||
|
||||
// Restore focus to the trigger element after dialog closes
|
||||
setTimeout(() => {
|
||||
if (this.triggerRef.current && this.triggerRef.current.focus) {
|
||||
this.triggerRef.current.focus();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
|
||||
handleInputChange = (field) => (event) => {
|
||||
@@ -145,6 +160,9 @@ class BUTable extends Component {
|
||||
};
|
||||
|
||||
handleDeleteClick = (bu) => {
|
||||
// Store reference to the trigger element for focus restoration
|
||||
this.triggerRef.current = document.activeElement;
|
||||
|
||||
this.setState({
|
||||
confirmDialogOpen: true,
|
||||
itemToDelete: bu,
|
||||
@@ -156,6 +174,13 @@ class BUTable extends Component {
|
||||
if (!itemToDelete) return;
|
||||
|
||||
this.setState({ confirmDialogOpen: false, itemToDelete: null });
|
||||
|
||||
// Restore focus to the trigger element after dialog closes
|
||||
setTimeout(() => {
|
||||
if (this.triggerRef.current && this.triggerRef.current.focus) {
|
||||
this.triggerRef.current.focus();
|
||||
}
|
||||
}, 100);
|
||||
|
||||
try {
|
||||
const response = await this.authService.apiCall(`/admin/buchungsschluessel/${itemToDelete.id}`, {
|
||||
@@ -179,6 +204,13 @@ class BUTable extends Component {
|
||||
confirmDialogOpen: false,
|
||||
itemToDelete: null,
|
||||
});
|
||||
|
||||
// Restore focus to the trigger element after dialog closes
|
||||
setTimeout(() => {
|
||||
if (this.triggerRef.current && this.triggerRef.current.focus) {
|
||||
this.triggerRef.current.focus();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
|
||||
render() {
|
||||
@@ -250,11 +282,22 @@ class BUTable extends Component {
|
||||
</Table>
|
||||
</TableContainer>
|
||||
|
||||
<Dialog open={dialogOpen} onClose={this.handleCloseDialog} maxWidth="sm" fullWidth>
|
||||
<DialogTitle>
|
||||
<Dialog
|
||||
open={dialogOpen}
|
||||
onClose={this.handleCloseDialog}
|
||||
maxWidth="sm"
|
||||
fullWidth
|
||||
ref={this.dialogRef}
|
||||
disableAutoFocus={false}
|
||||
disableEnforceFocus={false}
|
||||
disableRestoreFocus={true}
|
||||
aria-labelledby="bu-dialog-title"
|
||||
aria-describedby="bu-dialog-content"
|
||||
>
|
||||
<DialogTitle id="bu-dialog-title">
|
||||
{editingBU ? 'Buchungsschlüssel bearbeiten' : 'Neuer Buchungsschlüssel'}
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogContent id="bu-dialog-content">
|
||||
<TextField
|
||||
autoFocus
|
||||
margin="dense"
|
||||
@@ -310,9 +353,15 @@ class BUTable extends Component {
|
||||
onClose={this.handleDeleteCancel}
|
||||
maxWidth="sm"
|
||||
fullWidth
|
||||
ref={this.confirmDialogRef}
|
||||
disableAutoFocus={false}
|
||||
disableEnforceFocus={false}
|
||||
disableRestoreFocus={true}
|
||||
aria-labelledby="confirm-dialog-title"
|
||||
aria-describedby="confirm-dialog-content"
|
||||
>
|
||||
<DialogTitle>Löschen bestätigen</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogTitle id="confirm-dialog-title">Löschen bestätigen</DialogTitle>
|
||||
<DialogContent id="confirm-dialog-content">
|
||||
<Typography>
|
||||
{this.state.itemToDelete &&
|
||||
`Buchungsschlüssel "${this.state.itemToDelete.bu} - ${this.state.itemToDelete.name}" wirklich löschen?`
|
||||
|
||||
Reference in New Issue
Block a user