<div class="content-wrapper">
    <?php
    $form = $this->form;
    $form->prepare();

    $form->get('adminPassword')->setAttributes([
        'placeholder' => $this->translate('管理员密码')
    ]);
    $form->get('adminComPassword')->setAttributes([
        'placeholder' => $this->translate('确认密码')
    ]);
    ?>
    <?= $this->form()->openTag($form); ?>
    <section class="content-header">
        <?=$this->partial('layout/breadcrumb')?>

        <h1 class="pull-right">
            <a href="<?=$this->url('admin');?>" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> <?=$this->translate('返回管理员列表')?></a>
            <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-check"></i> <?=$this->translate('修改密码')?></button>
            <?=$this->HelpUrl('adminPassword')?>
        </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"><?=$this->translate('修改管理员密码')?></h3>
                    </div>

                    <div class="box-body">
                        <?= $this->formElementErrors($form->get('dberp_csrf'), ['class'=>'error-message']); ?>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?=$this->translate('管理员账号')?></label>
                            <div class="col-sm-6">
                                <p class="form-control-static"><?=$this->escapeHtml($user->getAdminName())?></p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?=$this->translate('管理员密码')?><span class="must_add_value">*</span></label>
                            <div class="col-sm-6">
                                <?= $this->formElement($form->get('adminPassword')); ?>
                                <?= $this->formElementErrors($form->get('adminPassword'), ['class'=>'error-message']); ?>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?=$this->translate('确认密码')?><span class="must_add_value">*</span></label>
                            <div class="col-sm-6">
                                <?= $this->formElement($form->get('adminComPassword')); ?>
                                <?= $this->formElementErrors($form->get('adminComPassword'), ['class'=>'error-message']); ?>
                            </div>
                        </div>
                    </div>

                    <div>
                        <div class="box-footer">
                            <?= $this->formElement($form->get('dberp_csrf')); ?>
                            <button type="submit" class="btn btn-primary col-md-offset-2"><i class="fa fa-check"></i> <?=$this->translate('修改密码')?></button>
                        </div>
                    </div>

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

    </section>
    <?= $this->form()->closeTag(); ?>
</div>
<script>
    $(document).ready(function() {
        $("#<?=$form->getName()?>").validate({
            rules: {
                adminPassword: {
                    required: true
                },
                adminComPassword: {
                    required: true,
                    equalTo: "#adminPassword"
                }
            },
            messages: {
                adminPassword: {
                    required: "<?=$this->translate('请输入管理员密码')?>"
                },
                adminComPassword: {
                    required: "<?=$this->translate('请输入确认密码')?>",
                    equalTo: "<?=$this->translate('两次输入的密码不一致')?>"
                }
            }
        });
    });
</script>