<div class="content-wrapper">

    <form name="clear-form" action="<?php echo $this->url('oper-log', ['action' => 'clearOperLog']);?>" method="post">
    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>
        <h1 class="pull-right">
                <select name="clear_time" id="clear_time" class="input-sm">
                    <option><?php echo $this->translate('选择清除时间'); ?></option>
                    <option value="7"><?php echo $this->translate('一周前'); ?></option>
                    <option value="30"><?php echo $this->translate('一个月前'); ?></option>
                    <option value="90"><?php echo $this->translate('三个月前'); ?></option>
                    <option value="180"><?php echo $this->translate('半年前'); ?></option>
                </select>
                <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-trash-o"></i> <?php echo $this->translate('删除日志'); ?></button>
            <?php echo $this->HelpUrl('operLogList'); ?>
        </h1>
    </section>
    </form>

    <section class="content">
        <?php echo $this->partial('layout/messages'); ?>

        <div class="row">
            <div class="col-xs-12">
                <div class="box shop-box">

                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover">
                            <thead>
                            <tr class="shop-bg-thead">
                                <th width="15%"><?php echo $this->translate('操作者'); ?></th>
                                <th width="15%"><?php echo $this->translate('操作者级别'); ?></th>
                                <th width="18%"><?php echo $this->translate('操作时间'); ?></th>
                                <th width="14%"><?php echo $this->translate('ip地址'); ?></th>
                                <th width="30%"><?php echo $this->translate('操作描述'); ?></th>
                                <th width="8%"></th>
                            </tr>
                            <?php
                            $sForm = $this->searchForm;
                            $sForm->prepare();
                            ?>
                            <?php echo $this->form()->openTag($sForm); ?>
                            <tr>
                                <td>
                                    <?php echo $this->formElement($sForm->get('log_oper_user')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('log_oper_user'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('log_oper_user_group')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('log_oper_user_group'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?php echo $this->formElement($sForm->get('start_time')); ?>
                                    </p>
                                    <div>
                                        <?php echo $this->formElement($sForm->get('end_time')); ?>
                                    </div>
                                    <?php echo $this->formElementErrors($sForm->get('start_time'), ['class'=>'error-message']);?>
                                    <?php echo $this->formElementErrors($sForm->get('end_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('log_ip')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('log_ip'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('log_body')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('log_body'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <button type="submit" class="btn btn-info btn-sm"><i class="fa fa-search"></i></button>
                                    <?php
                                    $formData = $sForm->getData();
                                    if(!empty(array_filter($formData))) { ?>
                                        &nbsp;&nbsp;<a href="<?php echo $this->url('oper-log');?>" class="btn btn-default btn-sm"><i class="fa fa-reply"></i></a>
                                    <?php } ?>
                                </td>
                            </tr>
                            <?php echo $this->form()->closeTag(); ?>
                            </thead>
                            <tbody>
                            <?php if($this->operLogList->getCurrentItemCount() > 0) foreach ($this->operLogList as $logValue) { ?>
                                <tr>
                                    <td><?php echo $this->escapeHtml($logValue->getLogOperUser()); ?></td>
                                    <td><?php echo $this->escapeHtml($logValue->getLogOperUserGroup()); ?></td>
                                    <td><?php echo $this->shopDateFormat()->adminLogTime($logValue->getLogTime()); ?></td>
                                    <td><?php echo $this->escapeHtml($logValue->getLogIp()); ?></td>
                                    <td><?php echo $this->escapeHtml($logValue->getLogBody()); ?></td>
                                    <td></td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <?php echo $this->paginationControl($this->operLogList, 'Sliding', 'layout/page', ['route' => 'oper-log']); ?>
                    </div>
                </div>
            </div>
        </div>

    </section>
</div>
<script>
    laydate.render({elem: '#start_time'});
    laydate.render({elem: '#end_time'});
</script>