@extends('vip.layouts')
@section('content')
<style type="text/css">
  .loss-input {
    /* display: block; */
    width: 100%;
    padding-left: 10px;
}
.loss-input {
    height: 38px;
    line-height: 1.3;
    line-height: 38px\9;
    border-width: 1px;
    border-style: solid;
    background-color: #fff;
    border-radius: 2px;
}
</style>
<form class="layui-form" action="{{ url()->full() }}" id="submitForm" name="submitForm" method="post" eventType=eventAjaxForm>
{!! csrf_field() !!}


            <div class="layui-form-item">
                <label class="layui-form-label">{{ trans('rgamesubclass.sname_en') }}:</label>
                <div class="layui-input-block">
                <input type="text" name="sname_en"   id="sname_en"  required  lay-verify="" placeholder="" autocomplete="off" value="@isset($data) {{ $data['sname_en'] }} @endisset" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">{{ trans('rgamesubclass.child_name') }}:</label>
                <div class="layui-input-block">
                <input type="text" name="child_name"   id="child_name"  required  lay-verify="" placeholder="" autocomplete="off" value="@isset($data) {{ $data['child_name'] }} @endisset" class="layui-input">
                </div>
            </div>
            

            <div class="layui-form-item">
            <label class="layui-form-label">游戏类型</label>
            <div>
                <div class="layui-input-inline" style="width: 20%">
                    <select name="game_type" id="fr_type" lay-fr lay-filter="fr_type" autocomplete="off" class="layui-input"
                            eventType=event-query>
                        <option value="">请选择游戏类型</option>
                        @if(isset($game_type)&&is_array($game_type))
                            @foreach($game_type as $v)
                                <option @if(isset($data['pin_name']) && $data['pin_name'] == $v['id'])selected @endif  value="{{$v['id']}}">{{$v['name']}}</option>
                            @endforeach
                        @endif
                    </select>
                </div>
            </div>
        </div>

            <div class="layui-form-item">
                <label class="layui-form-label">是否开启</label>
                <div class="layui-input-block">
                    <input type="radio" name="status" value="1" title="开启"
                           {{(!isset($data['status']) || $data['status']===1)?'checked':''}}
                           >
                    <input type="radio" name="status" value="0" title="禁用" 
                           {{(!isset($data['status']) || $data['status']===0)?'checked':''}}>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">是否推荐</label>
                <div class="layui-input-block">
                    <input type="radio" name="recommend" value="1" title="推荐"
                           {{(!isset($data['recommend']) || $data['recommend']===1)?'checked':''}}
                           >
                    <input type="radio" name="recommend" value="0" title="不推荐" 
                           {{(!isset($data['recommend']) || $data['recommend']===0)?'checked':''}}>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">{{ trans('rgamesubclass.parent_id') }}</label>
                <div class="layui-input-block">
                    <input type="number" name="parent_id" class="layui-input" id="parent_id"
                           value="{{isset($data['parent_id'])?$data['parent_id']:''}}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">图标</label>
                <div class="layui-input-block">
                    <input type="text" name="icon" class="layui-input"
                           value="{{isset($data['icon'])?$data['icon']:''}}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">{{ trans('rgamesubclass.order') }}</label>
                <div class="layui-input-block">
                    <input type="number" name="order" class="layui-input"
                           value="{{isset($data['order'])?$data['order']:''}}">
                </div>
            </div>
            <div class="layui-form-item">
            <label class="layui-form-label">角标</label>
            <div class="layui-input-block">
                <input type="radio" name="corner" value="0" title="无"
                       @if((isset($data['corner']) && $data['corner']==0) || !isset($data['corner'])) checked @endif>
                <input type="radio" name="corner" value="1" title="热门"
                       @if(isset($data['corner']) && $data['corner']==1) checked @endif>
                <input type="radio" name="corner" value="2" title="推荐"
                       @if(isset($data['corner']) && $data['corner']==2) checked @endif>
                <input type="radio" name="corner" value="3" title="精选"
                       @if(isset($data['corner']) && $data['corner']==3) checked @endif>
            </div>
        </div>


@if(S('ACTION')!='view')
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="submitForm">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-green">重置</button>
    </div>
  </div>
@endif
</form>

<script>
  
      //Demo
      layui.use(['form'], function(){
          var form = layui.form;
          form.on('select(fr_type)', function(data){
            var val = data.value.split('||');
            $("#parent_id").val(val[3]);

          });
          //监听提交
          form.on('submit(submitForm)', function(data){
              return true;
          });
          
      });
      function cbFormSuccess(data){
          layer.msg(data.msg);
          setTimeout(function(){
              window.location.href='/Admin/Rgame/subclass';
          },2500);
      }
  </script>
@endsection
