<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <h1 class="page-header">Settings</h1>

    <div class="row">
        <h3>Mailaccounts</h3>
        <table id="settings-mailboxes" class="table table-striped">
            <thead>
                <tr>
                    <th>Status</th>
                    <th>Hostname</th>
                    <th>Port</th>
                    <th>Protocol</th>
                    <th>SSL</th>
                    <th>Allow invalid cert</th>
                    <th>Username</th>
                    <th>Password</th>
                    <th></th>
                </tr>
            </thead>
            <?php
            if($this->_['mailboxes']) {
                foreach($this->_['mailboxes'] as $mailbox) {
                    echo '<tr data-mailbox-id="' . $mailbox->getID() . '">';
                    echo '<td></td>';
                    echo '<td>' . getEditableLink('hostname', 'text', $mailbox->getID(), 'Click to edit', $mailbox->getHostname()) . '</td>';
                    echo '<td>' . getEditableLink('port', 'text', $mailbox->getID(), 'Click to edit', $mailbox->getPort()) . '</td>';
                    echo '<td>' . getEditableLink('protocol', 'select', $mailbox->getID(), 'Click to edit', $mailbox->getProtocol()) . '</td>';
                    echo '<td>' . getEditableLink('use-ssl', 'select', $mailbox->getID(), 'Click to edit', $mailbox->getUseSsl()) . '</td>';
                    echo '<td>' . getEditableLink('no-valid-cert', 'select', $mailbox->getID(), 'Click to edit', $mailbox->getNoValidCert()) . '</td>';
                    echo '<td>' . getEditableLink('username', 'text', $mailbox->getID(), 'Click to edit', $mailbox->getUsername()) . '</td>';
                    echo '<td>' . getEditableLink('password', 'password', $mailbox->getID(), 'Click to edit', 'Click to change') . '</td>';
                    echo '<td><a class="remove-mailaccount" href="#" data-id="' . $mailbox->getID() . '"><i class="fa fa-minus-circle"></i></a></td>';
                    echo '</tr>';
                }
            }
            ?>
            <tr>
                <td><a id="refresh-mailaccounts" href="#"><i class="fa fa-refresh"></i></a></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td><a id="add-mailaccount" href="#" data-uid="<?php echo $this->_['user']->getUserID(); ?>"><i class="fa fa-plus-circle"></i></a></td>
            </tr>
        </table>
    </div>
</div>
