<div class="settingsPage">
    <div class="left-column">
        <?php include('settingsSideBar.php'); ?>
    </div>
    <div class="right-column">
        <div class="pageTitle">
            <h1><span>Send test email</span>
                <a class="btn btn-large pull-right" href="<?php
                echo site_url('settings/mail') ?>">Mail settings</a>
            </h1>
        </div>
        <div>
            <div class="pullTop">
                <?php

                if (($this->session->flashdata('message'))) {
                    $flashMessage = $this->session->flashdata('message');
                    $content = $flashMessage['content'];
                    $content_class = $flashMessage['type'];
                    ?>
                    <div style="margin-top: 13px;">
                        <div class="alert <?php echo $content_class; ?>">
                            <button class="close" data-dismiss="alert"><i class="bi bi-x"></i></button>
                            <?php echo $content; ?>
                        </div>
                    </div>

                <?php } ?>
            </div>
            <?php
            // Change the css classes to suit your needs

            $attributes = array('class' => 'form-horizontal', 'id' => 'mpsettings', 'autocomplete' => "off");
            echo form_open_multipart('settings/sendTestEmail', $attributes);
            ?>
            <div class="control-group">
                <label class="control-label" for="bluehost_threshold_global">From</label>
                <div class="controls">
                    <input id="from" type="text" name="from" class="input-xlarge"
                           value="<?= htmlspecialchars((isset($from) ? $from : $defaultEmail)) ?>"/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="bluehost_threshold_global">To</label>
                <div class="controls">
                    <input id="to" type="text" name="to" class="input-xlarge"
                           value="<?= isset($to) ? htmlspecialchars($to) : ''; ?>"/>
                </div>
            </div>

            <div class="control-group">


                <?php echo form_submit(array(
                    'name' => 'submit',
                    'class' => 'btn btn-primary btn-large pull-right',
                    'value' => 'Send'
                )); ?>
            </div>

            <?php echo form_close(); ?>

            <?php if (isset($debugInfo)) { ?>
                <div class="center-block">

                    <?= $debugInfo ?>

                </div>
            <?php } ?>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        var mode = $("input[name='mode']:checked").val();
        settings_toggle();
        function settings_toggle() {
            if ($("input[name='mode']:checked").val() == 'sendmail') {
                $('#smtpSettings').hide();
            }
            else if ($("input[name='mode']:checked").val() == 'smtp') {
                $('#smtpSettings').show();
            }
        };
        $("input[name='mode']").change(function () {
            settings_toggle();
        });
    });
</script>
