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

    $form->get('userName')->setAttributes([
        'readonly' => true
    ]);
    ?>
    <?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('user', [], ['query' => $this->queryData]);?>" 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>
            <?php echo $this->HelpUrl('editUserBalance'); ?>
        </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">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('客户名称'); ?></label>
                            <div class="col-sm-3">
                                <?php echo $this->formElement($form->get('userName')); ?>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('客户当前余额'); ?></label>
                            <div class="col-sm-3">
                                <p class="form-control-static"><?php echo $this->shopCurrencyFormat($this->userInfo->getUserMoney()); ?></p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('余额操作'); ?></label>
                            <div class="col-sm-2">
                                <?php echo $this->formElement($form->get('changeBalance')); ?>
                                <?php echo $this->formElementErrors($form->get('changeBalance'), ['class'=>'error-message']); ?>
                            </div>
                            <div class="col-sm-2">
                                <?php echo $this->formElement($form->get('changeBalanceNum')); ?>
                                <?php echo $this->formElementErrors($form->get('changeBalanceNum'), ['class'=>'error-message']); ?>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('备注说明'); ?><span class="must_add_value">*</span></label>
                            <div class="col-sm-8">
                                <?php echo $this->formElement($form->get('changeBalanceInfo')); ?>
                                <?php echo $this->formElementErrors($form->get('changeBalanceInfo'), ['class'=>'error-message']); ?>
                            </div>
                        </div>

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

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

</div>
<script>
    $(document).ready(function() {
        $("#<?php echo $form->getName(); ?>").validate({
            rules: {
                changeBalanceNum: {
                    number: true,
                    min:0.01
                },
                changeBalanceInfo: {
                    required: true
                }
            },
            messages: {
                changeBalanceNum: {
                    number: "<?php echo $this->translate('余额必须为数字!'); ?>",
                    min: "<?php echo $this->translate('必须是大于0的数字!'); ?>"
                },
                changeBalanceInfo: {
                    required: "<?php echo $this->translate('备注不能为空!'); ?>"
                }
            }
        });
    });
</script>
