Enhance Accounting Items Management with JTL Kontierung Integration
- Added a new API route to fetch JTL Kontierung data based on transaction ID. - Implemented loading of JTL Kontierung data in the AccountingItemsManager component. - Updated UI to display JTL Kontierung data for debugging purposes. - Enhanced user feedback during processing tasks in the App component with tooltips and progress indicators.
This commit is contained in:
@@ -44,6 +44,7 @@ class AccountingItemsManager extends Component {
|
||||
editingItem: null,
|
||||
showCreateDialog: false,
|
||||
showCreateKontoDialog: false,
|
||||
jtlKontierung: null,
|
||||
newItem: {
|
||||
umsatz_brutto: '',
|
||||
soll_haben_kz: 'S',
|
||||
@@ -65,6 +66,7 @@ class AccountingItemsManager extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
this.loadData();
|
||||
this.loadJtlKontierung();
|
||||
}
|
||||
|
||||
loadData = async () => {
|
||||
@@ -88,6 +90,31 @@ class AccountingItemsManager extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
loadJtlKontierung = async () => {
|
||||
try {
|
||||
const { transaction } = this.props;
|
||||
if (!transaction || !transaction.jtlId) {
|
||||
this.setState({ jtlKontierung: undefined });
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await this.authService.apiCall(`/data/jtl-kontierung/${transaction.jtlId}`);
|
||||
if (!response) return;
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
this.setState({ jtlKontierung: data });
|
||||
} else {
|
||||
const err = await response.json();
|
||||
console.error('Failed to load JTL Kontierung:', err);
|
||||
this.setState({ jtlKontierung: undefined });
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error loading JTL Kontierung:', e);
|
||||
this.setState({ jtlKontierung: undefined });
|
||||
}
|
||||
}
|
||||
|
||||
loadAccountingItems = async () => {
|
||||
const { transaction } = this.props;
|
||||
if (!transaction?.id) return;
|
||||
@@ -319,6 +346,21 @@ class AccountingItemsManager extends Component {
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{transaction?.jtlId && (
|
||||
<Box sx={{ mb: 2, p: 2, border: '1px dashed #999', borderRadius: 1 }}>
|
||||
<Typography variant="subtitle2">Debug: tUmsatzKontierung.data</Typography>
|
||||
<Typography variant="caption" component="div" sx={{ whiteSpace: 'pre-wrap', wordBreak: 'break-word' }}>
|
||||
{this.state.jtlKontierung === undefined
|
||||
? 'undefined'
|
||||
: this.state.jtlKontierung === null
|
||||
? 'null'
|
||||
: typeof this.state.jtlKontierung === 'object'
|
||||
? JSON.stringify(this.state.jtlKontierung, null, 2)
|
||||
: String(this.state.jtlKontierung)}
|
||||
</Typography>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
<TableContainer component={Paper}>
|
||||
<Table size="small">
|
||||
<TableHead>
|
||||
|
||||
Reference in New Issue
Block a user