doctype html

div.wrapper(
    ng-controller="IssueDetailController as ctrl",
    ng-init="section='issues'"
)
    tg-project-menu

    div.main.us-detail
        div.us-detail-header.header-with-actions
            include ../includes/components/mainTitle
            .action-buttons
                a.button-gray(
                    href=""
                    tg-check-permission="view_milestones"
                    tg-nav="project-taskboard:project=project.slug,sprint=sprint.slug"
                    ng-if="sprint && project.is_backlog_activated"
                    title="{{'ISSUES.TITLE_LINK_TASKBOARD' | translate}}"
                    translate="ISSUES.LINK_TASKBOARD"
                )

        section.us-story-main-data
            header
                tg-vote-button.upvote-btn(
                    item="issue"
                    on-upvote="ctrl.onUpvote"
                    on-downvote="ctrl.onDownvote"
                )
                tg-detail-header.detail-header-container(
                    item="issue"
                    project="project"
                    required-perm="modify_issue"
                    ng-class="{blocked: issue.is_blocked}"
                    ng-if="project && issue"
                    format="text"
                )
            .subheader
                tg-tag-line.tags-block(
                    ng-if="issue && project"
                    project="project"
                    item="issue"
                    permissions="modify_issue"
                )
                tg-created-by-display.ticket-created-by(ng-model="issue")

        section.duty-content
            tg-item-wysiwyg(
                type="issue",
                model="issue",
                required-perm="modify_issue"
            )

        // Custom Fields
        tg-custom-attributes-values(
            ng-model="issue"
            type="issue"
            project="project"
            required-edition-perm="modify_issue"
        )

        tg-attachments-full(
            obj-id="issue.id"
            type="issue",
            project-id="projectId"
            edit-permission = "modify_issue"
        )

        tg-history-section(
            ng-if="issue"
            type="issue"
            name="issue"
            id="issue.id"
            project-id="projectId"
        )

    sidebar.menu-secondary.sidebar.ticket-data

        .ticket-header
            span.ticket-title(
                tg-issue-status-display
                ng-model="issue"
            )
            span.detail-status(
                tg-issue-status-button
                ng-model="issue"
            )

        //tg-created-by-display.ticket-created-by(ng-model="issue")

        div.ticket-data-container
            div.ticket-status(
                tg-issue-type-button
                ng-model="issue"
            )
            div.ticket-status(
                tg-issue-severity-button
                ng-model="issue"
            )
            div.ticket-status(
                tg-issue-priority-button
                ng-model="issue"
            )

        section.ticket-assigned-to(
            tg-assigned-to
            ng-model="issue"
            required-perm="modify_issue"
        )

        section.ticket-watch-buttons
            div.ticket-watch(
                tg-watch-button
                item="issue"
                data-environment="ticket"
                on-watch="ctrl.onWatch"
                on-unwatch="ctrl.onUnwatch"
            )
            div.ticket-watchers(
                tg-watchers
                ng-model="issue"
                required-perm="modify_us"
            )

        section.ticket-detail-settings
            tg-due-date(
                due-date="issue.due_date"
                format="button"
                is-closed="issue.is_closed"
                item="issue"
                obj-type="issue"
                tg-check-permission="modify_issue"
            )
            tg-promote-issue-to-us-button(
                tg-check-permission="add_us",
                ng-model="issue"
            )
            tg-assign-sprint-to-issue-button(
                tg-check-permission="modify_issue",
                ng-model="issue"
                ng-if="project.is_backlog_activated"
            )
            tg-block-button(
                tg-check-permission="modify_issue",
                ng-model="issue"
            )
            tg-delete-button(
                tg-check-permission="delete_issue",
                on-delete-title="{{'ISSUES.ACTION_DELETE' | translate}}",
                on-delete-go-to-url="onDeleteGoToUrl",
                ng-model="issue"
            )

    div.lightbox.lightbox-block(tg-lb-block, ng-model="issue", title="ISSUES.LIGHTBOX_TITLE_BLOKING_ISSUE")
    div.lightbox.lightbox-select-user(tg-lb-assignedto)
    div.lightbox.lightbox-select-user(tg-lb-watchers)
