<?php
 require_once('includes/auth_check.php');
include_once('includes/header.php');
include_once('includes/sidebar.php');

?>
<div class="container mt-4">
    <div class="row justify-content-center">
        <div class="col-12 col-lg-10">
            <div class="card shadow-sm border-0 overflow-hidden">
                <div class="bg-success" style="height: 6px;"></div>

                <div class="card-body p-4 p-md-5">
                    <div class="row align-items-center">

                        <div class="col-md-3 text-center mb-4 mb-md-0 border-end-md">
                            <div class="p-3 bg-light rounded-circle d-inline-block shadow-sm">
                                <img id="display_school_logo" src="assets/img/default-school.png"
                                    style="width: 100px; height: 100px; object-fit: contain;" alt="School Logo">
                            </div>
                        </div>

                        <div class="col-md-6 ps-md-5 text-center text-md-start">
                            <h2 id="display_school_name" class="fw-bold text-dark mb-1">---</h2>
                            <p id="display_address" class="text-muted small mb-3">
                                <i class="fas fa-map-marker-alt me-2"></i>---
                            </p>

                            <div class="row g-2">
                                <div class="col-12">
                                    <span class="text-muted small">
                                        <i class="fas fa-phone-alt me-2 text-primary"></i>
                                        <span id="display_phone_number">---</span>
                                    </span>
                                </div>
                                <div class="col-12">
                                    <span class="text-muted small">
                                        <i class="fas fa-envelope me-2 text-primary"></i>
                                        <span id="display_school_email">---</span>
                                    </span>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-3 text-center text-md-end mt-4 mt-md-0">
                            <button class="btn btn-outline-success px-4 py-2 fw-bold shadow-sm"
                                onclick="openSettingsModal()">
                                <i class="fas fa-edit me-2"></i>Edit Profile
                            </button>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>

</div>

<!--============= add scholl setting modal ============ -->


<div class="modal fade" id="schoolSettingsModal" tabindex="-1">
    <div class="modal-dialog modal-lg">
        <form id="schoolSettingsForm">
            <div class="modal-content">
                <div class="modal-header bg-primary text-white">
                    <h5 class="modal-title">Edit School Settings</h5>
                </div>
                <div class="modal-body row">
                    <div class="col-md-6 mb-3">
                        <label>School Name</label>
                        <input type="text" name="school_name" id="set_school_name" class="form-control" required>
                    </div>
                    <div class="col-md-6 mb-3">
                        <label>Email</label>
                        <input type="email" name="email" id="set_email" class="form-control">
                    </div>
                    <div class="col-md-6 mb-3">
                        <label>Phone</label>
                        <input type="text" name="phone_number" id="set_phone_number" class="form-control">
                    </div>
                    <div class="col-md-6 mb-3">
                        <label>Address</label>
                        <textarea type="text" name="school_address" id="set_address" class="form-control"></textarea>
                    </div>
                    <div class="col-md-6 mb-3">
                        <label>Logo</label>
                        <input type="file" name="school_logo" class="form-control">
                    </div>
                    <div class="col-md-6 mb-3">
                        <label>Signature</label>
                        <input type="file" name="principal_signature" class="form-control">
                    </div>
                </div>
                <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                    
                    <button type="submit" class="btn btn-success">Update Now</button>
                </div>
            </div>
        </form>
    </div>
</div>
<?php include_once('includes/footer.php') ?>