before update auth

This commit is contained in:
2025-08-18 13:21:54 +03:00
parent 04ea1f83c6
commit 3b628cbfb3
12 changed files with 41 additions and 286 deletions

View File

@@ -1,234 +0,0 @@
<template>
<pn-page-card>
<template #title>
{{ $t('software__title') }}
</template>
<pn-scroll-list>
<template #card-body-header>
<div class="q-pa-md">
{{ $t('software__description') }}
</div>
</template>
<q-list separator>
<q-expansion-item
v-for="item in software"
group="somegroup"
>
<template #header>
<q-item-section avatar>
<q-avatar square size="sm" v-if="item.logo">
<img :src="'3software/logo/' + item.logo">
</q-avatar>
</q-item-section>
<q-item-section>
<div class="flex items-baseline">
<span class="text-h6">
{{ item.name }}
</span>
<span v-if = "item.ver" class="text-caption q-pl-xs">
{{ 'v.' + item.ver }}
</span>
</div>
</q-item-section>
</template>
<div class="w100 flex column q-px-md q-gutter-y-md q-py-sm">
<div class="flex row no-wrap items-center">
<q-icon name="mdi-scale-balance" size="sm" class="q-pr-lg" color="grey"/>
<div
@click="downloadFile('3software/license/' + item.license_file)"
class="flex w100 column q-pl-sm cursor-pointer"
>
<span> {{ item.license }} </span>
<span
class="text-caption"
style="white-space: pre-line;"
>
{{ item.license_copyright }}
</span>
</div>
</div>
<div class="flex row no-wrap items-center" v-if="item.web">
<q-icon name="mdi-web" size="sm" class="q-pr-lg" color="grey"/>
<span
class="q-pl-sm cursor-pointer"
@click="tg.openLink(item.web_url)"
>
{{ item.web }}
</span>
</div>
<div class="flex row no-wrap items-center" v-if="item.git">
<q-icon name="mdi-github" size="sm" class="q-pr-lg" color="grey"/>
<span
class="q-pl-sm cursor-pointer"
@click="tg.openLink(item.git_url)"
>
{{ item.git }}
</span>
</div>
</div>
</q-expansion-item>
</q-list>
</pn-scroll-list>
</pn-page-card>
</template>
<script setup lang="ts">
import { inject } from 'vue'
import type { WebApp } from '@twa-dev/types'
const tg = inject('tg') as WebApp
const software = [
{
id: 1,
name: 'Vue',
ver: '3.4',
logo: 'vue.webp',
web: 'vuejs.org',
web_url: 'https://vuejs.org/',
git: 'vuejs/core',
git_url: 'https://github.com/vuejs/core',
license: 'MIT License',
license_copyright: 'Copyright (c) 2018-present, Yuxi (Evan) You and Vue contributors',
license_file: 'vue/LICENSE.txt'
},
{
id: 2,
name: 'Quasar',
ver: '2.x',
logo: 'quasar.png',
web: 'quasar.dev',
web_url: 'https://quasar.dev/',
git: 'quasarframework/quasar',
git_url: 'https://github.com/quasarframework/quasar',
license: 'MIT License',
license_copyright: 'Copyright (c) 2015-present Razvan Stoenescu',
license_file: 'quasar/LICENSE.txt'
},
{
id: 3,
name: 'Pinia',
ver: '2.x',
logo: 'pinia.svg',
web: 'pinia.vuejs.org',
web_url: 'https://pinia.vuejs.org/',
git: 'vuejs/pinia',
git_url: 'https://github.com/vuejs/pinia',
license: 'MIT License',
license_copyright: 'Copyright (c) 2019-present Eduardo San Martin Morote',
license_file: 'pinia/LICENSE.txt'
},
{
id: 4,
name: 'Vue Router',
ver: '4.x',
logo: 'vue.webp',
web: 'router.vuejs.org',
web_url: 'https://router.vuejs.org/',
git: 'vuejs/router',
git_url: 'https://github.com/vuejs/router',
license: 'MIT License',
license_copyright: 'Copyright (c) 2019-present Eduardo San Martin Morote',
license_file: 'vue-router/LICENSE.txt'
},
{
id: 5,
name: 'Vue i18n',
ver: '9.x',
logo: 'vue-i18n.svg',
web: 'vue-i18n.intlify.dev',
web_url: 'https://vue-i18n.intlify.dev/',
git: 'intlify/vue-i18n',
git_url: 'https://github.com/intlify/vue-i18n',
license: 'MIT License',
license_copyright: 'Copyright (c) 2016-present kazuya kawaguchi and contributors',
license_file: 'vue-i18n/LICENSE.txt'
},
{
id: 6,
name: 'Axios',
ver: '1.x',
logo: 'axios.svg',
web: 'axios-http.com',
web_url: 'https://axios-http.com/',
git: 'axios/axios',
git_url: 'https://github.com/axios/axios',
license: 'MIT License',
license_copyright: 'Copyright (c) 2014-present Matt Zabriskie & Collaborators',
license_file: 'axios/LICENSE.txt'
},
{
id: 7,
name: 'better-sqlite3',
ver: '11.x',
logo: '',
web: '',
web_url: '',
git: 'WiseLibs/better-sqlite3',
git_url: 'https://github.com/WiseLibs/better-sqlite3',
license: 'MIT License',
license_copyright: 'Copyright (c) 2017 Joshua Wise',
license_file: 'better-sqlite3/LICENSE.txt'
},
{
id: 8,
name: 'Express',
ver: '4.x',
logo: 'express.svg',
web: 'expressjs.com',
web_url: 'https://expressjs.com/',
git: 'expressjs/express',
git_url: 'https://github.com/expressjs/express',
license: 'MIT License',
license_copyright: `Copyright (c) 2009-2014 TJ Holowaychuk <tj@vision-media.ca>
Copyright (c) 2013-2014 Roman Shtylman <shtylman+expressjs@gmail.com>
Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>`,
license_file: 'express/LICENSE.txt'
}
]
const downloadFile = async (url: string) => {
try {
const fullUrl = '/admin/' + url;
const fileUrl = new URL(fullUrl, window.location.origin).href;
const response = await fetch(fileUrl)
if (!response.ok) throw new Error(`HTTP error: ${response.status}`)
const blob = await response.blob()
const downloadUrl = URL.createObjectURL(blob)
const link = document.createElement('a')
const extractFileName = (url: string): string => {
return url.substring(url.lastIndexOf('/') + 1)
}
link.href = downloadUrl
link.download = extractFileName(url)
link.style.display = 'none'
document.body.appendChild(link)
link.click()
setTimeout(() => {
document.body.removeChild(link)
URL.revokeObjectURL(downloadUrl)
}, 100)
} catch (error) {
console.error('Download error:', error)
}
}
</script>
<style scope>
</style>

Binary file not shown.

View File

@@ -8,7 +8,7 @@
rounded color="primary"
class="w100 q-mt-md q-mb-xs fix-disabled-btn"
:disable="!isFormValid"
@click = "emit('update')"
@click = "onSubmit"
>
{{ $t(btnText) }}
</q-btn>
@@ -45,15 +45,6 @@
class="w100 q-pt-sm"
:label="$t('project_block__project_description')"
/>
<!-- <q-checkbox
v-if="modelValue.logo"
v-model="modelValue.is_logo_bg"
class="w100"
dense
>
{{ $t('project_block__image_use_as_background_chats') }}
</q-checkbox> -->
</div>
</div>
</pn-scroll-list>
@@ -62,9 +53,10 @@
</template>
<script setup lang="ts">
import { onMounted, computed, ref } from 'vue'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import type { ProjectParams } from 'types/Project'
import { convertEmptyStringsToNull } from 'helpers/helpers'
const { t } = useI18n()
@@ -95,11 +87,10 @@
return Object.values(validations).every(Boolean)
})
const initialProject = ref({} as ProjectParams)
onMounted(() => {
initialProject.value = { ...modelValue.value }
})
function onSubmit() {
const cleanedData = convertEmptyStringsToNull(modelValue.value)
emit('update', cleanedData)
}
</script>
<style scoped>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@
v-model="newCompany"
title="company_add__title_card"
btnText="company_add__btn"
@update = "addCompany"
@update="addCompany"
/>
</template>

View File

@@ -59,7 +59,7 @@
await router.push({ name: 'your_company' })
}
async function updateCompany(companyData: CompanyParams) {
async function updateCompany (companyData: CompanyParams) {
if (companyId.value) {
await companiesStore.update(companyId.value, companyData)
router.go(-1)

View File

@@ -17,15 +17,10 @@
const router = useRouter()
const projectsStore = useProjectsStore()
const newProject = ref(<ProjectParams>{
name: '',
logo: '',
description: '',
is_logo_bg: false
})
const newProject = ref<ProjectParams>({} as ProjectParams)
async function addProject () {
const newDataProject = await projectsStore.add(newProject.value)
async function addProject (projectData: ProjectParams) {
const newDataProject = await projectsStore.add(projectData)
await router.replace({ name: 'chats', params: { id: newDataProject.id }})
}

View File

@@ -1,7 +1,7 @@
<template>
<project-block
v-if="projectMod"
v-model="projectMod"
v-if="project"
v-model="project"
title="project_edit__title_card"
btnText="project_edit__btn"
@update="updateProject"
@@ -18,25 +18,27 @@
const router = useRouter()
const projectsStore = useProjectsStore()
const project = ref<ProjectParams | null>(null)
const projectId = computed(() => projectsStore.currentProjectId)
const projectMod = ref<ProjectParams | null>(null)
if (projectsStore.isInit) {
projectMod.value = projectId.value
project.value = projectId.value
? { ...projectsStore.projectById(projectId.value) } as ProjectParams
: null
}
watch(() => projectsStore.isInit, (isInit) => {
if (isInit && projectId.value && !projectMod.value) {
projectMod.value = { ...projectsStore.projectById(projectId.value) as ProjectParams }
if (isInit && projectId.value && !project.value) {
project.value = { ...projectsStore.projectById(projectId.value) as ProjectParams }
}
})
const updateProject = async () => {
if (!projectId.value || !projectMod.value) return
await projectsStore.update(projectId.value, projectMod.value)
router.go(-1)
async function updateProject (projectData: ProjectParams) {
if (projectId.value) {
await projectsStore.update(projectId.value, projectData)
router.go(-1)
}
}
</script>

View File

@@ -1,9 +1,9 @@
<template>
<pn-page-card>
<template #title>
{{ $t('projects__projects') }}
{{ $t('projects__title') }}
<q-btn
@click="goAccount()"
@click="goAccount"
flat rounded
no-caps
icon-right="mdi-chevron-right"
@@ -18,10 +18,10 @@
<pn-scroll-list>
<template
#card-body-header
v-if="projects.length !== 0 || archiveProjects.length !== 0"
v-if="projects.length!==0 || archiveProjects.length!==0"
>
<q-input
v-if="projects.length !== 0"
v-if="projects.length!== 0"
v-model="searchProject"
clearable
clear-icon="close"
@@ -35,7 +35,7 @@
</q-input>
</template>
<q-list separator v-if="projects.length !== 0">
<q-list separator v-if="projects.length!==0">
<template
v-for = "item in activeProjects"
:key="item.id"
@@ -66,7 +66,7 @@
caption lines="2"
style="max-width: -webkit-fill-available; white-space: pre-line"
>
{{item.description}}
{{ item.description }}
</q-item-label>
</q-item-section>
<q-item-section side top>
@@ -149,7 +149,7 @@
caption lines="2"
style="max-width: -webkit-fill-available; white-space: pre-line"
>
{{item.description}}
{{ item.description }}
</q-item-label>
</q-item-section>
</q-item>
@@ -158,7 +158,7 @@
</div>
</div>
<pn-onboard-btn
v-if="projects.length === 0 && projectsInit"
v-if="projects.length===0 && projectsInit"
icon="mdi-briefcase-plus-outline"
:message1="$t('projects__lets_start')"
:message2="$t('projects__lets_start_description')"

View File

@@ -56,9 +56,10 @@
flat
no-caps
dense
class="q-ml-xl"
rounded
class="q-ml-lg"
>
<span class="flex items-center no-wrap text-caption">
<span class="flex items-center no-wrap q-pl-sm">
{{ $t('header__to_projects') }}
<q-icon name="mdi-chevron-right"/>
</span>

View File

@@ -1,8 +1,8 @@
interface ProjectParams {
name: string
description: string
logo: string
is_logo_bg: boolean
description: string | null
logo: string | null
is_logo_bg: boolean | null
[key: string]: unknown
}