- 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

@@ -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',