model-manager 0.0.24 → 0.0.28
Sign up to get free protection for your applications and to get access to all the features.
- package/administration.html +79 -6
- package/assets/css/admin.css +173 -5
- package/assets/css/checkout.css +1 -1
- package/assets/css/dialog_admin.css +73 -0
- package/assets/css/dialog_checkout.css +22 -1
- package/assets/spinner_2.gif +0 -0
- package/assets/white/admin/check.svg +1 -0
- package/checkout.html +2 -1
- package/checkout_admin.html +2 -1
- package/index.html +2 -1
- package/index_admin.html +2 -1
- package/js/load_admin.js +32 -0
- package/js/load_items.js +1 -14
- package/login.html +3 -5
- package/main.js +62 -33
- package/package.json +10 -8
- package/preload.js +1 -1
- package/update.html +0 -48
package/administration.html
CHANGED
@@ -4,14 +4,16 @@
|
|
4
4
|
<meta charset="UTF-8">
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
|
6
6
|
<link href="./assets/css/basic.css" rel="stylesheet">
|
7
|
+
<link href="./assets/css/dialog_admin.css" rel="stylesheet">
|
7
8
|
<link href="./assets/css/admin.css" rel="stylesheet">
|
9
|
+
<title>Administration</title>
|
8
10
|
</head>
|
9
11
|
<body>
|
10
12
|
|
11
13
|
|
12
14
|
<section id="head">
|
13
15
|
<div class="drag-field-head">
|
14
|
-
<p class="drag-field-text">
|
16
|
+
<p class="drag-field-text">ModelManager</p>
|
15
17
|
</div>
|
16
18
|
<div class="win-btn">
|
17
19
|
<a class="btn-win" id="close-button">
|
@@ -52,15 +54,35 @@
|
|
52
54
|
<section id="main-content">
|
53
55
|
<div class="admin-content">
|
54
56
|
<div class="div2">
|
55
|
-
<
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
<div class="order_list">
|
58
|
+
<h2>Current orders:</h2>
|
59
|
+
<ul id="order-listing">
|
60
|
+
<div id="loading">
|
61
|
+
<h3 id="loading-text">loading...</h3>
|
62
|
+
<img id="loading-image" src="assets/spinner_2.gif" alt="Loading..." width="70px"/>
|
63
|
+
</div>
|
64
|
+
|
65
|
+
</ul>
|
66
|
+
</div>
|
59
67
|
</div>
|
60
68
|
</div>
|
69
|
+
|
61
70
|
</section>
|
62
|
-
|
71
|
+
|
72
|
+
<!--Popup renderer-->
|
73
|
+
<div id="body-overlay"></div>
|
74
|
+
<div class="dialog" id="dialog">
|
75
|
+
<a href="#" role="button" class="dialog-close-button" id="dialog-close-button">
|
76
|
+
<image src="assets/white/close_white_24dp.svg"> </image>
|
77
|
+
</a>
|
78
|
+
<pre id="item-listing">
|
79
|
+
<h1>Items:</h1>
|
80
|
+
</pre>
|
81
|
+
</div>
|
82
|
+
|
83
|
+
|
63
84
|
<script>
|
85
|
+
|
64
86
|
document.getElementById("close-button").addEventListener('click', event => {
|
65
87
|
window.api.send("toMain", "closeWindow");
|
66
88
|
});
|
@@ -70,7 +92,58 @@
|
|
70
92
|
document.getElementById("home-side").onclick = function () {
|
71
93
|
location.href = "./index_admin.html";
|
72
94
|
};
|
95
|
+
|
96
|
+
var ul = document.getElementById('order-listing');
|
97
|
+
ul.addEventListener('click', function(e) {
|
98
|
+
if (e.target.tagName === 'LI'){
|
99
|
+
var target = e.target; // Clicked element
|
100
|
+
document.getElementById("dialog").classList.add("visable");
|
101
|
+
document.getElementById("body-overlay").classList.add("visable");
|
102
|
+
|
103
|
+
var items = document.createElement('code')
|
104
|
+
var splitted_text = target.dataset.item_obj.split(",")
|
105
|
+
|
106
|
+
for (item in splitted_text) {
|
107
|
+
items.innerHTML = items.innerHTML + "\n" + splitted_text[item]
|
108
|
+
}
|
109
|
+
|
110
|
+
|
111
|
+
var h1 = document.createElement('h1')
|
112
|
+
h1.innerHTML = "Items ordered:"
|
113
|
+
document.getElementById("item-listing").innerHTML = ""
|
114
|
+
document.getElementById("item-listing").appendChild(h1)
|
115
|
+
document.getElementById("item-listing").appendChild(items)
|
116
|
+
}
|
117
|
+
});
|
118
|
+
|
119
|
+
document.getElementById('body-overlay').addEventListener('click', function(e) {
|
120
|
+
document.getElementById("dialog").classList.remove("visable");
|
121
|
+
document.getElementById("body-overlay").classList.remove("visable");
|
122
|
+
});
|
123
|
+
|
124
|
+
|
125
|
+
document.getElementById('dialog-close-button').addEventListener('click', function(e) {
|
126
|
+
document.getElementById("dialog").classList.remove("visable");
|
127
|
+
document.getElementById("body-overlay").classList.remove("visable");
|
128
|
+
});
|
129
|
+
|
130
|
+
document.onkeydown = function(evt) {
|
131
|
+
evt = evt || window.event;
|
132
|
+
var isEscape = false;
|
133
|
+
if ("key" in evt) {
|
134
|
+
isEscape = (evt.key === "Escape" || evt.key === "Esc");
|
135
|
+
} else {
|
136
|
+
isEscape = (evt.keyCode === 27);
|
137
|
+
}
|
138
|
+
if (isEscape) {
|
139
|
+
document.getElementById("dialog").classList.remove("visable");
|
140
|
+
document.getElementById("body-overlay").classList.remove("visable");
|
141
|
+
}
|
142
|
+
};
|
143
|
+
|
144
|
+
|
73
145
|
</script>
|
146
|
+
<script src="js/load_admin.js"></script>
|
74
147
|
|
75
148
|
</body>
|
76
149
|
</html>
|
package/assets/css/admin.css
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
-webkit-backdrop-filter: blur(25px) saturate(0%);
|
4
4
|
background-color: #2C2F33;
|
5
5
|
border-radius: 12px;
|
6
|
-
border: 1px solid
|
6
|
+
border: 1px solid #ffffff20;
|
7
7
|
width: 20%;
|
8
8
|
height: 17%;
|
9
9
|
position: relative;
|
@@ -51,13 +51,13 @@
|
|
51
51
|
position:relative;
|
52
52
|
}
|
53
53
|
.div2 {
|
54
|
-
grid-area: 1 / 1 / 6 /
|
54
|
+
grid-area: 1 / 1 / 6 / 7;
|
55
55
|
background-color: #2C2F33;
|
56
56
|
position: relative;
|
57
57
|
border-radius: 15px;
|
58
58
|
}
|
59
59
|
.div3 {
|
60
|
-
grid-area: 1 / 4 /
|
60
|
+
grid-area: 1 / 4 / 3 / 6;
|
61
61
|
background-color: #2C2F33;
|
62
62
|
position: relative;
|
63
63
|
border-radius: 15px;
|
@@ -69,11 +69,179 @@ button {
|
|
69
69
|
font-size: 15px;
|
70
70
|
background: linear-gradient(348deg, #5353e6 0%, #5199b6 48%, #0ebcdf 85%);
|
71
71
|
border-radius: 25px;
|
72
|
-
height:
|
73
|
-
width:
|
72
|
+
height: 10%;
|
73
|
+
width: 20%;
|
74
74
|
border: 0px;
|
75
75
|
filter: drop-shadow(0 0 20px #121212);
|
76
76
|
position: absolute;
|
77
77
|
bottom: 1%;
|
78
78
|
right: 1%;
|
79
|
+
}
|
80
|
+
|
81
|
+
.order_list {
|
82
|
+
width: 90%;
|
83
|
+
height: 90%;
|
84
|
+
margin: 0 auto;
|
85
|
+
padding: 10px;
|
86
|
+
position: relative;
|
87
|
+
}
|
88
|
+
|
89
|
+
ul {
|
90
|
+
list-style-type: none;
|
91
|
+
overflow:hidden; overflow-y:scroll;
|
92
|
+
width: 100%;
|
93
|
+
height: 95%;
|
94
|
+
}
|
95
|
+
li {
|
96
|
+
border-bottom: #5353e6 1px solid;
|
97
|
+
background: #2C2F33;
|
98
|
+
padding: 15px;
|
99
|
+
margin: 15px;
|
100
|
+
font-style: normal;
|
101
|
+
word-spacing: 38px;
|
102
|
+
border-radius: 25px;
|
103
|
+
filter: drop-shadow(0 0 4px #181818);
|
104
|
+
}
|
105
|
+
|
106
|
+
li:hover {
|
107
|
+
animation-name: hoverfadeli;
|
108
|
+
animation-duration: 0.3s;
|
109
|
+
animation-fill-mode: forwards;
|
110
|
+
border-radius: 25px;
|
111
|
+
}
|
112
|
+
|
113
|
+
@keyframes hoverfadeli {
|
114
|
+
from {
|
115
|
+
background: #2C2F33;
|
116
|
+
}
|
117
|
+
to {
|
118
|
+
background: #5a5d5e41;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
::-webkit-scrollbar {
|
125
|
+
width: 7px;
|
126
|
+
height: 10px;
|
127
|
+
}
|
128
|
+
|
129
|
+
::-webkit-scrollbar-track {
|
130
|
+
background-color: #2C2F33;
|
131
|
+
}
|
132
|
+
|
133
|
+
::-webkit-scrollbar-thumb {
|
134
|
+
background: linear-gradient(348deg, #5353e6 0%, #5199b6 48%, #0ebcdf 85%);
|
135
|
+
}
|
136
|
+
|
137
|
+
::-webkit-scrollbar-thumb {
|
138
|
+
background-color: #d6dee1;
|
139
|
+
border-radius: 20px;
|
140
|
+
}
|
141
|
+
::-webkit-scrollbar-thumb:hover {
|
142
|
+
background-color: #a8bbbf;
|
143
|
+
}
|
144
|
+
|
145
|
+
li a {
|
146
|
+
position: relative;
|
147
|
+
float: right;
|
148
|
+
border-radius: 55px;
|
149
|
+
transform: translateY(-20%);
|
150
|
+
width: 6%;
|
151
|
+
}
|
152
|
+
li a img {
|
153
|
+
transform: translateX(10%);
|
154
|
+
height: 80%;
|
155
|
+
width: 80%;
|
156
|
+
}
|
157
|
+
|
158
|
+
li a:hover {
|
159
|
+
animation-name: hoverfade;
|
160
|
+
animation-duration: 0.2s;
|
161
|
+
animation-fill-mode: forwards;
|
162
|
+
}
|
163
|
+
@keyframes hoverfade {
|
164
|
+
from {
|
165
|
+
opacity: 100%;
|
166
|
+
}
|
167
|
+
to{
|
168
|
+
opacity: 10%;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
/* For large screens */
|
173
|
+
@media only screen and (max-width: 1500px) {
|
174
|
+
li {
|
175
|
+
border-bottom: #5353e6 1px solid;
|
176
|
+
background: #2C2F33;
|
177
|
+
padding: 15px;
|
178
|
+
margin: 15px;
|
179
|
+
font-style: normal;
|
180
|
+
word-spacing: 22px;
|
181
|
+
border-radius: 25px;
|
182
|
+
filter: drop-shadow(0 0 4px #181818);
|
183
|
+
}
|
184
|
+
li a img {
|
185
|
+
transform: translateX(10%);
|
186
|
+
height: 80%;
|
187
|
+
width: 80%;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
@media only screen and (min-width: 1501px) {
|
192
|
+
li {
|
193
|
+
border-bottom: #5353e6 1px solid;
|
194
|
+
background: #2C2F33;
|
195
|
+
padding: 15px;
|
196
|
+
margin: 15px;
|
197
|
+
font-style: normal;
|
198
|
+
word-spacing: 38px;
|
199
|
+
border-radius: 25px;
|
200
|
+
filter: drop-shadow(0 0 4px #181818);
|
201
|
+
}
|
202
|
+
li a img {
|
203
|
+
transform: translateX(10%);
|
204
|
+
height: 50%;
|
205
|
+
width: 50%;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
|
210
|
+
input {
|
211
|
+
padding: 15px;
|
212
|
+
margin: 15px;
|
213
|
+
font-style: normal;
|
214
|
+
word-spacing: 38px;
|
215
|
+
border-radius: 25px;
|
216
|
+
font-size: 15px;
|
217
|
+
appearance: none;
|
218
|
+
display: inline-block;
|
219
|
+
background: #4e4f50;
|
220
|
+
border: 1px solid #4e4f50;
|
221
|
+
border-top: 1px solid #4e4f50;
|
222
|
+
box-sizing: border-box;
|
223
|
+
border-radius: 25px;
|
224
|
+
width: 80%;
|
225
|
+
color: #c2c2c2;
|
226
|
+
outline: none;
|
227
|
+
}
|
228
|
+
|
229
|
+
#loading {
|
230
|
+
pointer-events: none;
|
231
|
+
position: fixed;
|
232
|
+
display: block;
|
233
|
+
width: 100%;
|
234
|
+
height: 80%;
|
235
|
+
top: 0;
|
236
|
+
left: 0;
|
237
|
+
text-align: center;
|
238
|
+
opacity: 0.7;
|
239
|
+
z-index: 99;
|
240
|
+
}
|
241
|
+
|
242
|
+
p {
|
243
|
+
font-size: 20px;
|
244
|
+
font-style: italic;
|
245
|
+
margin: 14px;
|
246
|
+
margin-left: 20px;
|
79
247
|
}
|
package/assets/css/checkout.css
CHANGED
@@ -0,0 +1,73 @@
|
|
1
|
+
#body-overlay {
|
2
|
+
position: fixed;
|
3
|
+
top: 0;
|
4
|
+
right: 0;
|
5
|
+
bottom: 0;
|
6
|
+
left: 0;
|
7
|
+
background-color: rgb(24, 24, 24, 0.8);
|
8
|
+
z-index: 100000;
|
9
|
+
opacity: 0;
|
10
|
+
pointer-events: none;
|
11
|
+
}
|
12
|
+
|
13
|
+
.dialog {
|
14
|
+
height: 60%;
|
15
|
+
position: fixed;
|
16
|
+
left: 50%;
|
17
|
+
top: 50%;
|
18
|
+
transform: translate(-50%, -50%);
|
19
|
+
padding: 10px;
|
20
|
+
width: 50%;
|
21
|
+
background-color: #2C2F33;
|
22
|
+
z-index: 1000001;
|
23
|
+
opacity: 0;
|
24
|
+
pointer-events: none;
|
25
|
+
border-radius: 25px;
|
26
|
+
}
|
27
|
+
|
28
|
+
#body-overlay.visable, .dialog.visable {
|
29
|
+
opacity: 1;
|
30
|
+
pointer-events: auto;
|
31
|
+
}
|
32
|
+
|
33
|
+
#item-dialog {
|
34
|
+
width: 45%;
|
35
|
+
}
|
36
|
+
.dialog-close-button {
|
37
|
+
position: absolute;
|
38
|
+
top: 6px;
|
39
|
+
right: 8px;
|
40
|
+
font-size: 32px;
|
41
|
+
line-height: 32px;
|
42
|
+
text-decoration: none;
|
43
|
+
}
|
44
|
+
|
45
|
+
pre {
|
46
|
+
width: 80%;
|
47
|
+
height: 80%;
|
48
|
+
margin-top: 5%;
|
49
|
+
border-radius: 25px;
|
50
|
+
margin-left: 10%;
|
51
|
+
}
|
52
|
+
|
53
|
+
code {
|
54
|
+
font-size: 20px;
|
55
|
+
position: relative;
|
56
|
+
transform: translateX(-50%);
|
57
|
+
}
|
58
|
+
@media only screen and (max-width: 1500px) {
|
59
|
+
code {
|
60
|
+
font-size: 16px;
|
61
|
+
position: relative;
|
62
|
+
transform: translateX(-50%);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
@media only screen and (min-width: 1501px) {
|
67
|
+
code {
|
68
|
+
font-size: 20px;
|
69
|
+
position: relative;
|
70
|
+
transform: translateX(-50%);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
@@ -19,7 +19,7 @@
|
|
19
19
|
padding: 10px;
|
20
20
|
border-radius: 5px;
|
21
21
|
width: 60%;
|
22
|
-
background-color:
|
22
|
+
background-color: #2d3034;
|
23
23
|
z-index: 1000001;
|
24
24
|
opacity: 0;
|
25
25
|
pointer-events: none;
|
@@ -153,4 +153,25 @@
|
|
153
153
|
}
|
154
154
|
.control-checkbox input:checked + .control_indicator::before {
|
155
155
|
animation-name: s-ripple-dup;
|
156
|
+
}
|
157
|
+
|
158
|
+
::-webkit-scrollbar {
|
159
|
+
width: 7px;
|
160
|
+
height: 10px;
|
161
|
+
}
|
162
|
+
|
163
|
+
::-webkit-scrollbar-track {
|
164
|
+
background-color: #2d3034;
|
165
|
+
}
|
166
|
+
|
167
|
+
::-webkit-scrollbar-thumb {
|
168
|
+
background: linear-gradient(348deg, #5353e6 0%, #5199b6 48%, #0ebcdf 85%);
|
169
|
+
}
|
170
|
+
|
171
|
+
::-webkit-scrollbar-thumb {
|
172
|
+
background-color: #d6dee1;
|
173
|
+
border-radius: 20px;
|
174
|
+
}
|
175
|
+
::-webkit-scrollbar-thumb:hover {
|
176
|
+
background-color: #a8bbbf;
|
156
177
|
}
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="48" width="48" fill="#ECECEC"><path d="M18.9 35.7 7.7 24.5l2.15-2.15 9.05 9.05 19.2-19.2 2.15 2.15Z"/></svg>
|
package/checkout.html
CHANGED
@@ -5,13 +5,14 @@
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
|
6
6
|
<link href="assets/css/checkout.css" rel="stylesheet">
|
7
7
|
<link href="assets/css/dialog_checkout.css" rel="stylesheet">
|
8
|
+
<title>Checkout</title>
|
8
9
|
</head>
|
9
10
|
<body>
|
10
11
|
|
11
12
|
|
12
13
|
<section id="head">
|
13
14
|
<div class="drag-field-head">
|
14
|
-
<p class="drag-field-text">
|
15
|
+
<p class="drag-field-text">ModelManager</p>
|
15
16
|
</div>
|
16
17
|
<div class="win-btn">
|
17
18
|
<a class="btn-win" id="close-button">
|
package/checkout_admin.html
CHANGED
@@ -5,13 +5,14 @@
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
|
6
6
|
<link href="assets/css/checkout.css" rel="stylesheet">
|
7
7
|
<link href="assets/css/dialog_checkout.css" rel="stylesheet">
|
8
|
+
<title>Checkout</title>
|
8
9
|
</head>
|
9
10
|
<body>
|
10
11
|
|
11
12
|
|
12
13
|
<section id="head">
|
13
14
|
<div class="drag-field-head">
|
14
|
-
<p class="drag-field-text">
|
15
|
+
<p class="drag-field-text">ModelManager</p>
|
15
16
|
</div>
|
16
17
|
<div class="win-btn">
|
17
18
|
<a class="btn-win" id="close-button">
|
package/index.html
CHANGED
@@ -5,13 +5,14 @@
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
|
6
6
|
<link href="./assets/css/basic.css" rel="stylesheet">
|
7
7
|
<link href="./assets/css/dialog.css" rel="stylesheet">
|
8
|
+
<title>Browse</title>
|
8
9
|
</head>
|
9
10
|
<body>
|
10
11
|
|
11
12
|
|
12
13
|
<section id="head">
|
13
14
|
<div class="drag-field-head">
|
14
|
-
<p class="drag-field-text">
|
15
|
+
<p class="drag-field-text">ModelManager</p>
|
15
16
|
</div>
|
16
17
|
<div class="win-btn">
|
17
18
|
<a class="btn-win" id="close-button">
|
package/index_admin.html
CHANGED
@@ -5,13 +5,14 @@
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
|
6
6
|
<link href="./assets/css/basic.css" rel="stylesheet">
|
7
7
|
<link href="./assets/css/dialog.css" rel="stylesheet">
|
8
|
+
<title>Browse</title>
|
8
9
|
</head>
|
9
10
|
<body>
|
10
11
|
|
11
12
|
|
12
13
|
<section id="head">
|
13
14
|
<div class="drag-field-head">
|
14
|
-
<p class="drag-field-text">
|
15
|
+
<p class="drag-field-text">ModelManager</p>
|
15
16
|
</div>
|
16
17
|
<div class="win-btn">
|
17
18
|
<a class="btn-win" id="close-button">
|
package/js/load_admin.js
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
window.api.send("database_request", "rq_orderdata");
|
2
|
+
|
3
|
+
window.api.receive('admin_channel', function (data, evt) {
|
4
|
+
var list = document.getElementById("order-listing")
|
5
|
+
var a = document.createElement('a')
|
6
|
+
a.id = "finish_order"
|
7
|
+
var img_in_a = document.createElement('img')
|
8
|
+
img_in_a.src = "./assets/white/admin/check.svg"
|
9
|
+
a.appendChild(img_in_a);
|
10
|
+
var newLI = document.createElement('li')
|
11
|
+
newLI.id = "order-item"
|
12
|
+
newLI.dataset.order_id = data[0].order_number
|
13
|
+
a.dataset.order_id = data[0].order_number
|
14
|
+
newLI.dataset.item_obj = data[0].orders
|
15
|
+
newLI.innerHTML = "Ordercode: #" + data[0].order_number + " | Orderer: " + data[0].orderer + " | Items: " + data[0].orders.length
|
16
|
+
newLI.appendChild(a);
|
17
|
+
list.appendChild(newLI);
|
18
|
+
document.querySelectorAll("#finish_order").forEach(function (item) {
|
19
|
+
item.addEventListener('click', function() {
|
20
|
+
window.api.send("database_request", "delete_order:" + item.dataset.order_id);
|
21
|
+
});
|
22
|
+
});
|
23
|
+
});
|
24
|
+
|
25
|
+
window.api.receive('renderer', function (data, evt) {
|
26
|
+
if(data == "stop-spinner") {
|
27
|
+
document.getElementById("loading").remove();
|
28
|
+
} else if (data == "reload_side") {
|
29
|
+
|
30
|
+
location.reload()
|
31
|
+
}
|
32
|
+
});
|
package/js/load_items.js
CHANGED
@@ -248,20 +248,7 @@ window.api.receive('item_channel', function (data, evt) {
|
|
248
248
|
const controls = new OrbitControls(camera,renderer.domElement);
|
249
249
|
|
250
250
|
|
251
|
-
|
252
|
-
const canvas = renderer.domElement;
|
253
|
-
const width = canvas.clientWidth;
|
254
|
-
const height = canvas.clientHeight;
|
255
|
-
if (canvas.width !== width ||canvas.height !== height) {
|
256
|
-
// you must pass false here or three.js sadly fights the browser
|
257
|
-
renderer.setSize(width, height, false);
|
258
|
-
camera.aspect = width / height;
|
259
|
-
camera.updateProjectionMatrix();
|
260
|
-
|
261
|
-
// set render target sizes here
|
262
|
-
}
|
263
|
-
}
|
264
|
-
|
251
|
+
|
265
252
|
|
266
253
|
camera.position.y = 1;
|
267
254
|
camera.position.x = 3;
|
package/login.html
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html lang="en">
|
3
3
|
<head>
|
4
|
-
<!-- Design by foolishdeveloper.com -->
|
5
|
-
<title>Glassmorphism login Form Tutorial in html css</title>
|
6
|
-
|
7
4
|
<link rel="preconnect" href="https://fonts.gstatic.com">
|
8
5
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
9
6
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;600&display=swap" rel="stylesheet">
|
7
|
+
<title>Login</title>
|
10
8
|
<!--Stylesheet-->
|
11
9
|
<style media="screen">
|
12
10
|
*,
|
@@ -261,10 +259,10 @@ button > span {
|
|
261
259
|
window.api.receive('login_response', function (data, evt) {
|
262
260
|
if (data == "n") {
|
263
261
|
document.getElementById("alert").classList.remove("invis")
|
264
|
-
} else if (data
|
262
|
+
} else if (data == "y-0") {
|
265
263
|
location.href = "./index_admin.html";
|
266
264
|
window.api.send("change_window", input)
|
267
|
-
} else if (data
|
265
|
+
} else if (data == "y-1") {
|
268
266
|
location.href = "./index.html";
|
269
267
|
window.api.send("change_window", input)
|
270
268
|
}
|
package/main.js
CHANGED
@@ -1,10 +1,18 @@
|
|
1
1
|
const path = require('path')
|
2
|
-
//
|
2
|
+
// todo: need to remove this before compiling the software
|
3
3
|
// require('electron-reload')(__dirname, {
|
4
4
|
// electron: path.join(__dirname, 'node_modules', '.bin', 'electron')
|
5
5
|
// });
|
6
6
|
const { app, BrowserWindow, ipcMain, dialog } = require('electron');
|
7
|
-
const { autoUpdater } = require('electron-updater')
|
7
|
+
// const { autoUpdater } = require('electron-updater')
|
8
|
+
|
9
|
+
const { autoUpdater } = require('electron-github-autoupdater')
|
10
|
+
|
11
|
+
autoUpdater({
|
12
|
+
owner: "Mine-North",
|
13
|
+
repo: "Mine-North-Model-Tool",
|
14
|
+
accessToken: "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"
|
15
|
+
})
|
8
16
|
|
9
17
|
var cart = [];
|
10
18
|
var logged_user;
|
@@ -28,7 +36,7 @@ const loginWindow = () => {
|
|
28
36
|
preload: path.join(__dirname, 'preload.js')
|
29
37
|
}
|
30
38
|
})
|
31
|
-
|
39
|
+
win.webContents.openDevTools(true)
|
32
40
|
win.loadURL(`file://${__dirname}/login.html`)
|
33
41
|
|
34
42
|
ipcMain.on("change_window", (event, args) => {
|
@@ -36,7 +44,7 @@ const loginWindow = () => {
|
|
36
44
|
createWindow();
|
37
45
|
});
|
38
46
|
|
39
|
-
autoUpdater.checkForUpdates();
|
47
|
+
// autoUpdater.checkForUpdates();
|
40
48
|
}
|
41
49
|
|
42
50
|
|
@@ -85,12 +93,24 @@ ipcMain.on("toMain", (event, args) => {
|
|
85
93
|
const database = client.db("modeldatabase");
|
86
94
|
const orders = database.collection("orders");
|
87
95
|
|
96
|
+
// lets clean the order array first
|
97
|
+
var final_cart = cart.filter(function(item, pos, self) {
|
98
|
+
return self.indexOf(item) == pos;
|
99
|
+
})
|
100
|
+
|
88
101
|
client.connect(err => {
|
89
102
|
if (err) {
|
90
103
|
event.sender.send('order_response', "error")
|
91
104
|
throw err
|
92
105
|
}
|
93
|
-
|
106
|
+
|
107
|
+
var existing_order = 0;
|
108
|
+
// count existing orders
|
109
|
+
orders.find().forEach( function(item) {
|
110
|
+
existing_order++;
|
111
|
+
});
|
112
|
+
|
113
|
+
var modelobj1 = {order_by: logged_user, orders: final_cart, order_number: existing_order+1}
|
94
114
|
orders.insertOne(modelobj1);
|
95
115
|
cart = [];
|
96
116
|
event.sender.send('order_response', "success")
|
@@ -137,6 +157,7 @@ ipcMain.on("database_request", (event, args) => {
|
|
137
157
|
const database = client.db("modeldatabase");
|
138
158
|
const models = database.collection("models");
|
139
159
|
const users = database.collection("users");
|
160
|
+
const orders = database.collection("orders");
|
140
161
|
|
141
162
|
if(args == "rqID") {
|
142
163
|
client.connect(err => {
|
@@ -223,6 +244,42 @@ ipcMain.on("database_request", (event, args) => {
|
|
223
244
|
});
|
224
245
|
});
|
225
246
|
}
|
247
|
+
|
248
|
+
if (args == "rq_orderdata") {
|
249
|
+
client.connect(err => {
|
250
|
+
var data = []
|
251
|
+
var count = 0;
|
252
|
+
orders.find().forEach( function(item) {
|
253
|
+
data = []
|
254
|
+
var order_number = item.order_number
|
255
|
+
var orderer = item.order_by
|
256
|
+
var orders = item.orders
|
257
|
+
count = count+1;
|
258
|
+
data.push({
|
259
|
+
order_number,
|
260
|
+
orderer,
|
261
|
+
orders
|
262
|
+
})
|
263
|
+
event.sender.send('admin_channel', data)
|
264
|
+
if (count == 1) {
|
265
|
+
event.sender.send('renderer', "stop-spinner")
|
266
|
+
}
|
267
|
+
client.close();
|
268
|
+
});
|
269
|
+
});
|
270
|
+
}
|
271
|
+
|
272
|
+
if (args.includes("delete_order")) {
|
273
|
+
var splitted_data = args.split(":")
|
274
|
+
var order_id = splitted_data[1];
|
275
|
+
|
276
|
+
client.connect(err => {
|
277
|
+
console.log("looking to delete order number " + order_id);
|
278
|
+
orders.deleteOne({ order_number: parseInt(order_id) });
|
279
|
+
|
280
|
+
event.sender.send('renderer', "reload_side")
|
281
|
+
});
|
282
|
+
}
|
226
283
|
});
|
227
284
|
|
228
285
|
|
@@ -246,32 +303,4 @@ ipcMain.on("storage_request", (event, args) => {
|
|
246
303
|
|
247
304
|
ipcMain.on("cart_request", (event, args) => {
|
248
305
|
event.sender.send("cart_answer", cart)
|
249
|
-
});
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
// auto updater
|
254
|
-
autoUpdater.on("update-available", (_event, releaseNotes, releaseName) => {
|
255
|
-
const dialogOpts = {
|
256
|
-
type: 'info',
|
257
|
-
buttons: ['Ok'],
|
258
|
-
title: 'Application Update',
|
259
|
-
message: process.platform === "win32" ? releaseNotes : releaseName,
|
260
|
-
detail: 'A new version is being downloaded.'
|
261
|
-
}
|
262
|
-
dialog.showMessageBox(dialogOpts, (response) => {
|
263
|
-
});
|
264
|
-
});
|
265
|
-
|
266
|
-
autoUpdater.on("update-downloaded", (_event, releaseNotes, releaseName) => {
|
267
|
-
const dialogOpts = {
|
268
|
-
type: 'info',
|
269
|
-
buttons: ['Restart'],
|
270
|
-
title: 'Application Update',
|
271
|
-
message: process.platform === "win32" ? releaseNotes : releaseName,
|
272
|
-
detail: 'A new version has been downloaded. You need to restart the tool!'
|
273
|
-
}
|
274
|
-
dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
275
|
-
if (returnValue.response === 0) autoUpdater.quitAndInstall()
|
276
|
-
});
|
277
306
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "model-manager",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.28",
|
4
4
|
"main": "main.js",
|
5
5
|
"license": "ISC",
|
6
6
|
"scripts": {
|
@@ -11,6 +11,7 @@
|
|
11
11
|
"author": "Tristan H.",
|
12
12
|
"description": "A Tool for managing all model assets of Mine-North.",
|
13
13
|
"dependencies": {
|
14
|
+
"electron-is-dev": "^2.0.0",
|
14
15
|
"electron-updater": "^5.0.5",
|
15
16
|
"mongodb": "^4.5.0",
|
16
17
|
"swup": "^2.0.14",
|
@@ -19,20 +20,21 @@
|
|
19
20
|
},
|
20
21
|
"devDependencies": {
|
21
22
|
"electron": "^19.0.8",
|
22
|
-
"electron-builder": "
|
23
|
+
"electron-builder": "17.3.1",
|
24
|
+
"electron-github-autoupdater": "^2.0.0",
|
23
25
|
"electron-reload": "^2.0.0-alpha.1"
|
24
26
|
},
|
25
27
|
"build": {
|
26
|
-
"appId": "model-manager",
|
28
|
+
"appId": "com.mine-north.model-manager",
|
27
29
|
"productName": "ModelManager",
|
28
30
|
"win": {
|
29
31
|
"publish": [
|
30
32
|
{
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
"provider": "github",
|
34
|
+
"private": true,
|
35
|
+
"owner": "Mine-North",
|
36
|
+
"repo": "Mine-North-Model-Tool",
|
37
|
+
"token": "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"
|
36
38
|
}
|
37
39
|
]
|
38
40
|
}
|
package/preload.js
CHANGED
@@ -16,7 +16,7 @@ contextBridge.exposeInMainWorld(
|
|
16
16
|
}
|
17
17
|
},
|
18
18
|
receive: (channel, func) => {
|
19
|
-
let validChannels = ["fromMain", "item_channel", "item_channel2", "data_usage", "renderer", "login_response", "storage_answer", "cart_answer", "start_app", "order_response"];
|
19
|
+
let validChannels = ["fromMain", "item_channel", "item_channel2", "data_usage", "renderer", "login_response", "storage_answer", "cart_answer", "start_app", "order_response", "admin_channel"];
|
20
20
|
if (validChannels.includes(channel)) {
|
21
21
|
// Deliberately strip event as it includes `sender`
|
22
22
|
ipcRenderer.on(channel, (event, ...args) => func(...args));
|
package/update.html
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<link rel="preconnect" href="https://fonts.gstatic.com">
|
5
|
-
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;600&display=swap" rel="stylesheet">
|
6
|
-
<!--Stylesheet-->
|
7
|
-
<style media="screen">
|
8
|
-
body {
|
9
|
-
background: #1a1a1a;
|
10
|
-
color: whitesmoke;
|
11
|
-
}
|
12
|
-
#control {
|
13
|
-
-webkit-app-region: drag;
|
14
|
-
width: 100%;
|
15
|
-
height: 100vh;
|
16
|
-
z-index: 99;
|
17
|
-
top: 0;
|
18
|
-
left: 0;
|
19
|
-
position: absolute;
|
20
|
-
background: transparent;
|
21
|
-
}
|
22
|
-
#download {
|
23
|
-
position: absolute;
|
24
|
-
bottom: 15px;
|
25
|
-
width: 80%;
|
26
|
-
left: 10%;
|
27
|
-
height: 25px;
|
28
|
-
}
|
29
|
-
#download-label {
|
30
|
-
position: absolute;
|
31
|
-
top: 10vh;
|
32
|
-
width: 97%;
|
33
|
-
text-align: center;
|
34
|
-
font-size: 48px;
|
35
|
-
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
36
|
-
font-weight: 300;
|
37
|
-
}
|
38
|
-
</style>
|
39
|
-
</head>
|
40
|
-
<body>
|
41
|
-
|
42
|
-
<div id="control"></div>
|
43
|
-
<label for="download" id="download-label"></label>
|
44
|
-
<progress id="download" max="100" value="20"></progress>
|
45
|
-
<script src="./js/update.js"></script>
|
46
|
-
<!-- start_app -> channel to send data -->
|
47
|
-
</body>
|
48
|
-
</html>
|