-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
95 lines (91 loc) · 2.71 KB
/
app.js
File metadata and controls
95 lines (91 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const app = Vue.createApp({
el: "#demo",
data() {
return {
Account: false,
Operation: false,
Item: false,
accountValue: "",
operationValue: "",
accounts: ["Банк", "Наличные"],
operations: [
{
Account: "Банк",
Item: "Зарплата",
operationValue: "20000",
dateValue: "2022-07-15"
},
{
Account: "Наличные",
Item: "КУ",
operationValue: "-5000",
dateValue: "2022-07-15"
},
{
Account: "Наличные",
Item: "Аренда",
operationValue: "-10000",
dateValue: "2022-07-18"
}
],
items: ["Зарплата", "Продукты", "КУ", "Связь", "Машина"],
valueDate: ""
};
},
methods: {
addAccount() {
if (this.accountValue !== "") {
this.accounts.push(this.accountValue);
this.accountValue = "";
this.Account = false;
}
},
deleteAccount(idx) {
this.accounts.splice(idx, 1);
},
addOperation() {
if (this.operationValue !== "") {
this.operations.Account = this.selectedAccount;
this.operations.Item = this.selectedItem;
this.operations.operationValue = this.operationValue;
this.operations.dateValue = this.dateValue;
this.operations.push([
this.selectedAccount,
this.selectedItem,
this.operationValue,
this.valueDate
]);
this.operationValue = "";
this.Operation = false;
}
},
deleteOperation(idx) {
this.operations.splice(idx, 1);
},
addItem() {
if (this.itemValue !== "") {
this.items.push(this.itemValue);
this.itemValue = "";
this.Item = false;
}
},
filtred(){
const chooseFilterValue = this.filtrededAccount;
const tableBody = document.querySelector(".target");
for (let i = 1; i < tableBody.rows.length; i++) {
for (let j = table.rows[i].cells.length - 1; j >= 0; j--) {
if(chooseFilterValue === tableBody.rows[i].cells[j].innerHTML){
tableBody.rows[i].style.display = "";
} else {
tableBody.rows[i].style.display = "none";
}
}
}
}
},
computed: {
transactionAmount() {return this.operations.reduce((prev, curr) => prev += Number(curr.operationValue), 0);
}
}
});
app.mount("#app");