doctype html

div.wrapper(
    ng-controller="UserStoryDetailController as ctrl",
    ng-init="section='backlog-kanban'"
)
    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="{{'US.TITLE_LINK_TASKBOARD' | translate}}"
                    translate="US.LINK_TASKBOARD"
                )

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

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

        // Custom Fields
        tg-custom-attributes-values(
            ng-model="us"
            type="userstory"
            project="project"
            required-edition-perm="modify_us"
        )

        include ../includes/modules/related-tasks

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

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

    sidebar.menu-secondary.sidebar.ticket-data

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

            tg-tribe-linked(
                ng-if="tribeEnabled && us.tribe_gig",
                gig-title="us.tribe_gig.title"
                gig-id="us.tribe_gig.id"
            )

        tg-us-estimation.ticket-estimation(ng-model="us")

        section.ticket-assigned-to(
            tg-assigned-to
            ng-model="us"
            required-perm="modify_us"
        )

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

        section.ticket-to-tribe(ng-if="tribeEnabled && !us.tribe_gig")
            tg-tribe-button(
                us-id="us.id"
                project-slug="project.slug"
            )
            a.tribe-more-info(
                href=""
                title="{{'US.TRIBE.PUBLISH_TITLE' | translate}}"
                ng-click="ctrl.onTribeInfo()"
            ) {{'US.TRIBE.PUBLISH_INFO' | translate}}

        section.ticket-detail-settings
            tg-us-team-requirement-button(ng-model="us")
            tg-us-client-requirement-button(ng-model="us")
            tg-block-button(
                tg-check-permission="modify_us"
                ng-model="us"
            )
            tg-delete-button(
                tg-check-permission="delete_us"
                on-delete-title="{{'Delete User Story' | translate}}"
                on-delete-go-to-url="onDeleteGoToUrl"
                ng-model="us"
            )

    div.lightbox.lightbox-block(
        tg-lb-block
        title="{{ 'US.LIGHTBOX_TITLE_BLOKING_US' | translate }}"
        ng-model="us"
    )
    div.lightbox.lightbox-select-user(tg-lb-assignedto)
    div.lightbox.lightbox-select-user(tg-lb-watchers)
