<!DOCTYPE html>
<html>

@include('includes.head')

<body class="hold-transition skin-blue fixed sidebar-mini">
    <!-- Site wrapper -->
    <div class="wrapper">

        @include('includes.header')
        <!-- =============================================== -->

        <!-- Left side column. contains the sidebar -->
        @include('includes.side-nav')

        <!-- =============================================== -->

        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1> Roles &amp; Priviledges
                    <small>Manage System User Roles</small>
                </h1>
                <ol class="breadcrumb">
                    <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                    <li><a href="#">Human Resources</a></li>
                    <li>Roles &amp; Priviledges</li>
                    <li class="active">new</li>
                </ol>
            </section>

            <!-- Main content -->
            <section class="content">
                <!-- Default box -->
                <div class="box box-primary">
                    @include('includes.messages')
                    <div class="box-header with-border">
                        <h3 class="box-title">Create New Role</h3>
                    </div>
                    <div class="box">
                        <form role="form" action="{{route('hr.roles.store')}}" method="POST">
                            @csrf
                            <div class="box-body">
                                <div class="form-group col-md-12">
                                    <label for="name">Role Name</label>
                                    <input type="text" class="form-control" id="name" placeholder="Enter Name"
                                        name="name">
                                </div>

                                <div class="form-group col-md-12">
                                    <label for="name">Adjust Priviledges</label>
                                    <ul>
                                        @for ($i = 0; $i < 20; $i++) <div class="col-md-3">
                                            <li>
                                                <div class="checkbox">
                                                    <input type="checkbox" id="option"><label for="option">
                                                        HR Management</label>
                                                </div>
                                                <ul>

                                                    <li>
                                                        <div class="checkbox">
                                                            <label>
                                                                <input type="checkbox" class="subOption">Staffs
                                                            </label>
                                                        </div>
                                                    </li>
                                                    <li>
                                                        <div class="checkbox">
                                                            <label>
                                                                <input type="checkbox" class="subOption">Role and
                                                                Priviledges
                                                            </label>
                                                        </div>
                                                    </li>

                                                </ul>

                                            </li>
                                </div>
                                @endfor



                                </ul>

                            </div>
                    </div><!-- /.box-body -->

                    <div class="box-footer">
                        <button type="submit" name="submit" class="btn btn-primary btn-flat">Submit</button>
                    </div>
                    </form>

                </div>

        </div>
        <!-- /.box -->

        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    @include('includes.footer')

    </div>
    <!-- ./wrapper -->

    @include('includes.scripts')
</body>


<script>
var checkboxes = document.querySelectorAll('input.subOption'),
    checkall = document.getElementById('option');

for (var i = 0; i < checkboxes.length; i++) {
    checkboxes[i].onclick = function() {
        var checkedCount = document.querySelectorAll('input.subOption:checked').length;

        checkall.checked = checkedCount > 0;
        checkall.indeterminate = checkedCount > 0 && checkedCount < checkboxes.length;
    }
}

checkall.onclick = function() {
    for (var i = 0; i < checkboxes.length; i++) {
        checkboxes[i].checked = this.checked;
    }
}
</script>

</html>