in this ocdes (<?php // /public/workspace/index.php // Enable error reporting for…
- User
in this ocdes (<?php // /public/workspace/index.php
// Enable error reporting for debugging (disable in production) ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
// Start output buffering to prevent "headers already sent" errors ob_start();
// Include authentication, database connection, and utility functions require_once DIR . '/../../includes/auth.php'; require_once DIR . '/../../includes/db_connect.php'; require_once DIR . '/../../includes/functions.php'; // Contains sanitize_input()
// Ensure the user is authenticated if (!isset($_SESSION['user_id'])) { header("Location: /public/login.php"); exit(); }
_SESSION['user_id']; errors = [];
// Fetch summary data: Total Number of Plans, Posts, Notes try { // Total Plans stmt = plans_count_sql); if (!stmt) { throw new Exception("Prepare statement failed for plans count: " . conn->error); } result = plans_count = stmt->close();
// Total Posts $posts_count_sql = "SELECT COUNT(*) AS total FROM workspace_posts"; $stmt = $conn->prepare($posts_count_sql); if (!$stmt) { throw new Exception("Prepare statement failed for posts count: " . $conn->error); } $stmt->execute(); $result = $stmt->get_result(); $posts_count = $result->fetch_assoc()['total'] ?? 0; $stmt->close(); // Total Notes $notes_count_sql = "SELECT COUNT(*) AS total FROM workspace_notes"; $stmt = $conn->prepare($notes_count_sql); if (!$stmt) { throw new Exception("Prepare statement failed for notes count: " . $conn->error); } $stmt->execute(); $result = $stmt->get_result(); $notes_count = $result->fetch_assoc()['total'] ?? 0; $stmt->close();} catch (Exception e) { errors[] = plans_count = notes_count = 0; // Default values in case of error }
// Fetch upcoming plans for the calendar along with creator's username try { stmt = calendar_sql); if (!stmt) { throw new Exception("Prepare statement failed for calendar data: " . conn->error); } result = $stmt->get_result();
while ($plan = $result->fetch_assoc()) { $calendar_plans[] = [ 'id' => $plan['id'], 'title' => sanitize_input($plan['title']) . " (by " . sanitize_input($plan['username']) . ")", 'start' => $plan['due_date'], // FullCalendar accepts datetime strings ]; } $stmt->close();} catch (Exception e) { errors[] = $e->getMessage(); }
// (Optional) Fetch recent activities: Plans, Posts, Notes recent_posts = []; items_per_section = 5; // Number of items to display in each recent section
try { // Recent Plans stmt = recent_plans_sql); if (stmt) { stmt->bind_param("i", stmt->execute(); stmt->get_result(); while (result->fetch_assoc()) { plan; } $stmt->close(); }
// Recent Posts $recent_posts_sql = "SELECT wp.*, u.username FROM workspace_posts wp JOIN users u ON wp.user_id = u.id ORDER BY wp.created_at DESC LIMIT ?"; $stmt = $conn->prepare($recent_posts_sql); if ($stmt) { $stmt->bind_param("i", $items_per_section); $stmt->execute(); $result = $stmt->get_result(); while ($post = $result->fetch_assoc()) { $recent_posts[] = $post; } $stmt->close(); } // Recent Notes $recent_notes_sql = "SELECT wn.*, u.username FROM workspace_notes wn JOIN users u ON wn.user_id = u.id ORDER BY wn.created_at DESC LIMIT ?"; $stmt = $conn->prepare($recent_notes_sql); if ($stmt) { $stmt->bind_param("i", $items_per_section); $stmt->execute(); $result = $stmt->get_result(); while ($note = $result->fetch_assoc()) { $recent_notes[] = $note; } $stmt->close(); }} catch (Exception e) { errors[] = $e->getMessage(); } ?>
<!-- Main Content --> <main class="container mx-auto p-6 mt-24 mb-20"> <h1 class="text-3xl font-bold mb-6">Workspace Dashboard</h1> <!-- Display Errors --> <?php if (!empty($errors)): ?> <div class="mb-6"> <?php foreach ($errors as $error): ?> <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-2"> <?= htmlspecialchars($error) ?> </div> <?php endforeach; ?> </div> <?php endif; ?> <!-- Summary Cards --> <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6"> <!-- Plans --> <div class="flex items-center p-4 bg-blue-500 text-white rounded-lg shadow hover:bg-blue-600 transition"> <i class="bi bi-list-task text-4xl mr-4"></i> <div> <h2 class="text-xl font-semibold">Total Plans</h2> <p class="text-2xl"><?= htmlspecialchars(number_format($plans_count)) ?></p> </div> </div> <!-- Posts --> <div class="flex items-center p-4 bg-green-500 text-white rounded-lg shadow hover:bg-green-600 transition"> <i class="bi bi-calendar-plus text-4xl mr-4"></i> <div> <h2 class="text-xl font-semibold">Total Posts</h2> <p class="text-2xl"><?= htmlspecialchars(number_format($posts_count)) ?></p> </div> </div> <!-- Notes --> <div class="flex items-center p-4 bg-purple-500 text-white rounded-lg shadow hover:bg-purple-600 transition"> <i class="bi bi-stickies text-4xl mr-4"></i> <div> <h2 class="text-xl font-semibold">Total Notes</h2> <p class="text-2xl"><?= htmlspecialchars(number_format($notes_count)) ?></p> </div> </div> </div> <!-- Quick Links --> <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6"> <a href="plans.php" class="block p-6 bg-blue-400 text-white rounded-lg shadow hover:bg-blue-500 transition"> <i class="bi bi-list-task text-3xl"></i> <h2 class="mt-2 text-xl font-semibold">Manage Plans</h2> </a> <a href="posts.php" class="block p-6 bg-green-400 text-white rounded-lg shadow hover:bg-green-500 transition"> <i class="bi bi-calendar-plus text-3xl"></i> <h2 class="mt-2 text-xl font-semibold">Manage Posts</h2> </a> <a href="notes.php" class="block p-6 bg-purple-400 text-white rounded-lg shadow hover:bg-purple-500 transition"> <i class="bi bi-stickies text-3xl"></i> <h2 class="mt-2 text-xl font-semibold">Manage Notes</h2> </a> </div> <!-- Calendar --> <div class="mb-6"> <h2 class="text-2xl font-bold mb-4">Upcoming Plans</h2> <div id='calendar'></div> </div> <!-- (Optional) Recent Activities --> <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6"> <!-- Recent Plans --> <div> <h3 class="text-xl font-semibold mb-2">Recent Plans</h3> <?php if (!empty($recent_plans)): ?> <ul> <?php foreach ($recent_plans as $plan): ?> <li class="mb-2"> <span class="font-semibold"><?= htmlspecialchars($plan['title']) ?></span> by <span class="text-gray-700"><?= htmlspecialchars($plan['username']) ?></span> <br> <span class="text-sm text-gray-500"><?= htmlspecialchars(date("d M Y, h:i A", strtotime($plan['created_at']))) ?></span> </li> <?php endforeach; ?> </ul> <?php else: ?> <p class="text-gray-500">No recent plans found.</p> <?php endif; ?> </div> <!-- Recent Posts --> <div> <h3 class="text-xl font-semibold mb-2">Recent Posts</h3> <?php if (!empty($recent_posts)): ?> <ul> <?php foreach ($recent_posts as $post): ?> <li class="mb-2"> <span class="font-semibold"><?= htmlspecialchars($post['platform']) ?></span>: <?= htmlspecialchars(substr($post['content'], 0, 50)) ?>... by <span class="text-gray-700"><?= htmlspecialchars($post['username']) ?></span> <br> <span class="text-sm text-gray-500"><?= htmlspecialchars(date("d M Y, h:i A", strtotime($post['created_at']))) ?></span> </li> <?php endforeach; ?> </ul> <?php else: ?> <p class="text-gray-500">No recent posts found.</p> <?php endif; ?> </div> <!-- Recent Notes --> <div> <h3 class="text-xl font-semibold mb-2">Recent Notes</h3> <?php if (!empty($recent_notes)): ?> <ul> <?php foreach ($recent_notes as $note): ?> <li class="mb-2"> <span class="font-semibold"><?= htmlspecialchars($note['title']) ?></span> by <span class="text-gray-700"><?= htmlspecialchars($note['username']) ?></span> <br> <span class="text-sm text-gray-500"><?= htmlspecialchars(date("d M Y, h:i A", strtotime($note['created_at']))) ?></span> </li> <?php endforeach; ?> </ul> <?php else: ?> <p class="text-gray-500">No recent notes found.</p> <?php endif; ?> </div> </div> </main> <!-- Footer --> <footer class="fixed bottom-0 left-0 w-full bg-gray-800 text-white text-center p-4"> © 2024 Kaak Alia Bakery. All rights reserved. </footer> <!-- FullCalendar JS --> <script src='https://cdn.jsdelivr.net/npm/fullcalendar@5.11.3/main.min.js'></script> <script> document.addEventListener('DOMContentLoaded', function() { var calendarEl = document.getElementById('calendar'); var calendarData = <?= json_encode($calendar_plans) ?>; var calendar = new FullCalendar.Calendar(calendarEl, { initialView: 'dayGridMonth', events: calendarData, headerToolbar: { left: 'prev,next today', center: 'title', right: 'dayGridMonth,timeGridWeek,timeGridDay' }, eventClick: function(info) { // Redirect to edit plan page with the plan ID const planId = info.event.id; if(planId){ window.location.href = 'edit_plan.php?id=' + planId; } }, eventColor: '#06D6A0', // Optional: Customize event color navLinks: true, // Can click day/week names to navigate views selectable: true, selectMirror: true, select: function(arg) { // Handle date selection for creating new plans if(confirm('Would you like to add a new plan on ' + arg.startStr + '?')) { window.location.href = 'create_plan.php?due_date=' + encodeURIComponent(arg.startStr); } calendar.unselect() } }); calendar.render(); }); </script>-- version 5.2.1 -- https://www.phpmyadmin.net/
-- Host: 127.0.0.1:3306 -- Generation Time: Nov 10, 2024 at 08:15 AM -- Server version: 10.11.9-MariaDB -- PHP Version: 7.2.34
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:
u406552082_kaakalia
-- -- Table structure for table
customersCREATE TABLE
customers(idint(11) NOT NULL,namevarchar(100) NOT NULL,contactvarchar(50) DEFAULT NULL,delivery_addresstext DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- -- Table structure for table
driversCREATE TABLE
drivers(idint(11) NOT NULL,namevarchar(100) NOT NULL,numbervarchar(15) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- -- Table structure for table
ordersCREATE TABLE
orders(idint(11) NOT NULL,customer_idint(11) NOT NULL,statusenum('Pending','In Progress','Completed','Delivered') DEFAULT 'Pending',priorityenum('Normal','Important','Quick') DEFAULT 'Normal',order_datedatetime DEFAULT current_timestamp(),delivery_datetimedatetime DEFAULT NULL,delivery_datedate DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- -- Table structure for table
order_itemsCREATE TABLE
order_items(idint(11) NOT NULL,order_idint(11) NOT NULL,product_idint(11) NOT NULL,quantityint(11) NOT NULL DEFAULT 1,packaging_preferencesvarchar(255) DEFAULT NULL,discount_percentagedecimal(5,2) DEFAULT 0.00,discount_reasonvarchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- -- Table structure for table
productsCREATE TABLE
products(idint(11) NOT NULL,namevarchar(100) NOT NULL,sizevarchar(50) DEFAULT NULL,pricedecimal(10,2) NOT NULL,categoryvarchar(50) DEFAULT NULL,thumbnailvarchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- -- Table structure for table
usersCREATE TABLE
users(idint(11) NOT NULL,usernamevarchar(50) NOT NULL,passwordvarchar(255) NOT NULL,roleenum('admin','staff') NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- -- Table structure for table
workspace_notesCREATE TABLE
workspace_notes(idint(11) NOT NULL,user_idint(11) NOT NULL,titlevarchar(255) NOT NULL,contenttext NOT NULL,created_atdatetime DEFAULT current_timestamp(),updated_atdatetime DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- -- Table structure for table
workspace_plansCREATE TABLE
workspace_plans(idint(11) NOT NULL,user_idint(11) NOT NULL,titlevarchar(255) NOT NULL,descriptiontext DEFAULT NULL,due_datedatetime DEFAULT NULL,statusenum('Not Started','In Progress','Completed') DEFAULT 'Not Started',created_atdatetime DEFAULT current_timestamp(),updated_atdatetime DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- -- Table structure for table
workspace_postsCREATE TABLE
workspace_posts(idint(11) NOT NULL,user_idint(11) NOT NULL,platformenum('Instagram','Facebook','Twitter','Other') NOT NULL,contenttext NOT NULL,media_urlvarchar(255) DEFAULT NULL,scheduled_datetimedatetime DEFAULT NULL,statusenum('Scheduled','Posted','Failed') DEFAULT 'Scheduled',created_atdatetime DEFAULT current_timestamp(),updated_atdatetime DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;-- -- Indexes for dumped tables
-- -- Indexes for table
customersALTER TABLE
customersADD PRIMARY KEY (id);-- -- Indexes for table
driversALTER TABLE
driversADD PRIMARY KEY (id);-- -- Indexes for table
ordersALTER TABLE
ordersADD PRIMARY KEY (id), ADD KEYcustomer_id(customer_id), ADD KEYidx_orders_customer_id(customer_id);-- -- Indexes for table
order_itemsALTER TABLE
order_itemsADD PRIMARY KEY (id), ADD KEYorder_id(order_id), ADD KEYproduct_id(product_id), ADD KEYidx_order_items_order_id(order_id), ADD KEYidx_order_items_product_id(product_id);-- -- Indexes for table
productsALTER TABLE
productsADD PRIMARY KEY (id);-- -- Indexes for table
usersALTER TABLE
usersADD PRIMARY KEY (id), ADD UNIQUE KEYusername(username);-- -- Indexes for table
workspace_notesALTER TABLE
workspace_notesADD PRIMARY KEY (id), ADD KEYuser_id(user_id);-- -- Indexes for table
workspace_plansALTER TABLE
workspace_plansADD PRIMARY KEY (id), ADD KEYuser_id(user_id);-- -- Indexes for table
workspace_postsALTER TABLE
workspace_postsADD PRIMARY KEY (id), ADD KEYuser_id(user_id);-- -- AUTO_INCREMENT for dumped tables
-- -- AUTO_INCREMENT for table
customersALTER TABLE
customersMODIFYidint(11) NOT NULL AUTO_INCREMENT;-- -- AUTO_INCREMENT for table
driversALTER TABLE
driversMODIFYidint(11) NOT NULL AUTO_INCREMENT;-- -- AUTO_INCREMENT for table
ordersALTER TABLE
ordersMODIFYidint(11) NOT NULL AUTO_INCREMENT;-- -- AUTO_INCREMENT for table
order_itemsALTER TABLE
order_itemsMODIFYidint(11) NOT NULL AUTO_INCREMENT;-- -- AUTO_INCREMENT for table
productsALTER TABLE
productsMODIFYidint(11) NOT NULL AUTO_INCREMENT;-- -- AUTO_INCREMENT for table
usersALTER TABLE
usersMODIFYidint(11) NOT NULL AUTO_INCREMENT;-- -- AUTO_INCREMENT for table
workspace_notesALTER TABLE
workspace_notesMODIFYidint(11) NOT NULL AUTO_INCREMENT;-- -- AUTO_INCREMENT for table
workspace_plansALTER TABLE
workspace_plansMODIFYidint(11) NOT NULL AUTO_INCREMENT;-- -- AUTO_INCREMENT for table
workspace_postsALTER TABLE
workspace_postsMODIFYidint(11) NOT NULL AUTO_INCREMENT;-- -- Constraints for dumped tables
-- -- Constraints for table
ordersALTER TABLE
ordersADD CONSTRAINTfk_orders_customer_idFOREIGN KEY (customer_id) REFERENCEScustomers(id) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINTorders_ibfk_1FOREIGN KEY (customer_id) REFERENCEScustomers(id) ON DELETE CASCADE;-- -- Constraints for table
order_itemsALTER TABLE
order_itemsADD CONSTRAINTfk_order_items_order_idFOREIGN KEY (order_id) REFERENCESorders(id) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINTfk_order_items_product_idFOREIGN KEY (product_id) REFERENCESproducts(id) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINTorder_items_ibfk_1FOREIGN KEY (order_id) REFERENCESorders(id) ON DELETE CASCADE, ADD CONSTRAINTorder_items_ibfk_2FOREIGN KEY (product_id) REFERENCESproducts(id) ON DELETE CASCADE;-- -- Constraints for table
workspace_notesALTER TABLE
workspace_notesADD CONSTRAINTfk_workspace_notes_user_idFOREIGN KEY (user_id) REFERENCESusers(id) ON DELETE CASCADE;-- -- Constraints for table
workspace_plansALTER TABLE
workspace_plansADD CONSTRAINTfk_workspace_plans_user_idFOREIGN KEY (user_id) REFERENCESusers(id) ON DELETE CASCADE;-- -- Constraints for table
workspace_postsALTER TABLE
workspace_postsADD CONSTRAINTfk_workspace_posts_user_idFOREIGN KEY (user_id) REFERENCESusers(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 */;) in this codes (<?php // /public/workspace/create_note.php
// Enable error reporting for debugging (disable in production) ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
// Start output buffering to prevent "headers already sent" errors ob_start();
// Include authentication, database connection, and utility functions require_once DIR . '/../../includes/auth.php'; require_once DIR . '/../../includes/db_connect.php'; require_once DIR . '/../../includes/functions.php'; // Contains sanitize_input()
_SESSION['user_id']; $errors = [];
if (_SERVER['REQUEST_METHOD'] == 'POST') { title = sanitize_input(content = sanitize_input($_POST['content'] ?? '');
// Validation if (empty($title)) { $errors[] = "Title is required."; } if (empty($content)) { $errors[] = "Content is required."; } if (empty($errors)) { $sql = "INSERT INTO workspace_notes (user_id, title, content) VALUES (?, ?, ?)"; if ($stmt = $conn->prepare($sql)) { $stmt->bind_param("iss", $user_id, $title, $content); if ($stmt->execute()) { header("Location: notes.php"); exit(); } else { $errors[] = "Failed to create note. Please try again."; } $stmt->close(); } else { $errors[] = "Database error: Unable to prepare statement."; } }} ?>
<!-- Main Content --> <main class="container mx-auto p-6 mt-24 flex-grow"> <h1 class="text-2xl font-bold mb-6">Create New Note</h1> <!-- Display Errors --> <?php if(!empty($errors)): ?> <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4"> <ul> <?php foreach($errors as $error): ?> <li><?= htmlspecialchars($error) ?></li> <?php endforeach; ?> </ul> </div> <?php endif; ?> <!-- Note Creation Form --> <form action="create_note.php" method="POST" class="bg-white p-6 rounded shadow-md"> <div class="mb-4"> <label class="block text-gray-700">Title<span class="text-red-500">*</span></label> <input type="text" name="title" class="w-full px-3 py-2 border rounded focus:outline-none focus:ring focus:border-blue-300" required value="<?= isset($_POST['title']) ? htmlspecialchars($_POST['title']) : '' ?>"> </div> <div class="mb-4"> <label class="block text-gray-700">Content<span class="text-red-500">*</span></label> <textarea name="content" class="w-full px-3 py-2 border rounded focus:outline-none focus:ring focus:border-blue-300" rows="8" required><?= isset($_POST['content']) ? htmlspecialchars($_POST['content']) : '' ?></textarea> </div> <div class="flex justify-between"> <a href="notes.php" class="px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600">Cancel</a> <button type="submit" class="px-4 py-2 bg-purple-500 text-white rounded hover:bg-purple-600">Create Note</button> </div> </form> </main> <!-- Footer --> <footer class="bg-gray-800 text-white text-center p-4"> © 2024 Kaak Alia Bakery. All rights reserved. </footer>// Enable error reporting for debugging (disable in production) ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
// Start output buffering to prevent "headers already sent" errors ob_start();
// Include authentication, database connection, and utility functions require_once DIR . '/../../includes/auth.php'; require_once DIR . '/../../includes/db_connect.php'; require_once DIR . '/../../includes/functions.php'; // Contains sanitize_input()
_SESSION['user_id']; $errors = [];
// Pre-fill due_date if passed via GET (e.g., from calendar selection) _GET['due_date'] ?? '');
if (_SERVER['REQUEST_METHOD'] == 'POST') { title = sanitize_input(description = sanitize_input(due_date = sanitize_input(status = sanitize_input($_POST['status'] ?? 'Not Started');
// Validation if (empty($title)) { $errors[] = "Title is required."; } if (empty($due_date)) { $errors[] = "Due date is required."; } // Validate status $valid_statuses = ['Not Started', 'In Progress', 'Completed']; if (!in_array($status, $valid_statuses)) { $errors[] = "Invalid status selected."; } // Validate due_date format if (!strtotime($due_date)) { $errors[] = "Invalid due date format."; } if (empty($errors)) { $sql = "INSERT INTO workspace_plans (user_id, title, description, due_date, status) VALUES (?, ?, ?, ?, ?)"; if ($stmt = $conn->prepare($sql)) { $stmt->bind_param("issss", $user_id, $title, $description, $due_date, $status); if ($stmt->execute()) { header("Location: plans.php"); exit(); } else { $errors[] = "Failed to create plan. Please try again."; } $stmt->close(); } else { $errors[] = "Database error: Unable to prepare statement."; } }} ?>
<!-- Main Content --> <main class="container mx-auto p-6 mt-24 flex-grow"> <h1 class="text-2xl font-bold mb-6">Create New Plan</h1> <!-- Display Errors --> <?php if(!empty($errors)): ?> <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4"> <ul> <?php foreach($errors as $error): ?> <li><?= htmlspecialchars($error) ?></li> <?php endforeach; ?> </ul> </div> <?php endif; ?> <!-- Plan Creation Form --> <form action="create_plan.php" method="POST" class="bg-white p-6 rounded shadow-md"> <div class="mb-4"> <label class="block text-gray-700">Title<span class="text-red-500">*</span></label> <input type="text" name="title" class="w-full px-3 py-2 border rounded focus:outline-none focus:ring focus:border-blue-300" required value="<?= isset($_POST['title']) ? htmlspecialchars($_POST['title']) : '' ?>"> </div> <div class="mb-4"> <label class="block text-gray-700">Description</label> <textarea name="description" class="w-full px-3 py-2 border rounded focus:outline-none focus:ring focus:border-blue-300" rows="4"><?= isset($_POST['description']) ? htmlspecialchars($_POST['description']) : '' ?></textarea> </div> <div class="mb-4"> <label class="block text-gray-700">Due Date<span class="text-red-500">*</span></label> <input type="datetime-local" name="due_date" class="w-full px-3 py-2 border rounded focus:outline-none focus:ring focus:border-blue-300" required value="<?= isset($_POST['due_date']) ? htmlspecialchars($_POST['due_date']) : $pre_fill_due_date ?>"> </div> <div class="mb-4"> <label class="block text-gray-700">Status</label> <select name="status" class="w-full px-3 py-2 border rounded focus:outline-none focus:ring focus:border-blue-300"> <option value="Not Started" <?= (isset($_POST['status']) && $_POST['status'] == 'Not Started') ? 'selected' : '' ?>>Not Started</option> <option value="In Progress" <?= (isset($_POST['status']) && $_POST['status'] == 'In Progress') ? 'selected' : '' ?>>In Progress</option> <option value="Completed" <?= (isset($_POST['status']) && $_POST['status'] == 'Completed') ? 'selected' : '' ?>>Completed</option> </select> </div> <div class="flex justify-between"> <a href="plans.php" class="px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600">Cancel</a> <button type="submit" class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">Create Plan</button> </div> </form> </main> <!-- Footer --> <footer class="bg-gray-800 text-white text-center p-4"> © 2024 Kaak Alia Bakery. All rights reserved. </footer>// Enable error reporting for debugging (disable in production) ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
// Start output buffering to prevent "headers already sent" errors ob_start();
// Include authentication, database connection, and utility functions require_once DIR . '/../../includes/auth.php'; require_once DIR . '/../../includes/db_connect.php'; require_once DIR . '/../../includes/functions.php'; // Contains sanitize_input()
_SESSION['user_id']; $errors = [];
if (_SERVER['REQUEST_METHOD'] == 'POST') { platform = sanitize_input(content = sanitize_input(scheduled_datetime = sanitize_input(status = 'Scheduled'; // Default status
// Handle media upload if any $media_url = null; if (isset($_FILES['media']) && $_FILES['media']['error'] == UPLOAD_ERR_OK) { $allowed_types = ['image/jpeg', 'image/png', 'video/mp4', 'image/gif']; if (in_array($_FILES['media']['type'], $allowed_types)) { $upload_dir = __DIR__ . '/../../assets/uploads/workspace_posts/'; if (!is_dir($upload_dir)) { mkdir($upload_dir, 0755, true); } // Generate a unique filename to prevent overwriting $file_ext = pathinfo($_FILES['media']['name'], PATHINFO_EXTENSION); $filename = time() . '_' . bin2hex(random_bytes(8)) . '.' . $file_ext; $filepath = $upload_dir . $filename; if (move_uploaded_file($_FILES['media']['tmp_name'], $filepath)) { // Store relative path $media_url = '/assets/uploads/workspace_posts/' . $filename; } else { $errors[] = "Failed to upload media."; } } else { $errors[] = "Unsupported media type. Allowed types: JPEG, PNG, GIF, MP4."; } } // Validation if (empty($platform)) { $errors[] = "Platform is required."; } if (empty($content)) { $errors[] = "Content is required."; } if (empty($scheduled_datetime)) { $errors[] = "Scheduled date and time are required."; } // Validate platform $valid_platforms = ['Instagram', 'Facebook', 'Twitter', 'Other']; if (!in_array($platform, $valid_platforms)) { $errors[] = "Invalid platform selected."; } // Validate scheduled_datetime if (!strtotime($scheduled_datetime)) { $errors[] = "Invalid scheduled date and time."; } if (empty($errors)) { $sql = "INSERT INTO workspace_posts (user_id, platform, content, media_url, scheduled_datetime, status) VALUES (?, ?, ?, ?, ?, ?)"; if ($stmt = $conn->prepare($sql)) { $stmt->bind_param("isssss", $user_id, $platform, $content, $media_url, $scheduled_datetime, $status); if ($stmt->execute()) { header("Location: posts.php"); exit(); } else { $errors[] = "Failed to schedule post. Please try again."; } $stmt->close(); } else { $errors[] = "Database error: Unable to prepare statement."; } }} ?>
<!-- Main Content --> <main class="container mx-auto p-6 mt-24 flex-grow"> <h1 class="text-2xl font-bold mb-6">Schedule New Post</h1> <!-- Display Errors --> <?php if(!empty($errors)): ?> <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4"> <ul> <?php foreach($errors as $error): ?> <li><?= htmlspecialchars($error) ?></li> <?php endforeach; ?> </ul> </div> <?php endif; ?> <!-- Post Scheduling Form --> <form action="create_post.php" method="POST" enctype="multipart/form-data" class="bg-white p-6 rounded shadow-md"> <div class="mb-4"> <label class="block text-gray-700">Platform<span class="text-red-500">*</span></label> <select name="platform" class="w-full px-3 py-2 border rounded focus:outline-none focus:ring focus:border-blue-300" required> <option value="">-- Select Platform --</option> <option value="Instagram" <?= (isset($_POST['platform']) && $_POST['platform'] == 'Instagram') ? 'selected' : '' ?>>Instagram</option> <option value="Facebook" <?= (isset($_POST['platform']) && $_POST['platform'] == 'Facebook') ? 'selected' : '' ?>>Facebook</option> <option value="Twitter" <?= (isset($_POST['platform']) && $_POST['platform'] == 'Twitter') ? 'selected' : '' ?>>Twitter</option> <option value="Other" <?= (isset($_POST['platform']) && $_POST['platform'] == 'Other') ? 'selected' : '' ?>>Other</option> </select> </div> <div class="mb-4"> <label class="block text-gray-700">Content<span class="text-red-500">*</span></label> <textarea name="content" class="w-full px-3 py-2 border rounded focus:outline-none focus:ring focus:border-blue-300" rows="6" required><?= isset($_POST['content']) ? htmlspecialchars($_POST['content']) : '' ?></textarea> </div> <div class="mb-4"> <label class="block text-gray-700">Media (Optional)</label> <input type="file" name="media" class="w-full px-3 py-2 border rounded focus:outline-none focus:ring focus:border-blue-300"> <p class="text-sm text-gray-500 mt-1">Supported formats: JPEG, PNG, GIF, MP4.</p> </div> <div class="mb-4"> <label class="block text-gray-700">Scheduled Date & Time<span class="text-red-500">*</span></label> <input type="datetime-local" name="scheduled_datetime" class="w-full px-3 py-2 border rounded focus:outline-none focus:ring focus:border-blue-300" required value="<?= isset($_POST['scheduled_datetime']) ? htmlspecialchars($_POST['scheduled_datetime']) : '' ?>"> </div> <div class="flex justify-between"> <a href="posts.php" class="px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600">Cancel</a> <button type="submit" class="px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600">Schedule Post</button> </div> </form> </main> <!-- Footer --> <footer class="bg-gray-800 text-white text-center p-4 fixed bottom-0 left-0 w-full"> © 2024 Kaak Alia Bakery. All rights reserved. </footer> - Assistant
Certainly! Below is the updated
index.phpfile that incorporates both Plans and Posts into the calendar. When you click on a Plan or Post event in the calendar, it now redirects to their respective view pages (view_plan.phporview_post.php) instead of the edit page. Additionally, the design remains responsive and stylish using Tailwind CSS without altering the existing styles.Updated
/public/workspace/index.php<?php // /public/workspace/index.php // Enable error reporting for debugging (disable in production) ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); // Start output buffering to prevent "headers already sent" errors ob_start(); // Include authentication, database connection, and utility functions require_once __DIR__ . '/../../includes/auth.php'; require_once __DIR__ . '/../../includes/db_connect.php'; require_once __DIR__ . '/../../includes/functions.php'; // Contains sanitize_input() // Ensure the user is authenticated if (!isset($_SESSION['user_id'])) { header("Location: /public/login.php"); exit(); } $user_id = $_SESSION['user_id']; $calendar_events = []; // Initialize calendar events array $errors = []; // Fetch summary data: Total Number of Plans, Posts, Notes try { // Total Plans $plans_count_sql = "SELECT COUNT(*) AS total FROM workspace_plans"; $stmt = $conn->prepare($plans_count_sql); if (!$stmt) { throw new Exception("Prepare statement failed for plans count: " . $conn->error); } $stmt->execute(); $result = $stmt->get_result(); $plans_count = $result->fetch_assoc()['total'] ?? 0; $stmt->close(); // Total Posts $posts_count_sql = "SELECT COUNT(*) AS total FROM workspace_posts"; $stmt = $conn->prepare($posts_count_sql); if (!$stmt) { throw new Exception("Prepare statement failed for posts count: " . $conn->error); } $stmt->execute(); $result = $stmt->get_result(); $posts_count = $result->fetch_assoc()['total'] ?? 0; $stmt->close(); // Total Notes $notes_count_sql = "SELECT COUNT(*) AS total FROM workspace_notes"; $stmt = $conn->prepare($notes_count_sql); if (!$stmt) { throw new Exception("Prepare statement failed for notes count: " . $conn->error); } $stmt->execute(); $result = $stmt->get_result(); $notes_count = $result->fetch_assoc()['total'] ?? 0; $stmt->close(); } catch (Exception $e) { $errors[] = $e->getMessage(); $plans_count = $posts_count = $notes_count = 0; // Default values in case of error } // Fetch upcoming plans for the calendar along with creator's username try { $calendar_plans_sql = "SELECT wp.id, wp.title, wp.due_date, u.username FROM workspace_plans wp JOIN users u ON wp.user_id = u.id WHERE wp.due_date >= NOW() ORDER BY wp.due_date ASC"; $stmt = $conn->prepare($calendar_plans_sql); if (!$stmt) { throw new Exception("Prepare statement failed for calendar plans: " . $conn->error); } $stmt->execute(); $result = $stmt->get_result(); while ($plan = $result->fetch_assoc()) { $calendar_events[] = [ 'id' => 'plan_' . $plan['id'], // Prefix to distinguish type 'title' => sanitize_input($plan['title']) . " (by " . sanitize_input($plan['username']) . ")", 'start' => $plan['due_date'], 'type' => 'plan', // Custom property to identify type 'color' => '#3B82F6' // Tailwind Blue-500 ]; } $stmt->close(); // Fetch scheduled posts $calendar_posts_sql = "SELECT wp.id, wp.content, wp.scheduled_datetime, u.username FROM workspace_posts wp JOIN users u ON wp.user_id = u.id WHERE wp.scheduled_datetime >= NOW() ORDER BY wp.scheduled_datetime ASC"; $stmt = $conn->prepare($calendar_posts_sql); if (!$stmt) { throw new Exception("Prepare statement failed for calendar posts: " . $conn->error); } $stmt->execute(); $result = $stmt->get_result(); while ($post = $result->fetch_assoc()) { $calendar_events[] = [ 'id' => 'post_' . $post['id'], // Prefix to distinguish type 'title' => sanitize_input($post['content']) . " (by " . sanitize_input($post['username']) . ")", 'start' => $post['scheduled_datetime'], 'type' => 'post', // Custom property to identify type 'color' => '#10B981' // Tailwind Green-500 ]; } $stmt->close(); } catch (Exception $e) { $errors[] = $e->getMessage(); } // (Optional) Fetch recent activities: Plans, Posts, Notes $recent_plans = []; $recent_posts = []; $recent_notes = []; $items_per_section = 5; // Number of items to display in each recent section try { // Recent Plans $recent_plans_sql = "SELECT wp.*, u.username FROM workspace_plans wp JOIN users u ON wp.user_id = u.id ORDER BY wp.created_at DESC LIMIT ?"; $stmt = $conn->prepare($recent_plans_sql); if ($stmt) { $stmt->bind_param("i", $items_per_section); $stmt->execute(); $result = $stmt->get_result(); while ($plan = $result->fetch_assoc()) { $recent_plans[] = $plan; } $stmt->close(); } // Recent Posts $recent_posts_sql = "SELECT wp.*, u.username FROM workspace_posts wp JOIN users u ON wp.user_id = u.id ORDER BY wp.created_at DESC LIMIT ?"; $stmt = $conn->prepare($recent_posts_sql); if ($stmt) { $stmt->bind_param("i", $items_per_section); $stmt->execute(); $result = $stmt->get_result(); while ($post = $result->fetch_assoc()) { $recent_posts[] = $post; } $stmt->close(); } // Recent Notes $recent_notes_sql = "SELECT wn.*, u.username FROM workspace_notes wn JOIN users u ON wn.user_id = u.id ORDER BY wn.created_at DESC LIMIT ?"; $stmt = $conn->prepare($recent_notes_sql); if ($stmt) { $stmt->bind_param("i", $items_per_section); $stmt->execute(); $result = $stmt->get_result(); while ($note = $result->fetch_assoc()) { $recent_notes[] = $note; } $stmt->close(); } } catch (Exception $e) { $errors[] = $e->getMessage(); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Workspace Dashboard - Kaak Alia Management System</title> <!-- Tailwind CSS --> <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> <!-- Bootstrap Icons --> <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet"> <!-- FullCalendar CSS --> <link href='https://cdn.jsdelivr.net/npm/fullcalendar@5.11.3/main.min.css' rel='stylesheet' /> <!-- Custom Styles --> <style> body { font-family: 'Cairo', sans-serif; } #calendar { max-width: 100%; margin: 0 auto; background-color: #ffffff; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); padding: 20px; } </style> </head> <body class="bg-gray-100"> <!-- Header --> <?php include __DIR__ . '/../../includes/header.php'; ?> <!-- Main Content --> <main class="container mx-auto p-6 mt-24 mb-20"> <h1 class="text-3xl font-bold mb-6">Workspace Dashboard</h1> <!-- Display Errors --> <?php if (!empty($errors)): ?> <div class="mb-6"> <?php foreach ($errors as $error): ?> <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-2"> <?= htmlspecialchars($error) ?> </div> <?php endforeach; ?> </div> <?php endif; ?> <!-- Summary Cards --> <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6"> <!-- Plans --> <div class="flex items-center p-4 bg-blue-500 text-white rounded-lg shadow hover:bg-blue-600 transition"> <i class="bi bi-list-task text-4xl mr-4"></i> <div> <h2 class="text-xl font-semibold">Total Plans</h2> <p class="text-2xl"><?= htmlspecialchars(number_format($plans_count)) ?></p> </div> </div> <!-- Posts --> <div class="flex items-center p-4 bg-green-500 text-white rounded-lg shadow hover:bg-green-600 transition"> <i class="bi bi-calendar-plus text-4xl mr-4"></i> <div> <h2 class="text-xl font-semibold">Total Posts</h2> <p class="text-2xl"><?= htmlspecialchars(number_format($posts_count)) ?></p> </div> </div> <!-- Notes --> <div class="flex items-center p-4 bg-purple-500 text-white rounded-lg shadow hover:bg-purple-600 transition"> <i class="bi bi-stickies text-4xl mr-4"></i> <div> <h2 class="text-xl font-semibold">Total Notes</h2> <p class="text-2xl"><?= htmlspecialchars(number_format($notes_count)) ?></p> </div> </div> </div> <!-- Quick Links --> <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6"> <a href="plans.php" class="block p-6 bg-blue-400 text-white rounded-lg shadow hover:bg-blue-500 transition"> <i class="bi bi-list-task text-3xl"></i> <h2 class="mt-2 text-xl font-semibold">Manage Plans</h2> </a> <a href="posts.php" class="block p-6 bg-green-400 text-white rounded-lg shadow hover:bg-green-500 transition"> <i class="bi bi-calendar-plus text-3xl"></i> <h2 class="mt-2 text-xl font-semibold">Manage Posts</h2> </a> <a href="notes.php" class="block p-6 bg-purple-400 text-white rounded-lg shadow hover:bg-purple-500 transition"> <i class="bi bi-stickies text-3xl"></i> <h2 class="mt-2 text-xl font-semibold">Manage Notes</h2> </a> </div> <!-- Calendar --> <div class="mb-6"> <h2 class="text-2xl font-bold mb-4">Upcoming Plans & Posts</h2> <div id='calendar'></div> </div> <!-- (Optional) Recent Activities --> <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6"> <!-- Recent Plans --> <div> <h3 class="text-xl font-semibold mb-2">Recent Plans</h3> <?php if (!empty($recent_plans)): ?> <ul> <?php foreach ($recent_plans as $plan): ?> <li class="mb-2"> <span class="font-semibold"><?= htmlspecialchars($plan['title']) ?></span> by <span class="text-gray-700"><?= htmlspecialchars($plan['username']) ?></span> <br> <span class="text-sm text-gray-500"><?= htmlspecialchars(date("d M Y, h:i A", strtotime($plan['created_at']))) ?></span> </li> <?php endforeach; ?> </ul> <?php else: ?> <p class="text-gray-500">No recent plans found.</p> <?php endif; ?> </div> <!-- Recent Posts --> <div> <h3 class="text-xl font-semibold mb-2">Recent Posts</h3> <?php if (!empty($recent_posts)): ?> <ul> <?php foreach ($recent_posts as $post): ?> <li class="mb-2"> <span class="font-semibold"><?= htmlspecialchars($post['platform']) ?></span>: <?= htmlspecialchars(substr($post['content'], 0, 50)) ?>... by <span class="text-gray-700"><?= htmlspecialchars($post['username']) ?></span> <br> <span class="text-sm text-gray-500"><?= htmlspecialchars(date("d M Y, h:i A", strtotime($post['created_at']))) ?></span> </li> <?php endforeach; ?> </ul> <?php else: ?> <p class="text-gray-500">No recent posts found.</p> <?php endif; ?> </div> <!-- Recent Notes --> <div> <h3 class="text-xl font-semibold mb-2">Recent Notes</h3> <?php if (!empty($recent_notes)): ?> <ul> <?php foreach ($recent_notes as $note): ?> <li class="mb-2"> <span class="font-semibold"><?= htmlspecialchars($note['title']) ?></span> by <span class="text-gray-700"><?= htmlspecialchars($note['username']) ?></span> <br> <span class="text-sm text-gray-500"><?= htmlspecialchars(date("d M Y, h:i A", strtotime($note['created_at']))) ?></span> </li> <?php endforeach; ?> </ul> <?php else: ?> <p class="text-gray-500">No recent notes found.</p> <?php endif; ?> </div> </div> </main> <!-- Footer --> <footer class="fixed bottom-0 left-0 w-full bg-gray-800 text-white text-center p-4"> © 2024 Kaak Alia Bakery. All rights reserved. </footer> <!-- FullCalendar JS --> <script src='https://cdn.jsdelivr.net/npm/fullcalendar@5.11.3/main.min.js'></script> <script> document.addEventListener('DOMContentLoaded', function() { var calendarEl = document.getElementById('calendar'); var calendarData = <?= json_encode($calendar_events) ?>; var calendar = new FullCalendar.Calendar(calendarEl, { initialView: 'dayGridMonth', events: calendarData, headerToolbar: { left: 'prev,next today', center: 'title', right: 'dayGridMonth,timeGridWeek,timeGridDay' }, eventClick: function(info) { // Determine the type of the event and redirect accordingly const eventType = info.event.extendedProps.type; const eventId = info.event.id.split('_')[1]; // Extract the numeric ID if(eventType === 'plan'){ window.location.href = 'view_plan.php?id=' + eventId; } else if(eventType === 'post'){ window.location.href = 'view_post.php?id=' + eventId; } else { // Default action or handle other types if necessary alert('Unknown event type.'); } }, eventColor: '#06D6A0', // Default event color (can be overridden by individual event colors) navLinks: true, // Can click day/week names to navigate views selectable: true, selectMirror: true, select: function(arg) { // Handle date selection for creating new plans or posts const date = arg.startStr; if(confirm('Would you like to add a new plan or post on ' + date + '?')) { // You can offer options here or redirect to a combined creation page // For simplicity, redirecting to create_plan.php with pre-filled date window.location.href = 'create_plan.php?due_date=' + encodeURIComponent(date); } calendar.unselect() }, // Responsive Design Enhancements height: 'auto', windowResize: function(view) { calendar.render(); } }); calendar.render(); }); </script> </body> </html> <?php // Flush the output buffer ob_end_flush(); // No closing PHP tag to prevent unwanted output ?>Explanation of Changes:
-
Fetching Both Plans and Posts for the Calendar:
- Plans: Fetched from
workspace_planswithdue_dateas the start date. - Posts: Fetched from
workspace_postswithscheduled_datetimeas the start date. - Both are added to the
$calendar_eventsarray with a uniqueid(prefixed withplan_orpost_), atype(either'plan'or'post'), and a distinctcolorfor differentiation.
- Plans: Fetched from
-
Updated JavaScript for FullCalendar:
- Event Identification: Each event now has a
typein itsextendedProps. - Event Click Handling: The
eventClickfunction determines the type of the event and redirects the user to eitherview_plan.php?id=...orview_post.php?id=...accordingly. - Enhanced Responsiveness: Set
height: 'auto'and added awindowResizelistener to ensure the calendar adjusts smoothly across different screen sizes.
- Event Identification: Each event now has a
-
Design Enhancements:
- Color-Coding Events: Plans and Posts have distinct colors (
#3B82F6for Plans and#10B981for Posts) to visually differentiate them on the calendar. - Responsive Layout: The Tailwind CSS grid system ensures that the dashboard components stack appropriately on smaller screens, maintaining a clean and accessible interface.
- Color-Coding Events: Plans and Posts have distinct colors (
-
User Interaction:
- Creating New Events: When selecting a date on the calendar, a prompt asks the user if they want to add a new plan or post. For simplicity, it redirects to
create_plan.phpwith the selected date pre-filled. You can expand this functionality to allow choosing between creating a plan or a post.
- Creating New Events: When selecting a date on the calendar, a prompt asks the user if they want to add a new plan or post. For simplicity, it redirects to
Additional Recommendations:
-
View Pages (
view_plan.phpandview_post.php):- Ensure that these view pages are properly created to display the details of the selected Plan or Post based on the
idparameter.
- Ensure that these view pages are properly created to display the details of the selected Plan or Post based on the
-
Security Enhancements:
- Validation & Sanitization: While
sanitize_input()is used, always ensure that all inputs are thoroughly validated and sanitized to prevent SQL injection and XSS attacks. - User Permissions: Verify that the authenticated user has the necessary permissions to view the specific Plan or Post.
- Validation & Sanitization: While
-
User Experience Improvements:
- Modal Views: Instead of redirecting to a separate page, consider displaying the Plan or Post details in a modal for a smoother user experience.
- Filtering Events: Allow users to filter the calendar events by type (Plans or Posts) for better clarity.
-
Performance Optimizations:
- Caching: Implement caching strategies for frequently accessed data to reduce database load.
- Pagination: For sections like Recent Plans or Posts, consider implementing pagination if the number of items grows significantly.
This updated
index.phpshould provide a more interactive and user-friendly dashboard, seamlessly integrating both Plans and Posts into the calendar with clear navigation to their respective view pages. -