<?= $this->extend('layout/main_layout') ?>
<?= $this->section('content') ?>
<div class="container-xxl py-5">
    <div class="container">
        <div class="row">
            <main class="col-12 px-md-4">
                <div class="pt-3 pb-2 mb-3 dashboard-title">
                    <h1 class="h2">Support</h1>
                    <h5 class="h5 mt-2">Submit your support request</h5>
                </div>

                <?php if (session()->getFlashdata('success')): ?>
                    <div class="alert alert-success">
                        <?= session()->getFlashdata('success') ?>
                    </div>
                <?php endif; ?>

                <?php if (isset($validation)): ?>
                    <div class="alert alert-danger">
                        <?= $validation->listErrors() ?>
                    </div>
                <?php endif; ?>

                <?php helper(['form']); // Load form helper 
                ?>

                <form action="<?= base_url('support/submit') ?>" method="post" class="support-form">
                    <?= csrf_field() ?>

                    <div class="form-group">
                        <label for="subject">Subject</label>
                        <input type="text" class="form-control" id="subject" name="subject"
                            value="<?= set_value('subject') ?>" required>
                    </div>
                    <div class="form-group">
                        <label for="message">Message</label>
                        <textarea class="form-control" id="message" name="message"
                            required><?= set_value('message') ?></textarea>
                    </div>
                    <button type="submit" class="btn btn-primary mt-3">Submit</button>
                </form>
            </main>
        </div>
    </div>
<?= $this->endSection() ?>