This commit is contained in:
2026-10-04 16:07:41 +07:00
parent 70d1f4956d
commit 31d93a9916
5 changed files with 1181 additions and 529 deletions
+103
View File
@@ -0,0 +1,103 @@
<script setup lang="ts">
import { NButton, NFlex } from 'naive-ui'
import type { Application, Team } from '@/api/generated/crabs/evening_detective_server'
defineProps<{
teams: Team[]
participationOptions: { label: string; value: string }[]
}>()
const emit = defineEmits<{
add: []
openQR: [team: Team]
preview: [id: number, password: string]
delete: [team: Team]
giveApplication: [team: Team, application: Application]
}>()
</script>
<template>
<div class="team-block team-block-hover" @click="emit('add')">
<p class="place-image-plus">+</p>
</div>
<div v-for="team in teams" :key="team.ID" class="team-block">
<div class="team-content-block">
<n-flex justify="space-between">
<div class="title-block">
<span class="team-name-block">
{{ team.name }}
<small v-if="team.captainEmail"> — {{ team.captainEmail }}</small>
<small v-if="team.participantsCount"> · Участников: {{ team.participantsCount }}</small>
</span>
<div v-if="team.captainEmail || team.participationStatus !== 'pending'">
{{
participationOptions.find((option) => option.value === team.participationStatus)
?.label
}}<span v-if="team.participationSource === 'automatic'"> · автоматически</span>
</div>
<div v-if="!team.captainEmail">Почта капитана не указана</div>
<div v-else-if="team.participationEmailError">
Ошибка отправки: {{ team.participationEmailError }}
</div>
<div v-else-if="team.participationEmailSent">Письмо отправлено</div>
<div v-if="team.participationStatus !== 'cancelled'">
Поездки: {{ team.actionsCount }}
</div>
</div>
<n-flex justify="end">
<n-button v-if="team.participationStatus !== 'cancelled'" @click="emit('openQR', team)"
>QR</n-button
>
<n-button
v-if="team.participationStatus !== 'cancelled'"
@click="emit('preview', team.ID!, team.password!)"
>Подсмотреть игру</n-button
>
<n-button type="error" ghost @click="emit('delete', team)">Удалить</n-button>
</n-flex>
</n-flex>
<n-button
v-for="application in team.applications"
:key="application.name"
class="link-button"
@click="emit('giveApplication', team, application)"
>
Выдать: {{ application.name }}
</n-button>
</div>
</div>
</template>
<style scoped>
.team-block {
background-color: #222;
border: 1px solid #222;
border-radius: 10px;
margin: 10px 0;
}
.team-block-hover:hover {
background-color: #333;
cursor: pointer;
}
.team-content-block {
padding: 16px;
}
.team-name-block {
font-size: 20px;
}
.link-button {
margin: 6px 6px 0 0;
}
.place-image-plus {
font-size: 32px;
margin: 0;
padding: 12px;
text-align: center;
}
</style>