
<div class="card niceborder border-warning bg-primary text-light" ng-if="issues.length > 0">
  <table class="table table-hover table-striped">
    <thead>
      <tr>
	<th>Objet</th>
	<th>État / Priorité</th>
	<th>Géré par</th>
	<th>Messages</th>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat="issue in issues">
	<td>{{ issue.subject }} <span ng-if="issue.exercice">(challenge {{ issue.exercice }})</span></td>
	<td>{{ issue.state }} / {{ issue.priority }}</td>
	<td>{{ issue.assignee }}</td>
	<td>
	  <p ng-repeat="text in issue.texts | orderBy:'date':'reverse'" style="margin-left: 15px; text-indent: -15px">
	    <span ng-if="text.assignee == null || text.assignee == '$team'">Vous</span>
	    <span ng-if="text.assignee != null && text.assignee != '$team'" ng-bind="text.assignee"></span>&nbsp;à {{ text.date | date:"mediumTime" }}&nbsp;:
	    <span style="white-space: pre-line">{{ text.cnt }}</span>
	  </p>
	</td>
	<td>
	  <a ng-href="/issues/{{ issue.id }}#myIssue" class="btn btn-sm" ng-class="{'btn-danger': issue.state == 'need-info', 'btn-light': issue.state != 'need-info'}"><span class="glyphicon glyphicon-envelope"></span></a>
	</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="card border-warning mt-3" ng-if="!settings.acceptNewIssue">
  <div class="card-header bg-warning text-light">Rapporter une anomalie sur un exercice</div>
  <div class="card-body">
    <p class="card-text">Rapprochez-vous d'un membre de l'équipe serveur afin d'obtenir de l'aide.</p>
  </div>
</div>

<div class="card border-warning mt-3 mb-4" ng-if="settings.acceptNewIssue" id="myIssue">
  <div class="card-header bg-warning text-light" ng-if="!issue.id">Rapporter une anomalie <span ng-if="issue.id_exercice">sur un exercice</span></div>
  <div class="card-header bg-warning text-light" ng-if="issue.id">Répondre à un rapport d'anomalie</div>
  <div class="card-body">
    <p ng-class="messageClass" ng-if="message || sberr"><strong ng-if="!sberr">Votre rapport a bien été envoyé !</strong><strong ng-if="sberr">{{ sberr }}</strong> {{ message }}</p>
    <form ng-submit="isubmit()">

      <div class="form-group row" ng-if="issue.id_exercice">
	<label for="idExercice" class="col-sm-2 col-form-label">Exercice</label>
	<div class="col-sm-10" ng-if="current_theme">
	  <input type="text" readonly class="form-control-plaintext" id="idExercice" value="{{ themes[current_theme].exercices[issue.id_exercice].title }}">
	</div>
	<div class="col-sm-10" ng-if="!current_theme">
	  <input type="text" readonly class="form-control-plaintext" id="idExercice" value="{{ issue.id_exercice }}">
	</div>
      </div>

      <div class="form-group row" ng-if="issue.id && issues_idx[issue.id]">
	<label for="subject" class="col col-form-label">Objet</label>
	<div class="col-sm-10">
	  <input type="text" readonly class="form-control-plaintext" id="subject" value="Re: {{ issues_idx[issue.id].subject }}">
	</div>
      </div>

      <div class="form-group row" ng-if="!issue.id || !issues_idx[issue.id]">
	<label for="subject" class="col col-form-label">Objet</label>
	<div class="col-sm-10">
	  <input type="text" class="form-control" id="subject" ng-model="issue.subject" placeholder="Intitulé succinct">
	</div>
      </div>

      <div class="form-group row">
	<label for="description" class="col col-form-label">Description</label>
	<div class="col-sm-10">
	  <textarea class="form-control" id="description" ng-model="issue.description" placeholder="Décrivez en détail votre problème ici. Si nécessaire, incluez un lien vers une capture d'écran montrant votre problème."></textarea>
	</div>
      </div>

      <button type="submit" class="float-right btn btn-warning">Envoyer le rapport</button>
    </form>
  </div>
</div>
