I haven't changed anything in my web app but now I get a "Uncaught ReferenceError: updateTicket is not defined at HTMLButtonElement.onclick ((index):1:1)"
I have an index.html where I have "tickets" automatically inserted. The tickets are generated in my app.js file and include buttons that trigger the updateTicket() function I have in my app.js. I now get the mentioned error whenever I try to updateTicket().
Button Function Trigger inside Ticket
<button type="button" class="btn btn-outline-primary" id="${doc.id}"
onclick="updateTicket(this,
document.getElementById('tracking${doc.id}').value,
document.getElementById('carrier${doc.id}').value,
document.getElementById('supplier${doc.id}').value,
document.getElementById('supplierContact${doc.id}').value,
document.getElementById('supplierPhone${doc.id}').value,
document.getElementById('notes${doc.id}').value,
'${testValue(doc.data().status)}',
document.getElementById('buyPrice${doc.id}').value,
document.getElementById('shipPrice${doc.id}').value)">
UPDATE</button>
My updateTicket() function. (It invokes a firebase call to update the firestore database)
function updateTicket(e, tracking, carrier, supplier, supplierContact, supplierPhone, notes, status, buyPrice, shipPrice) {
console.log("Update Ticket");
db.collection("orders").doc(e.id).update(
{
notes: notes,
tracking: tracking,
carrier: carrier,
supplier: supplier,
supplierContact: supplierContact,
supplierPhone, supplierPhone,
status: status,
// time: String(Date()).substring(0,21).trim()
time: Date(),
buyPrice: buyPrice,
shipPrice: shipPrice
});
}
This is my import in index.html
<script defer src="app.js" type="module"></script>