<?php 
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/5/005
 * Time: 10:16
 */
?>
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-12">
    <h2>入金设置</h2>
        <ol class="breadcrumb">
            <li>
                <a href="<?= \yii\helpers\Url::to(['/admin/dashboard'])?>">管理首页</a>
            </li>
            <li class="active">
                <strong>入金参数设置</strong>
            </li>
        </ol>
    </div>
</div>

<div class="wrapper wrapper-content animated fadeInRight">
    <form id="form" class="form-horizontal">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox">
                    <div class="ibox-title">
                        <button class="btn btn-link">入金参数设置</button>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-bordered">
                            <?php foreach ($config as $key => $row) :?>
                            <tr>
                                <th>
                                    <?= $row['label'] ?>
                                    <input name="config[<?= $key ?>][id]" type="hidden" class="form-control" value="<?= $row['id'] ?>">
                                </th>
                                <td>
                                    <label class="checkbox-inline">
                                        <input name="config[<?= $key ?>][enable]" type="radio" value="1" <?php if($row['enable'] == 1): ?>checked<?php endif;?>> 启用 </label>
                                    <label class="checkbox-inline">
                                        <input name="config[<?= $key ?>][enable]" type="radio" value="0" <?php if($row['enable'] == 0): ?>checked<?php endif;?>> 禁用 </label>
                                </td>
                            </tr>
                            <?php endforeach;?>
                        </table>

                    </div>
                    <div class="ibox-footer">
                        <button id="submit" type="button" class="btn btn-primary"> 点我更新  ← 请谨慎设置</button>
                    </div>
                </div>
            </div>

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

<?php $this->beginBlock('footer_script'); ?>
<script>
    KindEditor.ready(function(K) {});
</script>

<!-- Page-Level Scripts -->
<script>
    $("#submit").on("click", function() {
        $.ajax({
            type: "POST",
            url: "/admin/deposit-config/config-ajax",
            data: $('#form').serialize(),
            dataType: "json",
            beforeSend: function() {},
            success: function(data) {
                if(data.isSuccess) {
                    toastr.success(data.msg, "提示");
                } else {
                    toastr.error(data.msg, "提示");
                }
            },
            complete: function(XMLHttpRequest, textStatus) {},
            error: function() {}
        });
    });
</script>
<?php $this->endBlock(); ?>
