- Profile

- Bot Telegram
- fixed Chip multiselect
This commit is contained in:
Paolo Arena
2020-01-03 01:53:19 +01:00
parent 4a20dca54a
commit 7b64358016
18 changed files with 206 additions and 84 deletions

View File

@@ -17,6 +17,6 @@ export class Patterns {
*
* 8 to 20 characters string with at least one digit, one upper case letter, one lower case letter and one special symbol
*/
public static Password: RegExp = /^((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20})/i
public static Password: RegExp = /^((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,30})/i
}

View File

@@ -45,6 +45,7 @@ export default class CDateTime extends Vue {
this.valueDate = new Date()
this.myvalue = tools.getstrYYMMDDDateTime(this.valueDate)
}
// console.log('Opening', this.valueDate, this.myvalue)
this.$emit('show')
}

View File

@@ -142,9 +142,9 @@ export default class CGridTableRec extends Vue {
if (this.colsel.subfield !== '') {
if (mydata.fieldsvalue[this.colsel.field] === undefined) {
mydata.fieldsvalue[this.colsel.field] = {}
mydata.fieldsvalue[this.colsel.field + '.' + this.colsel.subfield] = newVal
}
mydata.fieldsvalue[this.colsel.field][this.colsel.subfield] = newVal
// mydata.fieldsvalue[this.colsel.field][this.colsel.subfield] = newVal
} else {
mydata.fieldsvalue[this.colsel.field] = newVal
}

View File

@@ -1,5 +1,6 @@
.clchip{
display: flex;
justify-content: center;
//flex: 1;
//flex-direction: column;
}

View File

@@ -35,52 +35,84 @@ export default class CMyChipList extends Vue {
this.myarrvalues = []
// console.table(this.options)
this.options.forEach((rec, index) => {
if (this.type === tools.FieldType.multiselect) {
if (this.value.includes(rec[this.optval])) {
const mydata = {
label: null,
value: rec[this.optval],
// myris = mylist.filter((myrec) => arrval.includes(myrec[key]))
valbool: true,
icon: '',
color: tools.getColorByIndexBest(index)
if (this.options) {
this.options.forEach((rec, index) => {
if (this.type === tools.FieldType.multiselect) {
if (!!this.value) {
if (this.value.includes(rec[this.optval])) {
const mydata = {
label: null,
value: rec[this.optval],
// myris = mylist.filter((myrec) => arrval.includes(myrec[key]))
valbool: true,
icon: '',
color: tools.getColorByIndexBest(index)
}
if (tools.isObject(this.optlab)) {
mydata.label = this.options.filter((myrec) => myrec[this.optval] === mydata.value).map(this.optlab)
if (mydata.label)
mydata.label = mydata.label[0]
} else {
mydata.label = rec[this.optlab]
}
if (this.opticon)
mydata.icon = rec[this.opticon]
if (this.optcolor)
mydata.color = rec[this.optcolor]
this.myarrvalues.push(mydata)
}
}
} else if (this.type === tools.FieldType.select) {
if (this.value === rec[this.optval]) {
const mydata = {
label: null,
value: this.value,
valbool: true,
icon: '',
color: tools.getColorByIndexBest(index)
}
// console.log('mydata', mydata, 'optlab', this.optlab, 'value', this.value)
if (tools.isObject(this.optlab)) {
mydata.label = this.options.filter((myrec) => myrec[this.optval] === mydata.value).map(this.optlab)
if (mydata.label)
mydata.label = mydata.label[0]
} else {
mydata.label = rec[this.optlab]
}
if (this.opticon)
mydata.icon = rec[this.opticon]
if (this.optcolor)
mydata.color = rec[this.optcolor]
this.myarrvalues.push(mydata)
}
if (tools.isObject(this.optlab)) {
mydata.label = this.options.filter((myrec) => myrec[this.optval] === mydata.value).map(this.optlab)
if (mydata.label)
mydata.label = mydata.label[0]
} else {
mydata.label = rec[this.optlab]
} else {
if (tools.isBitActive(this.value, rec[this.optval])) {
const mydata = {
label: this.$t(rec[this.optlab]),
value: rec[this.optval],
valbool: tools.isBitActive(this.value, rec[this.optval]),
icon: '',
color: tools.getColorByIndexBest(index)
}
if (this.opticon)
mydata.icon = rec[this.opticon]
if (this.optcolor)
mydata.color = rec[this.optcolor]
this.myarrvalues.push(mydata)
}
if (this.opticon)
mydata.icon = rec[this.opticon]
if (this.optcolor)
mydata.color = rec[this.optcolor]
this.myarrvalues.push(mydata)
}
} else {
if (tools.isBitActive(this.value, rec[this.optval])) {
const mydata = {
label: this.$t(rec[this.optlab]),
value: rec[this.optval],
valbool: tools.isBitActive(this.value, rec[this.optval]),
icon: '',
color: tools.getColorByIndexBest(index)
}
if (this.opticon)
mydata.icon = rec[this.opticon]
if (this.optcolor)
mydata.color = rec[this.optcolor]
this.myarrvalues.push(mydata)
}
}
})
})
}
if (this.myarrvalues.length === 0)
this.myarrvalues.push({ label: this.$t('otherpages.manage.nessuno'), color: 'gray' })

View File

@@ -10,10 +10,11 @@ import { fieldsTable } from '../../store/Modules/fieldsTable'
import { IColGridTable } from '../../model'
import { CMySelect } from '../CMySelect'
import { GlobalStore, UserStore } from '../../store/Modules'
import { CMyChipList } from '../CMyChipList'
@Component({
name: 'CMyFieldDb',
components: { CMyEditor, CMySelect }
components: { CMyEditor, CMySelect, CMyChipList }
})
export default class CMyFieldDb extends MixinBase {

View File

@@ -31,7 +31,7 @@
:opticon="db_fieldsTable.getIconByTable(col.jointable)"></CMyChipList>
</div>
<!-- Show Value -->
<div v-else-if="col.fieldtype === tools.FieldType.nationality">
<div v-else-if="type === tools.FieldType.nationality">
<q-input
input-class="cursor-pointer text-center"
:readonly="true"
@@ -54,9 +54,9 @@
</q-input>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.intcode">
<div v-else-if="type === tools.FieldType.intcode">
{{ myvalue }}
{{ myvalprinted }}
</div>
<div v-else-if="type === tools.FieldType.multiselect">
@@ -68,6 +68,16 @@
:optlab="db_fieldsTable.getLabelByTable(col.jointable)"
:opticon="db_fieldsTable.getIconByTable(col.jointable)"></CMyChipList>
</div>
<div v-else-if="type === tools.FieldType.select">
<CMyChipList
myclass="text-center"
:type="tools.FieldType.select"
:value="myvalue"
:options="db_fieldsTable.getTableJoinByName(col.jointable)"
:optval="db_fieldsTable.getKeyByTable(col.jointable)"
:optlab="db_fieldsTable.getLabelByTable(col.jointable)"
:opticon="db_fieldsTable.getIconByTable(col.jointable)"></CMyChipList>
</div>
<div v-else-if="type === tools.FieldType.html">
<div v-html="myvalprinted">
@@ -186,7 +196,7 @@
</div>
</div>
<div v-else-if="type === tools.FieldType.multiselect">
<div v-else-if="col.fieldtype === tools.FieldType.multiselect">
<q-select
v-model="myvalue"
rounded

View File

@@ -72,7 +72,7 @@ export default class CMyPopupEdit extends Vue {
public SaveValueInt(newVal, valinitial) {
// console.log('SaveValueInt', newVal)
console.log('SaveValueInt', newVal, valinitial)
// Update value in table memory
if (this.subfield !== '') {

View File

@@ -58,6 +58,16 @@
:optlab="db_fieldsTable.getLabelByTable(col.jointable)"
:opticon="db_fieldsTable.getIconByTable(col.jointable)"></CMyChipList>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.select">
<CMyChipList
myclass="text-center"
:type="tools.FieldType.select"
:value="myvalue"
:options="db_fieldsTable.getTableJoinByName(col.jointable)"
:optval="db_fieldsTable.getKeyByTable(col.jointable)"
:optlab="db_fieldsTable.getLabelByTable(col.jointable)"
:opticon="db_fieldsTable.getIconByTable(col.jointable)"></CMyChipList>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.boolean">
<q-toggle dark color="green" v-model="myvalue" :label="col.title"
@input="Savedb"></q-toggle>
@@ -174,6 +184,8 @@
</div>
<div v-else-if="col.fieldtype === tools.FieldType.multiselect">
<div>join: {{col.jointable}}</div>
<q-select
v-model="myvalue"
rounded

View File

@@ -126,7 +126,7 @@ export default class CSignUp extends MixinBase {
public errorMsg(cosa: string, item: any) {
try {
if (!item.$error) { return '' }
console.log('errorMsg', cosa, item)
// console.log('errorMsg', cosa, item)
if (item.$params.email && !item.email) { return this.$t('reg.err.email') }
if (cosa === 'repeatpassword') {
@@ -135,7 +135,7 @@ export default class CSignUp extends MixinBase {
}
}
console.log('item', item)
// console.log('item', item)
if (item.minLength !== undefined) {
if (!item.minLength) {
@@ -155,7 +155,7 @@ export default class CSignUp extends MixinBase {
}
}
console.log(' ....avanti')
// console.log(' ....avanti')
if (cosa === 'email') {
// console.log("EMAIL " + item.isUnique);
// console.log(item);
@@ -166,7 +166,7 @@ export default class CSignUp extends MixinBase {
} else if (cosa === 'aportador_solidario') {
// console.log(item);
if (!item.aportadorexist) {
console.log('!item.aportadorexist !')
// console.log('!item.aportadorexist !')
return this.$t('reg.err.aportador_not_exist')
}
} else if ((cosa === 'name') || (cosa === 'surname')) {

View File

@@ -18,7 +18,7 @@
@blur="$v.signup.aportador_solidario.$touch"
:error="$v.signup.aportador_solidario.$error"
:error-message="errorMsg('aportador_solidario', $v.signup.aportador_solidario)"
maxlength="20"
debounce="1000"
:label="$t('reg.aportador_solidario')">
@@ -35,7 +35,7 @@
@blur="$v.signup.email.$touch"
:error="$v.signup.email.$error"
:error-message="errorMsg('email', $v.signup.email)"
maxlength="50"
debounce="1000"
:label="$t('reg.email')">
@@ -51,7 +51,7 @@
@blur="$v.signup.username.$touch"
:error="$v.signup.username.$error"
@keydown.space="(event) => event.preventDefault()"
maxlength="20"
debounce="1000"
:error-message="errorMsg('username', $v.signup.username)"
:label="$t('reg.username')">
@@ -67,7 +67,7 @@
rounded outlined
@blur="$v.signup.name.$touch"
:error="$v.signup.name.$error"
maxlength="30"
debounce="1000"
:error-message="errorMsg('name', $v.signup.name)"
:label="$t('reg.name')">
@@ -83,7 +83,7 @@
rounded outlined
@blur="$v.signup.surname.$touch"
:error="$v.signup.surname.$error"
maxlength="30"
debounce="1000"
:error-message="errorMsg('surname', $v.signup.surname)"
:label="$t('reg.surname')">
@@ -101,7 +101,7 @@
@blur="$v.signup.password.$touch"
:error="$v.signup.password.$error"
:error-message="`${errorMsg('password', $v.signup.password)}`"
maxlength="30"
:label="$t('reg.password')">
<template v-slot:prepend>
@@ -113,6 +113,7 @@
<q-input
v-model="signup.repeatPassword"
type="password"
maxlength="30"
rounded outlined
@blur="$v.signup.repeatPassword.$touch"
:error="$v.signup.repeatPassword.$error"
@@ -155,6 +156,7 @@
@country-changed="intcode_change"
v-model="signup.profile.cell"
:placeholder="$t('reg.cell')"
maxlength="20"
:enabledCountryCode="true"
inputClasses="clCell"
wrapperClasses="clCellCode">

View File

@@ -58,7 +58,7 @@ export default class MixinBase extends MixinMetaTags {
public async setValDb(key, value, type, serv: boolean, table?, subkey?) {
console.log('setValDb', key, value, serv, table, subkey)
// console.log('setValDb', key, value, serv, table, subkey)
let mydatatosave = null
if (table === 'users') {
const myid = UserStore.state.my._id
@@ -78,7 +78,7 @@ export default class MixinBase extends MixinMetaTags {
myfield[key] = value
}
console.log('myfield', myfield)
// console.log('myfield', myfield)
mydatatosave = {
id: myid,
@@ -118,7 +118,7 @@ export default class MixinBase extends MixinMetaTags {
return recsett.find((rec) => rec.key === key)
})
}
console.log('myrec', myrec)
// console.log('myrec', myrec)
mydatatosave = {
id: myrec._id,
@@ -127,7 +127,7 @@ export default class MixinBase extends MixinMetaTags {
}
}
console.log('mydatatosave', mydatatosave)
// console.log('mydatatosave', mydatatosave)
GlobalStore.actions.saveFieldValue(mydatatosave).then((esito) => {
if (esito) {

View File

@@ -1,6 +1,7 @@
import { IAction } from '@src/model/Projects'
import { Component } from 'vue-router/types/router'
import { lists } from '@src/store/Modules/lists'
import { IPaymentType } from '@src/model/UserStore'
export interface IPost {
title: string
@@ -149,6 +150,7 @@ export interface IGlobalState {
serv_settings: ISettings[],
settings: ISettings[],
disciplines: IDiscipline[],
paymenttypes: IPaymentType[],
newstosent: INewsToSent[],
gallery: IGallery[],
mypage: IMyPage[],

View File

@@ -17,6 +17,14 @@ export interface IUserProfile {
country_pay?: string
email_paypal?: string
username_telegram?: string
teleg_id?: number
teleg_checkcode?: number
paymenttypes?: IPaymentType[]
}
export interface IPaymentType {
key: string
label: string
}
export interface IUserFields {

View File

@@ -113,7 +113,7 @@ const msgglobal = {
aportador_solidario: 'Chi ti ha Invitato',
reflink: 'Link da condividere ai tuoi amici:',
page_title: 'Registrazione',
made_gift: 'Doné',
made_gift: 'Dono',
incorso: 'Registrazione in corso...',
richiesto: 'Campo Richiesto',
email: 'Email',
@@ -123,10 +123,12 @@ const msgglobal = {
email_paypal: 'Email Paypal',
country_pay: 'Paese di Destinazione Pagamenti',
username_telegram: 'Username Telegram',
teleg_id: 'Telegram ID',
paymenttype: 'Modalità di Pagamenti Disponbili',
img: 'Immagine',
date_reg: 'Data Reg.',
perm: 'Permessi',
username: 'Username',
username: 'Username (Pseudonimo)',
name: 'Nome',
surname: 'Cognome',
username_login: 'Nome Utente o email',
@@ -502,10 +504,12 @@ const msgglobal = {
email_paypal: 'Email Paypal',
country_pay: 'País del Pagos de destino',
username_telegram: 'Usuario Telegram',
teleg_id: 'Telegram ID',
paymenttype: 'Métodos de pago disponibles',
img: 'File image',
date_reg: 'Fecha Reg.',
perm: 'Permisos',
username: 'Username',
username: 'Username (Apodo)',
name: 'Nombre',
surname: 'Apellido',
username_login: 'Nombre usuario o email',
@@ -862,6 +866,7 @@ const msgglobal = {
aportador_solidario: 'Contributeur de solidarité',
reflink: 'Liens à partager avec vos amis:',
incorso: 'Inscription en cours...',
made_gift: 'Doné',
richiesto: 'Champ obligatoire',
email: 'Email',
intcode_cell: 'Préfixe int.',
@@ -870,10 +875,12 @@ const msgglobal = {
email_paypal: 'Email Paypal',
country_pay: 'Pays de destination Paiements',
username_telegram: 'Nom d\'utilisateur du Telegram',
teleg_id: 'Telegram ID',
paymenttype: 'Méthodes de paiement disponibles',
img: 'Fichier image',
date_reg: 'Date Inscript.',
perm: 'Autorisations',
username: 'Nom d\'utilisateur',
username: 'Username (Surnom)',
name: 'Nom',
surname: 'Prénom',
username_login: 'Nom d\'utilisateur ou email',
@@ -1239,11 +1246,13 @@ const msgglobal = {
email_paypal: 'Email Paypal',
country_pay: 'Country of Destination Payments',
username_telegram: 'Username Telegram',
teleg_id: 'Telegram ID',
paymenttype: 'Available Payment Methods',
img: 'File Image',
date_reg: 'Reg. Date',
perm: 'Permissions',
username_login: 'Username or email',
username: 'Username',
username: 'Username (Pseudonym)',
name: 'Name',
surname: 'Surname',
password: 'Password',
@@ -1608,11 +1617,13 @@ const msgglobal = {
email_paypal: 'Email Paypal',
country_pay: 'Country of Destination Payments',
username_telegram: 'Username Telegram',
teleg_id: 'Telegram ID',
paymenttype: 'Available Payment Methods',
img: 'File Image',
date_reg: 'Reg. Date',
perm: 'Permissions',
username_login: 'Username or email',
username: 'Username',
username: 'Username (Pseudonym)',
name: 'Name',
surname: 'Surname',
password: 'Password',

View File

@@ -74,6 +74,7 @@ const state: IGlobalState = {
opzemail: [],
settings: [],
disciplines: [],
paymenttypes: [],
autoplaydisc: 8000,
newstosent: [],
gallery: [],
@@ -193,6 +194,8 @@ namespace Getters {
return GlobalStore.state.mailinglist
else if (table === tools.TABMYPAGE)
return GlobalStore.state.mypage
else if (table === 'paymenttypes')
return GlobalStore.state.paymenttypes
else if (table === 'bookings')
return CalendarStore.state.bookedevent
else if (table === 'users')
@@ -391,7 +394,7 @@ namespace Mutations {
// console.log('myrec', myrec)
if (myrec) {
for (const [key, value] of Object.entries(mydata.fieldsvalue)) {
console.log('key', value, myrec[key])
// console.log('key', value, myrec[key])
myrec[key] = value
}
}
@@ -792,6 +795,7 @@ namespace Actions {
CalendarStore.state.contribtype = (res.data.contribtype) ? res.data.contribtype : []
GlobalStore.state.settings = (res.data.settings) ? [...res.data.settings] : []
GlobalStore.state.disciplines = (res.data.disciplines) ? [...res.data.disciplines] : []
GlobalStore.state.paymenttypes = (res.data.paymenttypes) ? [...res.data.paymenttypes] : []
GlobalStore.state.gallery = (res.data.gallery) ? [...res.data.gallery] : []
if (showall) {

View File

@@ -33,7 +33,7 @@ export const DefaultUser: IUserFields = {
profile: {
img: ''
},
downline: []
downline: [],
}
export const DefaultProfile: IUserProfile = {
@@ -45,7 +45,10 @@ export const DefaultProfile: IUserProfile = {
sex: 0,
country_pay: '',
email_paypal: '',
username_telegram: ''
username_telegram: '',
teleg_id: 0,
teleg_checkcode: 0,
paymenttypes: []
}
// State
@@ -157,6 +160,12 @@ namespace Getters {
return mystate.usersList.find((item) => item.username === username)
}, 'getUserByUsername')
const getPaymenttypeById = b.read((mystate: IUserState) => (id) => {
const ctrec = mystate.my.profile.paymenttypes.find((mycontr) => mycontr.key === id)
return (ctrec) ? ctrec.label : ''
}, 'getPaymenttypeById')
const getImgByUsername = b.read((mystate: IUserState) => (username): string => {
if (username === '')
return ''
@@ -219,6 +228,9 @@ namespace Getters {
get getRefLink() {
return getRefLink()
},
get getPaymenttypeById() {
return getPaymenttypeById()
},
}
}
@@ -554,7 +566,7 @@ namespace Actions {
const newuser = res.data
console.log('newuser', newuser)
// console.log('newuser', newuser)
Mutations.mutations.setServerCode(res.status)

View File

@@ -151,6 +151,12 @@ const colcontribtype = [
AddCol(DeleteRec)
]
const colpaymenttype = [
AddCol({ name: 'key', label_trans: 'reg.key' }),
AddCol({ name: 'label', label_trans: 'proj.longdescr' }),
AddCol(DeleteRec)
]
const coldisciplines = [
AddCol({ name: 'typol_code', label_trans: 'disc.typol_code' }),
AddCol({ name: 'order', label_trans: 'disc.order', fieldtype: tools.FieldType.number }),
@@ -289,29 +295,37 @@ export const fieldsTable = {
const collab = this.getLabelByTable(col.jointable)
// console.table(mylist)
// console.log('key=', key, 'collab', collab, 'val', val)
let risultato = ''
const myris = mylist.find((myrec) => myrec[key] === val)
// console.log('myris', myris)
if (myris) {
return myris[collab]
if (tools.isObject(collab)) {
risultato = mylist.filter((myrec) => myrec.username === val).map(collab)
} else {
return ''
const myris = mylist.find((myrec) => myrec[key] === val)
risultato = myris[collab]
}
if (key === 'username') {
console.log('key=', key, 'collab', collab, 'val', val)
console.log('myris', risultato)
}
return risultato
} else {
return ''
}
},
getMultiValueByTable(col: IColGridTable, arrval) {
// console.log('getMultiValueByTable')
if (col.jointable) {
const mylist = this.getTableJoinByName(col.jointable)
const key = this.getKeyByTable(col.jointable)
const collab = this.getLabelByTable(col.jointable)
// console.table(mylist)
// console.log('key=', key, 'collab', collab, 'val', val)
// console.log('key=', key, 'collab', collab, 'val', collab)
const myris = mylist.filter((myrec) => arrval.includes(myrec[key]))
// console.log('myris', myris)
@@ -363,7 +377,10 @@ export const fieldsTable = {
},
getTitleByTable(mytable): string {
const myrec = this.getrecTableList(mytable)
return myrec.label
if (!!myrec)
return myrec.label
else
return ''
},
getIconByTable(mytable): string {
const myrec = this.getrecTableList(mytable)
@@ -387,7 +404,9 @@ export const fieldsTable = {
AddCol({ name: 'profile.cell', field: 'profile', subfield: 'cell', label_trans: 'reg.cell', fieldtype: tools.FieldType.intcode }),
AddCol({ name: 'profile.email_paypal', field: 'profile', subfield: 'email_paypal', label_trans: 'reg.email_paypal' }),
AddCol({ name: 'profile.country_pay', field: 'profile', subfield: 'country_pay', label_trans: 'reg.country_pay', fieldtype: tools.FieldType.nationality }),
AddCol({ name: 'profile.username_telegram', field: 'profile', subfield: 'username_telegram', label_trans: 'reg.username_telegram' }),
AddCol({ name: 'profile.teleg_id', field: 'profile', subfield: 'teleg_id', label_trans: 'reg.teleg_id' }),
AddCol({ name: 'profile.teleg_checkcode', field: 'profile', subfield: 'teleg_checkcode', label_trans: 'reg.teleg_checkcode' }),
AddCol({ name: 'profile.paymenttypes', field: 'profile', subfield: 'paymenttypes', label_trans: 'reg.paymenttype', fieldtype: tools.FieldType.multiselect, jointable: 'paymenttypes' }),
AddCol({ name: 'profile.img', field: 'profile', subfield: 'img', label_trans: 'reg.img', sortable: false }),
AddCol({ name: 'date_reg', label_trans: 'reg.date_reg', fieldtype: tools.FieldType.date }),
// AddCol({ name: 'idapp', label_trans: 'reg.idapp', fieldtype: tools.FieldType.string }),
@@ -425,6 +444,13 @@ export const fieldsTable = {
colkey: '_id',
collabel: 'label'
},
{
value: 'paymenttypes',
label: 'Tipi di Pagamenti',
columns: colpaymenttype,
colkey: '_id',
collabel: 'label'
},
{
value: 'disciplines',
label: 'Discipline',