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 () => {
|
handleSave = async () => {
|
||||||
const { editingKonto, formData } = this.state;
|
const { editingKonto, formData } = this.state;
|
||||||
|
|
||||||
@@ -257,7 +263,11 @@ class KontoTable extends Component {
|
|||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={this.handleCloseDialog}>Abbrechen</Button>
|
<Button onClick={this.handleCloseDialog}>Abbrechen</Button>
|
||||||
<Button onClick={this.handleSave} variant="contained">
|
<Button
|
||||||
|
onClick={this.handleSave}
|
||||||
|
variant="contained"
|
||||||
|
disabled={!this.isFormValid()}
|
||||||
|
>
|
||||||
Speichern
|
Speichern
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</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 () => {
|
handleSave = async () => {
|
||||||
const { editingKreditor, formData } = this.state;
|
const { editingKreditor, formData } = this.state;
|
||||||
|
|
||||||
@@ -270,7 +277,11 @@ class KreditorTable extends Component {
|
|||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={this.handleCloseDialog}>Abbrechen</Button>
|
<Button onClick={this.handleCloseDialog}>Abbrechen</Button>
|
||||||
<Button onClick={this.handleSave} variant="contained">
|
<Button
|
||||||
|
onClick={this.handleSave}
|
||||||
|
variant="contained"
|
||||||
|
disabled={!this.isFormValid()}
|
||||||
|
>
|
||||||
Speichern
|
Speichern
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
|
|||||||
@@ -290,14 +290,11 @@ export default class TextHeaderWithFilter {
|
|||||||
this.eGui.style.height = '100%';
|
this.eGui.style.height = '100%';
|
||||||
this.eGui.style.display = 'flex';
|
this.eGui.style.display = 'flex';
|
||||||
this.eGui.style.flexDirection = 'column';
|
this.eGui.style.flexDirection = 'column';
|
||||||
|
|
||||||
console.log('TextHeaderWithFilter constructor');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init(params) {
|
init(params) {
|
||||||
this.params = params;
|
this.params = params;
|
||||||
console.log('TextHeaderWithFilter init params:', params);
|
|
||||||
|
|
||||||
// Listen for menu close events to keep state in sync
|
// Listen for menu close events to keep state in sync
|
||||||
if (params.api) {
|
if (params.api) {
|
||||||
params.api.addEventListener('popupMenuVisibleChanged', (event) => {
|
params.api.addEventListener('popupMenuVisibleChanged', (event) => {
|
||||||
@@ -312,7 +309,6 @@ export default class TextHeaderWithFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getGui() {
|
getGui() {
|
||||||
console.log('TextHeaderWithFilter getGui called');
|
|
||||||
return this.eGui;
|
return this.eGui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,7 @@ export const processTransactionData = (transactions) => {
|
|||||||
export const getRowStyle = (params, selectedRows) => {
|
export const getRowStyle = (params, selectedRows) => {
|
||||||
const rowId = params.data?.id || params.rowIndex;
|
const rowId = params.data?.id || params.rowIndex;
|
||||||
const isSelected = selectedRows && selectedRows.has && selectedRows.has(rowId);
|
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) {
|
if (params.data.isJTLOnly) {
|
||||||
return {
|
return {
|
||||||
backgroundColor: isSelected ? '#e3f2fd' : '#ffebee',
|
backgroundColor: isSelected ? '#e3f2fd' : '#ffebee',
|
||||||
|
|||||||
Reference in New Issue
Block a user