section.issues-table.basic-table(ng-class="{empty: !issues.length}")
    div.row.title
        div.level-field(data-fieldname="type")
             | {{"ISSUES.TABLE.COLUMNS.TYPE" | translate}}
        div.level-field(data-fieldname="severity")
             | {{"ISSUES.TABLE.COLUMNS.SEVERITY" | translate}}
        div.level-field(data-fieldname="priority")
             | {{"ISSUES.TABLE.COLUMNS.PRIORITY" | translate}}
        div.votes(data-fieldname="total_voters")
             | {{"ISSUES.TABLE.COLUMNS.VOTES" | translate}}
        div.subject(data-fieldname="subject")
             | {{"ISSUES.TABLE.COLUMNS.SUBJECT" | translate}}
        div.issue-field(data-fieldname="status")
             | {{"ISSUES.TABLE.COLUMNS.STATUS" | translate}}
        div.created-field(data-fieldname="created_date")
             | {{"ISSUES.TABLE.COLUMNS.CREATED" | translate}}
        div.assigned-field(data-fieldname="assigned_to")
             | {{"ISSUES.TABLE.COLUMNS.ASSIGNED_TO" | translate}}

    div.row.table-main(
        ng-repeat="issue in issues track by issue.id"
        ng-class="{'is-blocked': issue.is_blocked}"
    )
        div.level-field(tg-listitem-type="issue")
        div.level-field(tg-listitem-severity="issue")
        div.level-field(tg-listitem-priority="issue")
        div.votes.ng-animate-disabled(
            ng-class="{'inactive': !issue.total_voters}"
            ng-if="!issue.is_voter"
            title="{{ 'COMMON.VOTE_BUTTON.COUNTER_TITLE'|translate:{total:issue.total_voters||0}:'messageformat' }}"
            ng-click="ctrl.upVoteIssue(issue.id)"
            tg-loading="ctrl.voting == issue.id"
        )
            tg-svg(svg-icon="icon-upvote")
            span {{ issue.total_voters }}
        div.votes.ng-animate-disabled(
            ng-class="{'is-voted': issue.is_voter}"
            ng-if="issue.is_voter"
            title="{{ 'COMMON.VOTE_BUTTON.COUNTER_TITLE'|translate:{total:issue.total_voters||0}:'messageformat' }}"
            ng-click="ctrl.downVoteIssue(issue.id)"
            tg-loading="ctrl.voting == issue.id"
        )
            tg-svg(svg-icon="icon-upvote")
            span {{ issue.total_voters }}
        div.subject
            a(
                href=""
                tg-nav="project-issues-detail:project=project.slug,ref=issue.ref"
                title="#{{ ::issue.ref }} {{ ::issue.subject }}"
            )
                span(tg-bo-ref="issue.ref")
                span.blocked-text(
                    ng-if="issue.is_blocked"
                    title="{{issue.blocked_note}}"
                ) {{'ISSUES.TABLE.BLOCKED' | translate}}
                span(ng-bind="issue.subject")


        div.issue-field(tg-issue-status-inline-edition="issue")
            a.issue-status(
                href=""
                title="{{'ISSUES.TABLE.TITLE_ACTION_CHANGE_STATUS' | translate}}"
            )
                span.issue-status-bind
                tg-svg(
                    tg-check-permission="modify_issue"
                    svg-icon="icon-arrow-down"
                )

        div.created-field(
            tg-bo-bind="issue.created_date|momentFormat:'DD MMM YYYY'"
            tg-bo-title="issue.created_date|momentFormat:'DD MMM YYYY HH:mm'"
        )

        div.assigned-field(tg-issue-assigned-to-inline-edition="issue")
            div.issue-assignedto(title="{{'ISSUES.TABLE.TITLE_ACTION_ASSIGNED_TO' | translate}}")
                figure.avatar
                tg-svg(
                    tg-check-permission="modify_issue"
                    svg-icon="icon-arrow-down"
                )

section.empty-large(ng-if="issues != undefined && issues.length == 0")
    img(
        src="/#{v}/images/empty/empty_moon.png",
        alt="{{ISSUES.TABLE.EMPTY.TITLE | translate }}"
    )
    p.title(translate="ISSUES.TABLE.EMPTY.TITLE")
    a(
        href=""
        ng-click="ctrl.addNewIssue()"
        tg-check-permission="add_issue"
        title="{{ ISSUES.ACTION_NEW_ISSUE | translate }}"
        translate="ISSUES.TABLE.EMPTY.SUBTITLE"
    )
