{{/*
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/>.
*/}}

{{define "tab-content"}}
<div class="modal fade" id="helpModal">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">Tools</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span>&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <div class="media button-help">
                    <div class="d-flex mr-3 align-self-center">
                        <button class="btn btn-secondary mr-2 help-modal-button">
                            <i class="fa fa-long-arrow-left" aria-hidden="true"></i>
                        </button>
                    </div>
                    <div class="media-body">
                        Get back to the test case list.
                    </div>
                </div>
                <div class="media button-help">
                    <div class="d-flex mr-3 align-self-center">
                        <button class="btn btn-danger mr-2 help-modal-button">
                            <i class="fa fa-trash-o" aria-hidden="true"></i>
                        </button>
                    </div>
                    <div class="media-body">
                        Open a confirm dialog before deleting the current test case.
                    </div>
                </div>
                <div class="media button-help">
                    <div class="d-flex mr-3 align-self-center">
                        <button class="btn btn-primary mr-2 help-modal-button">
                            <i class="fa fa-clone" aria-hidden="true"></i>
                        </button>
                    </div>
                    <div class="media-body">
                        Duplicate the test case with history up to the currently selected version.
                    </div>
                </div>
                <div class="media button-help">
                    <div class="d-flex mr-3 align-self-center">
                        <button class="btn btn-primary mr-2 help-modal-button">
                            <i class="fa fa-history" aria-hidden="true"></i>
                        </button>
                    </div>
                    <div class="media-body">
                        Show a list with all previous versions of this test case.
                    </div>
                </div>
                <div class="media button-help">
                    <div class="d-flex mr-3 align-self-center">
                        <button class="btn btn-primary mr-2 help-modal-button">
                            <i class="fa fa-undo" aria-hidden="true"></i>
                        </button>
                    </div>
                    <div class="media-body">
                        Revert the test case to the selected version.
                    </div>
                </div>
                <div class="media button-help">
                    <div class="d-flex mr-3 align-self-center">
                        <button class="btn btn-primary mr-2 help-modal-button">
                            <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
                        </button>
                    </div>
                    <div class="media-body">
                        Edit the current test case.
                    </div>
                </div>
                <div class="media button-help">
                    <div class="d-flex mr-3 align-self-center">
                        <button class="btn btn-primary mr-2 help-modal-button">
                            <i class="fa fa-user-plus" aria-hidden="true"></i>
                        </button>
                    </div>
                    <div class="media-body">
                        Assign this test case as a task to a team member.
                    </div>
                </div>
                <div class="media button-help">
                    <div class="d-flex mr-3 align-self-center">
                        <button class="btn btn-primary mr-2 help-modal-button">
                            <i class="fa fa-play" aria-hidden="true"></i>
                        </button>
                    </div>
                    <div class="media-body">
                        Start the execution of the current test case.
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>
<div class="tab-card card" id="tabTestCases">
    <nav class="navbar navbar-light action-bar p-3">
        <button class="btn btn-danger mr-2" id="buttonAbort" >
            <i class="fa fa-times" aria-hidden="true"></i>
            <span class="d-none d-sm-inline"> Abort</span>
        </button>
        <button class="btn btn-secondary mr-2" id="buttonBackward">
            <i class="fa fa-step-backward" aria-hidden="true"></i>
            <span class="d-none d-sm-inline"> Previous</span>
        </button>
        <button class="btn btn-success mr-4" id="buttonSummaryFinish" >
            <i class="fa {{if and .isInSequence (not .isSequence)}}fa-step-forward{{else}}fa-check{{end}}" aria-hidden="true"></i>
            <span class="d-none d-sm-inline"> {{if and .isInSequence (not .isSequence)}}Next{{else}}Finish{{end}}</span>
        </button>
        <div class="progress mr-4" style="flex-grow: 100;">
            <div class="progress-bar" role="progressbar" style="width: {{ .ProgressBarPercent }}%;" aria-valuenow="{{ .ProgressBarPercent }}" aria-valuemin="0" aria-valuemax="100">{{ .ProgressBarCurrent }}/{{ .ProgressBarTotal }}</div>
        </div>
        {{if not .isSequence}}
        <span class="navbar-text" id="timeTracker">
            <span id="timeHours">{{ .hours }}</span>:<span id="timeMinutes">{{ .minutes }}</span>:<span id="timeSeconds">{{ .seconds }}</span>
        </span>
        <button class="btn btn-sm btn-secondary ml-2" id="buttonPause">
            <i class="fa fa-pause" aria-hidden="true" id="buttonPauseIcon"></i>
        </button>
        {{end}}
    </nav>
    <div class="row tab-side-bar-row">
        <div class="col-md-9 p-3">
            <h4 class="mb-3">Summary of {{.TestObject.Name}}</h4>
            <div class="form-group">
                <label><strong>Test {{if .isSequence}}Case{{else}}Step{{end}} Results</strong></label>
                {{ if .SubObjects }}
                <ol class="list-group" id="testStepsAccordion" data-children=".li">
                    {{ range $index, $element := .SubObjects }}
                    <li class="list-group-item">
                        <a data-toggle="collapse" data-parent="#testStepsAccordion" href="#testStepsAccordion{{ $index }}"
                            aria-expanded="true" aria-controls="testStepsAccordion{{ $index }}">
                            {{if eq .Result 1 }}
                                <i class="text-success fa fa-check-circle" aria-hidden="true"></i>
                            {{end}}
                            {{if eq .Result 2 }}
                                <i class="text-warning fa fa-info-circle" aria-hidden="true"></i>
                            {{end}}
                            {{if eq .Result 3 }}
                                <i class="text-danger fa fa-times-circle" aria-hidden="true"></i>
                            {{end}}
                            {{if eq .Result 0 }}
                                <i class="text-secondary fa fa-question-circle" aria-hidden="true"></i>
                            {{end}}
                            {{if $.isSequence}}{{.Name}}{{else}}{{ .Action }}{{end}}
                        </a>
                        <div id="testStepsAccordion{{ $index }}" class="collapse" role="tabpanel">
                            {{if not $.isSequence}}
                            <p class="mb-1">
                            Actual Result: {{if .ObservedBehavior}}{{ .ObservedBehavior }}{{else}}-{{end}}
                            </p>
                            {{end}}
                            <p class="mb-1">
                                Note: {{if .Comment}}{{.Comment}}{{else}}-{{end}}
                            </p>
                        </div>
                    </li>
                    {{ end }}
                </ol>
                {{ else }}

                <p class="text-muted">No Test {{if .isSequence}}Case{{else}}Step{{end}}</p>
                {{ end }}
            </div>
            <div class="form-group">
                {{if not .isSequence }}
                <label><strong>Notes</strong></label>
                <textarea class="form-control" id="inputTestComment" rows="4"></textarea>
                {{ end }}
                <input type="hidden" class="" id="inputTestStepNumber" value="{{ .step }}">
                <input type="hidden" class="" id="inputTestCaseNumber" value="{{ .case }}">
            </div>
        {{ if not .isSequence}}
            <label><strong>Overall Result</strong></label>
            <div class="custom-controls-stacked">
                <label class="custom-control custom-radio text-success">
                    <input id="successfulTest" name="testResults" type="radio" class="custom-control-input" value="Pass">
                    <span class="custom-control-indicator"></span>
                    <span class="custom-control-description">passed</span>
                </label>
                <label class="custom-control custom-radio text-warning">
                    <input id="failedPartlyTest" name="testResults" type="radio" class="custom-control-input" value="PassWithComment">
                    <span class="custom-control-indicator"></span>
                    <span class="custom-control-description">passed with comment</span>
                </label>
                <label class="custom-control custom-radio text-danger">
                    <input id="failedTest" name="testResults" type="radio" class="custom-control-input" value="Fail">
                    <span class="custom-control-indicator"></span>
                    <span class="custom-control-description">failed</span>
                </label>
                <label class="custom-control custom-radio text-muted">
                    <input id="notEvaluatedTest" name="testResults" type="radio" class="custom-control-input" value="NotAssessed" checked>
                    <span class="custom-control-indicator"></span>
                    <span class="custom-control-description">not assessed</span>
                </label>
            </div>
            {{end}}
        </div>
        <!--<div class="col-md-3 p-3 tab-side-bar">
        </div>-->
    </div>
    <script src="/static/js/execute.js"></script>
</div>
{{ end }}