|
|
|
@@ -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,23 +539,29 @@
|
|
|
|
|
const itemCode = row.dataset.itemCode || '';
|
|
|
|
|
const itemCost = row.dataset.itemCost || '';
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
form.action = "{{ url_for('admin_create_invoice', borrow_id='__BORROW_ID__') }}".replace('__BORROW_ID__', borrowId);
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|