@extends('vip.layouts')
@section('seo_title')
{{ trans('menu.report_detail') }}
@endsection
@section('content')
    <style>
        .layui-laydate-range{
            width: auto;
        }
        .red{
            color: red;
        }
        .blue{
            color: #1E9FFF;
        }
        .green{
            color: green;
        }
        .yellow{
            color: #ffca10;
        }
        .bottom-txt{
            padding: 0.5em;
            line-height: 2em;
        }
    </style>

	<script type="text/html" id="betdetail">
	  <a href="/Admin/SixlotteryBet/Index?game=@{{d.game_name}}">@{{ d.name}}</a>
	  <input type="hidden" id="allnum" value=@{{d.allnum}}>
	  <input type="hidden" id="allbetmoney" value=@{{d.allbetmoney}}>
	  <input type="hidden" id="allbetres" value=@{{d.allbetres}}>
      <input type="hidden" id="alleffectivemoney" value=@{{d.alleffectivemoney}}>

	  <input type="hidden" id="allwinmoney" value=@{{d.allwinmoney}}>
	</script>

	<script type="text/html" id="query">

  <!-- <a href="/admin/report/view?game_name=@{{d.game_name}}&star_time=@{{d.star_time}}&end_time=@{{d.end_time}}">@{{ d.name}}</a> -->
</script>

<script type="text/html" id="betde">
        @{{#if(d.winmoney>0){ }}
        <p style="color:red;">@{{d.winmoney}}</p>
        @{{#}else{ }}
         <p style="color:green;">@{{d.winmoney}}</p>
        @{{#} }}
    </script>
    <div class="layui-row">

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

            <form class="layui-form rewrite" action="" eventType=eventForm>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('report.account_name') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="account_name" id="form_account_name" lay-verify="required" autocomplete="off" class="layui-input" eventType=event-query  value="{{ $account_name }}">
                        </div>
                        <!-- <div class="layui-input-inline checkbox">
                            <input type="checkbox" name="sureblur" id="form_sureblur" lay-skin="switch" lay-text="精确|模糊" checked eventType=event-query>
                        </div> -->
                    </div>
                    
                    <div class="layui-inline">

						<label class="layui-form-label">{{ trans('report.betnum_area') }}</label>
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" name="betnum_small" id="betnum_small" placeholder="￥0" eventType="event-query" value="{{ $betnum_small }}" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<div class="layui-form-mid">-</div>
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" name="betnum_big" id="betnum_big" placeholder="￥0" eventType="event-query" value="{{ $betnum_big }}" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">{{ trans('report.betmoney_area') }}</label>
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" name="betmoney_small" id="betmoney_small" placeholder="￥0" eventType="event-query" value="{{ $betmoney_small }}" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-form-mid">-</div>
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" name="betmoney_big" id="betmoney_big" placeholder="￥0" eventType="event-query" value="{{ $betmoney_big }}"  autocomplete="off" class="layui-input">
						</div>
					</div>
					{{--<div class="layui-inline">--}}
                        {{--<label class="layui-form-label">{{ trans('report.name') }}</label>--}}
						{{--<div class="layui-input-inline" style="width: 125px">--}}
							{{--<select name="name"  id="name"  lay-verify="" autocomplete="off" class="layui-input" eventType="event-query" >--}}
								{{--<option value="">{{ trans('gamemenu.select_game') }}</option>--}}
								{{--@foreach(trans('gamemenu.game_type') as $k=>$v):--}}
                                {{--@if($k == $name)--}}
                                    {{--<option selected = "selected" value="{{$k}}">{{$v}}</option>--}}
                                {{--@else--}}
                                    {{--<option value="{{$k}}">{{$v}}</option>--}}
                                {{--@endif--}}
								{{--@endforeach--}}
							{{--</select>--}}
						{{--</div>--}}

					{{--</div>--}}

					<div class="layui-inline">

						<label class="layui-form-label">{{ trans('report.betres_area') }}</label>
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" name="betres_small" id="betres_small" eventType="event-query" value="{{ $betres_small }}" placeholder="￥0" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-form-mid">-</div>
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" name="betres_big" id="betres_big" eventType="event-query" value="{{ $betres_big }}" placeholder="￥0" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">{{ trans('report.win_area') }}</label>
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" name="win_small" id="win_small" eventType="event-query" value="{{ $win_small }}" placeholder="￥0" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-form-mid">-</div>
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" name="win_big" id="win_big" eventType="event-query" value="{{ $win_big }}" placeholder="￥0" autocomplete="off" class="layui-input">
						</div>
					</div>
                    <br>

                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('report.star_time') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="star_time" id="star_time" placeholder=" - " lay-verify="" eventType="event-query"
                                   @if($star_time == "" )
                                   value="{{trans('status.default_time.seven_day')}}"
                                   @else
                                   value="{{ $star_time }}"
                                   @endif
                                   autocomplete="off" class="layui-input test-item" eventType=event-query>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('report.end_time') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="end_time" id="end_time" placeholder=" - " lay-verify="" eventType="event-query"
                                   @if($end_time == "" )
                                   value="{{trans('status.default_time.etime')}}"
                                   @else
                                   value="{{ $end_time }}"
                                   @endif
                                   autocomplete="off" class="layui-input test-item"  eventType=event-query>
                        </div>
				   </div>

                     <div class="layui-inline" style="width: 280px">
                        <label class="layui-form-label">{{ trans('report.select_option') }}</label>
                        <div class="layui-input-inline"  style="width: 200px">
                            <select name="settle_status" id="form_settle_status" lay-verify="" autocomplete="off" class="layui-input" eventType=event-query>
                                @foreach(trans('report.settle_status') as $k=>$v):
                                    @if($settle_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">游戏</label>
                        <div class="layui-input-inline">
                            <select name="game" id="form_game"  autocomplete="off" eventType="event-query">
                                <option value="">{{ trans('report.all_sixgame') }}</option>
                                @foreach($gameList as $k=>$v):
                                    @if($game==$v['table_name'])
                                        <option value="{{$v['table_name']}}" selected="selected">{{$v['name']}}</option>
                                    @else
                                        <option value="{{$v['table_name']}}">{{$v['name']}}</option>
                                    @endif
                                @endforeach
                            </select>
                        </div>

                    </div>

					<div class="layui-inline">
					<a class="layui-btn layui-btn-sm lay-btn-diy"  eventType=event-query-submit  data-type="reload" style="opacity: 1; pointer-events: auto;"
                       >提交</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;"
                       href="javascript:window.location.reload()" >
                        <i class="layui-icon">ဂ</i>
                    </a>
				   </div>
                </div>
            </form>
        </div>
    </div>
@push('dataTableJS')

//	$('.lay-btn-diy').on('click', function(){
//		var type = $(this).data('type');
//		active[type] ? active[type].call(this) : '';
//	});


//重置表单
	$('.reset').on('click',function(){
		$('input').val('');
		$('#name').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 curdata = res.data;
    var str='';
    if(document.getElementById("statistics")){

    }else{
    $('.layui-table-page').after('<div id="statistics"></div>');
    }
    var allnum = 0;
    var allbetmoney = 0;
    var allbetres = 0;
    var allwinmoney = 0;
    var alleffectivemoney = 0;
    for(var k in curdata){
        allnum = allnum + parseInt(curdata[k]['allnum']);
        allbetmoney = allbetmoney + parseFloat(curdata[k]['allbetmoney']);
        allbetres = allbetres + parseFloat(curdata[k]['allbetres']);
        allwinmoney = allwinmoney + parseFloat(curdata[k]['allwinmoney']);
        alleffectivemoney = alleffectivemoney + parseFloat(curdata[k]['alleffectivemoney']);
    }

	str+='<div class="bottom-txt"><p>下注总笔额：<span class="blue">'+allnum+'</span>,投注总金额：<span class="green">'+allbetmoney+'</span>下注结果总额：<span class="red">'+allbetres+'</span>,有效总金额：<span class="yellow">'+alleffectivemoney+'</span>,赢取总金额；'
    if((allbetmoney-allbetres)>0){
    str+='<span class="red">'+(-1*allwinmoney)+'</span></p></div>';
    }else{
    str+='<span class="green">'+(-1*allwinmoney)+'</span></p></div>';
    }
	$('#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
