<div class="content-wrapper" ng-if="!myAccess.heroTimeline">
    <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 modal-demo" ng-if="myAccess.heroTimeline">
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="text-warning">
                        <go-back/>
                        <i class="fas fa-user"></i> Projects Timeline
                    </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"><a ng-href="{{baseurl}}/projects/list">Project</a></li>
                        <li class="breadcrumb-item"><a>Projects Timeline</a></li>
                    </ol>
                </div>
            </div>
        </div>
    </section>
    <section class="content">
        <div class="mb-4 row">
            <div class="pull-center col-sm-12 col-md-8 col-md-offset-2 d-md-inline-flex">
                <ui-select on-select="projectChange($model)" ng-model="param.proj_id" theme="bootstrap" title="Select a Project" placeholder="Select a Project" class="col-sm-12 col-md-9 border-left-0">
                    <ui-select-match placeholder="Select or search a project in the list...">{{$select.selected.proj_name}}</ui-select-match>
                    <ui-select-choices repeat="project.projectid as project in projects | filter: $select.search">
                        <span ng-bind-html="project.proj_name | highlight: $select.search"></span>
                    </ui-select-choices>
                </ui-select>
                <div class="btn btn-group col-sm-12 col-md-3 p-0" ng-if="param.proj_id">
                    <button class="btn btn-primary" ng-click="viewProject('previous')" ng-if="currentIndex > 0"  title="View Previous Project"><i class="fas fa-arrow-left"></i></button>
                    <a class="btn btn-success" href="/projects/view/{{param.proj_id}}" target="_blank" ><i class="fas fa-external-link-alt"></i> View Project </a>
                    <button class="btn btn-primary" ng-click="viewProject('next')" ng-if="currentIndex < (projects.length-1)" title="View Next Project"><i class="fas fa-arrow-right"></i></button>
                </div>
            </div>
        </div>
    </section>
    <section class="content" ng-if="nodata"><div class="col-sm-12 text-center text-red"><span>{{nodata}}</span></div></section>
    <section class="content" ng-if="tempProjectsData.length > 0">
        <div class="row ">
            <div class="col-md-11 col-sm-12 pull-center p-0">
                <div class="graph-ui mb-4 bg-white">
                    <div class="graph-ui-caption text-center mb-3"><strong>Project Allocation Graph Month-wise</strong></div>
                    <div id="projectTimelineGraph" class="pb-2"></div>
                </div>
            </div>
        </div>
    </section>
    <div ng-if="false">{{tempProjectsData}}</div>
    <div ng-if="false">{{projectsData}}</div>
    <section class="content" ng-if="tempProjectsData.length > 0">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="card card-success card-outline">
                        <div class="card-header border-transparent">
                            <h3 class="card-title">&nbsp;</h3>
                            <div class="card-tools">
                                <div class="btn-group">
                                    <button type="button" title="Fullscreen Toggle" class="btn btn-dark toggle-fullscreen"><i class="fas fa-expand"></i></button>
                                    <button data-id="{{project.id}}" 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">
                            <ul class="timeline">
                                <li ng-repeat="project in projectsData track by $index" class="{{project.new ? 'time-label' : ''}}">
                                    <span ng-if="project.new" class="bg-success nowrap">{{project.from | date:'dd MMM yyyy'}} - {{project.to | date:'dd MMM yyyy'}}</span>
                                    <i class="fas pf-char bg-green {{project.char}}" data-char-content="{{project.char}}" ng-if="!project.new"></i>
                                    <div class="timeline-item" ng-if="!project.new">
                                        <h3 class="timeline-header no-border">
                                            <a href="/heroes/view/{{project.emp_id}}" target="_blank">{{project.emp_first_name+ ' ' +project.emp_last_name+ ' (' +project.emp_email+')'}}</a>
                                            <span class="btn btn-group pull-right">
                                                <span class="btn badge bg-success" ng-if="project.billableHours > 0 && project.billableHours !== project.partialHours" title="Billable / Total Hours"><i class="fas fa-clock"></i> {{project.billableHours + '/' + project.partialHours}} </span>
                                                <span class="btn badge bg-success" ng-if="project.billableHours > 0 && project.billableHours === project.partialHours" title="Billable Hours"><i class="fas fa-clock"></i> {{project.partialHours || '0'}} </span>
                                                <span class="btn badge bg-danger" ng-if="project.billableHours < 1" title="Allocation Hours"><i class="fas fa-clock"></i> {{project.partialHours || '0' }} </span>

                                                <span class="btn badge bg-warning" ng-if="false">{{project.billableHours  +' / '+ project.partialHours}} </span>
                                            </span>

                                        </h3>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
