<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>支付加倍配置</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/bootstrap/bootstrap.min.css" >
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
    <link rel="stylesheet" href="<?php echo base_url();?>public/css/jquery.timepicker.min.css">
    <!-- Select2 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/select2/select2.min.css">

    <style type="text/css">
        .thumbnail {
            margin:10px;
        }

        .lang-name {
            margin-left:42px;
        }

        .upimg {
            cursor: pointer;
        }

    </style>
</head>
<body>
<div id="msg-tip">

</div>
<div class="content_wrapper">
    
    <div class="container-fluid">
        <aside>
            <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"  id="goodForm" action="#" style="margin-top: 20px">
                
                <input type="hidden" value="price" name="type"/>
                <header><i class="fa fa-fw fa-file"></i>支付加倍出现概率配置</header>
                <section>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <button type="button" class="btn btn-success" id="goodsubmitBtn">提交</button>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid">
                        <?php foreach ($list['priceConfig'] as $key => $vl) { ?>
                            <div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;">
                                <div class="form-group" >
                                    <label class="col-sm-1 control-label">价格*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control" readonly name="price[<?php echo $vl['id'];?>]" value="<?php echo $vl['price'];?>">
                                    </div>
                                    <div class="col-sm-10">
                                    <?php 
													if(!empty($vl['list'])){
														foreach ($vl['list'] as $k => $v){
												?>
									<div class="col-sm-12" style="margin-top: 1rem;padding-left:0">
	                                    <label class="col-sm-1 control-label">积分*: </label>
	                                    <div class="col-sm-1">
	                                        <input type="text" class="form-control" readonly name="list[<?php echo $vl['id'];?>][<?php echo $k;?>][mixPoint]" value="<?php echo $v['mixPoint'];?>">
	                                    </div>
	                                    <label class="col-sm-1 control-label">概率*: </label>
	                                    <div class="col-sm-1">
	                                        <input type="text" class="form-control"  name="list[<?php echo $vl['id'];?>][<?php echo $k;?>][probability]" value="<?php echo $v['probability'];?>">
	                                    </div>
	                                	<label class="col-sm-2 control-label">每日最大出现次数*: </label>
	                                    <div class="col-sm-1">
	                                        <input type="text" class="form-control"  name="list[<?php echo $vl['id'];?>][<?php echo $k;?>][maxNum]" value="<?php echo $v['maxNum'];?>">
	                                    </div>
                                    </div>
                                    <?php
														}
													} 
												?>
									</div>
                                </div>
                            </div>
                        <?php } ?>
                    </div>
                </section>
            </form>
        </aside>
    </div>
	
	
	<div class="container-fluid">
        <aside>
            <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"  id="configForm" action="#" style="margin-top: 20px">
                
                <input type="hidden" value="bet" name="type"/>
                <header><i class="fa fa-fw fa-file"></i>支付加倍倍率概率配置</header>
                <section>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <button type="button" class="btn btn-success" id="configsubmitBtn">提交</button>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid">
                    	<div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;">
                        <?php foreach ($list['betConfig'] as $key => $vl) { ?>
                            <div class="col-sm-2">
                                <div class="form-group">
	                                    <label class="col-sm-12 control-label">价格*: </label>
	                                    <div class="col-sm-12">
                                        	<input type="text" class="form-control" readonly name="price[<?php echo $vl['id'];?>]" value="<?php echo $vl['price'];?>">
                                    	</div>
                                    	
                                		<?php 
										if(!empty($vl['list'])){
											foreach ($vl['list'] as $k => $v){

											?>

			                                    <label class="col-sm-12 control-label">转盘序号<?php echo $k+1;?>(bet <?php echo $v[0];?>)*: </label>
			                                    <div class="col-sm-12">
			                                    	<input type="hidden" class="form-control"  name="list[<?php echo $vl['id'];?>][<?php echo $k;?>][]" value="<?php echo $v[0];?>">
			                                        <input type="text" class="form-control"  name="list[<?php echo $vl['id'];?>][<?php echo $k;?>][]" value="<?php echo $v[1];?>">
			                                    </div>

                            			<?php
													
												}
											} 
										?>
										
								</div>
                            </div>
                            
                        <?php } ?>
                        </div>
                    </div>
                </section>
            </form>
        </aside>
    </div>
</div>

</body>

<script type="text/javascript">
    
    $(function () {
        $('#goodsubmitBtn').click(function () {
            var data = new FormData(document.getElementById("goodForm"));
            $.ajax({
                url: rootPath + 'config/setTurnPaybetConfig',
                type: 'POST',
                data: data,
                dataType: 'json',
                contentType: false, //必须
                processData: false, //必须
                success: function (data) {
                    alert(data.msg);
                    window.location.reload();
                },
                error: function (msg) {
                    alert(data.msg);
                }
            });
        });
        $('#configsubmitBtn').click(function () {
            var data = new FormData(document.getElementById("configForm"));
            $.ajax({
                url: rootPath + 'config/setTurnPaybetConfig',
                type: 'POST',
                data: data,
                dataType: 'json',
                contentType: false, //必须
                processData: false, //必须
                success: function (data) {
                    alert(data.msg);
                    window.location.reload();
                },
                error: function (msg) {
                    alert(data.msg);
                }
            });
        });
        
        
        
    });
    
    
</script>
</html>
