<div class="content-wrapper" ng-if="!myAccess.allAllocationReport">
    <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.allAllocationReport">
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="text-danger">
                        <go-back/>
                        <i class="fas fa-users"></i> Pools 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">Pools</li>
                    </ol>
                </div>
            </div>
        </div>
    </section>
    <section class="content">
        <div class="container-fluid">
            <div class="row">
                <div data-info="Hero: Current Allocation" class="col-md-12">
                    <div class="card card-warning card-outline">
                        <h5 class="text-center" ><a href="https://datastudio.google.com/s/ipNEroJlIfs" target="_blank">Click Here To See Detailed Report</a></h5>
                        <div class="card-header border-transparent">
                            <h3 class="card-title">Hero: Current Allocation</h3>
                            <div class="card-tools">
                                <div class="btn-group btn-group-sm mt--5">
                                    <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="row p-3">
                                <!-- <div class="col-sm-4">
                                    <label>Shadow Heroes</label>
                                    
                                    <input type="radio" value="0" class="form-control" ng-model="selectShadow">
    
                                </div> -->
                                <div class="col-sm-4">
                                    <label>Revenue Centre</label>
                                    
                                    <select  class="form-control" ng-model="selectRevenue" ng-change="selRevenue(selectRevenue)">
                                        <option ng-repeat="x in revenueCentre" value="{{x.id}}">{{x.rc_name}}</option>
                                        </select>
    
                                </div>
                                <div class="col-sm-4">
                                    <label>Account</label>
                                    <select  class="form-control" id="selectAccount" ng-model="selectAccount" ng-change="selAccount(selectAccount)" ng-disabled="true">
                                        <option ng-repeat="acc in accounts" value="{{acc.id}}">{{acc.acc_company_name}}</option>
                                        </select>
                                </div>
                                <div class="col-sm-4">
                                    <label>Projects</label>
                                    
                                    <select  class="form-control" id="selectProject" ng-model="selectProject" ng-change="selProject(selectProject)" ng-disabled="true">
                                        <option ng-repeat="pro in projects" value="{{pro.proid}}">{{pro.proj_name}}</option>
                                        </select>
                                </div>

                                <!-- <div class="col-sm-4">
                                    <label>Project Manager</label>
                                    
                                    <select class="form-control" id="selectPM" ng-model="selectPM" ng-disabled="true">
                                        <option ng-repeat="pm in projectManagers | unique : pm_id" value="{{pm.pm_id}}">{{pm.emp_first_name + ' ' + pm.emp_last_name}}</option>
                                        </select>
                                </div> -->
                                <!-- <div class="col-sm-4">
                                    <label>Designation</label>
                                    
                                    <select class="form-control" id="selectDesignation" ng-model="selectDesignation" ng-disabled="false">
                                        <option ng-repeat="des in designations" value="{{des.id}}">{{des.desg_name}}</option>
                                        </select>
                                </div> -->
                            </div>
                            <div class="row p-3">
                                <div class="col-sm-4">
                                    <div class="row">
                                        <div class="col-sm-6"><label>Show All</label> 
                                            <input type="radio" class="" ng-model="selectShadow">
                                        </div>
                                        <div class="col-sm-6">
                                            <label>Shadow Heroes</label>
                                            <input type="radio" value="0" class="" ng-model="selectShadow">
                                        </div>
                                    </div> 
                                </div>

                                <div class="col-sm-4">
                                    <label>Designation</label>
                                    
                                    <select class="form-control" id="selectDesignation" ng-model="selectDesignation" ng-disabled="false">
                                        <option ng-repeat="des in designations" value="{{des.id}}">{{des.desg_name}}</option>
                                        </select>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-2">
                                    <label>Line Manager</label>
                                    
                                    <select class="form-control" id="selectLM" ng-model="selectLM" ng-change="selLM(selectLM)" ng-disabled="false">
                                        <option value="">Select Line Manager</option>
                                        <option ng-repeat="pm in projectManagers | unique : 'lm_id'" value="{{pm.lm_id}}">{{pm.lm_fn + ' ' + pm.lm_ln}}</option>
                                        </select>
                                </div>
                                <div class="col-sm-2">
                                    <label>Project Manager</label>
                                    
                                    <select class="form-control" id="selectPM" ng-model="selectPM" ng-change="selPM(selectPM)" ng-disabled="false">
                                        <option value="">Select Project Manager</option>
                                        <option ng-repeat="pm in projectManagers | unique : 'pm_id'" value="{{pm.pm_id}}">{{pm.pm_fn + ' ' + pm.pm_ln}}</option>
                                        </select>
                                </div>
                                <div class="col-sm-2">
                                     <button ng-click="updateBillableHours()" class="btn btn-primary p-3">Update Hours (Step - 1)</button>
                                    <!-- <button ng-click="createReport()" class="btn btn-success p-3">Create Report</button>
                                    <button ng-click="updateActuallBilledHours()" class="btn btn-info p-3">Update Actual Billed Hours</button> -->
                                </div>
                                <div class="col-sm-2">
                                     <button ng-click="createReport()" class="btn btn-success p-3">Create Report (Step - 2)</button>
                                    <!-- <button ng-click="updateActuallBilledHours()" class="btn btn-info p-3">Update Actual Billed Hours</button> -->
                                </div>
                                <div class="col-sm-2">
                                    <!-- <button ng-click="createReport()" class="btn btn-success p-3">Create Report</button> -->
                                     <button ng-click="updateActuallBilledHours()" class="btn btn-info p-3">Update Actual Billed Hours (Step - 3)</button>
                                </div>
                                <br>

                                
                                <!-- <div class="col-sm-5">
                                    <div class="row">
                                        <div class="col-sm-4">
                                            <label>Month</label>
                                            <select class="form-control" ng-model="month">
                                                <option value="01">Jan</option>
                                                <option value="02">Feb</option>
                                                <option value="03">Mar</option>
                                                <option value="04">Apr</option>
                                                <option value="05">May</option>
                                                <option value="06">Jun</option>
                                                <option value="07">Jul</option>
                                                <option value="08">Aug</option>
                                                <option value="09">Sep</option>
                                                <option value="10">Oct</option>
                                                <option value="11">Nov</option>
                                                <option value="12">Dec</option>
                                            </select>
                                        </div>
                                        <div class="col-sm-4">
                                            <label>Year</label>
                                            <select class="form-control" ng-model="year">
                                                <option value="2020">2020</option>
                                                <option value="2021">2021</option>
                                                <option value="2022">2022</option>
                                            </select>
                                        </div>
                                        <div class="col-sm-4">
                                            <button ng-click="getListReport(month,year)" class="btn btn-primary p-3">Filter</button>
                                        </div>
                                    </div>
                                </div> -->
                            </div>
                            
                            <div class="table-responsive">
                                
                                <table id="poolList98" class="poolList table table-bordered table-striped table-sm" data-name="HeroCurrentAllocation">
                                    <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>Name</th>
                                        <th>Code</th>
                                        <th>Exp. In Years</th>
                                        <th>Account</th>
                                        <th>Revenue Center</th>
                                        <th>Project</th>
                                        <th>Manager</th>
                                        <th>Proj. Manager</th>
                                        <th>Designation</th>
                                        <th>Allocated Hours</th>
                                        <th>Billable Hours</th>
                                        <th>Overall Allocated Hours</th>
                                        <th>Overall Billable Hours</th>
                                        <th>Last Allocated Date</th>
                                        <th>Aging</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr ng-repeat="hero in allallocation | filter: {emp_designation_id : selectDesignation}:true | filter:{billableHours:selectShadow}:true | filter:{accountid : selectAccount} | filter:{projectid : selectProject} | filter:{acc_revenue_center : selectRevenue} ">
                                        <td>{{$index + 1}}</td>
                                       <td><a class="nowrap" target="_blank" href="{{'/heroes/view/'+hero.emp_id}}"><i class="fas fa-external-link-alt"></i> {{hero.emp_first_name + ' ' + hero.emp_last_name}}</a><a target="_blank" href="{{'/heroes/feedback/'+hero.employeeid}}"><i class="fas fa-comments"/> </a></td>
                                        <td><span>{{'(' + hero.emp_code + ')'}}</span></td>
                                        <td><span>{{ hero.emp_yoe }}</span></td>
                                        <td><span class="text-blue pointer" ng-click="goToSelf('accountView',{accountid:hero.accountid})">{{hero.acc_company_name}}</span></td>
                                        <td>{{hero.rc_name}}</td>
                                        <td><span class="text-blue pointer" ng-click="goToSelf('projectView',{projectid:hero.projectid})">{{hero.proj_name}}</span></td>
                                        <td><span class="text-blue pointer" ng-click="goToSelf('heroView',{employeeid:hero.linemgr.employeeid})">{{hero.linemgr.emp_first_name + ' ' + hero.linemgr.emp_last_name}}</span></td>
                                        <td><span class="text-blue pointer" ng-click="goToSelf('heroView',{employeeid:hero.projmgr.employeeid})">{{hero.projmgr.emp_first_name + ' ' + hero.projmgr.emp_last_name}}</span></td>
                                        <td><span class="nowrap">{{hero.emp_desg}}</span></td>
                                        <td><span class="nowrap">{{hero.partialHours ? hero.partialHours : 0}}</span></td>
                                        <td><span class="nowrap">{{hero.billableHours ? hero.billableHours : 0}}</span></td>
                                        <td><span class="nowrap">{{ hero.overall_allocated_hours ? hero.overall_allocated_hours : 0}}</span></td>
                                        <td><span class="nowrap">{{ hero.overall_billable_hours ? hero.overall_billable_hours : 0 }}</span></td>
                                        <td>{{hero.lastAlloDate | datetz:'DD MMM YYYY'}}</td>
                                        <td>{{hero.aging}}</td>
                                    </tr>
                                    </tbody>
                                </table>

                        
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
