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.

90 lines
3.5 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 class="font-poppinsLight">
<form id="hiddenContent" method="POST" action="{% url 'save_point' %}">
{% csrf_token %}
<h1 class="text-secondosiblue text-2xl font-semibold text-center">Add Point</h1>
<select name="task" required
class="hidden w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500">
<option value="{{task.id}}">{{task.name}}</option>
</select>
<div class="w-full flex justify-center items-center">
<input name="text" 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"
>
</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 type="submit"
class="w-fit bg-osiblue border border-osiblue rounded-md text-white text-xl px-5 py-1 hover:bg-white hover:text-osiblue duration-300"
id="addPointsFormButton">Save</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> -->
</form>
</body>
</html>