<section class="content-header">
    <h1><?= __('Edit poll') ?></h1>

    <div class="actions">
        <a data-ajax class="btn btn-default btn-sm" href="<?= admin_url_to('/polls') ?>"><?= __('List') ?></a>
    </div>
</section>

<section class="content">

    <div class="nav-tabs-custom">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#"><?= __('Poll') ?></a></li>
            <li><a data-ajax href="<?= admin_url_to('/polls/answers?poll_id=' . $poll['id']) ?>"><?= __('Answers') ?></a></li>
        </ul>
        <div class="tab-content" style="padding:0">
            <form data-ajax class="form-focus" action="<?= admin_url_to('/polls/edit/' . $poll['id']) ?>" method="post">
                <?= csrf_field() ?>

                <div class="box-body">
                    <div class="section">
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
                                <h5><?= __('Poll') ?></h5>
                            </div>

                            <div class="col-lg-9 col-md-9 col-sm-8 col-xs-12">
                                <div class="row">
                                    <div class="col-md-10">
                                        <div class="form-group">
                                            <label class="control-label" for="title"><?= __('Title') ?> <span class="required">*</span></label>
                                            <input class="form-control" value="<?= $poll['title'] ?>" type="text" name="title" id="title" />
                                        </div>
                                    </div>

                                    <div class="col-md-2">
                                        <div class="form-group">
                                            <label class="control-label" for="active"><?= __('Active') ?></label>
                                            <div>
                                                <input<?= $poll['active'] ? ' checked' : '' ?> class="form-control toggle" type="checkbox" id="active" value="1" name="active" />
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="control-label" for="starts-at"><?= __('Starts at') ?> <span class="required">*</span></label>
                                            <input data-show-calendar class="form-control" value="<?= util('Date')->date($poll['start_date']) ?>" type="text" name="start_at" id="starts-at" />
                                        </div>
                                    </div>

                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="control-label" for="poll-ends-at"><?= __('Ends at') ?></label>
                                            <input data-show-calendar class="form-control" value="<?= util('Date')->date($poll['end_date']) ?>" type="text" name="end_at" id="end-at" />
                                        </div>
                                    </div>
                                </div>

                                <div class="row">
                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label class="control-label" for="multiple"><?= __('Allow multiple') ?></label>
                                            <div>
                                                <input<?= $poll['allow_multiple'] ? ' checked' : '' ?> class="form-control toggle" type="checkbox" id="multiple" value="1" name="multiple" />
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label class="control-label" for="poll-allow-ips"><?= __('Allow IPs') ?></label>
                                            <div>
                                                <input<?= $poll['allow_ips'] ? ' checked' : '' ?> class="form-control toggle" type="checkbox" id="allow-ips" value="1" name="allow_ips" />
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label class="control-label" for="only-logged-in"><?= __('Only logged in') ?></label>
                                            <div>
                                                <input<?= $poll['only_logged_in'] ? ' checked' : '' ?> class="form-control toggle" type="checkbox" id="only-logged-in" value="1" name="only_logged_in" />
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="box-footer">
                    <div class="row">
                        <div class="col-sm-offset-3" style="padding-left:15px">
                            <input type="submit" class="btn btn-primary" value="<?= __('Save') ?>" />
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</section>