<div class="content-wrapper"  ng-if="!myAccess.accountList">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-6 offset-sm-1 offset-md-2 offset-lg-3 mt-5">
                <div class="alert alert-warning alert-dismissible">
                    <h5><i class="icon fas fa-ban"></i> Warning!</h5>
                    Unauthorised Access.
                </div>
            </div>
        </div>
    </div>
</div>
<div class="content-wrapper"  ng-if="myAccess.accountList">
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="text-primary">
                        <go-back/>
                        <i class="fas fa-user-secret"></i> Account List ({{accounts.length}})
                    </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">Accounts</li>
                    </ol>
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>
    <section class="content">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="card card-primary card-outline">
                        <div class="card-header border-transparent">
                            <h3 class="card-title">&nbsp;</h3>
                            <div class="card-tools">
                                <div class="btn-group">
                                    <button ng-click="goTo($event,'accountAdd')" type="button" class="btn btn-primary"><i class="fas fa-plus"></i> <span class="d-none d-lg-inline-block">Create Account</span></button>
                                    <!--<button ng-click="goTo($event,'projectAdd')" type="button" class="btn btn-success"><i class="fas fa-table"></i> <span class="d-none d-lg-inline-block">Create Project</span></button>-->
                                    <button type="button" title="Fullscreen Toggle" class="btn btn-dark toggle-fullscreen"><i class="fas fa-expand"></i></button>
                                    <button type="button" class="btn btn-dark" data-widget="collapse"><i class="fas fa-minus"></i></button>
                                </div>
                            </div>
                        </div>
                        <div class="card-body p-0">
                            <div class="table table-responsive">
                                <table id="accountList" class="table table-bordered table-striped">
                                    <thead>
                                    <tr>
                                        <!--<th>Name</th>-->
                                        <!--<th>Email / Mobile</th>-->
                                        <th>Company Name</th>
                                        <th>Active Projects</th>
                                        <th>Allocated Hours</th>
                                        <th>Billable Hours</th>
                                        <th data-toggle="tooltip" title="Hours Per/day" ><small>Billable / Non Billable</small> <i class="fas fa-question-circle"></i></th>
                                        <th>Revenue Center</th>
                                        <th>Status</th>
                                        <th>Actions</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr ng-repeat="account in accounts">
                                        <td><span class="nowrap">{{account.accountDetails.acc_company_name}}</span></td>
                                        <td><span class="nowrap">{{account.allocationData[0].active_projs}}</span></td>
                                        <td><span class="nowrap">{{account.totalAllocation}}</span></td>
                                        <td><span class="nowrap">{{account.partialHoursBillable}}</span></td>
                                        <td>
                                            <div class="bar-chart-bar">
                                                <div class="bar bar1 bar-{{getPercent(account.partialHoursBillable,account)}}" data-toggle="tooltip" title="Billable">{{account.partialHoursBillable}}</div>
                                                <div class="bar bar2 bar-{{getPercent(account.partialHoursNonBillable,account)}}" data-toggle="tooltip" title="Non Billable">{{account.partialHoursNonBillable}}</div>
                                            </div>
                                        </td>
                                        <td>{{account.accountDetails.rc_name}}{{account.rc_name}}</td>
                                        <td><span class="badge {{getActiveClass(account.accountDetails.acc_status)}}">{{account.accountDetails.acc_status | capitalize}}</span></td>
                                        <td>
                                            <div class="btn-group nowrap">
                                                <button type="button" class="btn btn-primary" ng-click="goToSelf('accountView',{accountid:account.accountDetails.accountid})"><i class="fas fa-eye"></i> View</button>
                                                <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
                                                    <span class="caret"></span>
                                                    <span class="sr-only">Toggle Dropdown</span>
                                                </button>
                                                <div class="dropdown-menu dropdown-menu-right" role="menu">
                                                    <a class="dropdown-item" ng-href="{{baseurl+'/accounts/edit/'+account.accountDetails.accountid}}"><i class="fas fa-pen"></i> Edit</a>
                                                    <a class="dropdown-item" ng-href="{{baseurl+'/projects/accounts/'+account.accountDetails.accountid}}"><i class="fas fa-table"></i> Create Project</a>
                                                    <!--<a class="dropdown-item" href="#" ng-click="close()"><i class="fas fa-trash"></i> Deactivate</a>-->
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <!-- /.table-responsive -->
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
