<div class="content-wrapper">
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="text-navy">
                        <go-back/>
                        <i class="fas fa-lock"></i> Manage Access Control List
                    </h1>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a ng-href="{{baseurl}}/dashboard">Home</a></li>
                        <li class="breadcrumb-item active">ACL</li>
                    </ol>
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>
    <section class="content">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12">
                    <div class="card card-outline card-blue">
                        <div class="card-header">
                            <h3 class="card-title"><label for="selectHero">Select Hero</label></h3>
                        </div>
                        <div class="card-body">
                            <div class="form-group">
                                <ui-select multiple on-select="onHeroSelect($model)" on-remove="onHeroSelect($model)" ng-model="selHeroes.model" id="selectHero" theme="bootstrap" title="Select a Project" style="width: 100%">
                                    <ui-select-match placeholder="Select or search a hero in the list...">{{$item.emp_first_name +' '+$item.emp_last_name + ' ' + $item.emp_code}}</ui-select-match>
                                    <ui-select-choices repeat="hero.employeeid as hero in heroes | filter: searchHeroes"
                                    refresh="selHeroes.searchStr = $select.search" 
                                    refresh-delay="0">
                                        <span ng-bind-html="hero.emp_first_name +' '+hero.emp_last_name + ' ' + hero.emp_code | highlight: $select.search"></span>
                                    </ui-select-choices>
                                </ui-select>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-sm-12">
                    <div class="row">
                        <div class="col-sm-12 col-md-4 col-lg-3" ng-repeat="master in masters">
                            <div class="card card-outline card-{{master.color}}">
                                <div class="card-header">
                                    <h3 class="card-title" title="Access Control List for {{master.name}}"><strong>{{master.name}}</strong></h3>
                                    <code>{{master.name==='Master' ? 'Skills / Department / Designation':''}}</code>
                                    <div class="card-tools">
                                        <button type="button" class="btn btn-tool" ng-click="selectAll(master.name,$index)" title="Select / Unselect"><i class="fas fa-check-square text-{{master.color}}"></i></button>
                                    </div>
                                </div>
                                <div class="card-body">
                                    <span ng-repeat="acl in acls | filter : {'acl_module' : master.name}">
                                        <label class="badge-pill form-check-label mb-2 btn btn-block btn-sm {{acl.selected ? 'btn-success' : 'btn-default'}}">
                                            &nbsp;&nbsp;&nbsp; <input ng-model="acl.selected" name="acllist[]" class="form-check-input" type="checkbox" value="{{acl.acl_id}}">
                                            <small class="">{{acl.acl_module}} <i class="fas fa-arrow-right"></i> <strong>{{acl.acl_type}}</strong></small>
                                        </label>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-sm-12">
                <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#modal-default">Cancel</button>
                <button type="submit" ng-click="save()" class="btn btn-success float-right">
                    <i class="fas fa-save"></i>
                    {{btn.text}}
                </button>
            </div>
        </div>
    </section>


    <div class="modal fade" id="modal-default">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <p>Are you sure to leave this page!</p>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="goTo($event,'heroList')">Proceed</button>
                </div>
            </div>
        </div>
    </div>
</div>
