chandannsharma's picture
create a web application for my team, they can create task for devOps team. DeVOps team member take the task ownership and mark it in progress, and then once done mark it is done
272d177 verified
Raw History Blame Contribute Delete
2.66 kB
document.addEventListener('DOMContentLoaded', function() {
// Theme toggle functionality
const themeToggle = document.getElementById('theme-toggle');
const html = document.documentElement;
// Check for saved theme preference or use preferred color scheme
const savedTheme = localStorage.getItem('theme') ||
(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
html.classList.add(savedTheme);
themeToggle.addEventListener('click', () => {
html.classList.toggle('dark');
const theme = html.classList.contains('dark') ? 'dark' : 'light';
localStorage.setItem('theme', theme);
});
// Task modal functionality
const addTaskBtn = document.getElementById('add-task-btn');
const addTaskModal = document.getElementById('add-task-modal');
const closeModalBtn = document.getElementById('close-modal-btn');
const cancelTaskBtn = document.getElementById('cancel-task-btn');
const taskForm = document.getElementById('task-form');
addTaskBtn.addEventListener('click', () => {
addTaskModal.classList.remove('hidden');
});
[closeModalBtn, cancelTaskBtn].forEach(btn => {
btn.addEventListener('click', () => {
addTaskModal.classList.add('hidden');
taskForm.reset();
});
});
taskForm.addEventListener('submit', (e) => {
e.preventDefault();
const title = document.getElementById('task-title').value;
const description = document.getElementById('task-description').value;
const category = document.getElementById('task-category').value;
// In a real app, you would send this to your backend
console.log('New task:', { title, description, category });
// Close modal and reset form
addTaskModal.classList.add('hidden');
taskForm.reset();
// Show success message
alert('Task added to backlog!');
});
// Task action handlers
document.querySelectorAll('.task-action-btn').forEach(btn => {
btn.addEventListener('click', function() {
const action = this.getAttribute('data-action');
const taskCard = this.closest('.task-card');
const taskId = taskCard.getAttribute('data-id');
switch(action) {
case 'assign':
// In a real app, you would show a modal to select assignee
alert(`Assigning task ${taskId} to a team member`);
break;
case 'unassign':
alert(`Unassigning