This commit is contained in:
2025-12-03 17:40:50 +03:00
parent d3d8b7522a
commit 4cad91440c
34 changed files with 1120 additions and 434 deletions

View File

@@ -4,22 +4,20 @@
{{ $t('chat_card__title') }}
</template>
<template #footer>
<div class="w100 q-pa-md">
<q-btn
rounded color="primary"
class="w100"
@click="onSubmit"
v-if="chat"
>
{{ $t("chat_card__go_chat") }}
</q-btn>
</div>
<q-btn
rounded color="primary"
class="w100"
@click="onSubmit"
v-if="chat"
>
{{ $t("chat_card__go_chat") }}
</q-btn>
</template>
<pn-scroll-list>
<div
v-if="chat"
class="flex column items-center q-pa-md"
class="flex column items-center q-px-md q-pt-md q-pb-sm"
>
<pn-auto-avatar
:img="chat.logo"
@@ -34,12 +32,17 @@
</div>
<div
v-if="chat.description"
class="flex row items-start justify-center text-caption text-center"
class="flex row items-start justify-center text-caption text-center text-grey"
>
{{ chat.description }}
</div>
</div>
<q-list separator v-if="chatUsers.length!==0">
<div class="q-pb-md w100" v-if="chat">
<pn-chat-type-item :type="chat.bot_access || 0" :time="chat.bot_access_date"/>
<pn-chat-type-item v-if="chat.restore_date" :type="10" :time="chat.restore_date"/>
</div>
<q-list separator v-if="chatUsers.length !== 0">
<q-item-label class="text-caption text-bold q-py-none" header>
{{ $t('chat_card__members') + ' (' + chatUsers.length +')' }}
</q-item-label>
@@ -58,22 +61,28 @@
/>
</q-item-section>
<q-item-section>
<q-item-label lines="1" v-if="getUserStatus(item).status">
<q-badge :color="getUserStatus(item).color">
{{ $t(getUserStatus(item).text) }}
<q-item-label class="text-caption text-amber-10" lines="1" v-if="chat?.owner_id === item.id">
<div class="flex items-center">
<q-icon name="star" class="q-pr-xs"/>
{{ $t('chat_card__owner') }}
</div>
</q-item-label>
<q-item-label lines="1" v-if="getUserStatus(item) && getUserStatus(item)?.status">
<q-badge :color="getUserStatus(item)?.color">
{{ $t(getUserStatus(item)?.text ?? '') }}
</q-badge>
</q-item-label>
<q-item-label lines="1" class="text-bold" v-if="item.section1">
{{item.section1}}
{{ item.section1 }}
</q-item-label>
<q-item-label lines="2" caption v-if="item.section3">
{{item.section3}}
{{ item.section3 }}
</q-item-label>
<q-item-label caption lines="2">
<div class="flex items-center">
<q-icon name="telegram" v-if="item.section2_1 || item.section2_2" class="q-pr-xs" style="color: #27a7e7"/>
<div v-if="item.section2_1" class="q-mr-sm text-bold">{{item.section2_1}}</div>
<div class="text-blue" v-if="item.section2_2">{{'@' + item.section2_2}}</div>
<div v-if="item.section2_1" class="q-mr-sm text-bold">{{ item.section2_1 }}</div>
<div class="text-blue" v-if="item.section2_2">{{ '@' + item.section2_2 }}</div>
</div>
</q-item-label>
</q-item-section>
@@ -91,10 +100,11 @@
import { useUsersStore } from 'stores/users'
import { useCompaniesStore } from 'stores/companies'
import { parseIntString } from 'src/utils/helpers'
import type { Chat } from 'types/Chat'
import type { User } from 'types/User'
import type { WebApp } from '@twa-dev/types'
import { useUserSection } from 'composables/useUserSection'
import pnChatTypeItem from 'components/pnChatTypeItem.vue'
import { getUserStatus } from 'utils/users'
import type { Chat } from 'types/Chat'
import type { WebApp } from '@twa-dev/types'
const tg = inject('tg') as WebApp
@@ -119,9 +129,8 @@
watch(() => chatsStore.isInit, initChat)
async function onSubmit () {
function onSubmit () {
if (chat.value) tg.openTelegramLink('https://t.me/c/' + chat.value.telegram_id + '/' + chat.value.message_id)
if (chat.value) await chatsStore.getChatUsers(chat.value.id)
}
const users = computed(() => usersStore.users)
@@ -146,19 +155,4 @@
await router.push({ name: 'user_info', params: { id: route.params.id, userId: id }})
}
interface chatUser extends User {
section1: string
section2_1: string
section2_2: string
section3: string
companyName: string | null
}
function getUserStatus (item: chatUser) {
if (item.is_blocked) return { status: 'blocked', text: 'user_block__user_blocked', color: 'negative' }
if (item.is_leave) return { status: 'leave', text: 'user_block__user_leave', color: 'primary' }
if (!item.is_terms_accepted) return { status: 'pending', text: 'user_block__user_pending', color: 'secondary' }
return { status: null, text: '', color: '' }
}
</script>