@extends('vip.layouts')
@section('content')

<div class="layui-row">

    <div class="layui-col-xs12">
        <form class="layui-form" action="" eventType=eventForm>
            <div class="layui-form-item">

                <div class="layui-inline">
                    <label class="layui-form-label">{{ trans('priv_role.priv_name') }}</label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="role_name" id="form_priv_id" lay-verify="" autocomplete="off" class="layui-input">
                    </div>

                    <label class="layui-form-label">{{ trans('priv_role.priv_code') }}</label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="priv_code" id="form_priv_code" lay-verify="" autocomplete="off" class="layui-input">
                    </div>
					
                     <label class="layui-form-label">{{ trans('priv_role.role_name') }}</label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="role_name" id="form_role_name" lay-verify="" autocomplete="off" class="layui-input">
                    </div>


                    <div class="layui-inline">
                        <a class="layui-btn layui-btn-sm lay-btn-diy"   data-type="reload" style="opacity: 1; pointer-events: auto;">提交</a>
						<a  class="layui-btn   layui-btn-sm  layui-btn-normol reset" data-type="reload" style="opacity: 1; pointer-events: auto;">重置</a>
                        <a href="/admin/priv/addTo?role_id={{ Request::get('id') }}&&priv_code={{ Request::get('role_code') }}" class="layui-btn layui-btn-sm  ">添加</a>
                        <a href="javascript:delWin('/{{ S('MODULE') }}/{{ S('CONTROLLER') }}/delete?id=');" class="layui-btn layui-btn-sm layui-btn-danger">{{ trans('common.delete') }}</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>
                </div>
            </div>
        </form>
    </div>
</div>
@push('dataTableJS')
var active = {
    reload: function(){
      //执行重载
      table.reload('{{ $dataId }}', {
        page: {
          curr: 1 //重新从第 1 页开始
        }
        ,where: {

            role_name:$("#form_role_name").val(),

            priv_code:$("#form_priv_code").val(),

            priv_name:$("#form_priv_id").val(),
                    rtoken:''

        }
      });
    }
  };

  //重置表单
  $('.reset').on('click',function(){
	  $('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) : '';
        });
$('.lay-btn-diy').on('click', function(){
    var type = $(this).data('type');
    active[type] ? active[type].call(this) : '';
  });
@endpush

@include('vip.datatable')
@endsection
