Implementation of a extra button to add the complete replacement for the Bibliotheks item
Release Inventarsystem / release-docker (push) Successful in 2m14s
Release Inventarsystem / release-docker (push) Successful in 2m14s
This commit is contained in:
@@ -432,7 +432,10 @@
|
|||||||
<input id="damage-invoice-code" type="text" readonly style="width:100%; padding:10px; border:1px solid #ddd; border-radius:6px; background: var(--ui-surface-soft);">
|
<input id="damage-invoice-code" type="text" readonly style="width:100%; padding:10px; border:1px solid #ddd; border-radius:6px; background: var(--ui-surface-soft);">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="damage-invoice-amount" style="display:block; font-weight:700; margin-bottom:6px;">Preis</label>
|
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:6px;">
|
||||||
|
<label for="damage-invoice-amount" style="font-weight:700; margin:0;">Preis</label>
|
||||||
|
<button type="button" id="damage-invoice-replace-btn" class="btn btn-outline-secondary btn-sm" style="padding: 2px 8px; font-size: 0.75rem;">Komplett ersetzen</button>
|
||||||
|
</div>
|
||||||
<input id="damage-invoice-amount" name="invoice_amount" type="text" required style="width:100%; padding:10px; border:1px solid #ddd; border-radius:6px;" placeholder="z.B. 12,50">
|
<input id="damage-invoice-amount" name="invoice_amount" type="text" required style="width:100%; padding:10px; border:1px solid #ddd; border-radius:6px;" placeholder="z.B. 12,50">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -477,6 +480,7 @@
|
|||||||
const damageInvoiceCode = document.getElementById('damage-invoice-code');
|
const damageInvoiceCode = document.getElementById('damage-invoice-code');
|
||||||
const damageInvoiceAmount = document.getElementById('damage-invoice-amount');
|
const damageInvoiceAmount = document.getElementById('damage-invoice-amount');
|
||||||
const damageInvoiceReason = document.getElementById('damage-invoice-reason');
|
const damageInvoiceReason = document.getElementById('damage-invoice-reason');
|
||||||
|
const damageInvoiceReplaceBtn = document.getElementById('damage-invoice-replace-btn');
|
||||||
|
|
||||||
function openDamageReportPrompt(button) {
|
function openDamageReportPrompt(button) {
|
||||||
const row = button.closest('.loan-row');
|
const row = button.closest('.loan-row');
|
||||||
@@ -527,6 +531,7 @@
|
|||||||
const inputCode = document.getElementById('damage-invoice-code');
|
const inputCode = document.getElementById('damage-invoice-code');
|
||||||
const inputAmount = document.getElementById('damage-invoice-amount');
|
const inputAmount = document.getElementById('damage-invoice-amount');
|
||||||
const inputReason = document.getElementById('damage-invoice-reason');
|
const inputReason = document.getElementById('damage-invoice-reason');
|
||||||
|
const replaceBtn = document.getElementById('damage-invoice-replace-btn');
|
||||||
|
|
||||||
if (!modal || !form) {
|
if (!modal || !form) {
|
||||||
console.error("Modal oder Formular nicht gefunden.");
|
console.error("Modal oder Formular nicht gefunden.");
|
||||||
@@ -545,7 +550,13 @@
|
|||||||
inputBorrower.value = borrower;
|
inputBorrower.value = borrower;
|
||||||
inputCode.value = itemCode;
|
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}`;
|
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.openDamageInvoiceModal = openDamageInvoiceModal;
|
||||||
window.closeDamageInvoiceModal = closeDamageInvoiceModal;
|
window.closeDamageInvoiceModal = closeDamageInvoiceModal;
|
||||||
|
|
||||||
@@ -571,8 +591,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.closeDamageInvoiceModal = closeDamageInvoiceModal;
|
|
||||||
|
|
||||||
function applyFilters() {
|
function applyFilters() {
|
||||||
const search = (searchInput.value || '').trim().toLowerCase();
|
const search = (searchInput.value || '').trim().toLowerCase();
|
||||||
const status = statusFilter.value;
|
const status = statusFilter.value;
|
||||||
@@ -613,4 +631,4 @@
|
|||||||
applyFilters();
|
applyFilters();
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user