<div class="content-wrapper">
    <?php
    $form = $this->form;
    $form->prepare();
    ?>
    <?php echo $this->form()->openTag($form); ?>
    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>

        <h1 class="pull-right" id="dbshop-menu-top">
            <a href="<?php echo $this->url('operation-ad', ['action' => 'mobileAdList']);?>" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> <?php echo $this->translate('返回手机端广告列表'); ?></a>
            <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-check"></i> <?php echo $this->translate('保存广告信息'); ?></button>
            <a href="javascript:;" onclick="deleteConfirm('<?php echo $this->translate('您确实要清除该广告内容吗?'); ?>', '<?php echo $this->url('operation-ad', ['action'=>'adDelete'], ['query' => ['type' => 'mobile', 'class' => $this->classCode, 'placeCode' => $this->placeCode, 'qToken' => $this->adminHelper()->getCsrfValue()]]); ?>');" class="btn btn-sm btn-danger"><i class="fa fa-trash"></i> <?php echo $this->translate('清除广告'); ?></a>
            <?php echo $this->HelpUrl('mobileAd'); ?>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title"><?php echo $this->translate('设置广告'); ?></h3>
                    </div>

                    <div class="box-body">
                        <?php echo $this->partial('layout/messages'); ?>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('广告位置'); ?></label>
                            <div class="col-sm-5">
                                <p class="form-control-static"><?php echo $this->className . ' -> ' . $this->placeName; ?></p>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('广告类型'); ?></label>
                            <div class="col-sm-5">
                                <p class="form-control-static"><?php echo $this->adType == 'image' ? $this->translate('图片') : $this->translate('幻灯片'); ?></p>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('图片尺寸'); ?></label>
                            <div class="col-sm-5">
                                <p class="form-control-static"><?php echo $this->imageSize; ?></p>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('广告图片'); ?></label>
                            <div class="col-sm-5">
                                <?php if(is_string($form->get('adImage')->getValue())) { ?>
                                    <img src="<?php echo $this->basePath($form->get('adImage')->getValue()); ?>" style="max-width: 800px;padding-bottom: 5px;">
                                <?php } ?>
                                <?php echo $this->formElement($form->get('adImage')); ?>
                                <?php echo $this->formElementErrors($form->get('adImage'), ['class'=>'error-message']); ?>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('URL地址'); ?></label>
                            <div class="col-sm-6">
                                <?php echo $this->formElement($form->get('adUrl')); ?>
                                <?php echo $this->formElementErrors($form->get('adUrl'), ['class'=>'error-message']); ?>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('开始时间'); ?></label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <div class="input-group-addon">
                                        <i class="fa fa-calendar"></i>
                                    </div>
                                    <?php echo $this->formElement($form->get('adStartTime')); ?>
                                </div>
                                <?php echo $this->formElementErrors($form->get('adStartTime'), ['class'=>'error-message']); ?>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('结束时间'); ?></label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <div class="input-group-addon">
                                        <i class="fa fa-calendar"></i>
                                    </div>
                                    <?php echo $this->formElement($form->get('adEndTime')); ?>
                                </div>
                                <?php echo $this->formElementErrors($form->get('adEndTime'), ['class'=>'error-message']); ?>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('状态'); ?></label>
                            <div class="col-sm-4">
                                <div class="checkbox">
                                    <label>
                                        <?php echo $this->formElement($form->get('adState')); ?><?php echo $this->translate('启用'); ?>
                                        <?php echo $this->formElementErrors($form->get('adState'), ['class'=>'error-message']); ?>
                                    </label>
                                </div>
                            </div>
                        </div>

                    </div>

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

    </section>
    <?php echo $this->form()->closeTag(); ?>

</div>
<script type="text/javascript">
    laydate.render({elem: '#adStartTime'});
    laydate.render({elem: '#adEndTime'});
</script>
