<?php $act =88;
 include './login/connect.php';

?>

<!DOCTYPE html>
<!-- =========================================================
* ekseba Admin Template - Pro | v1.0.0
==============================================================

* Product Page: https://ekseba.com
* Created by: ekseba
* License: ekseba.com
* Copyright ThemeSelection (https://ekseba.com)

=========================================================
 -->
<!-- beautify ignore:start -->
<html lang="en"  class="light-style layout-menu-fixed"  dir="ltr"  data-theme="theme-default"  data-assets-path="assets/"  data-template="vertical-menu-template-free">
  <head>
    
    <?php include './html/head.php'; ?>
      
        <!-- serch script -->
        <script src="jeffartagame.js" type="text/javascript" charset="utf-8"></script>
        <script src="application.js" type="text/javascript" charset="utf-8"></script>
        <!-- serch script -->
     
      <style>
#customers {
  font-family: Arial, Helvetica, sans-serif;
  border-collapse: collapse;
  width: 100%; font-size: 12px;
}

#customers td, #customers th {
  border: 1px solid #ddd;
  padding: 5px 2px 5px 2px; font-size: 12px;
  text-align: center;
}

#customers tr:nth-child(even){background-color: #f2f2f2;}

#customers tr:hover {background-color: #ddd;}

#customers th {
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  background-color: #04AA6D;
  color: white; font-size: 12px;
}
      </style>
      <style>
        /* General Page Styling */

/* Heading Styling */
h1, h2 {
    color: #2c3e50;
    text-align: center;
}

/* Form Styling */
form {
    max-width: 600px;
    margin: 0 auto 30px auto;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Label and Input Field Styling */
label {
    font-weight: bold;
    display: block;
    margin-bottom: 8px;
}

select {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 14px;
}

/* Button Styling */
button {
    background-color: #3498db;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
}

button:hover {
    background-color: #2980b9;
}

/* Table Styling */
table {
    width: 100%;
    margin-top: 30px;
    border-collapse: collapse;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

th, td {
    padding: 12px;
    text-align: center;
    border: 1px solid #ddd;
}

th {
    background-color: #3498db;
    color: white;
    font-weight: bold;
}

td {
    background-color: #f9f9f9;
}

/* Hover effect for table rows */
tr:hover {
    background-color: #f1f1f1;
}

/* Action Links (Edit/Delete) Styling */
a {
    text-decoration: none;
    color: #3498db;
    font-weight: bold;
}

a:hover {
    color: #2980b9;
}

a:active {
    color: #e74c3c;
}

    </style>
  </head>

  <body>
    <!-- Layout wrapper -->
    <div class="layout-wrapper layout-content-navbar">
      <div class="layout-container">
        <!-- Menu -->
        <?php 
        include './menue.php';
        ?>
        <!-- / Menu -->

        <!-- Layout container -->
        <div class="layout-page">
          <!-- Navbar -->

          <?php include './navbar.php'; ?>

          <!-- / Navbar -->

          <!-- Content wrapper -->
          <div class="content-wrapper">
            <!-- Content -->

            <!-- Content wrapper -->
          <div class="content-wrapper">
            <!-- Content -->

            <div class="container-xxl flex-grow-1 container-p-y">
              <h4 class="fw-bold py-3 mb-4"><span class="text-muted fw-light">Student/</span> Information</h4>

              <!-- Basic Layout & Basic with Icons -->
              <div class="row">
                <!-- Basic Layout -->
                <div class="col-xl">
                  <div class="card mb-4">
                    <div class="card-header d-flex justify-content-between align-items-center">
                      <h5 class="mb-0">Student Information</h5>
                      
                      
                      <span class="float:right;" >
                           <button   type="button" class="btn btn-primary" data-bs-toggle="modal"
                          data-bs-target="#largeModal">Add New Student 
                        </button>
				</a></span>
                       
                  
                    </div>
                    <div class="card-body">
                     <h1>Create or Update Class Routine</h1>
    <?php

// ক্লাস রুটিন দেখানোর কোড
$join_routine_query = "
    SELECT cr.id, cr.class_id, cr.day, cr.period_1, cr.period_2, cr.period_3, cr.period_4, cr.period_5, cr.period_6, 
           s1.subject_name as period_1_name, s2.subject_name as period_2_name, s3.subject_name as period_3_name,
           s4.subject_name as period_4_name, s5.subject_name as period_5_name, s6.subject_name as period_6_name
    FROM class_routine cr
    LEFT JOIN subjects s1 ON cr.period_1 = s1.id
    LEFT JOIN subjects s2 ON cr.period_2 = s2.id
    LEFT JOIN subjects s3 ON cr.period_3 = s3.id
    LEFT JOIN subjects s4 ON cr.period_4 = s4.id
    LEFT JOIN subjects s5 ON cr.period_5 = s5.id
    LEFT JOIN subjects s6 ON cr.period_6 = s6.id
";
$join_routine_result = $conn->query($join_routine_query);
?>

    
    
    <h2>Existing Class Routine</h2>
    <table border="1">
        <thead>
            <tr>
                <th>Class</th>
                <th>Day</th>
                <th>1st Period</th>
                <th>2nd Period</th>
                <th>3rd Period</th>
                <th>4th Period</th>
                <th>5th Period</th>
                <th>6th Period</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
            <?php while ($routine_row = $join_routine_result->fetch_assoc()): ?>
                <tr>
                    <td><?= $routine_row['class_id']; ?></td>
                    <td><?= $routine_row['day']; ?></td>
                    <td><?= $routine_row['period_1_name']; ?></td>
                    <td><?= $routine_row['period_2_name']; ?></td>
                    <td><?= $routine_row['period_3_name']; ?></td>
                    <td><?= $routine_row['period_4_name']; ?></td>
                    <td><?= $routine_row['period_5_name']; ?></td>
                    <td><?= $routine_row['period_6_name']; ?></td>
                    <td>
                        <a href="edit_routine.php?id=<?= $routine_row['id']; ?>">Edit</a> |
                        <a href="?delete_id=<?= $routine_row['id']; ?>" onclick="return confirm('Are you sure you want to delete this routine?')">Delete</a>
                    </td>
                </tr>
            <?php endwhile; ?>
        </tbody>
    </table>
                        
                        
                <!-- Basic with Icons -->
  
                
                    </div>
                  </div>
                </div>
              </div>
            </div>

            <!-- / Content -->
          </div>
            <!-- Footer -->
           <?php require './footer.php'; ?>
<!-- Large Modal -->

                      <div class="modal fade" id="largeModal" tabindex="-1" aria-hidden="true">
                        <div class="modal-dialog modal-lg" role="document">
                          <div class="modal-content">
                            <div class="modal-header">
                              <h5 class="modal-title" id="exampleModalLabel3">Student Admission Form</h5>
                              <button type="button" class="btn-close" data-bs-dismiss="modal"  aria-label="Close" ></button>
                            </div>
                            <div class="modal-body">
                                
                                
                            </div>
                            
                          </div>
                        </div>
                      </div>
</form>

                      <!-- Extra Large Modal -->
                      