@extends('vip.layouts')
@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;
        }
    </style>
    <script type="text/html" id="agent_name">
       <a href="/admin/agent/agentInfo?id=@{{ d.id }}" >@{{d.agent_user}}</a>
    </script>

    <script type="text/html" id="child_bet">
        @{{d.child_bet}}/ @{{d.child_bet_settle}}
    </script>

    <script type="text/html" id="settle">
        @{{d.no_settle}}/ @{{d.settle}}
    </script>
    <script type="text/html" id="sellte_agent">
        <a class="layui-btns" href="/admin/agent/Settle?id=@{{ d.id }}" >结算代理</a>
    </script>
    <script type="text/html" id="money_list">
        <a class="layui-btns" href="/admin/AgentFund/index?agent_name=@{{ d.agent_user }}" >查看</a>
    </script>
    <script type="text/html" id="child">
        <a class="" href="/admin/agentChild/index?identity=@{{ d.agent_identity }}" >下级会员</a>
    </script>
    <script type="text/html" id="pass">
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:Vertity('/admin/agent/pass/?id=@{{ d.id }}');" >通过</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:Vertity('/admin/agent/NoAccess/?id=@{{ d.id }}');" >驳回</a>
    </script>
    <script type="text/html" id="agent">
        @{{#if(d.state==1){ }}
            <div style="color:green;">启用&nbsp;&nbsp;<a href="/admin/agent/changeStatus?id=@{{d.id}}" class="layui-btn layui-btn-xs layui-btn-danger" style="margin-bottom:5px;margin-left:0px;">禁用</a></div>
        @{{#}else{ }}
            <div style="color:red;">禁用&nbsp;&nbsp;<a href="/admin/agent/changeStatus?id=@{{d.id}}" class="layui-btn layui-btn-xs" style="margin-bottom:5px;margin-left:0px;">启用</a></div>
        @{{#} }}
    </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('agent.agent_user') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="agent_user" id="agent_user" value="{{ $agent_user }}" eventType=event-query lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-input-inline checkbox">
                            <input type="checkbox" name="sureblur" id="sureblur" lay-skin="switch" lay-text="精确|模糊" checked>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('agent.grade') }}</label>
                        <div class="layui-input-inline" style="width: 200px">
                            <select name="grade" id="grade" lay-verify="" autocomplete="off" eventType=event-query class="layui-input">
                                <option value="">{{ trans('agent.select_grade') }}</option>
                                @foreach($gradeArray as $k=>$v):
                                @if($v['grade_code'] == $grade)
                                    <option selected = "selected" value="{{$v['grade_code']}}">{{$v['grade_name']}}</option>
                                @else
                                    <option value="{{$v['grade_code']}}">{{$v['grade_name']}}</option>
                                @endif
                                @endforeach
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">

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

                    </div>
                    <div class="layui-inline">

                        <label class="layui-form-label">{{ trans('agent.type') }}</label>
                        <div class="layui-input-inline" style="width: 200px">
                            <select name="type" id="type" lay-verify="" autocomplete="off"  eventType=event-query class="layui-input">
                                <option value="">{{ trans('agent.select_type') }}</option>
                                @foreach(trans('status.agent_detailed.type') as $k=>$v):
                                @if($k == $type)
                                    <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('agent.status') }}</label>
                        <div class="layui-input-inline" style="width: 200px">
                            <select name="status" id="status" lay-verify="" autocomplete="off" eventType=event-query class="layui-input">
                                <option value="">{{ trans('agent.select_status') }}</option>
                                @foreach(trans('status.agent_detailed.status') as $k=>$v):
                                @if($k == $status)
                                    <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('agent.regist_startime') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="regist_startime"  id="regist_startime" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item"  value="{{$regist_startime}}" eventType=event-query>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('agent.regist_endtime') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="regist_endtime"  id="regist_endtime" placeholder=" - "  lay-verify="" autocomplete="off" class="layui-input test-item" value="{{ $regist_endtime }}" eventType=event-query>
                        </div>
                    </div>

                     <div class="layui-inline">
                        <label class="layui-form-label">{{ trans('agent.id') }}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="id" id="id" value="{{ $id }}" eventType=event-query lay-verify="required" autocomplete="off" class="layui-input">
                        </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;"
                        ><i class="layui-icon">ဂ</i></a>
                    </div>

                <!--  &nbsp;&nbsp;&nbsp;&nbsp;<div class="layui-inline"><a href="javascript:openWin('/admin/system/addMenu','{{ trans("menu.menu_add")}}','600px','800px','')"
                     class="layui-btn layui-btn-sm">添加</a></div>
                    <div class="layui-inline"><a href="/admin/menu/add"
                                                 class="layui-btn layui-btn-sm  layui-btn-danger">删除</a></div> -->

                </div>
            </form>
        </div>
    </div>
@push('dataTableJS')
/*var active = {
    reload: function(){
      //执行重载
      table.reload('{{ $dataId }}', {
        page: {
          curr: 1 //重新从第 1 页开始
        }
        ,where: {
            agent_user:$("#agent_user").val(),
            grade:$('#grade').val(),
            phone:$('#phone').val(),
            email:$('#email').val(),
            type:$('#type').val(),
            status:$('#status').val(),
            regist_startime:$('#regist_startime').val(),
            regist_endtime:$('#regist_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('');
	  $('#grade').val('');
	  $('#type').val('');
	  $('#status').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) : '';
//    });
@endpush
<script>
    function Vertity(url) {
        layer.confirm('是否确认操作？', {
            btn: ['确认', '取消'] //按钮
        }, function() {
            $.getJSON(url, function(data, textStatus) {
                if (data.status == '1') {
                    layer.msg('操作成功');
                    reloadDataTable();
                } else {
                    layer.msg(data.msg);
                }
            });
        }, function() {
        });
    }
</script>
    @include('vip.datatable')
@endsection
