0% found this document useful (0 votes)
8 views2 pages

Popup

This HTML document provides a user interface for editing and deleting tasks. It includes functions to load tasks, display task details, update task information, and delete selected tasks using Google Apps Script. The interface features input fields for task details and buttons for updating or deleting tasks.

Uploaded by

apoorv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Popup

This HTML document provides a user interface for editing and deleting tasks. It includes functions to load tasks, display task details, update task information, and delete selected tasks using Google Apps Script. The interface features input fields for task details and buttons for updating or deleting tasks.

Uploaded by

apoorv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

<!

DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
function loadTasks() {
google.script.run.withSuccessHandler(function(tasks) {
let taskSelect = document.getElementById("taskSelect");
taskSelect.innerHTML = "";
tasks.forEach(task => {
let option = document.createElement("option");
option.value = task.id;
option.text = task.name + " (" + task.id + ")";
taskSelect.appendChild(option);
});
}).getTasksForPopup();
}

function loadTaskDetails() {
let selectedTaskId = document.getElementById("taskSelect").value;
google.script.run.withSuccessHandler(function(task) {
document.getElementById("taskName").value = task.name;
document.getElementById("assignedTo").value = task.assignedTo;
document.getElementById("status").value = task.status;
document.getElementById("timeline").value = task.timeline;
document.getElementById("approvalReq").value = task.approvalReq;
}).getTaskDetails(selectedTaskId);
}

function updateTask() {
let taskId = document.getElementById("taskSelect").value;
let updatedData = [
document.getElementById("taskName").value,
document.getElementById("assignedTo").value,
document.getElementById("status").value,
document.getElementById("timeline").value,
document.getElementById("approvalReq").value
];
google.script.run.updateTask(taskId, updatedData);
alert("Task updated successfully!");
google.script.host.close();
}

function deleteTasks() {
let selectedTasks = Array.from(document.querySelectorAll("#taskSelect
option:checked")).map(option => option.value);
if (selectedTasks.length === 0) {
alert("Please select at least one task to delete.");
return;
}
google.script.run.deleteTasks(selectedTasks);
alert("Selected tasks deleted successfully!");
google.script.host.close();
}

window.onload = loadTasks;
</script>
</head>
<body>
<h2>Edit/Delete Task</h2>

<label for="taskSelect">Select Task:</label>


<select id="taskSelect" onchange="loadTaskDetails()" multiple></select>
<br><br>

<div id="editSection">
<label for="taskName">Task Name:</label>
<input type="text" id="taskName"><br><br>

<label for="assignedTo">Assigned To:</label>


<input type="text" id="assignedTo"><br><br>

<label for="status">Status:</label>
<select id="status">
<option value="Pending">Pending</option>
<option value="In Progress">In Progress</option>
<option value="Completed">Completed</option>
</select><br><br>

<label for="timeline">Timeline:</label>
<input type="date" id="timeline"><br><br>

<label for="approvalReq">Approval Required:</label>


<select id="approvalReq">
<option value="No">No</option>
<option value="Yes">Yes</option>
</select><br><br>

<button onclick="updateTask()">Update Task</button>


</div>

<br>
<button onclick="deleteTasks()">Delete Selected Tasks</button>
</body>
</html>

You might also like