doctype html

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

    sidebar.backlog-filter
        tg-filter(
            q="ctrl.filterQ"
            filters="ctrl.filters"
            custom-filters="ctrl.customFilters"
            selected-filters="ctrl.selectedFilters"
            customFilters="ctl.customFilters"
            on-save-custom-filter="ctrl.saveCustomFilter(name)"
            on-add-filter="ctrl.addFilter(filter)"
            on-select-custom-filter="ctrl.selectCustomFilter(filter)"
            on-remove-custom-filter="ctrl.removeCustomFilter(filter)"
            on-remove-filter="ctrl.removeFilter(filter)"
            on-change-q="ctrl.changeQ(q)"
        )
    section.main.backlog
        include ../includes/components/mainTitle

        div.backlog-summary(tg-toggle-burndown-visibility)
            include ../includes/components/summary

            div.empty-burndown(ng-if="showGraphPlaceholder && project.i_am_admin")
                tg-svg(svg-icon="icon-graph")
                div.empty-text
                    p.title(translate="BACKLOG.CUSTOMIZE_GRAPH")
                    p {{'BACKLOG.CUSTOMIZE_GRAPH_TEXT' | translate}} #[a(href="", tg-nav="project-admin-project-values-points:project=project.slug", title="{{'BACKLOG.CUSTOMIZE_GRAPH_TITLE' | translate}}") {{'BACKLOG.CUSTOMIZE_GRAPH_ADMIN' | translate}}]

            div.graphics-container.js-burndown-graph
                div.burndown(tg-burndown-backlog-graph)
                    include ../includes/modules/burndown

        div.backlog-menu
            div.backlog-table-options
                a.menu-button.move-to-current-sprint.move-to-sprint.e2e-move-to-sprint(
                    ng-if="currentSprint"
                    href=""
                    title="{{'BACKLOG.MOVE_US_TO_CURRENT_SPRINT' | translate}}"
                    id="move-to-current-sprint"
                )
                    tg-svg(svg-icon="icon-move")
                    span.text(translate="BACKLOG.MOVE_US_TO_CURRENT_SPRINT")
                a.menu-button.move-to-latest-sprint.move-to-sprint.e2e-move-to-sprint(
                    ng-if="!currentSprint"
                    href=""
                    title="{{'BACKLOG.MOVE_US_TO_LATEST_SPRINT' | translate}}"
                    id="move-to-latest-sprint"
                )
                    tg-svg(svg-icon="icon-move")
                    span.text(translate="BACKLOG.MOVE_US_TO_LATEST_SPRINT")
                a.menu-button.e2e-open-filter.ng-animate-disabled(
                    ng-if="!ctrl.activeFilters"
                    href=""
                    title="{{'BACKLOG.FILTERS.TOGGLE' | translate}}"
                    id="show-filters-button"
                    translate="BACKLOG.FILTERS.SHOW"
                )
                a.menu-button.active.e2e-open-filter.ng-animate-disabled(
                    ng-if="ctrl.activeFilters"
                    href=""
                    title="{{'BACKLOG.FILTERS.HIDE' | translate}}"
                    id="show-filters-button"
                    translate="BACKLOG.FILTERS.HIDE"
                )
                a.menu-button(
                    ng-if="userstories.length"
                    href=""
                    title="{{'BACKLOG.TAGS.TOGGLE' | translate}}"
                    id="show-tags"
                    translate="BACKLOG.TAGS.SHOW"
                )
                a.menu-button.velocity-forecasting-btn.ng-animate-disabled.e2e-velocity-forecasting(
                    ng-if="userstories.length && ctrl.displayVelocity "
                    href=""
                    title="{{'BACKLOG.FORECASTING.TITLE' | translate}}"
                    translate="BACKLOG.FORECASTING.BACKLOG"
                    ng-click="ctrl.toggleVelocityForecasting()"
                    tg-check-permission="add_milestone"
                )
                a.menu-button.velocity-forecasting-btn.ng-animate-disabled.e2e-velocity-forecasting(
                    ng-if="userstories.length && !ctrl.displayVelocity && stats.speed > 0"
                    href=""
                    title="{{'BACKLOG.FORECASTING.BACKLOG' | translate}}"
                    translate="BACKLOG.FORECASTING.TITLE"
                    ng-click="ctrl.toggleVelocityForecasting()"
                    tg-check-permission="add_milestone"
                )
            include ../includes/components/addnewus

        
        section.backlog-table(ng-class="{'hidden': !userstories.length}")
            include ../includes/modules/backlog-table
            
        .forecasting-add-sprint.e2e-velocity-forecasting-add(ng-if="ctrl.displayVelocity")
            tg-svg(svg-icon="icon-add")
            span(
                ng-if="!currentSprint"
                translate="BACKLOG.FORECASTING.NEW_SPRINT"
            )
            span(
                ng-if="currentSprint"
                translate="BACKLOG.FORECASTING.CURRENT_SPRINT"
            )
            
        .empty-large.js-empty-backlog(ng-class="{'hidden': userstories === undefined || userstories.length}")
            img(
                src="/#{v}/images/empty/empty_mex.png"
                alt="{{'BACKLOG.EMPTY' | translate}}"
            )
            p.title(translate="BACKLOG.EMPTY")
            a(
                href=""
                title="{{'BACKLOG.CREATE_NEW_US' | translate}}"
                ng-click="ctrl.addNewUs('standard')"
                tg-check-permission="add_us"
                translate="BACKLOG.CREATE_NEW_US_EMPTY_HELP"
            )

    sidebar.menu-secondary.sidebar
        include ../includes/modules/sprints

    div.lightbox.lightbox-generic-form.lightbox-create-edit(tg-lb-create-edit)

    div.lightbox.lightbox-generic-bulk(tg-lb-create-bulk-userstories)
        include ../includes/modules/lightbox-us-bulk

    div.lightbox.lightbox-sprint-add-edit(tg-lb-create-edit-sprint)
        include ../includes/modules/lightbox-sprint-add-edit
