-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
304 additions
and
152 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
frontend/source/components/eventCreationForm/eventCreationForm.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* Modal Styles */ | ||
#event-form-modal { | ||
display: none; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
justify-content: center; | ||
align-items: center; | ||
z-index: 1000; | ||
} | ||
|
||
#event-form-modal .modal-content { | ||
max-width: 600px; | ||
/* Increase width slightly */ | ||
margin: auto; | ||
padding: 30px; | ||
/* Increase padding for better spacing */ | ||
background-color: #1a002b; | ||
border-radius: 12px; | ||
/* More rounded corners */ | ||
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5); | ||
/* Subtle shadow */ | ||
color: #ffd700; | ||
text-align: center; | ||
/* Center align content */ | ||
} | ||
|
||
#event-form-modal .close-button { | ||
float: right; | ||
font-size: 18px; | ||
cursor: pointer; | ||
color: #ff0000; | ||
font-weight: bold; | ||
} | ||
|
||
/* Event Creation Form */ | ||
#event-creation-form { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 20px; | ||
/* Add more space between input fields */ | ||
padding: 10px; | ||
margin: 0 auto; | ||
text-align: left; | ||
align-items: center; | ||
/* Center align elements */ | ||
} | ||
|
||
#event-creation-form input, | ||
#event-creation-form textarea, | ||
#event-creation-form select { | ||
width: 90%; | ||
/* Ensure fields don't touch edges */ | ||
padding: 12px; | ||
/* Add more padding for a modern look */ | ||
border-radius: 8px; | ||
border: 1px solid #ffd700; | ||
background-color: #262135; | ||
color: #ffd700; | ||
font-size: 1em; | ||
} | ||
|
||
#event-creation-form label { | ||
font-weight: bold; | ||
font-size: 1em; | ||
color: #ffd700; | ||
margin-bottom: 5px; | ||
/* Add space between label and input */ | ||
} | ||
|
||
#event-creation-form button:hover { | ||
background-color: #0056b3; | ||
transform: scale(1.05); | ||
/* Slight zoom effect */ | ||
} | ||
|
||
/* Optional: Add spacing for the modal close button */ | ||
#event-form-modal .close-button { | ||
position: absolute; | ||
top: 15px; | ||
right: 15px; | ||
font-size: 24px; | ||
color: #ff0000; | ||
cursor: pointer; | ||
transition: color 0.3s ease; | ||
} | ||
|
||
#event-form-modal .close-button:hover { | ||
color: #ffd700; | ||
} |
21 changes: 21 additions & 0 deletions
21
frontend/source/components/eventCreationForm/eventCreationForm.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<section id="event-creation-form"> | ||
<h2>Create an Event</h2> | ||
<form id="create-event-form"> | ||
<label for="event-name">Event Name:</label> | ||
<input type="text" id="event-name" name="event-name" required /> | ||
|
||
<label for="event-description">Description:</label> | ||
<textarea id="event-description" name="event-description" rows="4" required></textarea> | ||
|
||
<label for="event-location">Location:</label> | ||
<input type="text" id="event-location" name="event-location" required /> | ||
|
||
<label for="event-tags">Tags:</label> | ||
<input type="text" id="event-tags" name="event-tags" placeholder="e.g., Rock, Jazz" required /> | ||
|
||
<label for="event-time">Time:</label> | ||
<input type="datetime-local" id="event-time" name="event-time" required /> | ||
|
||
<button type="submit">Create Event</button> | ||
</form> | ||
</section> |
64 changes: 64 additions & 0 deletions
64
frontend/source/components/eventCreationForm/eventCreationFrom.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
|
||
document.addEventListener("DOMContentLoaded", () => { | ||
const openButton = document.getElementById("open-event-form"); | ||
const modal = document.getElementById("event-form-modal"); | ||
const closeButton = modal.querySelector(".close-button"); | ||
|
||
// Open the modal | ||
openButton.addEventListener("click", () => { | ||
modal.style.display = "flex"; | ||
}); | ||
|
||
// Close the modal | ||
closeButton.addEventListener("click", () => { | ||
modal.style.display = "none"; | ||
}); | ||
|
||
// Close modal when clicking outside content | ||
window.addEventListener("click", (event) => { | ||
if (event.target === modal) { | ||
modal.style.display = "none"; | ||
} | ||
}); | ||
|
||
// Handle form submission | ||
document | ||
.getElementById("create-event-form") | ||
.addEventListener("submit", function (event) { | ||
event.preventDefault(); // Prevent default behavior | ||
|
||
// Get form values | ||
const eventName = document.getElementById("event-name").value; | ||
const eventDescription = | ||
document.getElementById("event-description").value; | ||
const eventLocation = document.getElementById("event-location").value; | ||
const eventTags = document | ||
.getElementById("event-tags") | ||
.value.split(",") | ||
.map((tag) => tag.trim()); | ||
const eventTime = document.getElementById("event-time").value; | ||
const eventImage = document.getElementById("event-image").files[0]; // Get the uploaded file | ||
|
||
// Create a FormData object | ||
const formData = new FormData(); | ||
formData.append("eventName", eventName); | ||
formData.append("eventDescription", eventDescription); | ||
formData.append("eventLocation", eventLocation); | ||
formData.append("eventTags", eventTags); | ||
formData.append("eventTime", eventTime); | ||
formData.append("eventImage", eventImage); // Append the file | ||
|
||
// Log the form data for testing | ||
console.log("Form Data:"); | ||
for (let [key, value] of formData.entries()) { | ||
console.log(`${key}:`, value); | ||
} | ||
|
||
// TODO: Send formData to a server using fetch or AJAX | ||
alert("Event created successfully! (Check console for form data)"); | ||
|
||
// Clear the form and close the modal | ||
document.getElementById("create-event-form").reset(); | ||
modal.style.display = "none"; | ||
}); | ||
}); |
Oops, something went wrong.