Sidebar
Sidebar
DOCTYPE html>
<html>
<head>
<base target="_top">
<style>
.dropdown-container {
position: relative;
display: inline-block;
width: 100%;
}
.dropdown-btn {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
background: white;
text-align: left;
cursor: pointer;
}
.dropdown-list {
display: none;
position: absolute;
width: 100%;
border: 1px solid #ccc;
background: white;
max-height: 150px;
overflow-y: auto;
z-index: 1000;
}
.dropdown-list label {
display: block;
padding: 5px;
cursor: pointer;
}
.dropdown-list label:hover {
background: #f0f0f0;
}
</style>
<script>
function loadAssignees() {
google.script.run.withSuccessHandler(function(names) {
let dropdownList = document.getElementById("dropdown-list");
dropdownList.innerHTML = ""; // Clear existing options
names.forEach(name => {
let label = document.createElement("label");
let checkbox = document.createElement("input");
checkbox.type = "checkbox";
checkbox.value = name;
checkbox.onclick = updateSelectedAssignees;
label.appendChild(checkbox);
label.appendChild(document.createTextNode(" " + name));
dropdownList.appendChild(label);
});
}).getAssignees();
}
function toggleDropdown() {
let dropdown = document.getElementById("dropdown-list");
dropdown.style.display = dropdown.style.display === "block" ? "none" :
"block";
}
function updateSelectedAssignees() {
let checkboxes = document.querySelectorAll("#dropdown-list
input[type=checkbox]:checked");
let selectedNames = Array.from(checkboxes).map(cb => cb.value);
document.getElementById("assignedTo").value = selectedNames.join(", ");
}
function clearForm() {
document.getElementById("taskName").value = "";
document.getElementById("assignedTo").value = "";
document.querySelectorAll("#dropdown-list input[type=checkbox]").forEach(cb
=> cb.checked = false);
document.getElementById("status").value = "Pending";
document.getElementById("assignedBy").value = "";
document.getElementById("timeline").value = "";
document.getElementById("approvalReq").value = "No";
}
function submitTask() {
let taskName = document.getElementById("taskName").value;
window.onload = loadAssignees;
</script>
</head>
<body>
<h2>Task Manager</h2>
<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" required><br><br>