130 lines
4 KiB
Go Template
130 lines
4 KiB
Go Template
|
{{ template "header" . }}
|
||
|
|
||
|
{{ $IsAdmin := false }}
|
||
|
{{ if and .User.Team (eq .Team.ID .User.Team.TeamID) (eq .User.Team.Role 0) }}
|
||
|
{{ $IsAdmin = true }}
|
||
|
{{ end }}
|
||
|
|
||
|
<h1>{{ .Team.Name }}</h1>
|
||
|
<p class="fw-light">Создана {{ .Team.CreatedAt.Format "02.01.2006" }}</p>
|
||
|
|
||
|
{{ if $IsAdmin }}
|
||
|
<p>Вы капитан команды</p>
|
||
|
{{ end }}
|
||
|
|
||
|
{{ if or (not .User.Team) (ne .Team.ID .User.Team.TeamID) }}
|
||
|
{{ $requested := false }}
|
||
|
{{ $userID := .User.ID }}
|
||
|
{{ range .Team.Requests }}
|
||
|
{{ if eq .User.ID $userID }}
|
||
|
{{ $requested = true }}
|
||
|
{{ end }}
|
||
|
{{ end }}
|
||
|
|
||
|
{{ if $requested }}
|
||
|
<div class="alert alert-secondary">Заявка в команду рассматривается.</div>
|
||
|
{{ else }}
|
||
|
<form method="post" class="mt-2" action="/team/{{.Team.ID}}/request">
|
||
|
<input type="submit" class="btn btn-outline-primary" value="Отправить заявку в команду" />
|
||
|
</form>
|
||
|
{{ end }}
|
||
|
{{ end }}
|
||
|
|
||
|
<h2 class="mt-4">Участники</h2>
|
||
|
<table class="table table-bordered">
|
||
|
<thead class="table-primary">
|
||
|
<tr>
|
||
|
<th>Ник</th>
|
||
|
<th class="thin">Роль</th>
|
||
|
<th class="thin">Дата вступления</th>
|
||
|
{{ if $IsAdmin }}
|
||
|
<th class="thin">Действие</th>
|
||
|
{{ end }}
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
{{ range .Team.Members }}
|
||
|
<tr>
|
||
|
<td>
|
||
|
{{.User.Username}}
|
||
|
</td>
|
||
|
<td>
|
||
|
{{if eq .Role 0 }}
|
||
|
Капитан
|
||
|
{{else if eq .Role 1 }}
|
||
|
Участник
|
||
|
{{end}}
|
||
|
</td>
|
||
|
<td>
|
||
|
{{ .CreatedAt.Format "15:04 02.01.2006" }}
|
||
|
</td>
|
||
|
{{ if and $IsAdmin (ne .Role 0) }}
|
||
|
<td>
|
||
|
<form method="post" action="/team/member/remove">
|
||
|
<input type="hidden" name="member_id" value="{{.User.ID}}">
|
||
|
<input type="submit" class="btn btn-outline-danger" value="Выгнать" />
|
||
|
</form>
|
||
|
</td>
|
||
|
{{ else if $IsAdmin }}
|
||
|
<td> </td>
|
||
|
{{ end }}
|
||
|
</tr>
|
||
|
{{ end }}
|
||
|
</tbody>
|
||
|
</table>
|
||
|
|
||
|
|
||
|
<p>
|
||
|
Чтобы добавить участников в команду пришлите им ссылку на команду
|
||
|
(<a href="https://nquest.ru/team/{{.Team.ID}}">https://nquest.ru/team/{{.Team.ID}}</a>).
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
По этой ссылке будущие участники могут подать заявку на вступление в команду.
|
||
|
</p>
|
||
|
|
||
|
{{ if $IsAdmin }}
|
||
|
<h2>Заявки</h2>
|
||
|
<table class="table table-bordered">
|
||
|
<thead class="table-primary">
|
||
|
<tr>
|
||
|
<th>Ник</th>
|
||
|
<th class="thin">Дата заявки</th>
|
||
|
<th class="thin">Действие</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
{{ range .Team.Requests }}
|
||
|
<tr>
|
||
|
<td>
|
||
|
{{ .User.Username }}
|
||
|
</td>
|
||
|
<td>
|
||
|
{{ .CreatedAt.Format "15:04 02.01.2006" }}
|
||
|
</td>
|
||
|
<td>
|
||
|
<form method="post" action="/team/member/approve">
|
||
|
<input type="hidden" name="member_id" value="{{ .User.ID }}">
|
||
|
<div class="btn-group">
|
||
|
<input type="submit" name="approve" class="btn btn-outline-success" value="Принять" />
|
||
|
<input type="submit" name="decline" class="btn btn-outline-danger" value="Отказать" />
|
||
|
</div>
|
||
|
</form>
|
||
|
</td>
|
||
|
</tr>
|
||
|
{{else}}
|
||
|
<tr>
|
||
|
<td colspan="3"><span>Нет заявок</span></td>
|
||
|
</tr>
|
||
|
{{ end }}
|
||
|
</tbody>
|
||
|
</table>
|
||
|
{{ end }}
|
||
|
|
||
|
{{ if and .User.Team (eq .Team.ID .User.Team.TeamID) (eq .User.Team.Role 1) }}
|
||
|
<form method="post" action="/team/member/leave">
|
||
|
<input type="submit" class="btn btn-outline-danger" value="Покинуть команду" />
|
||
|
</form>
|
||
|
{{ end }}
|
||
|
|
||
|
{{ template "footer" . }}
|