@extends('vip.layouts')
@section('seo_title')
    {{ trans('menu.take_money') }}
@endsection
@section('content')
    <style>
        .layui-laydate-range {
            width: auto;
        }

        .layui-form-switch em {
            width: auto;
        }

        .layui-form-switch {
            width: 44px;
            line-height: 23px;
        }

        .layui-form-item .checkbox {
            width: auto;
        }

        .red{
            color: red;
        }
        .blue{
            color: #1E9FFF;
        }
        .green{
            color: green;
        }
        .yellow{
            color: #ffca10;
        }

        .red{
            color: red;
        }
        .blue{
            color: #1E9FFF;
        }
        .green{
            color: green;
        }
        .yellow{
            color: #ffca10;
        }
    </style>

    <script type="text/html" id="tools">
        <!---详情---->
        <a class="layui-btn layui-btn-sm" href="/admin/Competition/view?info_no=@{{d.info_no}}">{{trans('competition.view')}}</a>
        <!-----关闭赛事--
        <a class="layui-btn layui-btn-sm"href="">{{ trans('match.close') }}</a>-->


    </script>
    <script type="text/html" id="status">
                @{{#if(d.status=="0"){ }}
                <p style="">投注</p>
                @{{#}else if(d.status=="1"){ }}
                 <p style="">封盘</p>
                @{{#}else{ }}
                 <p style="">已结束</p>
                @{{#} }}
            </script>

    <div class="layui-row">

        <div class="layui-col-xs12">

            <form class="layui-form rewrite" action="" eventType=eventForm>
                <input type="hidden" name="match_id" value="{{ $match_id }}">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('competition.info_name') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="info_name" id="form_info_name" lay-verify="required" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $info_name }}">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('competition.sub_title') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="sub_title" id="form_sub_title" lay-verify="required" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $sub_title }}">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('competition.info_no') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="info_no" id="form_info_no" lay-verify="required" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $info_no }}">
                        </div>
                    </div>

                    <div class="layui-inline" style="width: 360px">
                            <label class="layui-form-label">{{ trans('competition.status') }}</label>
                            <div class="layui-input-inline"  style="width: 200px">
                                <select name="status" id="form_status" lay-verify="" autocomplete="off" class="layui-input" eventType=event-query>
                                    @foreach(trans('competition.select_status') as $k=>$v):
                                        @if($status==$k)
                                            <option value="{{$k}}" selected="selected">{{$v}}</option>
                                        @else
                                            <option value="{{$k}}">{{$v}}</option>
                                        @endif
                                    @endforeach
                                </select>
                            </div>
                        </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('competition.start_time') }}</label>
                        <div class="layui-input-inline" style="width: 100px;">
                            <input type="text" name="start_time_a" id="form_start_time_a"  lay-verify="" autocomplete="off" class="layui-input test-item" eventType=event-query  value="{{ $start_time_a}}">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline" style="width: 100px;">
                            <input type="text" name="start_time_b" id="form_start_time_b" placeholder="  " lay-verify="" autocomplete="off" class="layui-input test-item" eventType=event-query  value="{{ $start_time_b }}">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('competition.end_time') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="end_time_a" id="form_end_time_a" placeholder=" - " lay-verify="" autocomplete="off" class="layui-input test-item" eventType=event-query  value="{{ $end_time_a }}">
                        </div>
                    <div class="layui-form-mid">-</div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input type="text" name="end_time_b" id="form_end_time_b" placeholder="-" lay-verify="" autocomplete="off" class="layui-input test-item" eventType=event-query  value="{{ $end_time_b }}">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <a class="layui-btn layui-btn-sm lay-btn-diy" data-type="reload" style="opacity: 1; pointer-events: auto;" eventType='event-query-submit' eventType=event-query-submit>提交</a>
                        <!--<a class="layui-btn   layui-btn-sm  layui-btn-normal reset" data-type="reload"
                           style="opacity: 1; pointer-events: auto;">重置</a>
                           <a class="layui-btn layui-btn-sm layui-btn-green set" data-type="reload" style="opacity: 1; pointer-events: auto;" eventType=event-query-submit><i class="layui-icon">ဂ</i></a>-->
                    </div>
                    <div class="layui-inline">
                        <a class="layui-btn layui-btn-sm" data-type="reload" href="/admin/Competition/add?match_id={{ $match_id }}">添加新一期</a>
                    </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
    @push('dataTableJS')
        /*var active = {
			reload: function(){
				//执行重载
				console.log($('#form_status').val());
				table.reload('{{ $dataId }}', {
					page: {
						curr: 1 //重新从第 1 页开始
					}
					,where: {
						account_name:$("#form_account_name").val(),
						order_id:$('#form_order_id').val(),
						bank_user:$('#form_bank_user').val(),
						money_small:$('#form_money_small').val(),
						money_big:$('#form_money_big').val(),
						status:$('#form_status').val(),
						apply_startime:$('#form_apply_startime').val(),
						apply_endtime:$('#form_apply_endtime').val(),
						haddle_startime:$('#form_haddle_startime').val(),
						haddle_endtime:$('#form_haddle_endtime').val(),
						sureblur:$('.layui-form-switch').text(),
					}
				});
			}
        };*/
        //$('.lay-btn-diy').on('click', function(){
		//	var type = $(this).data('type');
		//	active[type] ? active[type].call(this) : '';
        //});

        //重置表单
        /*$('.reset').on('click',function(){
			$('input').val('');
			$('#form_status').val('3');
			$('.layui-form-select input').val('待审核');			
			//var type = $(this).data('type');
			//active[type] ? active[type].call(this) : '';
        });

        //刷新表单
        $('.set').on('click',function(){
        //var type = $(this).data('type');
        //active[type] ? active[type].call(this) : '';
        });*/


        function dataTableLoadFinished(res,curr,count){
        var str='';
        if(document.getElementById("statistics")){

        }else{
        $('.layui-table-page').after('<div id="statistics"></div>');
        }
        $.ajax({
        type: 'get',
        url: '/admin/money/takeMoneyCount',
        data: {where:res.extras},
        dataType: 'json',
        //async: false,
        success: function (data) {
        var data=data.data;
        for(var i in data){
        data[i]=parseFloat(data[i]);
        }
        str+='<p>总金额：<span class="blue">'+data.all_money+'</span> , 成功：<span class="green">'+data.success_money+'</span> , 手续费：<span class="red">'+data.service_money+'</span> , 处理中：<span class="yellow">'+data.handing+'</span></p>'
        $('#statistics').html(str);
        var height1=$('.layui-table-view').height();
        var height2=$('#statistics').height();

        $('.layui-table-view').css({height:(height1+height2)});
        }
        });


        }
    @endpush

    @include('vip.datatable')
@endsection
