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

View File

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

View File

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

View File

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

View File

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

View File

@@ -56,9 +56,10 @@
flat flat
no-caps no-caps
dense 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') }} {{ $t('header__to_projects') }}
<q-icon name="mdi-chevron-right"/> <q-icon name="mdi-chevron-right"/>
</span> </span>

View File

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