-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
184 lines (164 loc) · 6.19 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
<!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">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN"
crossorigin="anonymous"></script>
<link rel="stylesheet" href="./Frontend/css/styles.css">
<link rel="stylesheet" href="./Frontend/css/login.css">
<title>Waslni | Sign in</title>
<link rel="icon" href="./Frontend/images/WaslniLogo.png" type="image/x-icon">
<script>
async function getcompanybyid() {
let bodydata = {
"email": email,
"password": password,
}
await fetch('https://waslni.azurewebsites.net/getidforcompany', {
method: 'POST',
cache: 'no-cache',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(bodydata),
})
.then(res => res[0].json())
.then(response => console.log('Success: ', response))
.catch(error => alert(error));
}
async function Companylogin() {
let email = document.getElementById('exampleInputEmail1').value;
let password = document.getElementById('exampleInputPassword1').value;
let bodydata = {
"email": email,
"password": password,
}
await fetch('https://waslni.azurewebsites.net/Companylogin', {
method: 'POST',
cache: 'no-cache',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(bodydata),
})
.then(res => {
console.log(res.status)
if (res.status == 401) {
alert('Password or Email empty')
return;
}
else if (res.status == 200) {
let name = localStorage.setItem("storageName", "home.html")
window.location.replace("/Frontend/pages/companyHomePage.html");
return;
}
else if (res.status == 400) {
return;
}
}
)
.catch(Error => {
console.log(Error)
})
return
}
async function Clientlogin() {
event.preventDefault()
let email = document.getElementById('exampleInputEmail1').value;
let password = document.getElementById('exampleInputPassword1').value;
let bodydata = {
"email": email,
"password": password,
}
await fetch('https://waslni.azurewebsites.net/Login_User', {
method: 'POST',
cache: 'no-cache',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(bodydata),
})
.then(res => {
console.log(res.status)
if (res.status == 401) {
alert('Password or Email empty')
}
else if (res.status == 200) {
window.location.replace("/Waslni/Frontend/pages/home.html");
}
else if (res.status == 400) {
Companylogin();
return;
}
}
)
.catch(Error => {
console.log(Error)
window.location.replace("/Waslni/Frontend/pages/companyHomePage.html");
})
}
</script>
</head>
<body>
<div class="SignMainBackground">
<form class="container SignContainer">
<div class="mb-4 SignHeaderContainer">
<h1>Sign in to Waslni</h1>
</div>
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">Email address</label>
<input type="email" class="form-control SignInput" id="exampleInputEmail1" aria-describedby="emailHelp"
value="[email protected]">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Password</label>
<input type="password" class="form-control SignInput" id="exampleInputPassword1" value="waslni123456">
</div>
<div class="mb-3">
<div style="padding-bottom: 5px;">Don't have account ?</div>
<a href="signup.html" class="SignLink">Create new Customer account</a><br>
<a href="#" class="SignLink" data-bs-target="#exampleModalToggle" data-bs-toggle="modal">Create new
Company account</a>
</div>
<button style="margin-bottom: 15px;" type="submit" onclick="Clientlogin()" class="btn btn-light SignButton">Log
In</button>
<a href="./Frontend/pages/HomePage.html" class="SignLink">Or, Return to Home Page</a>
</form>
</div>
<div class="modal fade" id="exampleModalToggle" aria-hidden="true" aria-labelledby="exampleModalToggleLabel"
tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-3" id="exampleModalLabel" style="margin-right: auto; margin-left: auto;">
Company registration conditions
</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"
style="margin-left: 0;"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<p>You must be a delivery company, that works in the state of Palestine</p>
<p>You must serve the customers to deliver their products</p>
<p>You're going to create new Delivery Company Account, if you're confirming this, click on
confirm button</p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-danger" data-bs-dismiss="modal"
style="margin-right: auto;">Cancel</button>
<a href="registerCompany.html"><button type="button" class="btn btn-success" data-bs-dismiss="modal"
style="margin-left: auto;">Confirm</button></a>
</div>
</div>
</div>
</div>
</body>
</html>