<div class="content-wrapper">

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

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

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

                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover">
                            <thead>
                            <tr class="erp-bg-thead">
                                <th width="15%"><?=$this->translate('操作者')?></th>
                                <th width="15%"><?=$this->translate('操作者级别')?></th>
                                <th width="15%"><?=$this->translate('操作时间')?></th>
                                <th width="15%"><?=$this->translate('ip地址')?></th>
                                <th width="32%"><?=$this->translate('操作描述')?></th>
                                <th width="8%"></th>
                            </tr>
                            <?php
                            $sForm = $this->searchForm;
                            $sForm->prepare();
                            ?>
                            <?= $this->form()->openTag($sForm); ?>
                            <tr>
                                <td>
                                    <?= $this->formElement($sForm->get('log_oper_user')); ?>
                                    <?=$this->formElementErrors($sForm->get('log_oper_user'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?= $this->formElement($sForm->get('log_oper_user_group')); ?>
                                    <?=$this->formElementErrors($sForm->get('log_oper_user_group'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?= $this->formElement($sForm->get('start_time')); ?>
                                    </p>
                                    <div>
                                        <?= $this->formElement($sForm->get('end_time')); ?>
                                    </div>
                                    <?=$this->formElementErrors($sForm->get('start_time'), ['class'=>'error-message']);?>
                                    <?=$this->formElementErrors($sForm->get('end_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?= $this->formElement($sForm->get('log_ip')); ?>
                                    <?=$this->formElementErrors($sForm->get('log_ip'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?= $this->formElement($sForm->get('log_body')); ?>
                                    <?=$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))) { ?>
                                        <a href="<?=$this->url('oper-log');?>" class="btn btn-default btn-sm"><i class="fa fa-reply"></i></a>
                                    <?php } ?>
                                </td>
                            </tr>
                            <?= $this->form()->closeTag(); ?>
                            </thead>
                            <tbody>
                            <?php if($this->operLogList) foreach ($this->operLogList as $logValue) { ?>
                                <tr>
                                    <td><?= $this->escapeHtml($logValue->getLogOperUser())?></td>
                                    <td><?= $this->escapeHtml($logValue->getLogOperUserGroup())?></td>
                                    <td><?= date("Y-m-d H:i:s", $logValue->getLogTime())?></td>
                                    <td><?= $this->escapeHtml($logValue->getLogIp())?></td>
                                    <td><?= $this->escapeHtml($logValue->getLogBody())?></td>
                                    <td></td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <?= $this->paginationControl($this->operLogList,
                            'Sliding',
                            'layout/page',
                            ['route' => 'oper-log']); ?>
                    </div>
                </div>
            </div>
        </div>

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