-
© 2025 Sentinel. Alle Rechte vorbehalten.
+
+

+
built with Flatlogic Generator
@@ -314,14 +337,27 @@
const buttonSpinner = uploadButton.querySelector('.spinner');
const buttonText = uploadButton.querySelector('.button-text');
const resultsBody = document.getElementById('results-body');
+ const imagePreviewContainer = document.getElementById('image-preview-container');
+ const imagePreview = document.getElementById('image-preview');
+ const carInfoContainer = document.getElementById('car-info-container');
+ const carInfoDetails = document.getElementById('car-info-details');
const placeholderText = 'Laden Sie ein Bild hoch, um die Analyse zu sehen.';
const errorPlaceholder = (message) => `Fehler: ${message}`;
fileInput.addEventListener('change', function() {
if (this.files.length > 0) {
fileNameDisplay.textContent = `Ausgewählt: ${this.files[0].name}`;
+ const reader = new FileReader();
+ reader.onload = function(e) {
+ imagePreview.src = e.target.result;
+ imagePreviewContainer.style.display = 'block';
+ }
+ reader.readAsDataURL(this.files[0]);
} else {
fileNameDisplay.textContent = '';
+ imagePreview.src = '';
+ imagePreviewContainer.style.display = 'none';
+ carInfoContainer.style.display = 'none';
}
});
@@ -357,6 +393,13 @@
setTableEmpty();
}
+ if (result.carInfo) {
+ populateCarInfo(result.carInfo);
+ carInfoContainer.style.display = 'block';
+ } else {
+ carInfoContainer.style.display = 'none';
+ }
+
} catch (error) {
console.error('Error during analysis:', error);
setTableError(error.message);
@@ -377,15 +420,15 @@
}
function setTableLoading() {
- resultsBody.innerHTML = `
| Analysiere Bild... |
`;
+ resultsBody.innerHTML = `
| Analysiere Bild... |
`;
}
function setTableError(message) {
- resultsBody.innerHTML = `
| ${errorPlaceholder(message)} |
`;
+ resultsBody.innerHTML = `
| ${errorPlaceholder(message)} |
`;
}
function setTableEmpty() {
- resultsBody.innerHTML = `
| Keine Schäden im Bild erkannt. |
`;
+ resultsBody.innerHTML = `
| Keine Schäden im Bild erkannt. |
`;
}
function populateTable(defects) {
@@ -397,15 +440,27 @@
cellIndex.textContent = index + 1;
const cellDefect = document.createElement('td');
- cellDefect.textContent = defect;
+ cellDefect.textContent = defect.defect;
+
+ const cellCost = document.createElement('td');
+ cellCost.textContent = new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(defect.cost);
row.appendChild(cellIndex);
row.appendChild(cellDefect);
+ row.appendChild(cellCost);
resultsBody.appendChild(row);
});
}
+ function populateCarInfo(carInfo) {
+ carInfoDetails.innerHTML = `
+
Marke: ${carInfo.make}
+
Modell: ${carInfo.model}
+
Farbe: ${carInfo.color}
+ `;
+ }
+