MCPcopy Create free account
hub / github.com/codemistic/Web-Development / addTransaction

Function addTransaction

Organisational Manager/assets/js/track.js:24–47  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

22
23// Add transaction
24function addTransaction(e) {
25 e.preventDefault();
26
27 if (text.value.trim() === '' || amount.value.trim() === '') {
28 alert('Please add a text and amount');
29 } else {
30 const transaction = {
31 id: generateID(),
32 text: text.value,
33 amount: +amount.value
34 };
35
36 transactions.push(transaction);
37
38 addTransactionDOM(transaction);
39
40 updateValues();
41
42 updateLocalStorage();
43
44 text.value = '';
45 amount.value = '';
46 }
47}
48
49// Generate random ID
50function generateID() {

Callers

nothing calls this directly

Calls 4

generateIDFunction · 0.85
addTransactionDOMFunction · 0.85
updateValuesFunction · 0.85
updateLocalStorageFunction · 0.85

Tested by

no test coverage detected