Compare commits

...

1 Commits

Author SHA1 Message Date
Aiirondev_dev 6fcabc8638 changes to the open Damage Invoice Modal 2026-07-27 21:13:18 +02:00
2 changed files with 30 additions and 17 deletions
+1 -1
View File
@@ -3157,7 +3157,7 @@ def library_loans_admin():
'damage_text': (damage_reports[0].get('description', '') if damage_reports else ''),
'available': bool(item_doc.get('Verfuegbar', False)),
'last_updated': fmt_dt(item_doc.get('LastUpdated')),
'acquisition_costs': fmt_money(item_doc.get('Anschaffungskosten'))
'acquisition_costs': item_doc.get('Anschaffungskosten', "")
})
return render_template(
+29 -16
View File
@@ -520,7 +520,16 @@
window.openDamageReportPrompt = openDamageReportPrompt;
function openDamageInvoiceModal(row, description) {
if (!damageInvoiceModal || !damageInvoiceForm) {
const modal = document.getElementById('damage-invoice-modal');
const form = document.getElementById('damage-invoice-form');
const inputItem = document.getElementById('damage-invoice-item');
const inputBorrower = document.getElementById('damage-invoice-borrower');
const inputCode = document.getElementById('damage-invoice-code');
const inputAmount = document.getElementById('damage-invoice-amount');
const inputReason = document.getElementById('damage-invoice-reason');
if (!modal || !form) {
console.error("Modal oder Formular nicht gefunden.");
return;
}
@@ -530,25 +539,29 @@
const itemCode = row.dataset.itemCode || '';
const itemCost = row.dataset.itemCost || '';
document.getElementById("damage-invoice-amount").value = "{{ item.acquisition_costs }}";
form.action = "{{ url_for('admin_create_invoice', borrow_id='__BORROW_ID__') }}".replace('__BORROW_ID__', borrowId);
damageInvoiceForm.action = "{{ url_for('admin_create_invoice', borrow_id='__BORROW_ID__') }}".replace('__BORROW_ID__', borrowId);
damageInvoiceItem.value = itemName;
damageInvoiceBorrower.value = borrower;
damageInvoiceCode.value = itemCode;
damageInvoiceAmount.value = String(itemCost).replace(' EUR', '').trim();
damageInvoiceReason.value = description || `Schaden gemeldet für ${itemName}`;
damageInvoiceModal.style.display = 'block';
damageInvoiceAmount.focus();
inputItem.value = itemName;
inputBorrower.value = borrower;
inputCode.value = itemCode;
inputAmount.value = String(itemCost).replace(' EUR', '').trim();
inputReason.value = description || `Schaden gemeldet für ${itemName}`;
modal.style.display = 'block';
inputAmount.focus();
}
function closeDamageInvoiceModal() {
const modal = document.getElementById('damage-invoice-modal');
if (modal) {
modal.style.display = 'none';
}
}
window.openDamageInvoiceModal = openDamageInvoiceModal;
function closeDamageInvoiceModal() {
if (damageInvoiceModal) {
damageInvoiceModal.style.display = 'none';
}
}
window.closeDamageInvoiceModal = closeDamageInvoiceModal;
if (damageInvoiceModal) {
damageInvoiceModal.addEventListener('click', function(event) {