You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
3.3 KiB
HTML
89 lines
3.3 KiB
HTML
{% load static %}
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Osina</title>
|
|
|
|
<link rel="stylesheet" type="text/css" href='{% static "dist/output.css" %}'>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
|
</head>
|
|
|
|
|
|
<body>
|
|
<div id="hiddenContent">
|
|
<h1 class="text-slate-800 text-2xl font-semibold text-center">Add Point</h1>
|
|
|
|
<div class="w-full flex justify-center items-center">
|
|
<input type="text" placeholder="Type your point here..."
|
|
class="w-full p-3 border border-gray-300 rounded-md bg-transparent outline-none mt-4" id="pointInput"
|
|
required>
|
|
</div>
|
|
|
|
<!-- THE WARNING MESSAGE THAT APPEARS WHEN THE USER CLICKS ON THE ADD BUTTON WITH AN EMPTY INPUT FIELD -->
|
|
<p class="text-red-500 font-light mt-2" id="AlertPointMessage">
|
|
|
|
</p>
|
|
|
|
<div class="w-full flex justify-center items-center mt-4 gap-4">
|
|
<button
|
|
class="w-fit bg-blue-500 border border-blue-500 rounded-md text-white text-xl px-3 py-2 hover:bg-white hover:text-blue-500"
|
|
id="addPointsFormButton">Add</button>
|
|
|
|
<button
|
|
class="w-fit bg-blue-500 border border-blue-500 rounded-md text-white text-xl px-3 py-2 hover:bg-white hover:text-blue-500">Save
|
|
Notes</button>
|
|
</div>
|
|
|
|
<div class="w-full flex flex-col" id="allPointsContainer">
|
|
<!-- THE ENTERED POINTS BY THE USER CONTAINER -->
|
|
</div>
|
|
|
|
|
|
<script>
|
|
const allPointsContainer = document.getElementById("allPointsContainer");
|
|
const pointInput = document.getElementById("pointInput");
|
|
const addButton = document.getElementById("addPointsFormButton");
|
|
const alertMessage = document.getElementById("AlertPointMessage");
|
|
|
|
addButton.addEventListener("click", function () {
|
|
// Fetch the entered in the input field
|
|
const pointText = pointInput.value;
|
|
|
|
// Check if the input field is empty
|
|
if (pointText.trim() === "") {
|
|
// Show an error message
|
|
alertMessage.textContent = "Please enter a point before adding.";
|
|
return; // Exit the function without adding if input is empty
|
|
}
|
|
|
|
// Clear the error message
|
|
alertMessage.textContent = "";
|
|
|
|
// Create a new container div for each pair
|
|
const container = document.createElement("div");
|
|
container.className = "w-full flex justify-start items-center gap-3 mt-3";
|
|
|
|
// Create a new paragraph element
|
|
const newParagraph = document.createElement("p");
|
|
|
|
// Set the text content of the new paragraph to the input text
|
|
newParagraph.textContent = "- " + pointText;
|
|
|
|
container.appendChild(newParagraph);
|
|
|
|
allPointsContainer.appendChild(container);
|
|
|
|
// Clear the input field
|
|
pointInput.value = "";
|
|
});
|
|
</script>
|
|
|
|
</div>
|
|
</body>
|
|
|
|
</html> |