<?php
require_once "common/header.php";
require_once "include/db_handler.php";

if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $message = $db->getSingleMessage($id);
}
?>

<body>

<div class="container-fluid">
    <div class="row">
        <?php
        require_once "common/sidebar.php";
        ?>
        <div class="right-column">
            <?php
            require_once "common/navbar.php";
            ?>
            <main class="main-content p-5" role="main">

                <div class="row mb-4">
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-mailbox">
                                <div class="row mx-0">

                                    <div class="col-lg-12">
                                        <div class="mailbox-container mailbox-message-compose">
                                            <form role="form" id="message-compose">
                                                <div class="form-group email-recepient-main-container">
                                                    <label for="email-recepient-main">To: </label>
                                                    <input id="email-recepient-main" type="text"  value="<?php echo $message[0]['email'] ?>" class="form-control email-recepient email-recepient-main">
                                                </div>

                                                <div class="form-group email-subject-container">
                                                    <label for="email-subject">Subject</label>
                                                    <input id="email-subject" type="text" value="<?php echo $message[0]['subject'] ?>" class="form-control email-subject">
                                                </div>
                                                <div class="form-group email-body-container">
														<textarea id="email-body" class="form-control email-body load-ckeditor" rows="30">

														</textarea>
                                                </div>
                                                <div class="email-pager-container">
                                                    <a href="#" class="btn btn-primary" id="send-email" data-toggle="tooltip" title="Send Message">
                                                        <i class="batch-icon batch-icon-mail"></i>
                                                        Send Message
                                                    </a>
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

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

<?php
require_once "modals/add_article.php";
require_once "modals/logout.php";
require_once "modals/add_category.php";
require_once "common/footer.php";
?>

