Add form validation to KontoTable and KreditorTable components. Disable save button when form is invalid. Clean up console logs in TextHeaderWithFilter and dataUtils.
This commit is contained in:
@@ -98,6 +98,12 @@ class KontoTable extends Component {
|
||||
});
|
||||
};
|
||||
|
||||
isFormValid = () => {
|
||||
const { formData } = this.state;
|
||||
return formData.konto.trim() !== '' &&
|
||||
formData.name.trim() !== '';
|
||||
};
|
||||
|
||||
handleSave = async () => {
|
||||
const { editingKonto, formData } = this.state;
|
||||
|
||||
@@ -257,7 +263,11 @@ class KontoTable extends Component {
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={this.handleCloseDialog}>Abbrechen</Button>
|
||||
<Button onClick={this.handleSave} variant="contained">
|
||||
<Button
|
||||
onClick={this.handleSave}
|
||||
variant="contained"
|
||||
disabled={!this.isFormValid()}
|
||||
>
|
||||
Speichern
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
||||
@@ -102,6 +102,13 @@ class KreditorTable extends Component {
|
||||
});
|
||||
};
|
||||
|
||||
isFormValid = () => {
|
||||
const { formData } = this.state;
|
||||
return formData.iban.trim() !== '' &&
|
||||
formData.name.trim() !== '' &&
|
||||
formData.kreditorId.trim() !== '';
|
||||
};
|
||||
|
||||
handleSave = async () => {
|
||||
const { editingKreditor, formData } = this.state;
|
||||
|
||||
@@ -270,7 +277,11 @@ class KreditorTable extends Component {
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={this.handleCloseDialog}>Abbrechen</Button>
|
||||
<Button onClick={this.handleSave} variant="contained">
|
||||
<Button
|
||||
onClick={this.handleSave}
|
||||
variant="contained"
|
||||
disabled={!this.isFormValid()}
|
||||
>
|
||||
Speichern
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
||||
@@ -290,14 +290,11 @@ export default class TextHeaderWithFilter {
|
||||
this.eGui.style.height = '100%';
|
||||
this.eGui.style.display = 'flex';
|
||||
this.eGui.style.flexDirection = 'column';
|
||||
|
||||
console.log('TextHeaderWithFilter constructor');
|
||||
}
|
||||
|
||||
init(params) {
|
||||
this.params = params;
|
||||
console.log('TextHeaderWithFilter init params:', params);
|
||||
|
||||
|
||||
// Listen for menu close events to keep state in sync
|
||||
if (params.api) {
|
||||
params.api.addEventListener('popupMenuVisibleChanged', (event) => {
|
||||
@@ -312,7 +309,6 @@ export default class TextHeaderWithFilter {
|
||||
}
|
||||
|
||||
getGui() {
|
||||
console.log('TextHeaderWithFilter getGui called');
|
||||
return this.eGui;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,7 @@ export const processTransactionData = (transactions) => {
|
||||
export const getRowStyle = (params, selectedRows) => {
|
||||
const rowId = params.data?.id || params.rowIndex;
|
||||
const isSelected = selectedRows && selectedRows.has && selectedRows.has(rowId);
|
||||
|
||||
console.log('getRowStyle called for row:', rowId, 'isSelected:', isSelected, 'selectedRows size:', selectedRows?.size);
|
||||
|
||||
|
||||
if (params.data.isJTLOnly) {
|
||||
return {
|
||||
backgroundColor: isSelected ? '#e3f2fd' : '#ffebee',
|
||||
|
||||
Reference in New Issue
Block a user