NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Event Management System</title>
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
</head>
<style>

h1, h2 {
color: #333;
}

#registration-form, #login-form, #event-management {
max-width: 400px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f9f9f9;
}

label {
display: block;
margin-bottom: 5px;
color: #555;
}

input {
width: 100%;
padding: 8px;
margin-bottom: 10px;
box-sizing: border-box;
}

button {
background-color: #4caf50;
color: white;
padding: 10px 15px;
border: none;
border-radius: 3px;
cursor: pointer;
}

button:hover {
background-color: #45a049;
}
</style>
<body>

<h1>Event Management System</h1>

<div id="registration-form" >
<h2>User Registration</h2>
<label for="reg-username">Username:</label>
<input type="text" id="reg-username" required>
<br>
<label for="reg-password">Password:</label>
<input type="password" id="reg-password" required>
<br>
<button onclick="registerUser()">Register</button>
</div>

<!-- User Login Form -->
<div id="login-form" >
<h2>User Login</h2>
<label for="login-username">Username:</label>
<input type="text" id="login-username" required>
<br>
<label for="login-password">Password:</label>
<input type="password" id="login-password" required>
<br>
<button onclick="loginUser()">Login</button>
</div>

<!-- Event Management Section -->
<div id="event-management" style="display: none;">
<h2>Event Management</h2>
<button onclick="displayUpcomingEvents()">Upcoming Events</button>
<button onclick="manageMyEvents()">Manage My Events</button>


<button onclick="createNewEvent()">Create New Event</button>
<button onclick="trackMyEvents()">Track My Events</button>
<button onclick="logout()">Logout</button>
</div>
</body>

<script>
const apiUrl = "https://localhost:7299/api/Evensht";

function registerUser() {
const username = $("#reg-username").val();
const password = $("#reg-password").val();

$.post({
url: "https://localhost:7299/api/Evensht/register",
data: JSON.stringify({ Username: username, Password: password }),
contentType: "application/json",
success: function (data) {
alert("registration sucessful");
},
error: function (xhr, status, error) {
alert("Registration failed. Please try again or change username");
console.error("Error:", xhr.responseText);
}
});
}


function loginUser() {
// Implement user login logic using AJAX
const username = $("#login-username").val();
const password = $("#login-password").val();

$.post({
url: `https://localhost:7299/api/vensht/login`,
type:"POST",
contentType: "application/json",
data: JSON.stringify({ Username: username, Password: password }),
success: function(data) {
if (success) {
alert("registration sucessful");
$("registration-form").hide();
$("login-form").hide();
$("event-management").show();
// Assuming you want to hide the loginfo here
("loginfo").hide();
} else {
// Login failed, show an alert or handle accordingly
alert("Login failed. Please check your credentials.");
}
},
error: function(error) {
// Handle errors here
console.error("Error during login:", error);
}
});
}

function displayUpcomingEvents() {
// Implement logic to display upcoming events using AJAX
// Make an AJAX GET request to the upcoming events endpoint
$.get(`$https://localhost:7299/api/Evensht/upcoming`, function (data) {
alert(JSON.stringify(data));
});
}

function manageMyEvents() {
// Implement logic to manage user's events using AJAX
// Make an AJAX POST request to the join event endpoint


const eventName = prompt("Enter the event name to join:");
$.post(`https://localhost:7299/api/Evensht/join`, { Username: "currentUsername", EventName: eventName }, function (data) {
alert(data);
});
}

function createNewEvent() {
// Implement logic to create a new event using AJAX
// Make an AJAX POST request to the create event endpoint
const eventName = prompt("Enter the event name:");
const location = prompt("Enter the event location:");
const date = prompt("Enter the event date (YYYY-MM-DDTHH:mm:ss.fffZ):");


const description = prompt("Enter the event description:");

$.post(`$https://localhost:7299/api/Evensht/create`, { Name: eventName, Location: location, Date: date, Description: description }, function (data) {
alert(data);
});
}

function trackMyEvents() {
// Implement logic to track user's events using AJAX
// Make an AJAX GET request to the track events endpoint


$.get(`$https://localhost:7299/api/Evensht/track/currentUsername`, function (data) {
alert(JSON.stringify(data));
});
}

function logout() {
// Implement logout logic
$("#registration-form").hide();
$("#login-form").show();
$("#event-management").hide();
}
</script>

</body>
</html>
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.