Skip to content

Commit

Permalink
Merge pull request #300 from Sami3160/main
Browse files Browse the repository at this point in the history
resolved priority bug
  • Loading branch information
Kritika30032002 authored Dec 17, 2023
2 parents b6a75c4 + e1a9aa7 commit 85aaa2d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ function handleEditClick(e) {
const editedDescriptionText = descriptionInput.value;
const editedDueDate = new Date(dueDateInput.value);
const currentDate = new Date().toISOString().split("T")[0];
const editedPriority=document.getElementById("priority").value;

if (!editedItemText.trim()) {
displayErrorMessage("Task not entered");
Expand All @@ -123,15 +124,23 @@ function handleEditClick(e) {
displayErrorMessage("Due date has already passed !!!");
return false;
}
if(!editedPriority){
displayErrorMessage("Please select priority")
return false
}

const listItem = editItem.parentElement;
console.log(listItem.childNodes)
console.log(listItem.childNodes[1].textContent)
listItem.childNodes[1].textContent = editedItemText;
listItem.childNodes[4].textContent = "Description:"+editedDescriptionText;
listItem.childNodes[7].textContent = editedPriority;
if (editedDueDate >= new Date(currentDate)) {
listItem.childNodes[6].textContent = `Due Date:${dueDateInput.value}`;
}
const capitalizedPriority =editedPriority.charAt(0).toUpperCase() + editedPriority.slice(1).toLowerCase();
console.log(editedPriority)
listItem.className = `list-group-item card shadow mb-4 bg-transparent ${priorityColors[capitalizedPriority]}`;

displaySuccessMessage("Task edited successfully !!!");
editItem = null;
Expand Down
4 changes: 4 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ body.dark-mode::before {
word-break: break-all;
word-wrap: break-word;
padding: 0.75rem;
width:80%;
}

.list-group-item button {
Expand Down Expand Up @@ -1005,6 +1006,9 @@ ul {
flex-wrap: wrap;
width: 100vw;
}
ul.list-group {
width: auto;
}

li {
margin:10px;
Expand Down

0 comments on commit 85aaa2d

Please sign in to comment.