diff --git a/Web/templates/library_borrowings_admin.html b/Web/templates/library_borrowings_admin.html
index d3ae9ed..19b24c1 100644
--- a/Web/templates/library_borrowings_admin.html
+++ b/Web/templates/library_borrowings_admin.html
@@ -432,7 +432,10 @@
-
+
+
+
+
@@ -477,6 +480,7 @@
const damageInvoiceCode = document.getElementById('damage-invoice-code');
const damageInvoiceAmount = document.getElementById('damage-invoice-amount');
const damageInvoiceReason = document.getElementById('damage-invoice-reason');
+ const damageInvoiceReplaceBtn = document.getElementById('damage-invoice-replace-btn');
function openDamageReportPrompt(button) {
const row = button.closest('.loan-row');
@@ -527,6 +531,7 @@
const inputCode = document.getElementById('damage-invoice-code');
const inputAmount = document.getElementById('damage-invoice-amount');
const inputReason = document.getElementById('damage-invoice-reason');
+ const replaceBtn = document.getElementById('damage-invoice-replace-btn');
if (!modal || !form) {
console.error("Modal oder Formular nicht gefunden.");
@@ -545,7 +550,13 @@
inputBorrower.value = borrower;
inputCode.value = itemCode;
- inputAmount.value = String(itemCost).replace(' EUR', '').trim();
+ // Feld zunächst leeren, damit der Ersetzen-Button genutzt werden kann
+ inputAmount.value = '';
+
+ // Original-Preis im Button als data-Attribut hinterlegen
+ if (replaceBtn) {
+ replaceBtn.dataset.price = String(itemCost).replace(' EUR', '').trim();
+ }
inputReason.value = description || `Schaden gemeldet für ${itemName}`;
@@ -560,6 +571,15 @@
}
}
+ // Event-Listener für den Ersetzen-Button
+ if (damageInvoiceReplaceBtn) {
+ damageInvoiceReplaceBtn.addEventListener('click', function() {
+ if (this.dataset.price) {
+ damageInvoiceAmount.value = this.dataset.price;
+ }
+ });
+ }
+
window.openDamageInvoiceModal = openDamageInvoiceModal;
window.closeDamageInvoiceModal = closeDamageInvoiceModal;
@@ -571,8 +591,6 @@
});
}
- window.closeDamageInvoiceModal = closeDamageInvoiceModal;
-
function applyFilters() {
const search = (searchInput.value || '').trim().toLowerCase();
const status = statusFilter.value;
@@ -613,4 +631,4 @@
applyFilters();
})();
-{% endblock %}
+{% endblock %}
\ No newline at end of file