commit 40aa44fd7a6c199a5f93ef3293c2e71a3dd0a40d Author: Garcia-Gomez Date: Mon Jan 26 13:02:02 2026 -0800 Updated SQL File to remove dummy data. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85f1589 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +### PHPUnit ### +# Covers PHPUnit +# Reference: https://phpunit.de/ + +# Generated files +.phpunit.result.cache +.phpunit.cache + +# PHPUnit +/app/phpunit.xml +/phpunit.xml + +# Build data +/build/ + diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..072e9d8 --- /dev/null +++ b/TODO.md @@ -0,0 +1,19 @@ +1. Change the background color of the project container to a very light color. + +2. Change the headers of the project to be bold with slight larger text. + +3. Allow the project header of the background to be the same color as the project container, but slightly darker. + +4. Change the button text to a button icon for + and -. + +5. Align the + and - of the project buttons with the + and - of the tasks and subtasks. + +6. Each project color should be different + +7. Allow uploading a custom SVG icon via the settings modal. + +8. Automatically detect dark mode and swap favicon colors accordingly. + +9. Save and load a secondary accent color (e.g., for UI highlights or hover effects). + +10. Enable keyboard shortcuts to open modals or trigger common actions. \ No newline at end of file diff --git a/add_project.php b/add_project.php new file mode 100644 index 0000000..92746d6 --- /dev/null +++ b/add_project.php @@ -0,0 +1,15 @@ + 'Project name is required']); + exit; +} + +$stmt = $pdo->prepare("INSERT INTO projects (name) VALUES (?)"); +$stmt->execute([trim($data['name'])]); + +echo json_encode(['success' => true, 'id' => $pdo->lastInsertId()]); +?> diff --git a/add_subtask.php b/add_subtask.php new file mode 100644 index 0000000..f320d92 --- /dev/null +++ b/add_subtask.php @@ -0,0 +1,18 @@ + 'Invalid input']); + exit; +} + +$stmt = $pdo->prepare("INSERT INTO subtasks (task_id, name) VALUES (?, ?)"); +$stmt->execute([$task_id, $name]); + +echo json_encode(['success' => true, 'id' => $pdo->lastInsertId()]); +?> diff --git a/add_task.php b/add_task.php new file mode 100644 index 0000000..8119ffd --- /dev/null +++ b/add_task.php @@ -0,0 +1,18 @@ + 'Invalid input']); + exit; +} + +$stmt = $pdo->prepare("INSERT INTO tasks (project_id, name) VALUES (?, ?)"); +$stmt->execute([$project_id, $name]); + +echo json_encode(['success' => true, 'id' => $pdo->lastInsertId()]); +?> diff --git a/db.php b/db.php new file mode 100644 index 0000000..c8fb1ca --- /dev/null +++ b/db.php @@ -0,0 +1,21 @@ + PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, +]; + +try { + $pdo = new PDO($dsn, $user, $pass, $options); +} catch (\PDOException $e) { + http_response_code(500); + echo "Database error: " . $e->getMessage(); + exit; +} +?> \ No newline at end of file diff --git a/delete_project.php b/delete_project.php new file mode 100644 index 0000000..d900e92 --- /dev/null +++ b/delete_project.php @@ -0,0 +1,6 @@ + 0) { + $pdo->prepare("DELETE FROM projects WHERE id = ?")->execute([$id]); +} diff --git a/delete_subtask.php b/delete_subtask.php new file mode 100644 index 0000000..32649c5 --- /dev/null +++ b/delete_subtask.php @@ -0,0 +1,6 @@ + 0) { + $pdo->prepare("DELETE FROM subtasks WHERE id = ?")->execute([$id]); +} diff --git a/delete_task.php b/delete_task.php new file mode 100644 index 0000000..d7265e3 --- /dev/null +++ b/delete_task.php @@ -0,0 +1,6 @@ + 0) { + $pdo->prepare("DELETE FROM tasks WHERE id = ?")->execute([$id]); +} diff --git a/get_data.php b/get_data.php new file mode 100644 index 0000000..72446e9 --- /dev/null +++ b/get_data.php @@ -0,0 +1,19 @@ +query("SELECT * FROM projects ORDER BY sort_order ASC")->fetchAll(); + +foreach ($projects as &$project) { + $stmt = $pdo->prepare("SELECT * FROM tasks WHERE project_id = ? ORDER BY created_at"); + $stmt->execute([$project['id']]); + $project['tasks'] = $stmt->fetchAll(); + + foreach ($project['tasks'] as &$task) { + $stmt = $pdo->prepare("SELECT * FROM subtasks WHERE task_id = ? ORDER BY created_at"); + $stmt->execute([$task['id']]); + $task['subtasks'] = $stmt->fetchAll(); + } +} + +echo json_encode($projects); +?> diff --git a/get_settings.php b/get_settings.php new file mode 100644 index 0000000..b616dc8 --- /dev/null +++ b/get_settings.php @@ -0,0 +1,5 @@ +query("SELECT title, icon_class, icon_color FROM settings LIMIT 1"); +echo json_encode($stmt->fetch(PDO::FETCH_ASSOC)); +?> diff --git a/index.php b/index.php new file mode 100644 index 0000000..1d2a36d --- /dev/null +++ b/index.php @@ -0,0 +1,784 @@ + + + + + + tinyTask + + + + + + + + +

+ + + + + + +

+ + +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/info.php b/info.php new file mode 100644 index 0000000..9ce26ab --- /dev/null +++ b/info.php @@ -0,0 +1 @@ + diff --git a/reset_settings.php b/reset_settings.php new file mode 100644 index 0000000..f7ac3b2 --- /dev/null +++ b/reset_settings.php @@ -0,0 +1,6 @@ +prepare("UPDATE settings SET title = 'tinyTask', icon_class = 'kanban', icon_color = '#ff0000' WHERE id = 1"); +$stmt->execute(); +echo json_encode(['success' => true]); +?> diff --git a/test.php b/test.php new file mode 100644 index 0000000..1d2a36d --- /dev/null +++ b/test.php @@ -0,0 +1,784 @@ + + + + + + tinyTask + + + + + + + + +

+ + + + + + +

+ + +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tinytask.sql b/tinytask.sql new file mode 100644 index 0000000..bc72cb1 --- /dev/null +++ b/tinytask.sql @@ -0,0 +1,172 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.1 +-- https://www.phpmyadmin.net/ +-- +-- Host: 127.0.0.1 +-- Generation Time: May 09, 2025 at 09:19 AM +-- Server version: 10.4.32-MariaDB +-- PHP Version: 8.2.12 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `taskmanage` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `projects` +-- + +CREATE TABLE `projects` ( + `id` int(11) NOT NULL, + `name` varchar(255) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `sort_order` int(11) DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `settings` +-- + +CREATE TABLE `settings` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT 'Task Management', + `icon_class` varchar(255) DEFAULT 'bi-kanban', + `icon_color` varchar(50) DEFAULT '#6c757d' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `settings` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `subtasks` +-- + +CREATE TABLE `subtasks` ( + `id` int(11) NOT NULL, + `task_id` int(11) DEFAULT NULL, + `name` varchar(255) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `highlighted` tinyint(1) DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `subtasks` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `tasks` +-- + +CREATE TABLE `tasks` ( + `id` int(11) NOT NULL, + `project_id` int(11) DEFAULT NULL, + `name` varchar(255) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `highlighted` tinyint(1) DEFAULT 0, + `task_order` int(11) DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `tasks` +-- + + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `projects` +-- +ALTER TABLE `projects` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `settings` +-- +ALTER TABLE `settings` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `subtasks` +-- +ALTER TABLE `subtasks` + ADD PRIMARY KEY (`id`), + ADD KEY `task_id` (`task_id`); + +-- +-- Indexes for table `tasks` +-- +ALTER TABLE `tasks` + ADD PRIMARY KEY (`id`), + ADD KEY `project_id` (`project_id`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `projects` +-- +ALTER TABLE `projects` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=48; + +-- +-- AUTO_INCREMENT for table `settings` +-- +ALTER TABLE `settings` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + +-- +-- AUTO_INCREMENT for table `subtasks` +-- +ALTER TABLE `subtasks` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=64; + +-- +-- AUTO_INCREMENT for table `tasks` +-- +ALTER TABLE `tasks` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=78; + +-- +-- Constraints for dumped tables +-- + +-- +-- Constraints for table `subtasks` +-- +ALTER TABLE `subtasks` + ADD CONSTRAINT `subtasks_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE; + +-- +-- Constraints for table `tasks` +-- +ALTER TABLE `tasks` + ADD CONSTRAINT `tasks_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE; +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/toggle_highlight.php b/toggle_highlight.php new file mode 100644 index 0000000..5494b35 --- /dev/null +++ b/toggle_highlight.php @@ -0,0 +1,21 @@ +prepare("UPDATE tasks SET highlighted = ? WHERE id = ?"); + $stmt->execute([$highlighted, $id]); + echo json_encode(['success' => true]); +} elseif ($type === 'subtask') { + $stmt = $pdo->prepare("UPDATE subtasks SET highlighted = ? WHERE id = ?"); + $stmt->execute([$highlighted, $id]); + echo json_encode(['success' => true]); +} else { + echo json_encode(['success' => false, 'error' => 'Invalid type']); +} +?> diff --git a/update_project.php b/update_project.php new file mode 100644 index 0000000..e667fa7 --- /dev/null +++ b/update_project.php @@ -0,0 +1,12 @@ +prepare('UPDATE projects SET name = ? WHERE id = ?'); + echo json_encode(['success' => $stmt->execute([$name, $id])]); +} else { + echo json_encode(['success' => false]); +} diff --git a/update_project_order.php b/update_project_order.php new file mode 100644 index 0000000..ff32701 --- /dev/null +++ b/update_project_order.php @@ -0,0 +1,25 @@ + false, 'message' => 'Invalid input']); + exit; +} + +$stmt = $pdo->prepare("UPDATE projects SET sort_order = ? WHERE id = ?"); + +foreach ($data as $item) { + $id = $item['id']; + $order = $item['order']; + + if (!is_numeric($id) || !is_numeric($order)) continue; + + $stmt->execute([$order, $id]); +} + +echo json_encode(['success' => true]); +exit; diff --git a/update_settings.php b/update_settings.php new file mode 100644 index 0000000..3b0c1b1 --- /dev/null +++ b/update_settings.php @@ -0,0 +1,13 @@ +prepare("UPDATE settings SET title = ?, icon_class = ?, icon_color = ? WHERE id = 1"); +$stmt->execute([$title, $icon, $color]); + +echo json_encode(['success' => true]); +?> diff --git a/update_task_order.php b/update_task_order.php new file mode 100644 index 0000000..fe599fc --- /dev/null +++ b/update_task_order.php @@ -0,0 +1,11 @@ +prepare("UPDATE tasks SET task_order = ? WHERE id = ?"); + foreach ($data['task_ids'] as $order => $id) { + $stmt->execute([$order, $id]); + } + echo json_encode