-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
189 lines (170 loc) · 7.13 KB
/
index.html
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dress Designer</title>
<link rel="stylesheet" href="page_layout.css">
<link rel="stylesheet" href="navbar.css">
<link rel="stylesheet" href="menubar.css">
<link rel="stylesheet" href="material.css">
<link rel="stylesheet" href="colorjoe.css">
<link rel="stylesheet" href="colorPicker.css">
<script src="colorjoe.min.js"></script>
<script src="addCards.js"></script>
</head>
<body>
<div class="root">
<div id="navbar_container">
<div id="navbar">
<a href="index.html">
<div id="logo">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="256"
height="256" viewBox="0 0 256 256" xml:space="preserve">
<desc>Created with Fabric.js 1.7.22</desc>
<defs>
</defs>
<g transform="translate(128 128) scale(0.72 0.72)">
<g style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; fill-rule: nonzero; opacity: 1;"
transform="translate(-175.05 -175.05000000000004) scale(3.89 3.89)">
<path
d="M 35.813 54.013 H 4.514 C 2.025 54.013 0 51.987 0 49.498 V 4.514 C 0 2.025 2.025 0 4.514 0 h 31.299 c 2.489 0 4.514 2.025 4.514 4.514 v 44.984 C 40.328 51.987 38.303 54.013 35.813 54.013 z"
style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,80,192); fill-rule: nonzero; opacity: 1;"
transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round" />
<path
d="M 35.813 90 H 4.514 C 2.025 90 0 87.975 0 85.485 V 69.741 c 0 -2.489 2.025 -4.515 4.514 -4.515 h 31.299 c 2.489 0 4.514 2.025 4.514 4.515 v 15.744 C 40.328 87.975 38.303 90 35.813 90 z"
style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,109,255); fill-rule: nonzero; opacity: 1;"
transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round" />
<path
d="M 85.485 90 H 54.187 c -2.489 0 -4.515 -2.025 -4.515 -4.515 V 40.501 c 0 -2.489 2.025 -4.514 4.515 -4.514 h 31.299 c 2.489 0 4.515 2.025 4.515 4.514 v 44.984 C 90 87.975 87.975 90 85.485 90 z"
style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,80,192); fill-rule: nonzero; opacity: 1;"
transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round" />
<path
d="M 85.485 24.773 H 54.187 c -2.489 0 -4.515 -2.025 -4.515 -4.515 V 4.514 C 49.672 2.025 51.697 0 54.187 0 h 31.299 C 87.975 0 90 2.025 90 4.514 v 15.745 C 90 22.748 87.975 24.773 85.485 24.773 z"
style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,109,255); fill-rule: nonzero; opacity: 1;"
transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round" />
</g>
</g>
</svg>
</div>
</a>
<div id="login_container">
<a id="login" href="login.html">Login</a>
</div>
</div>
</div>
<div class="menubar_body">
<nav id="menubar">
<a href="#first">Material</a>
<a href="#second">Pattern</a>
<a href="#third">Color</a>
<a href="#fourth">Border</a>
</nav>
</div>
<div class='container'>
<section id='first'>
<div class="card_container">
<ul class="cards">
</ul>
</div>
</section>
<section id='second'>
<div class="card_container">
<ul class="cards">
</ul>
</div>
</section>
<section id='third'>
<div class="colorjoe_wrapper">
<div class="colorjoe_container">
<div class="colorjoe"></div>
<div class="config">
<p class="title">Selected Color</p>
<div class="colorName">#ffffff</div>
<div class="color"></div>
</div>
</div>
</div>
</section>
<section id='fourth'>
<div class="card_container">
<ul class="cards">
</ul>
</div>
<button onclick="send_selected()" id="submit">Submit</button>
</section>
</div>
</div>
<script>
let user = null;
console.log("User:",sessionStorage.getItem("user"))
if (sessionStorage.getItem("user")) {
user = sessionStorage.getItem("user");
document.getElementById("login").innerText = user;
}
if (document.cookie == null) {
document.getElementById("login").innerText = "Login";
}
class ColorPicker {
constructor(root) {
this.root = root;
this.colorjoe = colorjoe.rgb(this.root.querySelector(".colorjoe"))
this.selectedColor = null;
this.colorjoe.show();
this.setSelectedColor["#ffffff"];
this.colorjoe.on("change", color => {
this.setSelectedColor(color.hex());
})
}
setSelectedColor(color, skipCjUpdate = false) {
this.selectedColor = color;
this.root.querySelector(".colorName").textContent = color;
this.root.querySelector(".color").style.background = color;
}
}
const cp = new ColorPicker(document.querySelector(".colorjoe_container"));
var selected = [];
function toggle_selection(id, page) {
let current_a = document.getElementById(id).firstElementChild
if (selected[page] && selected[page] != id) {
let selected_a = document.getElementById(selected[page]).firstElementChild
selected_a.classList.remove("selected");
current_a.classList.add("selected");
selected[page] = id;
}
else if (selected[page] && selected[page] == id){
current_a.classList.toggle("selected");
selected[page] = null;
}
else {
current_a.classList.toggle("selected");
selected[page] = id;
}
}
let send_selected = async () => {
if (user != null && user != "") {
selected[2] = document.querySelector(".colorName").textContent
console.log(selected)
let reply = await fetch('http://localhost:3000/submit', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({selected, user}),
})
let message = await reply.json()
if(message.message == true){
window.alert("Order Placed. Manufacturer will contact you for further communications!")
}
else{
window.alert("Error Occured!")
}
}
else {
window.alert("Please Login!")
}
}
</script>
</body>
</html>