{{/*
This file is part of SystemTestPortal.
Copyright (C) 2017  Institute of Software Technology, University of Stuttgart

SystemTestPortal is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

SystemTestPortal is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with SystemTestPortal.  If not, see <http://www.gnu.org/licenses/>.
*/}}

{{/* Content for the opened task items*/}}
{{define "task-content" }}
<ul class="list-group list-group-flush ">
    {{with .TaskList}}

        {{ range .GetTaskDone }}

            <li class="list-group-item align-items-center" style="opacity: 0.6" id="task-item-{{ .Index }}">
                <div class="d-flex">

                    <!-- Project Image + task name -->
                    <div class="align-self-center">
                        <img src="{{.ProjectImage}}" alt="..." class="rounded-circle mr-2" height="42" width="42">
                       {{ if ne .Reference.Type 2}}
                        <a href="/{{ .ProjectID.ActorID }}/{{ .ProjectID.Project }}/{{ if eq .Reference.Type 0 }}testcases{{ else }}testsequences{{ end }}/{{ .Reference.ID }}">
                            {{ .Reference.ID }}
                        </a>
                       {{ else }}
                       {{T "New release " .}}{{ .Reference.ID }} {{T "of " .}}<a href="/{{ .ProjectID.ActorID }}/{{ .ProjectID.Project }}/">{{ .ProjectID.Project }}</a>
                        {{ end }}
                    </div>

                    <!-- Set task to undone -->
                    <div class="align-self-center ml-auto">
                        <button id="btn-task-item-undone-{{ .Index }}"
                                class="btn btn-sm btn-secondary btn-task-item-undone float-right"
                                value="{{ .Index }}"
                                type="button"
                                title="{{T "Set the task to done" .}}">{{T "Undone" .}}
                        </button>
                    </div>

                </div>
            </li>

        {{else}}

            <div class="card-body text-center">
                <h4 class="card-title">{{T "You have not completed any tasks" .}}!</h4>
                <p class="card-text">{{T "Why don't you start" .}}?</p>
            </div>

        {{ end }}

    {{end}}
</ul>
<script src="/static/js/task/task-undone.js"></script>
{{end}}