<div class="page-title mb-4">
  <div>
    <h1 class="fw-bold text-success"><i class="fa fa-laptop"></i> Administrative Manager</h1>
    <p class="text-muted">View School Info</p>
  </div>
</div>

<div class="card shadow-sm border-0 rounded-4 p-4">
  <div class="row">
    <?php
    $query = "SELECT * FROM `administratives`";
    $run_query = mysqli_query($connection, $query);

    if (mysqli_num_rows($run_query) > 0) {
      while ($result = mysqli_fetch_assoc($run_query)) {
        $school_name = htmlspecialchars($result['school_name']);
        $school_address = htmlspecialchars($result['school_address']);
        $school_motto = htmlspecialchars($result['school_motto']);
        $school_phone = htmlspecialchars($result['school_phone']);
        $school_mail = htmlspecialchars($result['school_mail']);
        $school_website = htmlspecialchars($result['school_website']);
        $school_whatsapp = htmlspecialchars($result['school_whatsapp']);
        $school_short_name = htmlspecialchars($result['school_short_name']);
        $school_logo = $result['school_logo'];
        $school_stamp = $result['school_stamp'];
        $school_favicon = $result['school_favicon'];
    ?>

      <!-- LEFT SIDE: School Info -->
      <div class="col-lg-7">
        <div class="border rounded-3 p-4 mb-4 bg-light">
          <h3 class="text-uppercase text-muted mb-3 text-center">School Details</h3>
          <ul class="list-group list-group-flush">
            <li class="list-group-item"><strong>School Name:</strong> <?php echo $school_name; ?></li>
            <li class="list-group-item"><strong>Address:</strong> <?php echo $school_address; ?></li>
            <li class="list-group-item"><strong>Motto:</strong> <?php echo $school_motto; ?></li>
            <li class="list-group-item"><strong>Phone:</strong> <?php echo $school_phone; ?></li>
            <li class="list-group-item"><strong>Email:</strong> <?php echo $school_mail; ?></li>
            <li class="list-group-item"><strong>Website:</strong> <a href="<?php echo $school_website; ?>" target="_blank"><?php echo $school_website; ?></a></li>
            <li class="list-group-item"><strong>WhatsApp:</strong> <?php echo $school_whatsapp; ?></li>
            <li class="list-group-item"><strong>Short Name:</strong> <?php echo $school_short_name; ?></li>
          </ul>
        </div>
      </div>

      <!-- RIGHT SIDE: Logo / Stamp / Favicon Cards -->
      <div class="col-lg-5 d-flex flex-column gap-4">
        <div class="card text-center shadow-sm">
          <div class="card-body">
            <h6 class="card-title text-muted">School Logo</h6>
            <img src="../<?php echo $school_logo; ?>" alt="School Logo" style="height: 80px;" class="img-fluid rounded" onerror="this.src='placeholder.png';">
          </div>
        </div>

        <div class="card text-center shadow-sm">
          <div class="card-body">
            <h6 class="card-title text-muted">School Stamp</h6>
            <img src="../<?php echo $school_stamp; ?>" alt="School Stamp" style="height: 80px;" class="img-fluid rounded" onerror="this.src='placeholder.png';">
          </div>
        </div>

        <div class="card text-center shadow-sm">
          <div class="card-body">
            <h6 class="card-title text-muted">Favicon</h6>
            <img src="../<?php echo $school_favicon; ?>" alt="Favicon" style="height: 40px; width: 40px;" class="img-fluid rounded-circle" onerror="this.src='placeholder.png';">
          </div>
        </div>
      </div>

    <?php
      }
    } else {
      echo "<div class='alert alert-danger text-center'><b>No school administrative info found.</b></div>";
    }
    ?>
  </div>
</div>

