Repository navigation
Expand file tree
/
Copy pathadd.html
More file actions
148 lines (132 loc) Β· 6.33 KB
/
Copy pathadd.html
File metadata and controls
148 lines (132 loc) Β· 6.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add Item - Daily Dashboard</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Floating Theme Toggle -->
<button class="floating-theme-toggle" id="darkModeToggle" title="Toggle Dark Mode">
π
</button>
<!-- Floating Back Button -->
<button class="floating-back-btn" onclick="window.location.href='index.html'" title="Back to Dashboard">
β
</button>
<!-- Add Item Form -->
<main class="add-page">
<div class="form-container">
<form id="addItemForm" class="add-form">
<div class="form-group">
<label for="category">Category *</label>
<select id="category" name="category" required>
<option value="">-- Select Category --</option>
<option value="todo">π To Do</option>
<option value="running">π Running Tasks</option>
<option value="ideas">π‘ Ideas</option>
<option value="completed">β
Completed Tasks</option>
<option value="reminder">π Reminder</option>
<option value="exam">π Exam Schedule</option>
<option value="problems">π§© Problem List</option>
<option value="learn">π New Things to Learn</option>
</select>
</div>
<div class="form-group">
<label for="title">Title *</label>
<input type="text" id="title" name="title" placeholder="Enter item title" required>
</div>
<div class="form-group">
<label for="description">Description (optional)</label>
<textarea id="description" name="description" rows="4" placeholder="Add details..."></textarea>
</div>
<div class="form-group" id="priorityGroupMain">
<label for="priority">Priority Level (optional - for To Do & Reminder)</label>
<div class="priority-selector">
<label class="priority-option">
<input type="radio" name="priority" value="1">
<span class="priority-badge priority-1">π΄ High (1)</span>
</label>
<label class="priority-option">
<input type="radio" name="priority" value="2">
<span class="priority-badge priority-2">π Medium (2)</span>
</label>
<label class="priority-option">
<input type="radio" name="priority" value="3">
<span class="priority-badge priority-3">π΅ Normal (3)</span>
</label>
<label class="priority-option">
<input type="radio" name="priority" value="4">
<span class="priority-badge priority-4">π’ Low (4)</span>
</label>
<label class="priority-option">
<input type="radio" name="priority" value="" checked>
<span class="priority-badge priority-none">βͺ None</span>
</label>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="date">Date (optional)</label>
<input type="date" id="date" name="date">
</div>
<div class="form-group">
<label for="time">Time (optional)</label>
<input type="time" id="time" name="time">
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary btn-large">
πΎ Save Item
</button>
<button type="reset" class="btn btn-secondary btn-large">
π Clear Form
</button>
</div>
</form>
<!-- Success Message -->
<div id="successMessage" class="success-message" style="display: none;">
β
Item added successfully! Redirecting...
</div>
</div>
</main>
<script src="app.js"></script>
<script>
// Handle form submission on add.html
document.getElementById('addItemForm').addEventListener('submit', function(e) {
e.preventDefault();
const category = document.getElementById('category').value;
const title = document.getElementById('title').value;
const description = document.getElementById('description').value;
const date = document.getElementById('date').value;
const time = document.getElementById('time').value;
const priority = document.querySelector('input[name="priority"]:checked')?.value || '';
// Create new item
const newItem = {
id: Date.now().toString(),
category: category,
title: title,
description: description,
date: date,
time: time,
priority: priority,
completed: false,
createdAt: new Date().toISOString()
};
// Get existing items from localStorage
let items = JSON.parse(localStorage.getItem('dashboardItems') || '[]');
// Add new item
items.push(newItem);
// Save back to localStorage
localStorage.setItem('dashboardItems', JSON.stringify(items));
// Show success message
document.getElementById('successMessage').style.display = 'block';
// Redirect to dashboard after 1 second
setTimeout(() => {
window.location.href = 'index.html';
}, 1000);
});
</script>
</body>
</html>