<div data-ng-controller="DashboardCtrl as dashboard" class="dashboard fullheight">

    <div class="row fullheight">
        <div class="col-sm-6 col-md-8 fullheight">

            <div class="panel panel-default buttons-left fullheight shadow-3">
                <div class="panel-heading">
                    <h3>
                        {{'global.greeting'|translate}} {{$root.currentUserName}},
                        <span data-ng-if="dashboard.currentProjects.length != 1">{{'global.youhavexprojects'|translate:dashboard.currentProjects}}</span>
                        <span data-ng-if="dashboard.currentProjects.length == 1">{{'global.youhaveoneproject'|translate}}</span>
                    </h3>
                </div>
                <div class="panel-body">
                    <div class="row fullheight">
                        <div class="col-fixedwidth-35 fullheight">
                            <a class="fastbutton action" data-ng-click="dashboard.newProject()" data-ng-href="/clients/" title="{{'projects.new' | translate}}">
                                <i class="md-add"></i>
                            </a>

                            <a class="fastbutton action" data-ui-sref="app.clientCreation" title="{{'clients.newClient'| translate}}">
                                <i class="md-person-add"></i>
                            </a>

                            <a class="fastbutton" data-ui-sref="app.clients.detail" title="{{'clients.clients' | translate}}">
                                <i class="md-group"></i>
                            </a>
                            <a class="fastbutton" data-ui-sref="app.projectArchive.detail" title="{{'projects.actions.archive' | translate}}">
                                <i class="md-folder"></i>
                            </a>

                            <a class="fastbutton" data-ui-sref="app.itemPresets.detail" title="{{'itemPresets.itemPresets' | translate}}">
                                <i class="md-extension"></i>
                            </a>
                        </div>
                        <div class="col-beneath-fixedwidth-35 fullheight scroll-y">
                            <div data-ng-if="dashboard.currentProjects.length == 0">
                                <h3 data-ng-bind-html="'dashboard.noprojects'|translate"></h3>
                            </div>
                            <div class="row">
                                <div data-ng-repeat="project in dashboard.currentProjects" class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                    <a class="tile" data-ui-sref="app.projectDetail({id:project.id})">
                                        <span class="tile-total"
                                              data-ng-if="project.stats.totalProjectWorth > 0"
                                              data-ng-class="{overdue: project.stats.overdue > 0}">
                                            {{ project.stats.totalProjectWorth | price}}
                                        </span>
                                        <i class="tile-icon tile-icon-{{project.state}}"></i>
                                        <h4 class="tile-heading">{{project.name}}</h4>
                                        <p class="tile-text">
                                            {{project.companyname}}<span data-ng-if="!project.companyname || project.companyname == ''">{{project.contact_firstname}} {{project.contact_lastname}}</span>
                                        </p>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>

        <div class="col-sm-6 col-md-4 fullheight">

            <div class="panel panel-default fixedheight-360 shadow-1">
                <div class="panel-heading">
                    <h3>{{'global.estimatedIncome' | translate}}</h3>
                </div>
                <div class="panel-body scroll-y">
                    <div data-payment-stats="dashboard.statistics"></div>
                </div>
            </div>

            <div class="panel panel-default under-fixedheight-360 shadow-0 scroll-y">
                <div class="stream-entry list-group-item" data-ng-if="dashboard.stream.length == 0">
                    <h3>{{'stream.nothing'|translate}}</h3>
                </div>
                <div class="stream-entry list-group-item" data-ng-repeat="entry in dashboard.stream">
                    <div class="row">
                        <div class="col-fixedwidth-46">
                           <span class="icon-bubble icon-{{entry.action}}"></span>
                        </div>
                        <div class="col-beneath-fixedwidth-46">
                            <div class="row">
                                <div class="col-xs-12">
                                    <h3 data-ng-if="!entry.user.name">
                                        {{ 'stream.'+entry.type | translate }}
                                        <a data-ng-click="dashboard.goto(entry.type, entry.id)">{{entry.title}}</a>
                                        {{ 'stream.'+entry.action | translate}}
                                    </h3>
                                    <h3 data-ng-if="entry.user.name">
                                        <a href="mailto:{{entry.user.email}}">{{entry.user.name}}</a> {{ 'stream.'+entry.action | translate}} {{ 'stream.'+entry.type | translate }}
                                        <a data-ng-if="dashboard.linkable(entry)" data-ng-click="dashboard.goto(entry.type, entry.id)">{{entry.title}}</a>
                                        <span data-ng-if="!dashboard.linkable(entry)">{{entry.title}}</span>
                                    </h3>
                                </div>
                                <div class="stream-date col-xs-12">
                                    {{entry.create_time | amaDate:'dd.MM.yyyy - HH:mm'}}
                                    <a data-ng-if="dashboard.clientLinkable(entry)" data-ng-click="dashboard.goto('client', entry.client.id)"> - {{entry.client.name}}</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>


</div>

