{{include_file name='home/public/header' title='成员管理'}}
<style>
    body {
        background-color: #ffffff;
    }

    table a{
        margin-top: 10px;
    }
</style>
</head>

<body>

<div class="container">

    <!-- /.row -->
    <div class="row">

        <form role="form" action="{{url()}}" method="post">

            <input type="hidden" name="csrf-phprap" value="{{csrf_token()}}" />

            <div class="alert alert-dismissable alert-warning">
                <i class="fa fa-fw fa-info-circle"></i>&nbsp;
                成员隶属于项目，勾选权限后，该成员具有项目的勾选权限
            </div>

            <div class="form-group">
                <label>成员信息</label>
                <input type="text" readonly class="form-control" datatype="*1-250" value="{{$member->account->fullName}}">
            </div>

            <div class="form-group">
                <label>项目权限</label>
                <input type="hidden" class="js_projectRule" name="UpdateMember[project_rule]">
                <label class="checkbox-inline">
                    <input class="js_projectRule" onclick="return false;" checked type="checkbox" value="look">查看项目
                </label>

                <label class="checkbox-inline">
                    <input class="js_projectRule" type="checkbox" value="update" {{if $member->hasAuth(['project' => 'update'])}}checked{{/if}} >编辑项目
                </label>

                <label class="checkbox-inline">
                    <input class="js_projectRule" type="checkbox" value="export" {{if $member->hasAuth(['project' => 'export'])}}checked{{/if}} >导出项目
                </label>

                <label class="checkbox-inline">
                    <input class="js_projectRule" type="checkbox" value="history" {{if $member->hasAuth(['project' => 'history'])}}checked{{/if}}>项目动态
                </label>

                <label class="checkbox-inline">
                    <input class="js_projectRule" type="checkbox" value="transfer" {{if $member->hasAuth(['project' => 'transfer'])}}checked{{/if}} >转让项目
                </label>

                <label class="checkbox-inline">
                    <input class="js_projectRule" type="checkbox" value="delete" {{if $member->hasAuth(['project' => 'delete'])}}checked{{/if}} >删除项目
                </label>
            </div>

            <div class="form-group">
                <label>环境权限</label>
                <input type="hidden" class="js_envRule" name="UpdateMember[env_rule]">
                <label class="checkbox-inline">
                    <input class="js_envRule" onclick="return false;" checked type="checkbox" value="look">查看环境
                </label>
                <label class="checkbox-inline">
                    <input class="js_envRule" type="checkbox" {{if $member->hasAuth(['env' => 'create'])}}checked{{/if}} value="create">新增环境
                </label>
                <label class="checkbox-inline">
                    <input class="js_envRule" type="checkbox" {{if $member->hasAuth(['env' => 'update'])}}checked{{/if}} value="update">编辑环境
                </label>
                <label class="checkbox-inline">
                    <input class="js_envRule" type="checkbox" {{if $member->hasAuth(['env' => 'delete'])}}checked{{/if}} value="delete">删除环境
                </label>
            </div>

            <div class="form-group">
                <label>模块权限</label>
                <input type="hidden" class="js_moduleRule" name="UpdateMember[module_rule]">
                <label class="checkbox-inline">
                    <input class="js_moduleRule" onclick="return false;" checked type="checkbox" value="look">查看模块
                </label>
                <label class="checkbox-inline">
                    <input class="js_moduleRule" type="checkbox" {{if $member->hasAuth(['module' => 'create'])}}checked{{/if}} value="create">新增模块
                </label>
                <label class="checkbox-inline">
                    <input class="js_moduleRule" type="checkbox" {{if $member->hasAuth(['module' => 'update'])}}checked{{/if}} value="update">编辑模块
                </label>
                <label class="checkbox-inline">
                    <input class="js_moduleRule" type="checkbox" {{if $member->hasAuth(['module' => 'delete'])}}checked{{/if}} value="delete">删除模块
                </label>
            </div>

            <div class="form-group">
                <label>接口权限</label>
                <input type="hidden" class="js_apiRule" name="UpdateMember[api_rule]">

                <label class="checkbox-inline">
                    <input class="js_apiRule" onclick="return false;" checked type="checkbox" value="look">查看接口
                </label>
                <label class="checkbox-inline">
                    <input class="js_apiRule" type="checkbox" {{if $member->hasAuth(['api' => 'create'])}}checked{{/if}} value="create">新增接口
                </label>

                <label class="checkbox-inline">
                    <input class="js_apiRule" type="checkbox" {{if $member->hasAuth(['api' => 'update'])}}checked{{/if}} value="update">编辑接口
                </label>
                <label class="checkbox-inline">
                    <input class="js_apiRule" type="checkbox" {{if $member->hasAuth(['api' => 'export'])}}checked{{/if}} value="export">导出接口
                </label>
                <label class="checkbox-inline">
                    <input class="js_apiRule" type="checkbox" {{if $member->hasAuth(['api' => 'delete'])}}checked{{/if}} value="delete">删除接口
                </label>
            </div>

            <div class="form-group">
                <label>成员权限</label>
                <input type="hidden" class="js_memberRule" name="UpdateMember[member_rule]">
                <label class="checkbox-inline">
                    <input class="js_memberRule" type="checkbox" {{if $member->hasAuth(['member' => 'look'])}}checked{{/if}} value="look">查看成员
                </label>
                <label class="checkbox-inline">
                    <input class="js_memberRule" type="checkbox" {{if $member->hasAuth(['member' => 'create'])}}checked{{/if}} value="create">添加成员
                </label>

                <label class="checkbox-inline">
                    <input class="js_memberRule" type="checkbox" {{if $member->hasAuth(['member' => 'update'])}}checked{{/if}} value="update">编辑成员
                </label>
                <label class="checkbox-inline">
                    <input class="js_memberRule" type="checkbox" {{if $member->hasAuth(['member' => 'remove'])}}checked{{/if}} value="remove">移除成员
                </label>
            </div>

            <input type="hidden" id="js_submit" value="提交">

        </form>

        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
</div>
<!-- /#wrapper -->

<script>
$(function(){
    // 表单验证
    $("form").validateForm({
        'before':function (json) {
            // 项目权限
            var projectRule =[];
            $(".js_projectRule:checkbox:checked").each(function(){
                projectRule.push($(this).val());
            });
            $(".js_projectRule:hidden").val(projectRule.join(','));

            // 环境权限
            var envRule =[];
            $(".js_envRule:checkbox:checked").each(function(){
                envRule.push($(this).val());
            });
            $(".js_envRule:hidden").val(envRule.join(','));

            // 模块权限
            var moduleRule =[];
            $(".js_moduleRule:checkbox:checked").each(function(){
                moduleRule.push($(this).val());
            });
            $(".js_moduleRule:hidden").val(moduleRule.join(','));

            // 接口权限
            var apiRule =[];
            $(".js_apiRule:checkbox:checked").each(function(){
                apiRule.push($(this).val());
            });
            $(".js_apiRule:hidden").val(apiRule.join(','));

            // 成员权限
            var memberRule =[];
            $(".js_memberRule:checkbox:checked").each(function(){
                memberRule.push($(this).val());
            });
            $(".js_memberRule:hidden").val(memberRule.join(','));
        }
    });
});
</script>
{{include_file name='home/public/footer'}}
