Skip to content
Snippets Groups Projects
Commit 284d727c authored by Yulong Wang's avatar Yulong Wang
Browse files

Delete regist.html

parent 073de896
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Register</title>
<link rel="stylesheet" href="../css/regist.css">
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="../js/emailValidation.js"></script>
</head>
<body>
<!-- NAVBAR CREATION -->
<header class="header">
<nav class="navbar">
<a href="../html/login.html">Home</a>
</nav>
</header>
<!-- BACKGROUND AND MAIN CONTAINER -->
<div class="background"></div>
<div class="container">
<div class="item">
<h2 class="logo"><i class='bx bxl-xing'></i>Health & Social Care</h2>
<div class="text-item">
<h2>Welcome! <br><span>
To Our Website
</span></h2>
<p>Effective communication promotes faster and more efficient placements</p>
<div class="social-icon">
<a href="#"><i class='bx bxl-facebook'></i></a>
<a href="#"><i class='bx bxl-twitter'></i></a>
<a href="#"><i class='bx bxl-youtube'></i></a>
<a href="#"><i class='bx bxl-instagram'></i></a>
<a href="#"><i class='bx bxl-linkedin'></i></a>
</div>
</div>
</div>
<div class="login-section" style="overflow: auto">
<div class="form-box register" >
<form action="" id="registForm">
<h2>Sign Up</h2>
<!-- Username -->
<div class="input-box">
<span class="icon"><i class='bx bxs-user'></i></span>
<input type="text" id="name" name="name" required>
<label>Username</label>
<span id="nameError" class="error-message"></span>
</div>
<!-- Password -->
<div class="input-box">
<span class="icon"><i class='bx bxs-lock-alt'></i></span>
<input type="password" id="password" name="password" required>
<label>Password</label>
<span id="passwordError" class="error-message"></span>
</div>
<!-- Email -->
<div class="input-box">
<span class="icon"><i class='bx bxs-envelope'></i></span>
<input type="text" id="email" required>
<label>Email</label>
<span id="emailError" class="error-message"></span>
</div>
<!-- Phone -->
<div class="input-box">
<span class="icon"><i class='bx bxs-phone'></i></span>
<input type="tel" id="phone" name="phone" required>
<label>Phone</label>
<span id="phoneError" class="error-message"></span>
</div>
<!-- Address -->
<div class="input-box">
<span class="icon"><i class='bx bxs-map'></i></span>
<input type="text"id="address" name="address" required>
<label>Address</label>
<span id="addressError" class="error-message"></span>
</div>
<!-- Type (Dropdown) -->
<div class="input-box">
<span class="icon"><i class='bx bxs-category'></i></span>
<select required id="type">
<option value="" disabled selected>Select Type</option>
<option style="color: black" value="hospital">hospital</option>
<option style="color: black" value="patient">patient</option>
</select>
</div>
</form>
<button class="btn" onclick="regist()">Sign Up</button>
</div>
</div>
</div>
<script>
var type;
var role;
const getType = document.getElementById("type");
getType.addEventListener("change", function () {
type = getType.value; // Gets the selected value
});
function regist() {
if (type === "hospital") {
role = "HOSPITAL";
} else if (type === "patient") {
role = "PATIENT";
}
const url = '/superAdmin/sign';
const data = {
name: document.getElementsByName("name")[0].value,
password: document.getElementsByName("password")[0].value,
email: document.getElementById("email").value,
phone: document.getElementsByName("phone")[0].value,
address: document.getElementsByName("address")[0].value,
status: 1,
role: role,
type: type
};
console.log("Sending data:", data);
fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data)
})
.then((response) => response.json())
.then((data) => {
console.log(data)
if (data.code === 1) {
console.log(data)
window.location.href="login.html"
}
if(data.code === 0){
alert(data.msg);
}
})
}
</script>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment