Mini Kabibi Habibi

Current Path : C:/xampp/htdocs/cid/system/
Upload File :
Current File : C:/xampp/htdocs/cid/system/user_index.php

<?php
session_start();
@include 'include/config.php';

if (!isset($_SESSION['username_school'])) {
    $_SESSION['username'] = $_POST['username'];
    $username = mysqli_real_escape_string($conn, $_POST['username']);
    header('Location: login.php');
}

$username = $_SESSION['username_school'];
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>PROJ. COURSE</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" href="images/favicon.ico" type="image/ico" />

    <!-- CSS Dependencies -->
    <link href="../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="../vendors/nprogress/nprogress.css" rel="stylesheet">
    <link href="../vendors/iCheck/skins/flat/green.css" rel="stylesheet">
    <link href="../vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
    <link href="../vendors/jqvmap/dist/jqvmap.min.css" rel="stylesheet" />
    <link href="../vendors/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
    <link href="../build/css/custom.min.css" rel="stylesheet">

    <style>
        .table thead th {
            position: static !important;
        }
    </style>
</head>

<body class="nav-md">
<div class="container body">
    <div class="main_container">

        <!-- Sidebar -->
        <div class="col-md-3 left_col">
            <div class="left_col scroll-view">
                <div class="navbar nav_title" style="border: 0;">
                    <a href="user_index.php" class="site_title"><i class="fa fa-spinner"></i> <span>PROJ. COURSE</span></a>
                </div>
                <div class="clearfix"></div>

                <div class="profile clearfix">
                    <div class="profile_info">
                        <span>Welcome,</span>
                        <h2><?php echo htmlspecialchars($username); ?></h2>
                    </div>
                </div>
                <br />

                <!-- Sidebar Menu -->
                <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
                    <div class="menu_section">
                        <h3>General</h3>
                        <ul class="nav side-menu">
                            <li><a><i class=""></i> Home <span class="fa fa-chevron-down"></span></a>
                                <ul class="nav child_menu">
                                    <li><a href="user_index.php">Dashboard</a></li>
                                </ul>
                            </li>
                            <li><a><i class=""></i> Daily Activities <span class="fa fa-chevron-down"></span></a>
                                <ul class="nav child_menu">
                                    <li><a href="form_user.php">Submit New Activity</a></li>
                                </ul>
                            </li>
                            <li><a><i class="glyphicon glyphicon"></i> Daily Accomplishments <span class="fa fa-chevron-down"></span></a>
                                <ul class="nav child_menu">
                                    <li><a href="add_daily_accomplishments.php">Submit Accomplishments</a></li>
                                    <li><a href="daily_accomplishments.php">View My Accomplishments</a></li>
                                </ul>
                            </li>
                            <li><a><i class="glyphicon glyphicon"></i> Monthly Accomplishment Reports <span class="fa fa-chevron-down"></span></a>
                                <ul class="nav child_menu">
                                    <li><a href="submit_monthly_report.php">Submit Monthly Accomplishment Report</a></li>
                                    <li><a href="monthly_reports.php">View Monthly Accomplishment Reports</a></li>
                                </ul>
                            </li>
                            <li><a><i class="glyphicon glyphicon"></i> MISTA Plans <span class="fa fa-chevron-down"></span></a>
                                <ul class="nav child_menu">
                                    <li><a href="create_mista_plan.php">Create MISTA Plan</a></li>
                                    <li><a href="view_mista_plans.php">View MISTA Plans</a></li>
                                    <li><a href="submit_mista_plan.php">Submit MISTA Plan</a></li>
                                    <li><a href="submitted_mista_plans.php">Submitted MISTA Plans</a></li>
                                </ul>
                            </li>
                            <li><a><i class="glyphicon glyphicon"></i> MISTA Reports <span class="fa fa-chevron-down"></span></a>
                                <ul class="nav child_menu">
                                    <li><a href="create_mista_report.php">Create MISTA Report</a></li>
                                    <li><a href="view_mista_reports.php">View MISTA Reports</a></li>
                                    <li><a href="submit_mista_report.php">Submit MISTA Report</a></li>
                                    <li><a href="submitted_mista_reports.php">Submitted MISTA Reports</a></li>
                                </ul>
                            </li>
                            <li><a><i class="glyphicon glyphicon"></i> M/QCAIS Reports <span class="fa fa-chevron-down"></span></a>
                                <ul class="nav child_menu">
                                    <li><a href="create_mqcais_report.php">Create M/QCAIS Report</a></li>
                                    <li><a href="view_mqcais_reports.php">View M/QCAIS Reports</a></li>
                                    <li><a href="submit_mqcais_report.php">Submit M/QCAIS Report</a></li>
                                    <li><a href="submitted_mqcais_reports.php">Submitted M/QCAIS Reports</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </div>

                <!-- Footer -->
                <div class="sidebar-footer hidden-small">
                    <a title="Settings"><span class="glyphicon glyphicon-cog"></span></a>
                    <a title="FullScreen"><span class="glyphicon glyphicon-fullscreen"></span></a>
                    <a title="Lock"><span class="glyphicon glyphicon-eye-close"></span></a>
                    <a title="Logout" href="logout.php"><span class="glyphicon glyphicon-off"></span></a>
                </div>
            </div>
        </div>

        <!-- Top Navigation -->
        <div class="top_nav">
            <div class="nav_menu">
                <div class="nav toggle"><a id="menu_toggle"><i class="fa fa-bars"></i></a></div>
                <nav class="nav navbar-nav">
                    <ul class="navbar-right">
                        <li class="nav-item dropdown open" style="padding-left: 15px;">
                            <a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown">
                                <?php echo htmlspecialchars($username); ?>
                            </a>
                            <div class="dropdown-menu dropdown-usermenu pull-right">
                                <a class="dropdown-item" href="../logout.php"><i class="fa fa-sign-out pull-right"></i> Log Out</a>
                            </div>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
        <!-- /Top Navigation -->

        <!-- Page Content -->
        <div class="right_col" role="main">
            <div class="">
                <div class="clearfix"></div>
                <div class="row">
                    <div class="col-md-12 col-sm-12">
                        <div class="x_panel">
                            <div class="x_title">
                                <h2>Daily Activities</h2>
                                <div class="clearfix"></div>
                            </div>

                            <div class="x_content">
                                <!-- Form Start -->
                                <form action="generate_monthly_report.php" method="POST">
                                    <div class="form-row" style="margin-bottom: 20px; display: flex; gap: 10px; align-items: center;">
                                        <!-- Month Dropdown -->
                                        <div class="form-group">
                                            <label for="month">Select Month:</label>
                                            <select name="month" id="month" class="form-control" required>
                                                <option value="">-- Month --</option>
                                                <?php
                                                $months = [
                                                    1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April',
                                                    5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August',
                                                    9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December'
                                                ];
                                                foreach ($months as $num => $name) {
                                                    echo "<option value='$num'>$name</option>";
                                                }
                                                ?>
                                            </select>
                                        </div>

                                        <!-- Year Dropdown -->
                                        <div class="form-group">
                                            <label for="year">Select Year:</label>
                                            <select name="year" id="year" class="form-control" required>
                                                <option value="">-- Year --</option>
                                                <?php
                                                $currentYear = date('Y');
                                                for ($y = $currentYear; $y >= 2020; $y--) {
                                                    echo "<option value='$y'>$y</option>";
                                                }
                                                ?>
                                            </select>
                                        </div>

                                        <!-- Submit Button -->
                                        <div class="form-group" style="margin-top: 25px;">
                                            <button type="submit" class="btn btn-success">Generate Monthly Report</button>
                                        </div>
                                    </div>

                                    <!-- Activities Table -->
                                    <div class="table-responsive">
                                        <table class="table table-striped jambo_table bulk_action">
                                            <thead>
                                                <tr class="headings">
                                                    <th><input type="checkbox" id="check-all" class="flat"></th>
                                                    <th>Activities</th>
                                                    <th>Date</th>
                                                    <th class="action-buttons">Action</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                $stmt = $conn->prepare("SELECT * FROM schedule WHERE username = ?");
                                                $stmt->bind_param("s", $username);
                                                $stmt->execute();
                                                $result = $stmt->get_result();

                                                while ($row = $result->fetch_assoc()) {
                                                    $activity = htmlspecialchars($row['activities']);
                                                    $other_activity = htmlspecialchars($row['other_activity']);
                                                    if ($activity === 'Others' && !empty($other_activity)) {
                                                        $activity = "Other Activity: " . $other_activity;
                                                    }

                                                    echo "<tr class='even pointer'>
                                                        <td><input type='checkbox' class='flat' name='selected_ids[]' value='" . htmlspecialchars($row['id']) . "'></td>
                                                        <td>" . $activity . "</td>
                                                        <td>" . htmlspecialchars($row['date']) . "</td>
                                                        <td class='action-buttons'>
                                                            <a href='edit_schedule.php?id=" . urlencode($row['id']) . "' class='btn btn-sm btn-primary'>
                                                                <i class='fa fa-edit'></i> Edit
                                                            </a>
                                                            <a href='delete_schedule.php?id=" . urlencode($row['id']) . "' class='btn btn-sm btn-danger' onclick='return confirm(\"Are you sure you want to delete this schedule?\");'>
                                                                <i class='fa fa-trash'></i> Delete
                                                            </a>
                                                        </td>
                                                    </tr>";
                                                }
                                                ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </form>
                                <!-- Form End -->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Footer -->
        <footer>
            <div class="pull-right">
                SDO BATANGAS CITY - CID PROJECT COURSE
            </div>
            <div class="clearfix"></div>
        </footer>
    </div>
</div>

<!-- JS Scripts -->
<script src="../vendors/jquery/dist/jquery.min.js"></script>
<script src="../vendors/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="../vendors/fastclick/lib/fastclick.js"></script>
<script src="../vendors/nprogress/nprogress.js"></script>
<script src="../vendors/iCheck/icheck.min.js"></script>
<script src="../build/js/custom.min.js"></script>

<!-- Script to select all checkboxes -->
<script>
document.getElementById('check-all').addEventListener('change', function () {
    const checkboxes = document.querySelectorAll("input[name='selected_ids[]']");
    checkboxes.forEach(cb => cb.checked = this.checked);
});
</script>

</body>
</html>