Verifica telegram + email
- convertito la Configurazione newsletter - Protetto le password (al load) che vengono settate in settings
This commit is contained in:
@@ -46,6 +46,9 @@ export const shared_consts = {
|
||||
|
||||
TAB_COUNTRY: 'countries',
|
||||
TAB_PHONES: 'phones',
|
||||
TAB_SETTINGS: 'settings',
|
||||
|
||||
KEY_TO_CRYPTED: ['PWD_FROM'],
|
||||
|
||||
TablePickup: ['countries', 'phones'],
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
{{myimgint}}
|
||||
<q-avatar v-if="!myimgint" class="q-mb-sx center_img" :icon="myicon" :font-size="size">
|
||||
|
||||
</q-avatar>
|
||||
|
||||
@@ -152,8 +152,18 @@ export default defineComponent({
|
||||
|
||||
if (fieldsTable.tableRemotePickup.includes(props.tablesel)) {
|
||||
// if (myvalue.value.length > 1) {
|
||||
try {
|
||||
if (mystr !== '')
|
||||
myarr = await globalStore.loadPickup({ table: props.tablesel, search: mystr })
|
||||
|
||||
if (myarr === null){
|
||||
abort()
|
||||
return
|
||||
}
|
||||
}catch (e) {
|
||||
abort()
|
||||
return
|
||||
}
|
||||
// const needle = val.toLocaleLowerCase()
|
||||
// optFiltered.value = optFiltered.value.filter((v: any) => v.toLocaleLowerCase().indexOf(needle) > -1)
|
||||
// }
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
|
||||
<div v-if="!tools.isMobile()"><br></div>
|
||||
|
||||
showcell: {{ showcell}}
|
||||
|
||||
<!--<vue-tel-input
|
||||
v-if="showcell"
|
||||
@country-changed="intcode_change()"
|
||||
|
||||
0
src/components/CVerifyEmail/CVerifyEmail.scss
Executable file
0
src/components/CVerifyEmail/CVerifyEmail.scss
Executable file
23
src/components/CVerifyEmail/CVerifyEmail.ts
Executable file
23
src/components/CVerifyEmail/CVerifyEmail.ts
Executable file
@@ -0,0 +1,23 @@
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
import { CCopyBtn } from '../CCopyBtn'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CVerifyEmail',
|
||||
components: { CCopyBtn },
|
||||
props: {},
|
||||
setup() {
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
function isEmailVerified(): boolean {
|
||||
return userStore.my.verified_email!
|
||||
}
|
||||
|
||||
return {
|
||||
isEmailVerified,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
23
src/components/CVerifyEmail/CVerifyEmail.vue
Executable file
23
src/components/CVerifyEmail/CVerifyEmail.vue
Executable file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<div class="text-center q-gutter-sm q-ma-sm clBorderWarning">
|
||||
<q-chip v-if="isEmailVerified()" color="positive" text-color="white" icon="email">
|
||||
{{ `Email ` + $t('pages.statusreg.verified') }}
|
||||
</q-chip>
|
||||
<q-chip v-else color="negative" text-color="white" icon="email">
|
||||
{{ `Email ` + $t('pages.statusreg.nonverified') }}
|
||||
</q-chip>
|
||||
<div v-if="!isEmailVerified()" v-html="$t('components.authentication.email_verification.link_sent', {botname: $t('ws.botname') })">
|
||||
|
||||
</div>
|
||||
<div v-if="!isEmailVerified()" v-html="$t('components.authentication.email_verification.se_non_ricevo')">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CVerifyEmail.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CVerifyEmail.scss';
|
||||
</style>
|
||||
1
src/components/CVerifyEmail/index.ts
Executable file
1
src/components/CVerifyEmail/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as CVerifyEmail} from './CVerifyEmail.vue'
|
||||
0
src/components/CVerifyTelegram/CVerifyTelegram.scss
Executable file
0
src/components/CVerifyTelegram/CVerifyTelegram.scss
Executable file
53
src/components/CVerifyTelegram/CVerifyTelegram.ts
Executable file
53
src/components/CVerifyTelegram/CVerifyTelegram.ts
Executable file
@@ -0,0 +1,53 @@
|
||||
import { defineComponent, ref, computed } from 'vue'
|
||||
|
||||
import MixinBase from '@src/mixins/mixin-base'
|
||||
import { CCopyBtn } from '../CCopyBtn'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CVerifyTelegram',
|
||||
components: { CCopyBtn },
|
||||
props: {},
|
||||
setup(props, { emit }) {
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const { setValDb, getValDb } = MixinBase()
|
||||
|
||||
function TelegCode() {
|
||||
if (userStore.my.profile) {
|
||||
return userStore.my.profile.teleg_checkcode
|
||||
}else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
function TelegVerificato(): boolean {
|
||||
return userStore.my.profile ? userStore.my.profile.teleg_id! > 0 : false
|
||||
}
|
||||
|
||||
function getLinkBotTelegram(): string {
|
||||
return getValDb('TELEG_BOT_LINK', false)
|
||||
}
|
||||
function getBotNameTelegram() {
|
||||
return t('ws.botname');
|
||||
}
|
||||
|
||||
function isEmailVerified(): boolean {
|
||||
return userStore.my.verified_email!
|
||||
}
|
||||
|
||||
return {
|
||||
TelegCode,
|
||||
TelegVerificato,
|
||||
getLinkBotTelegram,
|
||||
isEmailVerified,
|
||||
getBotNameTelegram,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
39
src/components/CVerifyTelegram/CVerifyTelegram.vue
Executable file
39
src/components/CVerifyTelegram/CVerifyTelegram.vue
Executable file
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<div class="text-center q-gutter-sm q-ma-sm clBorderWarning">
|
||||
<div v-if="TelegCode() > 0">
|
||||
<div class="text-h5 text-center text-red">
|
||||
{{ $t('reg.teleg_auth') }} Telegram:
|
||||
</div>
|
||||
|
||||
<CCopyBtn :title="$t('reg.click_per_copiare')" :texttocopy="TelegCode()">
|
||||
|
||||
</CCopyBtn>
|
||||
|
||||
<div class="text-h6 text-center" v-html="$t('reg.teleg_torna_sul_bot', {botname: getBotNameTelegram()})">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="!TelegVerificato()" class="q-pa-sm q-gutter-sm">
|
||||
<div v-if="!TelegCode()"><strong>{{ $t('components.authentication.telegram.open')}}</strong></div>
|
||||
<div class="q-ma-md">
|
||||
<q-btn rounded color="primary" icon="fab fa-telegram" :label="$t('components.authentication.telegram.openbot', {botname: $t('ws.botname') })"
|
||||
type="a"
|
||||
:href="getLinkBotTelegram()" target="_blank"></q-btn>
|
||||
<br>
|
||||
</div>
|
||||
<strong>{{ $t('components.authentication.telegram.ifclose', {botname: getBotNameTelegram() })}}</strong>
|
||||
<div class="q-my-sm">
|
||||
<q-img src="statics/images/ayni_bot.jpg" class="" :alt="$t('ws.sitename')" style="height: 100px; width: 250px;">
|
||||
</q-img>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CVerifyTelegram.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CVerifyTelegram.scss';
|
||||
</style>
|
||||
1
src/components/CVerifyTelegram/index.ts
Executable file
1
src/components/CVerifyTelegram/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as CVerifyTelegram} from './CVerifyTelegram.vue'
|
||||
@@ -196,8 +196,10 @@
|
||||
}}
|
||||
</div>
|
||||
|
||||
<!--<span class="text-white" v-if="Verificato"> {{t('reg.verificato')}} </span>-->
|
||||
<!--<span class="text-white background-red" v-else> {{t('reg.non_verificato')}} </span>-->
|
||||
<div class="text-center">
|
||||
<span class="text-white" v-if="Verificato()"> {{t('reg.verificato')}} </span>
|
||||
<span class="text-white background-red" v-else> {{t('reg.non_verificato')}} </span>
|
||||
</div>
|
||||
|
||||
<div v-if="isLogged()" id="user-actions" class="column justify-center q-gutter-sm q-ma-sm center-150">
|
||||
<q-btn rounded color="primary" icon="person" to="/profile">{{ t('pages.profile') }}</q-btn>
|
||||
|
||||
@@ -33,4 +33,6 @@ export * from './CEventsCalendar'
|
||||
export * from './CMySingleEvent'
|
||||
// export * from './PagePolicy'
|
||||
export * from './CFacebookFrame'
|
||||
export * from './CVerifyEmail'
|
||||
export * from './CVerifyTelegram'
|
||||
// export * from './CPreloadImages'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const msg_website_it = {
|
||||
ws: {
|
||||
sitename: 'Prima APP',
|
||||
siteshortname: 'Prima APP',
|
||||
botname: 'Prima APP',
|
||||
sitename: 'FreePlanet',
|
||||
siteshortname: 'FreePlanet',
|
||||
botname: 'il Bot di FreePlanet',
|
||||
},
|
||||
products: {
|
||||
quantity: 'Quantità',
|
||||
@@ -23,6 +23,7 @@ const msg_website_it = {
|
||||
pages: {
|
||||
home: 'Home',
|
||||
profile: 'Profilo',
|
||||
test: 'Test',
|
||||
projects: 'Progetti',
|
||||
report: 'Report Ore',
|
||||
producer: 'Produttore',
|
||||
|
||||
@@ -109,6 +109,65 @@ const routes_admin: IListRoutes[] = [
|
||||
}
|
||||
]
|
||||
|
||||
const routes_newsletter: IListRoutes[] = [
|
||||
{
|
||||
active: true,
|
||||
order: 10,
|
||||
name: 'newsletter.template', path: '/admin/newsletter/templemail', materialIcon: 'fas fa-users',
|
||||
component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
|
||||
inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
order: 20,
|
||||
name: 'newsletter.sendemail', path: '/admin/newsletter/newnewsletter', materialIcon: 'fas fa-users',
|
||||
component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
|
||||
inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
order: 30,
|
||||
name: 'newsletter.check', path: '/admin/newsletter/check', materialIcon: 'fas fa-users',
|
||||
component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
|
||||
inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
order: 40,
|
||||
name: 'newsletter.sent', path: '/admin/newsletter/newslist', materialIcon: 'fas fa-users',
|
||||
component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
|
||||
inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
order: 50,
|
||||
name: 'newsletter.mailinglist', path: '/admin/newsletter/mailinglist', materialIcon: 'fas fa-users',
|
||||
component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
|
||||
inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
order: 60,
|
||||
name: 'newsletter.settings', path: '/admin/newsletter/settings', materialIcon: 'fas fa-users',
|
||||
component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
|
||||
inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
order: 70,
|
||||
name: 'newsletter.serversettings', path: '/admin/newsletter/main_settings', materialIcon: 'fas fa-users',
|
||||
component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
|
||||
inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
order: 80,
|
||||
name: 'newsletter.others', path: '/admin/newsletter/events', materialIcon: 'fas fa-users',
|
||||
component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
|
||||
inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
|
||||
}
|
||||
]
|
||||
|
||||
const routes_manager: IListRoutes[] = [
|
||||
{
|
||||
active: functionality.BOOKING_EVENTS,
|
||||
@@ -199,7 +258,7 @@ const routes_manager: IListRoutes[] = [
|
||||
onlyManager: true,
|
||||
onlyEditor: true
|
||||
},
|
||||
/*{
|
||||
{
|
||||
active: true,
|
||||
path: '/admin/newsletter',
|
||||
order: 60,
|
||||
@@ -215,6 +274,7 @@ const routes_manager: IListRoutes[] = [
|
||||
onlyAdmin: true,
|
||||
onlyManager: true
|
||||
},
|
||||
/*
|
||||
{
|
||||
active: functionality.ENABLE_ECOMMERCE,
|
||||
path: '/admin/ecommerce',
|
||||
@@ -314,6 +374,17 @@ const baseroutes: IListRoutes[] = [
|
||||
inmenu: true,
|
||||
infooter: true,
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
order: 120,
|
||||
path: '/test',
|
||||
materialIcon: 'fas fa-user',
|
||||
name: 'pages.test',
|
||||
component: () => import('@/views/user/test/test.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
inmenu: true,
|
||||
infooter: true,
|
||||
},
|
||||
/*{
|
||||
active: true,
|
||||
order: 6,
|
||||
@@ -473,6 +544,16 @@ const baseroutes: IListRoutes[] = [
|
||||
inmenu: true,
|
||||
infooter: true
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
order: 1000,
|
||||
path: '/admin/newsletter/:idparam',
|
||||
materialIcon: 'event',
|
||||
name: 'pages.newsletter.menu',
|
||||
component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
|
||||
inmenu: false,
|
||||
infooter: false
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
order: 90,
|
||||
|
||||
@@ -46,6 +46,7 @@ export interface ISettings {
|
||||
value_num?: number
|
||||
value_bool?: boolean
|
||||
serv?: boolean
|
||||
crypted?: boolean
|
||||
}
|
||||
|
||||
export interface ITeachUname {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import {
|
||||
defineComponent, ref, computed,
|
||||
} from 'vue'
|
||||
@@ -8,15 +7,52 @@ import { CSkill } from '@/components/CSkill'
|
||||
import { CFinder } from '@/components/CFinder'
|
||||
import { CChartMap } from '@src/components/CChartMap'
|
||||
import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
||||
import { CVerifyEmail } from '@src/components/CVerifyEmail'
|
||||
import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { static_data } from '@/db/static_data'
|
||||
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Home',
|
||||
components: { CSkill, CChartMap, CMapsEsempio, CFinder },
|
||||
components: { CSkill, CChartMap, CMapsEsempio, CFinder, CVerifyEmail, CVerifyTelegram },
|
||||
setup() {
|
||||
const globalStore = useGlobalStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
function isEmailVerified() {
|
||||
return userStore.my.verified_email
|
||||
}
|
||||
|
||||
function TelegCode() {
|
||||
return userStore.my.profile.teleg_checkcode
|
||||
}
|
||||
|
||||
function TelegVerificato(): boolean {
|
||||
return userStore.my.profile ? userStore.my.profile.teleg_id! > 0 : false
|
||||
}
|
||||
|
||||
function openrighttoolbar() {
|
||||
globalStore.rightDrawerOpen = true
|
||||
}
|
||||
|
||||
function isLogged() {
|
||||
return userStore.isLogged
|
||||
}
|
||||
function isUserOk() {
|
||||
return userStore.isUserOk()
|
||||
}
|
||||
|
||||
return {
|
||||
tools,
|
||||
static_data,
|
||||
isEmailVerified,
|
||||
TelegCode,
|
||||
TelegVerificato,
|
||||
isLogged,
|
||||
openrighttoolbar,
|
||||
isUserOk,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -11,7 +11,34 @@
|
||||
|
||||
<!--<CMapsEsempio></CMapsEsempio>-->
|
||||
|
||||
<div v-if="isLogged()">
|
||||
<CVerifyEmail v-if="!isEmailVerified()">
|
||||
|
||||
</CVerifyEmail>
|
||||
|
||||
<CVerifyTelegram v-if="TelegCode() || !TelegVerificato()">
|
||||
|
||||
</CVerifyTelegram>
|
||||
|
||||
<div v-if="isUserOk()">
|
||||
<CFinder/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="!isLogged() && static_data.functionality.ENABLE_REGISTRATION" style="margin:20px; text-align: center;">
|
||||
<q-btn rounded size="lg" color="primary" @click="openrighttoolbar">{{ $t('login.enter') }}
|
||||
</q-btn>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div v-if="!isLogged && static_data.functionality.ENABLE_REGISTRATION" align="center" style="margin:20px;">
|
||||
<q-btn rounded size="lg" color="primary" to="/signup">{{$t('reg.submit')}}
|
||||
</q-btn>
|
||||
</div>
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
</q-page>
|
||||
|
||||
|
||||
6
src/rootgen/admin/newsletter/newsletter.scss
Executable file
6
src/rootgen/admin/newsletter/newsletter.scss
Executable file
@@ -0,0 +1,6 @@
|
||||
.mlvalue {
|
||||
margin: 5px 5px;
|
||||
font-weight: bold;
|
||||
font-size: 1rem;
|
||||
|
||||
}
|
||||
314
src/rootgen/admin/newsletter/newsletter.ts
Executable file
314
src/rootgen/admin/newsletter/newsletter.ts
Executable file
@@ -0,0 +1,314 @@
|
||||
import { defineComponent, ref, onMounted, watch, computed } from 'vue'
|
||||
|
||||
|
||||
import { tools } from '@src/store/Modules/tools'
|
||||
import {
|
||||
colnewstosent,
|
||||
coltemplemail,
|
||||
colopzemail,
|
||||
colmailinglist,
|
||||
colmsg_templates, fieldsTable
|
||||
} from '@src/store/Modules/fieldsTable'
|
||||
import { DefaultNewsState, INewsState } from '@src/model/index'
|
||||
import translate from '../../../globalroutines/util'
|
||||
import { CTitle } from '../../../components/CTitle'
|
||||
import { CMyPage } from '../../../components/CMyPage'
|
||||
import MixinBase from '../../../mixins/mixin-base'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { CGridTableRec } from '@/components/CGridTableRec'
|
||||
import { CTitleBanner } from '@/components/CTitleBanner'
|
||||
import { CMyFieldDb } from '@/components/CMyFieldDb'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { costanti } from '@costanti'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'newsletter',
|
||||
components: { CTitle, CMyPage, CGridTableRec, CTitleBanner, CMyFieldDb },
|
||||
setup() {
|
||||
const globalStore = useGlobalStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const $q = useQuasar()
|
||||
const { getValDb } = MixinBase()
|
||||
|
||||
const $route = useRoute()
|
||||
|
||||
const myloadingload = ref(false)
|
||||
const myloading = ref(false)
|
||||
const myloadingprew = ref(false)
|
||||
const myloading2 = ref(false)
|
||||
const myloading3 = ref(false)
|
||||
const myloading4 = ref(false)
|
||||
const myloadingState = ref(false)
|
||||
const myloadingImport = ref(false)
|
||||
const mailinglist_imported = ref('')
|
||||
const myrisimport = ref('')
|
||||
const errimport = ref(false)
|
||||
const okimport = ref(false)
|
||||
const newsstate = ref (<INewsState>{})
|
||||
const percsubscribed = ref(0.0)
|
||||
const polling = ref(<any> null)
|
||||
const tab = ref('')
|
||||
const emailtextheader = ref('')
|
||||
const eseguipolling = ref(false)
|
||||
|
||||
const idparam = computed( () => $route.params.idparam.toString())
|
||||
|
||||
|
||||
async function mounted() {
|
||||
await load()
|
||||
newsstate.value = DefaultNewsState
|
||||
// tab = tools.getCookie('formnews', 'check')
|
||||
tab.value = $route.params.idparam.toString()
|
||||
emailtextheader.value = getValDb('EMAIL_TEXT', true)
|
||||
|
||||
}
|
||||
|
||||
function checkifpolling() {
|
||||
if (eseguipolling.value) {
|
||||
// Is Still sending email, so, every minutes, check the status
|
||||
if (!polling.value) {
|
||||
console.log('esegui POLLING....')
|
||||
polling.value = setInterval(() => {
|
||||
load()
|
||||
}, 15000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
watch(idparam, (newval, oldval) => {
|
||||
console.log('$route.params.idparam')
|
||||
tab.value = idparam.value
|
||||
})
|
||||
|
||||
async function createNewsletter(minuti: number, loading: boolean) {
|
||||
loading = true
|
||||
// Crea nuovo record tra N minuti
|
||||
const mynews = {
|
||||
idapp: process.env.APP_ID,
|
||||
label: 'Newsletter creata il ' + tools.getstrDateTimeAll(tools.getDateNow()),
|
||||
activate: true,
|
||||
datetoSent: tools.addMinutes(tools.getDateNow(), minuti),
|
||||
templemail_str: globalStore.gettemplemailbyId(getValDb('TEMPLEMAIL_ID', true))
|
||||
}
|
||||
await tools.createNewRecord($q, 'newstosent', mynews).then((myrecris) => {
|
||||
// reload data
|
||||
load()
|
||||
loading = false
|
||||
})
|
||||
}
|
||||
|
||||
function beforeDestroy() {
|
||||
console.log('beforeDestroy')
|
||||
if (polling.value)
|
||||
clearInterval(polling.value)
|
||||
}
|
||||
|
||||
async function load() {
|
||||
console.log('Newsletter load')
|
||||
myloadingload.value = true
|
||||
const mydata = {
|
||||
locale: tools.getLocale()
|
||||
}
|
||||
const myris = await userStore.newsletterload(mydata)
|
||||
newsstate.value = myris.newsstate
|
||||
globalStore.serv_settings = myris.serv_settings
|
||||
globalStore.templemail = myris.templemail
|
||||
globalStore.opzemail = myris.opzemail
|
||||
|
||||
// console.log('newsstate')
|
||||
// console.table('globalStore.serv_settings', globalStore.serv_settings)
|
||||
|
||||
percsubscribed.value = newsstate.value.totsubscribed / newsstate.value.totemail
|
||||
|
||||
if (newsstate.value.lastnewstosent)
|
||||
eseguipolling.value = (eseguipolling.value || newsstate.value.lastnewstosent.starting_job! && !newsstate.value.lastnewstosent.finish_job!)
|
||||
|
||||
if (newsstate.value.nextnewstosent)
|
||||
eseguipolling.value = eseguipolling.value || true
|
||||
|
||||
// console.log('eseguipolling', eseguipolling)
|
||||
myloadingload.value = false
|
||||
|
||||
checkifpolling()
|
||||
}
|
||||
|
||||
function DisableNewsletter() {
|
||||
return setActiveDisactiveNewsletter(false)
|
||||
}
|
||||
|
||||
function EnableNewsletter() {
|
||||
return setActiveDisactiveNewsletter(true)
|
||||
}
|
||||
|
||||
function setActiveDisactiveNewsletter(activate: any) {
|
||||
let mytext = ''
|
||||
const mytitle = 'Newsletter'
|
||||
if (activate)
|
||||
mytext = 'Procedo a far Ripartire la newsletter?'
|
||||
else
|
||||
mytext = 'Procedo a fermare l\'Invio della newsletter?'
|
||||
|
||||
$q.dialog({
|
||||
message: mytext,
|
||||
ok: {
|
||||
label: translate('dialog.yes'),
|
||||
push: true
|
||||
},
|
||||
title: mytitle,
|
||||
cancel: true,
|
||||
persistent: false
|
||||
}).onOk(async () => {
|
||||
|
||||
myloadingState.value = true
|
||||
const mydata = {
|
||||
_id: newsstate.value.lastnewstosent!._id,
|
||||
locale: tools.getLocale(),
|
||||
activate
|
||||
}
|
||||
newsstate.value = await userStore.newsletter_setactivate(mydata)
|
||||
myloadingState.value = false
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function emailtest() {
|
||||
return getValDb('EMAIL_TEST', true)
|
||||
}
|
||||
|
||||
async function sendNewsletterTest(previewonly: any) {
|
||||
if (previewonly)
|
||||
myloadingprew.value = true
|
||||
else
|
||||
myloading.value = true
|
||||
|
||||
const res = await globalStore.sendEmailTest({ previewonly })
|
||||
|
||||
if (res)
|
||||
tools.showPositiveNotif($q, 'Email di Test Inviata')
|
||||
else {
|
||||
tools.showNegativeNotif($q, 'Email di Test Non Inviata')
|
||||
}
|
||||
|
||||
if (previewonly)
|
||||
myloadingprew.value = false
|
||||
else
|
||||
myloading.value = false
|
||||
}
|
||||
|
||||
function changetabnews(value: any, oldval: any) {
|
||||
console.log('changetabnews')
|
||||
tools.setCookie('formnews', value)
|
||||
}
|
||||
|
||||
function getcolnewstosent() {
|
||||
return colnewstosent
|
||||
}
|
||||
|
||||
function getcolmailinglist() {
|
||||
return colmailinglist
|
||||
}
|
||||
|
||||
function getcoltemplemail() {
|
||||
return coltemplemail
|
||||
}
|
||||
|
||||
function getcolopzemail() {
|
||||
return colopzemail
|
||||
}
|
||||
|
||||
async function importMailinglist() {
|
||||
myloadingImport.value = true
|
||||
errimport.value = false
|
||||
okimport.value = false
|
||||
|
||||
const mydata = {
|
||||
strdataemail: mailinglist_imported,
|
||||
locale: tools.getLocale(),
|
||||
settomailchimp: getValDb('MAILCHIMP_ON', true, false)
|
||||
}
|
||||
|
||||
const res: any = await userStore.importemail(mydata)
|
||||
|
||||
let esistiti = ''
|
||||
if (res.data.numalreadyexisted > 0)
|
||||
esistiti = ` ${res.data.numalreadyexisted} email già esistenti`
|
||||
|
||||
if (res.data.numadded > 0) {
|
||||
okimport.value = true
|
||||
myrisimport.value = `(${res.data.numadded} / ${res.data.numtot}) email importate !` + esistiti
|
||||
} else {
|
||||
errimport.value = true
|
||||
myrisimport.value = `Nessuna email importata (trovate ${res.data.numtot})` + esistiti
|
||||
}
|
||||
|
||||
myloadingImport.value = false
|
||||
}
|
||||
|
||||
function progresslabsubscribed() {
|
||||
return (percsubscribed.value * 100).toFixed(0) + '%'
|
||||
}
|
||||
|
||||
function percsent(next: any) {
|
||||
let rec = newsstate.value.lastnewstosent!
|
||||
if (next)
|
||||
rec = newsstate.value.nextnewstosent!
|
||||
|
||||
let val = 0
|
||||
if (rec) {
|
||||
val = rec.numemail_sent! / rec.numemail_tot! * 100
|
||||
if (val > 100)
|
||||
val = 100
|
||||
}
|
||||
return val.toFixed(2)
|
||||
}
|
||||
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
colmsg_templates,
|
||||
DisableNewsletter,
|
||||
EnableNewsletter,
|
||||
emailtest,
|
||||
sendNewsletterTest,
|
||||
changetabnews,
|
||||
getcolnewstosent,
|
||||
getcolmailinglist,
|
||||
getcoltemplemail,
|
||||
getcolopzemail,
|
||||
importMailinglist,
|
||||
progresslabsubscribed,
|
||||
percsent,
|
||||
myloadingload,
|
||||
myloading,
|
||||
myloadingprew,
|
||||
myloading2,
|
||||
myloading3,
|
||||
myloading4,
|
||||
myloadingState,
|
||||
myloadingImport,
|
||||
mailinglist_imported,
|
||||
myrisimport,
|
||||
errimport,
|
||||
okimport,
|
||||
newsstate,
|
||||
percsubscribed,
|
||||
polling,
|
||||
tab,
|
||||
emailtextheader,
|
||||
eseguipolling,
|
||||
createNewsletter,
|
||||
tools,
|
||||
toolsext,
|
||||
costanti,
|
||||
fieldsTable,
|
||||
globalStore,
|
||||
}
|
||||
}
|
||||
})
|
||||
547
src/rootgen/admin/newsletter/newsletter.vue
Executable file
547
src/rootgen/admin/newsletter/newsletter.vue
Executable file
@@ -0,0 +1,547 @@
|
||||
<template>
|
||||
<CMyPage title="Newsletter" keywords="" description="" imgbackground="images/calendario_eventi.jpg"
|
||||
sizes="max-height: 120px">
|
||||
|
||||
<q-card>
|
||||
<div v-show="false">
|
||||
<q-tabs
|
||||
v-model="tab"
|
||||
dense
|
||||
class="text-grey"
|
||||
active-color="primary"
|
||||
indicator-color="primary"
|
||||
align="justify"
|
||||
narrow-indicator
|
||||
>
|
||||
<q-tab name="settings" label="Impostazioni"></q-tab>
|
||||
<q-tab name="main_settings" label="Impostaz. Primarie"></q-tab>
|
||||
<q-tab name="templemail" label="Template Email"></q-tab>
|
||||
<q-tab name="newnewsletter" label="Invia"></q-tab>
|
||||
<q-tab name="check" label="Controlla"></q-tab>
|
||||
<q-tab name="newslist" label="Già Inviate"></q-tab>
|
||||
<q-tab name="mailinglist" label="Lista Contatti (MailingList)"></q-tab>
|
||||
<q-tab name="events" label="Altre"></q-tab>
|
||||
</q-tabs>
|
||||
</div>
|
||||
<q-tab-panels v-model="tab" animated @transition="changetabnews">
|
||||
<q-tab-panel name="settings">
|
||||
<div class="q-ma-xs q-pa-xs text-center rounded-borders q-list--bordered">
|
||||
<CTitleBanner title="Impostazioni:"></CTitleBanner>
|
||||
|
||||
<div class="row">
|
||||
<CMyFieldDb title="Altezza Logo"
|
||||
mykey="HEIGHT_LOGO"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.number">
|
||||
</CMyFieldDb>
|
||||
<CMyFieldDb title="Titolo Discipline"
|
||||
mykey="DISC_TITLE"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.string">
|
||||
</CMyFieldDb>
|
||||
</div>
|
||||
<CMyFieldDb title="Testo Promozione"
|
||||
mykey="TEXT_PROMO"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.html">
|
||||
</CMyFieldDb>
|
||||
|
||||
<div class="row">
|
||||
<CMyFieldDb title="Numero di Eventi da mostrare"
|
||||
mykey="SHOW_LAST_N_EV"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.number">
|
||||
</CMyFieldDb>
|
||||
<CMyFieldDb title="Testo dopo gli Eventi"
|
||||
mykey="TEXT_AFTER_EV"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.html">
|
||||
</CMyFieldDb>
|
||||
</div>
|
||||
<div class="row">
|
||||
<CMyFieldDb title="Pagina Twitter"
|
||||
mykey="URL_TWITTER"
|
||||
:type="costanti.FieldType.string">
|
||||
</CMyFieldDb>
|
||||
<CMyFieldDb title="Pagina Facebook"
|
||||
mykey="URL_FACEBOOK"
|
||||
:type="costanti.FieldType.string">
|
||||
</CMyFieldDb>
|
||||
<CMyFieldDb title="Pagina YouTube"
|
||||
mykey="URL_YOUTUBE"
|
||||
:type="costanti.FieldType.string">
|
||||
</CMyFieldDb>
|
||||
<CMyFieldDb title="Pagina Instagram"
|
||||
mykey="URL_INSTAGRAM"
|
||||
:type="costanti.FieldType.string">
|
||||
</CMyFieldDb>
|
||||
</div>
|
||||
<CMyFieldDb title="Firma"
|
||||
mykey="TEXT_SIGN"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.html">
|
||||
</CMyFieldDb>
|
||||
<CMyFieldDb title="Testo Disclaimer"
|
||||
mykey="TEXT_DISCLAIMER"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.html">
|
||||
</CMyFieldDb>
|
||||
<CMyFieldDb title="Testo a piè pagina"
|
||||
mykey="TEXT_DISC_BOTTOM"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.html">
|
||||
</CMyFieldDb>
|
||||
|
||||
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="main_settings">
|
||||
<div class="q-ma-xs q-pa-xs text-center rounded-borders q-list--bordered">
|
||||
<CTitleBanner title="Impostazioni Server:"></CTitleBanner>
|
||||
|
||||
<CMyFieldDb title="Email da cui Inviare la Newsletter"
|
||||
mykey="EMAIL_FROM"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.string">
|
||||
</CMyFieldDb>
|
||||
<CMyFieldDb title="Email di Reply"
|
||||
mykey="EMAIL_REPLY"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.string">
|
||||
</CMyFieldDb>
|
||||
<CMyFieldDb title="Password email"
|
||||
mykey="PWD_FROM"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.password">
|
||||
</CMyFieldDb>
|
||||
<CMyFieldDb title="Servizio SMTP Email ('gmail' per inviare email da Gmail)"
|
||||
mykey="EMAIL_SERVICE_SEND"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.string">
|
||||
</CMyFieldDb>
|
||||
<CMyFieldDb title="Porta SMTP"
|
||||
mykey="EMAIL_PORT"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.number">
|
||||
</CMyFieldDb>
|
||||
<CMyFieldDb title="Millisecondi di pausa tra una email e l'altra"
|
||||
mykey="MSEC_PAUSE_SEND"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.number">
|
||||
</CMyFieldDb>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="events">
|
||||
<CTitleBanner title="Altre Impostazioni:"></CTitleBanner>
|
||||
|
||||
<CMyFieldDb title="Messaggio dopo che l'utente ha Prenotato un Evento"
|
||||
mykey="MSG_REPLY_AFTER_BOOKING"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.string">
|
||||
</CMyFieldDb>
|
||||
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="templemail">
|
||||
<CTitleBanner title="Modelli Email:"></CTitleBanner>
|
||||
<CGridTableRec prop_mytitle=""
|
||||
prop_mytable="templemail"
|
||||
:prop_mycolumns="getcoltemplemail()"
|
||||
:prop_colkey="fieldsTable.getKeyByTable('templemail')"
|
||||
nodataLabel="Nessuna Email Template attualmente creata"
|
||||
noresultLabel="Il filtro selezionato non ha trovato nessun risultato"
|
||||
>
|
||||
|
||||
</CGridTableRec>
|
||||
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="newnewsletter">
|
||||
<div class="q-ma-md q-pa-sm text-center rounded-borders q-list--bordered">
|
||||
<CTitleBanner title="Test Invio Newsletter:"></CTitleBanner>
|
||||
<div class="q-pa-xs q-ma-md q-gutter-md">
|
||||
|
||||
<q-btn v-if="tools.isDebug()" :loading="myloadingprew" rounded outline
|
||||
@click="sendNewsletterTest(true)"
|
||||
color="primary"
|
||||
icon="fas fa-desktop">
|
||||
<span class="q-px-sm">Anteprima</span>
|
||||
<template v-slot:loading>
|
||||
<q-spinner-hourglass class="on-left"/>
|
||||
Carica Anteprima...
|
||||
</template>
|
||||
</q-btn>
|
||||
<div class="text-center">
|
||||
<CMyFieldDb title="Email di Test"
|
||||
mykey="EMAIL_TEST"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.string">
|
||||
</CMyFieldDb>
|
||||
<q-btn :loading="myloading" rounded outline @click="sendNewsletterTest(false)"
|
||||
color="primary"
|
||||
icon="email">
|
||||
<span class="q-px-sm">Invia Email di Test</span>
|
||||
<template v-slot:loading>
|
||||
<q-spinner-hourglass class="on-left"/>
|
||||
Invia Email a '{{emailtest()}}' in corso ...
|
||||
</template>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<div class="q-ma-xs q-pa-sm text-center rounded-borders q-list--bordered">
|
||||
<CTitleBanner title="Invia Newsletter:"></CTitleBanner>
|
||||
|
||||
<div class="q-pa-xs q-ma-md q-gutter-md">
|
||||
<CMyFieldDb title="Template Email da Inviare"
|
||||
mykey="TEMPLEMAIL_ID"
|
||||
:serv="true"
|
||||
:type="costanti.FieldType.select"
|
||||
jointable="templemail">
|
||||
</CMyFieldDb>
|
||||
|
||||
<q-btn :loading="myloading2" rounded outline @click="createNewsletter(3, myloading2)"
|
||||
color="primary"
|
||||
icon="fas fa-file-alt">
|
||||
<span class="q-px-sm">Crea Nuovo Invio Newsletter Schedulato tra 3 minuti</span>
|
||||
<template v-slot:loading>
|
||||
<q-spinner-hourglass class="on-left"/>
|
||||
Creazione Newsletter...
|
||||
</template>
|
||||
</q-btn>
|
||||
<br>
|
||||
<q-btn :loading="myloading3" rounded outline @click="createNewsletter(10, myloading3)"
|
||||
color="primary"
|
||||
icon="fas fa-clock">
|
||||
<span class="q-px-sm">Crea Nuovo Invio Newsletter Schedulato tra 10 minuti</span>
|
||||
<template v-slot:loading>
|
||||
<q-spinner-hourglass class="on-left"/>
|
||||
Creazione Newsletter
|
||||
</template>
|
||||
</q-btn>
|
||||
<br>
|
||||
<q-btn :loading="myloading4" rounded outline
|
||||
@click="createNewsletter(60*60*24, myloading4)"
|
||||
color="primary"
|
||||
icon="fas fa-calendar-day">
|
||||
<span class="q-px-sm">Crea Nuovo Invio Newsletter Schedulato tra 1 giorno</span>
|
||||
<template v-slot:loading>
|
||||
<q-spinner-hourglass class="on-left"/>
|
||||
Creazione Newsletter...
|
||||
</template>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<div class="q-ma-md rounded-borders q-list--bordered">
|
||||
<div class="text-center">
|
||||
<CTitleBanner title="Prossima Newsletter da Inviare:"></CTitleBanner>
|
||||
</div>
|
||||
|
||||
|
||||
<div v-if="newsstate.nextnewstosent"
|
||||
class="q-ma-md q-pa-sm text-center rounded-borders q-list--bordered">
|
||||
<q-card class="bg-grey-3 relative-position card-example">
|
||||
<q-card-section>
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="orange" text-color="white"
|
||||
icon="schedule">
|
||||
Modello Email da Inviare: <span class="mlvalue">{{ newsstate.nextnewstosent.templemail_str }}</span>
|
||||
</q-chip>
|
||||
<br>
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="blue" text-color="white"
|
||||
icon="schedule">
|
||||
Data Schedulato: <span class="mlvalue">{{ tools.getstrDateTimeAll(newsstate.nextnewstosent.datetoSent) }}</span>
|
||||
</q-chip>
|
||||
<br>
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="blue" text-color="white"
|
||||
icon="schedule">
|
||||
Inizio Invio: <span class="mlvalue">{{ tools.getstrDateTimeAll(newsstate.nextnewstosent.datestartJob) }}</span>
|
||||
</q-chip>
|
||||
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="blue" text-color="white"
|
||||
icon="schedule">
|
||||
Fine Invio: <span class="mlvalue">{{ tools.getstrDateTimeAll(newsstate.nextnewstosent.datefinishJob) }}</span>
|
||||
</q-chip>
|
||||
<br>
|
||||
<div v-if="newsstate.nextnewstosent.starting_job && !newsstate.nextnewstosent.finish_job">
|
||||
<q-chip
|
||||
dense class="shadow-5 q-mb-md" color="orange" text-color="white"
|
||||
icon="email">
|
||||
<span class="mlvalue">Invio Newsletter in Corso...</span>
|
||||
</q-chip>
|
||||
<br>
|
||||
</div>
|
||||
<div>
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="blue" text-color="white"
|
||||
icon="schedule">
|
||||
Ultima Email inviata: <span class="mlvalue">{{ tools.getstrTimeAll(newsstate.nextnewstosent.lastemailsent_Job) }}</span>
|
||||
</q-chip>
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="blue" text-color="white"
|
||||
icon="email">
|
||||
Inviate: <span class="mlvalue">{{ newsstate.nextnewstosent.numemail_sent }} / {{ newsstate.nextnewstosent.numemail_tot }}</span>
|
||||
</q-chip>
|
||||
<q-circular-progress
|
||||
show-value font-size="12px" :value="percsent(true)"
|
||||
size="60px" :thickness="0.22" color="green"
|
||||
track-color="grey-3"
|
||||
class="q-ma-md"
|
||||
>
|
||||
<span class="mlvalue"> {{ percsent(true) }} % </span>
|
||||
</q-circular-progress>
|
||||
<div class="text-center">
|
||||
<q-slider
|
||||
v-model="newsstate.nextnewstosent.numemail_sent"
|
||||
:min="0"
|
||||
readonly
|
||||
:max="newsstate.nextnewstosent.numemail_tot"
|
||||
:step="1"
|
||||
label
|
||||
label-always
|
||||
color="light-green"></q-slider>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-if="newsstate.nextnewstosent.finish_job">
|
||||
<br>
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="green"
|
||||
text-color="white" icon="email">
|
||||
<span class="mlvalue">Invio Newsletter Completato</span>
|
||||
</q-chip>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-inner-loading id="spinner3" :showing="myloadingload">
|
||||
<q-spinner-tail
|
||||
color="primary"
|
||||
size="4em">
|
||||
</q-spinner-tail>
|
||||
</q-inner-loading>
|
||||
</q-card>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div>
|
||||
Nessuna Newsletter attualmente è stata Schedulata
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="check">
|
||||
<div class="q-ma-md rounded-borders q-list--bordered">
|
||||
<div class="text-center">
|
||||
<CTitleBanner title="Ultima Newsletter Inviata:"></CTitleBanner>
|
||||
</div>
|
||||
|
||||
<div v-if="newsstate.lastnewstosent"
|
||||
class="q-ma-md q-pa-sm text-center rounded-borders q-list--bordered">
|
||||
<q-card class="bg-grey-3 relative-position card-example">
|
||||
<q-card-section>
|
||||
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="orange" text-color="white"
|
||||
icon="schedule">
|
||||
Modello Email: <span class="mlvalue">{{ newsstate.lastnewstosent.templemail_str }}</span>
|
||||
</q-chip>
|
||||
<div class="text-center">
|
||||
|
||||
</div>
|
||||
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="blue" text-color="white"
|
||||
icon="schedule">
|
||||
Data Schedulato: <span class="mlvalue">{{ tools.getstrDateTimeAll(newsstate.lastnewstosent.datetoSent) }}</span>
|
||||
</q-chip>
|
||||
<br>
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="blue" text-color="white"
|
||||
icon="schedule">
|
||||
Inizio Invio: <span class="mlvalue">{{ tools.getstrDateTimeAll(newsstate.lastnewstosent.datestartJob) }}</span>
|
||||
</q-chip>
|
||||
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="blue" text-color="white"
|
||||
icon="schedule">
|
||||
Fine Invio: <span class="mlvalue">{{ tools.getstrDateTimeAll(newsstate.lastnewstosent.datefinishJob) }}</span>
|
||||
</q-chip>
|
||||
<br>
|
||||
<div v-if="newsstate.lastnewstosent.activate && newsstate.lastnewstosent.starting_job && !newsstate.lastnewstosent.finish_job">
|
||||
<q-chip
|
||||
dense class="shadow-5 q-mb-md" color="orange" text-color="white"
|
||||
icon="email">
|
||||
<span class="mlvalue">Invio Newsletter in Corso...</span>
|
||||
</q-chip>
|
||||
<br>
|
||||
</div>
|
||||
<div v-if="!newsstate.lastnewstosent.activate">
|
||||
<q-chip
|
||||
dense class="shadow-5 q-mb-md" color="red" text-color="white"
|
||||
icon="email">
|
||||
<span class="mlvalue">L'invio della Newsletter è stato fermato dall'Utente.</span>
|
||||
</q-chip>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="blue" text-color="white"
|
||||
icon="schedule">
|
||||
Ultima Email inviata: <span class="mlvalue">{{ tools.getstrTimeAll(newsstate.lastnewstosent.lastemailsent_Job) }}</span>
|
||||
</q-chip>
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="blue" text-color="white"
|
||||
icon="email">
|
||||
Inviate: <span class="mlvalue">{{ newsstate.lastnewstosent.numemail_sent }} / {{ newsstate.lastnewstosent.numemail_tot }}</span>
|
||||
</q-chip>
|
||||
<q-circular-progress
|
||||
show-value font-size="12px" :value="percsent(false)"
|
||||
size="60px" :thickness="0.5" color="green"
|
||||
track-color="grey-3"
|
||||
class="q-ma-md"
|
||||
>
|
||||
<span class="mlvalue"> {{ percsent(false) }} % </span>
|
||||
</q-circular-progress>
|
||||
<div class="text-center">
|
||||
<q-slider
|
||||
v-model="newsstate.lastnewstosent.numemail_sent"
|
||||
:min="0"
|
||||
readonly
|
||||
:max="newsstate.lastnewstosent.numemail_tot"
|
||||
:step="1"
|
||||
label
|
||||
label-always
|
||||
color="light-green"></q-slider>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-if="newsstate.lastnewstosent.finish_job">
|
||||
<br>
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="green"
|
||||
text-color="white" icon="email">
|
||||
<span class="mlvalue">Invio Newsletter Completato</span>
|
||||
</q-chip>
|
||||
</div>
|
||||
|
||||
<div v-if="!newsstate.lastnewstosent.finish_job">
|
||||
<q-btn v-if="newsstate.lastnewstosent.activate" :loading="myloadingState"
|
||||
rounded outline
|
||||
@click="DisableNewsletter()" color="negative" icon="">
|
||||
Ferma l'Invio della Newsletter
|
||||
<template v-slot:loading>
|
||||
<q-spinner-hourglass class="on-left"/>
|
||||
Disattivazione Invio Newsletter ...
|
||||
</template>
|
||||
</q-btn>
|
||||
<q-btn v-if="!newsstate.lastnewstosent.activate" :loading="myloadingState"
|
||||
rounded outline
|
||||
@click="EnableNewsletter()" color="positive" icon="">
|
||||
Riattiva l'Invio della Newsletter
|
||||
<template v-slot:loading>
|
||||
<q-spinner-hourglass class="on-left"/>
|
||||
Riattivazione Invio Newsletter ...
|
||||
</template>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-inner-loading id="spinner2" :showing="myloading">
|
||||
<q-spinner-tail
|
||||
color="primary"
|
||||
size="4em">
|
||||
</q-spinner-tail>
|
||||
</q-inner-loading>
|
||||
</q-card>
|
||||
</div>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
|
||||
<q-tab-panel name="newslist">
|
||||
<CTitleBanner bgcolor="bg-accent" title="Lista Newsletter Inviate:"></CTitleBanner>
|
||||
|
||||
<CGridTableRec prop_mytitle="Newsletter"
|
||||
prop_mytable="newstosent"
|
||||
:prop_mycolumns="getcolnewstosent()"
|
||||
:prop_colkey="fieldsTable.getKeyByTable('newstosent')"
|
||||
nodataLabel="Nessuna Newsletter attualmente creata"
|
||||
noresultLabel="Il filtro selezionato non ha trovato nessun risultato"
|
||||
>
|
||||
|
||||
</CGridTableRec>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="mailinglist">
|
||||
<div class="q-ma-md rounded-borders q-list--bordered">
|
||||
<CTitleBanner title="Lista Contatti:" bgcolor="bg-positive"></CTitleBanner>
|
||||
|
||||
<div class="q-ma-md q-pa-sm text-center rounded-borders q-list--bordered">
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="blue" text-color="white" icon="email">
|
||||
Email Totali: <span class="mlvalue">{{ newsstate.totemail }}</span>
|
||||
</q-chip>
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="green" text-color="white"
|
||||
icon="event_available">
|
||||
Email Sottoscritte: <span class="mlvalue">{{ newsstate.totsubscribed }}</span>
|
||||
</q-chip>
|
||||
<q-circular-progress
|
||||
show-value font-size="12px" :value="percsubscribed * 100"
|
||||
size="60px" :thickness="0.22" color="green"
|
||||
track-color="grey-3"
|
||||
class="q-ma-md"
|
||||
>
|
||||
<span class="mlvalue"> {{ progresslabsubscribed() }} </span>
|
||||
</q-circular-progress>
|
||||
|
||||
<q-chip dense class="shadow-5 q-mb-md" color="orange" text-color="white"
|
||||
icon="">
|
||||
Email Desottoscritte: <span class="mlvalue">{{ newsstate.totunsubscribed }}</span>
|
||||
</q-chip>
|
||||
</div>
|
||||
|
||||
<CGridTableRec prop_mytitle="Lista Contatti"
|
||||
:prop_mytable="toolsext.TABMAILINGLIST"
|
||||
:prop_mycolumns="getcolmailinglist()"
|
||||
:prop_colkey="fieldsTable.getKeyByTable('mailinglist')"
|
||||
nodataLabel="Nessuna Lista Contatti attualmente creata"
|
||||
noresultLabel="Il filtro selezionato non ha trovato nessun risultato"
|
||||
>
|
||||
|
||||
</CGridTableRec>
|
||||
|
||||
<CTitleBanner title="Importa lista di Email:"></CTitleBanner>
|
||||
<div class="q-ma-md q-pa-sm text-center rounded-borders q-list--bordered">
|
||||
|
||||
<q-input v-model="mailinglist_imported"
|
||||
autofocus
|
||||
filled
|
||||
bordered
|
||||
color="blue-12"
|
||||
@keyup.enter.stop
|
||||
type="textarea"
|
||||
>
|
||||
</q-input>
|
||||
<div class="q-ma-md q-pa-sm text-center">
|
||||
<q-btn :loading="myloadingImport" rounded outline :disable="mailinglist_imported === ''"
|
||||
@click="importMailinglist()" color="primary" icon="email">
|
||||
Importa
|
||||
<template v-slot:loading>
|
||||
<q-spinner-hourglass class="on-left"/>
|
||||
Importazione Email in corso ...
|
||||
</template>
|
||||
</q-btn>
|
||||
</div>
|
||||
|
||||
<transition
|
||||
enter-active-class="animated fadeIn"
|
||||
leave-active-class="animated fadeOut"
|
||||
appear
|
||||
|
||||
>
|
||||
<div>
|
||||
<CTitleBanner v-if="errimport" bgcolor="bg-warning" :title="myrisimport"></CTitleBanner>
|
||||
<CTitleBanner v-if="okimport" :title="myrisimport"></CTitleBanner>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
|
||||
</q-tab-panels>
|
||||
|
||||
</q-card>
|
||||
</CMyPage>
|
||||
|
||||
</template>
|
||||
<script lang="ts" src="./newsletter.ts">
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import './newsletter.scss';
|
||||
</style>
|
||||
@@ -47,6 +47,7 @@ export const costanti = {
|
||||
multioption: 6000,
|
||||
onlydate: 7000,
|
||||
hours: 8000,
|
||||
crypted: 9000,
|
||||
},
|
||||
FieldTypeArr: [
|
||||
{ label: 'Boolean', value: 1 },
|
||||
|
||||
@@ -789,6 +789,7 @@ export const fields = {
|
||||
AddCol({ name: 'value_num', label_trans: 'cal.num', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'value_bool', label_trans: 'cal.bool', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'serv', label_trans: 'cal.serv', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'crypted', label_trans: 'cal.crypted', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
],
|
||||
|
||||
@@ -175,6 +175,10 @@ export const useUserStore = defineStore('UserStore', {
|
||||
return ''
|
||||
},
|
||||
|
||||
isUserOk(): boolean {
|
||||
return this.my.verified_email! && this.my.profile.teleg_id! > 0
|
||||
},
|
||||
|
||||
getNameSurnameByUserId(userId: string): string {
|
||||
|
||||
const user = this.getUserByUserId(userId)
|
||||
|
||||
@@ -281,10 +281,12 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
if ((myrec.type === costanti.FieldType.date) || (myrec.type === costanti.FieldType.onlydate)) return myrec.value_date
|
||||
if ((myrec.type === costanti.FieldType.number) || (myrec.type === costanti.FieldType.hours)) return myrec.value_num
|
||||
if (myrec.type === costanti.FieldType.boolean) return myrec.value_bool
|
||||
if (myrec.value_str === undefined) {
|
||||
else if (myrec.type === costanti.FieldType.crypted)
|
||||
return '***********'
|
||||
else if (myrec.value_str === undefined) {
|
||||
return ''
|
||||
} else {
|
||||
myrec.value_str
|
||||
return myrec.value_str
|
||||
}
|
||||
}
|
||||
return ''
|
||||
@@ -1200,6 +1202,20 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async sendEmailTest({ previewonly}:{previewonly: any}) {
|
||||
const usertosend = {
|
||||
locale: tools.getLocale(),
|
||||
previewonly
|
||||
}
|
||||
console.log(usertosend)
|
||||
|
||||
return Api.SendReq('/news/testemail', 'POST', usertosend)
|
||||
.then((res) => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
getArrStrByValueBinary(col: IColGridTable, val: any) {
|
||||
const arr = this.getArrByValueBinary(null, col, val)
|
||||
if (arr.length > 0) return arr.join(' - ')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<q-page padding class="signup">
|
||||
<CSignUp :showcell="false">
|
||||
<CSignUp :showcell="true">
|
||||
|
||||
</CSignUp>
|
||||
</q-page>
|
||||
|
||||
12
src/views/user/test/test.scss
Executable file
12
src/views/user/test/test.scss
Executable file
@@ -0,0 +1,12 @@
|
||||
.profile {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
.myrow{
|
||||
display: flex;
|
||||
@media (max-width: 600px) {
|
||||
flex-flow: column;
|
||||
}
|
||||
}
|
||||
93
src/views/user/test/test.ts
Executable file
93
src/views/user/test/test.ts
Executable file
@@ -0,0 +1,93 @@
|
||||
import { CMyFieldDb } from '@/components/CMyFieldDb'
|
||||
import { CTitleBanner } from '@/components/CTitleBanner'
|
||||
import { CProfile } from '@/components/CProfile'
|
||||
import { CSkill } from '@/components/CSkill'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { defineComponent, onMounted, ref } from 'vue'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { costanti } from '@costanti'
|
||||
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ProfileMy',
|
||||
components: { CProfile, CTitleBanner, CMyFieldDb, CSkill },
|
||||
props: {},
|
||||
setup() {
|
||||
const userStore = useUserStore()
|
||||
const $router = useRouter()
|
||||
const globalStore = useGlobalStore()
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n();
|
||||
|
||||
const filtroutente = ref(<any[]>[])
|
||||
|
||||
function getpayment() {
|
||||
return userStore.my.profile.paymenttypes
|
||||
}
|
||||
|
||||
function profile() {
|
||||
return userStore.my.profile
|
||||
}
|
||||
|
||||
function eliminaAccount() {
|
||||
|
||||
$q.dialog({
|
||||
message: t('reg.cancellami', { sitename: t('ws.sitename') }),
|
||||
cancel: {
|
||||
label: t('dialog.cancel')
|
||||
},
|
||||
ok: {
|
||||
label: t('dialog.yes'),
|
||||
push: true
|
||||
},
|
||||
title: t('pages.profile')
|
||||
}).onOk(() => {
|
||||
$q.dialog({
|
||||
message: t('reg.cancellami_2', { sitename: t('ws.sitename') }),
|
||||
cancel: {
|
||||
label: t('dialog.cancel')
|
||||
},
|
||||
ok: {
|
||||
label: t('dialog.yes'),
|
||||
push: true
|
||||
},
|
||||
title: t('pages.profile')
|
||||
})
|
||||
.onOk(() => {
|
||||
globalStore.DeleteRec({ table: toolsext.TABUSER, id: userStore.my._id })
|
||||
.then((ris: any) => {
|
||||
if (ris) {
|
||||
tools.showPositiveNotif($q, t('reg.account_cancellato'))
|
||||
userStore.logout()
|
||||
$router.replace('/')
|
||||
} else
|
||||
tools.showNegativeNotif($q, t('db.recfailed'))
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function mounted() {
|
||||
filtroutente.value = [
|
||||
{ userId: userStore.my._id}
|
||||
]
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
eliminaAccount,
|
||||
profile,
|
||||
getpayment,
|
||||
tools,
|
||||
costanti,
|
||||
filtroutente,
|
||||
}
|
||||
}
|
||||
})
|
||||
14
src/views/user/test/test.vue
Executable file
14
src/views/user/test/test.vue
Executable file
@@ -0,0 +1,14 @@
|
||||
<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
|
||||
<div class="q-gutter-sm q-pa-xs q-pb-md">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./test.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './test.scss';
|
||||
</style>
|
||||
Reference in New Issue
Block a user