-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
137 lines (131 loc) · 4.3 KB
/
scripts.js
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/* Switching functions */
function switchCategoryView(checkboxElem) {
onlyOne(checkboxElem)
switchReset();
if (checkboxElem.checked) {
CategoryViewOn();
}
}
function switchAlreadyOrdered(checkboxElem) {
onlyOne(checkboxElem)
switchReset();
if (checkboxElem.checked) {
AlreadyOrderedOn();
}
}
/* Deactive all other checkboxes when one gets checked */
function onlyOne(checkbox) {
var checkboxes = document.getElementsByClassName('switch-input')
for (i = 0; i < checkboxes.length; i++) {
if (checkboxes[i] !== checkbox) checkboxes[i].checked = false
}
}
/* Reset Orderlist */
function switchReset() {
/* show all */
table = document.getElementsByClassName('table-hover');
rows = table[0].getElementsByTagName('tr');
for (i = 2; i < rows.length; i++) {
row = rows[i];
cols = row.getElementsByTagName('td');
if (cols.length > 6) {
code = cols[7];
divs = code.getElementsByTagName('span');
menge = parseInt(divs[2].innerHTML) + parseInt(divs[3].innerHTML);
row.style.display = 'table-row';
}
}
/* remove title line links */
for (i = 1; i < rows.length; i++) {
row = rows[i];
if (row.className == 'list-heading article-category') {
row.onclick = "";
row.removeAttribute('hide');
row.setAttribute('onmouseover', 'this.style.cursor="default"')
}
}
}
/* Categorie View */
function openCat() {
table = document.getElementsByClassName('table-hover');
rows = table[0].getElementsByTagName('tr');
disp = 'none';
for (i = 1; i < rows.length; i++) {
row = rows[i];
if (row == this) {
if (this.getAttribute('hide') == 'true') {
disp = 'table-row';
row.setAttribute('hide', false);
} else {
disp = 'none';
row.setAttribute('hide', true);
}
} else if (row.className == 'list-heading article-category') {
row.onclick = openCat;
row.setAttribute('hide', true);
disp = 'none';
} else if (row.className.indexOf('order-article')) {
row.style.display = disp;
}
}
this.scrollIntoView(true);
}
function CategoryViewOn() {
table = document.getElementsByClassName('table-hover');
rows = table[0].getElementsByTagName('tr');
for (i = 1; i < rows.length; i++) {
row = rows[i];
if (row.className == 'list-heading article-category') {
row.onclick = openCat;
row.setAttribute('hide', true);
row.setAttribute('onmouseover', 'this.style.cursor="pointer"')
} else if (row.className.indexOf('order-article')) {
row.style.display = 'none';
}
}
}
/* What is already ordered? */
function AlreadyOrderedOn() {
table = document.getElementsByClassName('table-hover');
rows = table[0].getElementsByTagName('tr');
for (i = 2; i < rows.length; i++) {
row = rows[i];
cols = row.getElementsByTagName('td');
if (cols.length > 6) {
code = cols[7];
divs = code.getElementsByTagName('span');
menge = parseInt(divs[2].innerHTML) + parseInt(divs[3].innerHTML);
if (menge == 0) {
row.style.display = 'none';
}
else {
row.style.display = 'table-row';
}
}
}
}
/* Clean Order overivew */
//function CleanOrderOverviewOn() {
// Buebersicht_hidden_rows = [];
// Buebersicht_hidden = true;
// articlesection = document.getElementById('articles_table');
// rows = articlesection.getElementsByTagName('tr');
// for (i = 2; i < rows.length; i++) {
// row = rows[i];
// cols = row.getElementsByTagName('td');
// if (cols.length > 2) {
// menge = eval(cols[3].innerHTML);
// if (menge == 0) {
// row.style.display = 'none';
// Buebersicht_hidden_rows.push(row);
// }
// }
// }
//}
//function CleanOrderOverviewOn() {
// if (typeof(window['Buebersicht_hidden_rows']) == "object") {
// for (i = 0; i < Buebersicht_hidden_rows.length; i++) {
// Buebersicht_hidden_rows[i].style.display = 'table-row';
// }
// }
//}