- DashBoard, Profile, Order Menu
This commit is contained in:
@@ -837,6 +837,7 @@ namespace Actions {
|
||||
if (page.active) {
|
||||
arrpagesroute.push({
|
||||
active: true,
|
||||
order: page.order,
|
||||
path: '/' + page.path,
|
||||
name: undefined,
|
||||
text: page.title,
|
||||
@@ -852,6 +853,7 @@ namespace Actions {
|
||||
|
||||
const last = {
|
||||
active: true,
|
||||
order: 10000,
|
||||
path: '*',
|
||||
materialIcon: 'fas fa-calendar-plus',
|
||||
name: 'otherpages.error404def',
|
||||
@@ -860,7 +862,10 @@ namespace Actions {
|
||||
infooter: false
|
||||
}
|
||||
|
||||
static_data.routes = [...static_data.routes, ...arrpagesroute, last]
|
||||
static_data.routes = [...static_data.baseroutes, ...arrpagesroute, last]
|
||||
|
||||
// Sort array
|
||||
static_data.routes = static_data.routes.sort((a, b) => a.order - b.order)
|
||||
|
||||
router.addRoutes([...arrpagesroute, last])
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import { shared_consts } from '../../common/shared_vuejs'
|
||||
|
||||
const bcrypt = require('bcryptjs')
|
||||
|
||||
const DefaultUser: IUserFields = {
|
||||
export const DefaultUser: IUserFields = {
|
||||
_id: '',
|
||||
email: '',
|
||||
username: '',
|
||||
@@ -29,9 +29,11 @@ const DefaultUser: IUserFields = {
|
||||
password: '',
|
||||
tokens: [],
|
||||
verified_email: false,
|
||||
made_gift: false,
|
||||
profile: {
|
||||
img: ''
|
||||
}
|
||||
},
|
||||
downline: []
|
||||
}
|
||||
|
||||
export const DefaultProfile: IUserProfile = {
|
||||
@@ -41,6 +43,7 @@ export const DefaultProfile: IUserProfile = {
|
||||
cell: '',
|
||||
dateofbirth: new Date(),
|
||||
sex: 0,
|
||||
country_pay: '',
|
||||
email_paypal: '',
|
||||
username_telegram: ''
|
||||
}
|
||||
@@ -166,6 +169,12 @@ namespace Getters {
|
||||
return ''
|
||||
}
|
||||
}, 'getImgByUsername')
|
||||
const getRefLink = b.read((mystate: IUserState) => (): string => {
|
||||
// console.log('myrec', myrec)
|
||||
|
||||
return tools.getUrlSite() + '/signup/' + mystate.my.username
|
||||
|
||||
}, 'getRefLink')
|
||||
|
||||
export const getters = {
|
||||
get isUserInvalid() {
|
||||
@@ -207,6 +216,9 @@ namespace Getters {
|
||||
get getUsersList() {
|
||||
return getUsersList()
|
||||
},
|
||||
get getRefLink() {
|
||||
return getRefLink()
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
@@ -263,6 +275,7 @@ namespace Mutations {
|
||||
localStorage.setItem(tools.localStorage.expirationDate, expirationDate.toString())
|
||||
localStorage.setItem(tools.localStorage.isLogged, String(true))
|
||||
localStorage.setItem(tools.localStorage.verified_email, String(myuser.verified_email))
|
||||
localStorage.setItem(tools.localStorage.made_gift, String(myuser.made_gift))
|
||||
localStorage.setItem(tools.localStorage.wasAlreadySubOnDb, String(GlobalStore.state.wasAlreadySubOnDb))
|
||||
|
||||
}
|
||||
@@ -323,6 +336,7 @@ namespace Mutations {
|
||||
mystate.my.surname = ''
|
||||
resetArrToken(mystate.my.tokens)
|
||||
mystate.my.verified_email = false
|
||||
mystate.my.made_gift = false
|
||||
mystate.categorySel = 'personal'
|
||||
|
||||
mystate.servercode = 0
|
||||
@@ -482,7 +496,7 @@ namespace Actions {
|
||||
// mutations.setServerCode(myres);
|
||||
return res
|
||||
}).catch((error) => {
|
||||
return { numtot: 0, numadded: 0, numalreadyexisted: 0}
|
||||
return { numtot: 0, numadded: 0, numalreadyexisted: 0 }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -518,18 +532,18 @@ namespace Actions {
|
||||
|
||||
return bcrypt.hash(authData.password, bcrypt.genSaltSync(12))
|
||||
.then((hashedPassword: string) => {
|
||||
/*
|
||||
const usertosend = {
|
||||
lang: mylang,
|
||||
email: authData.email,
|
||||
password: String(hashedPassword),
|
||||
username: authData.username,
|
||||
name: authData.name,
|
||||
surname: authData.surname
|
||||
}
|
||||
console.log(usertosend)
|
||||
/*
|
||||
const usertosend = {
|
||||
lang: mylang,
|
||||
email: authData.email,
|
||||
password: String(hashedPassword),
|
||||
username: authData.username,
|
||||
name: authData.name,
|
||||
surname: authData.surname
|
||||
}
|
||||
console.log(usertosend)
|
||||
|
||||
*/
|
||||
*/
|
||||
authData.lang = mylang
|
||||
authData.password = String(hashedPassword)
|
||||
|
||||
@@ -689,6 +703,7 @@ namespace Actions {
|
||||
localStorage.removeItem(tools.localStorage.isLogged)
|
||||
// localStorage.removeItem(rescodes.localStorage.leftDrawerOpen)
|
||||
localStorage.removeItem(tools.localStorage.verified_email)
|
||||
localStorage.removeItem(tools.localStorage.made_gift)
|
||||
localStorage.removeItem(tools.localStorage.categorySel)
|
||||
localStorage.removeItem(tools.localStorage.wasAlreadySubOnDb)
|
||||
|
||||
@@ -775,6 +790,7 @@ namespace Actions {
|
||||
const name = String(localStorage.getItem(tools.localStorage.name))
|
||||
const surname = String(localStorage.getItem(tools.localStorage.surname))
|
||||
const verified_email = localStorage.getItem(tools.localStorage.verified_email) === 'true'
|
||||
const made_gift = localStorage.getItem(tools.localStorage.made_gift) === 'true'
|
||||
const perm = parseInt(localStorage.getItem(tools.localStorage.perm), 10)
|
||||
const img = String(localStorage.getItem(tools.localStorage.img))
|
||||
|
||||
@@ -790,6 +806,7 @@ namespace Actions {
|
||||
name,
|
||||
surname,
|
||||
verified_email,
|
||||
made_gift,
|
||||
perm,
|
||||
profile: { img }
|
||||
})
|
||||
@@ -809,6 +826,22 @@ namespace Actions {
|
||||
}
|
||||
}
|
||||
|
||||
async function getDashboard(context, paramquery) {
|
||||
|
||||
return await Api.SendReq('/dashboard', 'POST', paramquery)
|
||||
.then((res) => {
|
||||
if (res.status === 200) {
|
||||
return res.data.dashboard
|
||||
}
|
||||
}).catch((error) => {
|
||||
return {
|
||||
aportador: {},
|
||||
downline: []
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
async function refreshUserInfos(){
|
||||
let {token, refresh_token} = JWT.fetch();
|
||||
@@ -837,6 +870,7 @@ namespace Actions {
|
||||
importemail: b.dispatch(importemail),
|
||||
newsletterload: b.dispatch(newsletterload),
|
||||
newsletter_setactivate: b.dispatch(newsletter_setactivate),
|
||||
getDashboard: b.dispatch(getDashboard),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -77,8 +77,10 @@ export const colgallery = [
|
||||
|
||||
export const colmypage = [
|
||||
AddCol({ name: 'title', label_trans: 'pages.title' }),
|
||||
AddCol({ name: 'lang', label_trans: 'pages.lang' }),
|
||||
AddCol({ name: 'path', label_trans: 'pages.path' }),
|
||||
AddCol({ name: 'icon', label_trans: 'pages.icon' }),
|
||||
AddCol({ name: 'order', label_trans: 'pages.order', fieldtype: tools.FieldType.number }),
|
||||
AddCol({ name: 'keywords', label_trans: 'pages.keywords' }),
|
||||
AddCol({ name: 'description', label_trans: 'pages.description' }),
|
||||
AddCol({ name: 'heightimg', label_trans: 'pages.heightimg', fieldtype: tools.FieldType.number }),
|
||||
@@ -378,11 +380,13 @@ export const fieldsTable = {
|
||||
AddCol({ name: 'name', label_trans: 'reg.name' }),
|
||||
AddCol({ name: 'surname', label_trans: 'reg.surname' }),
|
||||
AddCol({ name: 'email', label_trans: 'reg.email' }),
|
||||
AddCol({ name: 'made_gift', label_trans: 'reg.made_gift', fieldtype: tools.FieldType.boolean }),
|
||||
AddCol({ name: 'profile.nationality', field: 'profile', subfield: 'nationality', label_trans: 'reg.nationality', fieldtype: tools.FieldType.nationality }),
|
||||
AddCol({ name: 'profile.intcode_cell', field: 'profile', subfield: 'intcode_cell', label_trans: 'reg.intcode_cell', fieldtype: tools.FieldType.intcode }),
|
||||
AddCol({ name: 'profile.iso2_cell', field: 'profile', subfield: 'iso2_cell', label_trans: 'reg.iso2_cell' }),
|
||||
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.img', field: 'profile', subfield: 'img', label_trans: 'reg.img', sortable: false }),
|
||||
AddCol({ name: 'date_reg', label_trans: 'reg.date_reg', fieldtype: tools.FieldType.date }),
|
||||
|
||||
@@ -104,6 +104,7 @@ export const tools = {
|
||||
|
||||
localStorage: {
|
||||
verified_email: 'vf',
|
||||
made_gift: 'mg',
|
||||
wasAlreadySubOnDb: 'sb',
|
||||
categorySel: 'cs',
|
||||
isLogged: 'ilog',
|
||||
@@ -1387,8 +1388,13 @@ export const tools = {
|
||||
},
|
||||
|
||||
visumenu(elem) { // : IListRoutes
|
||||
return (elem.onlyAdmin && UserStore.state.isAdmin) || (elem.onlyManager && UserStore.state.isManager)
|
||||
|| ((!elem.onlyAdmin) && (!elem.onlyManager))
|
||||
let visu = ((elem.onlyAdmin && UserStore.state.isAdmin) || (elem.onlyManager && UserStore.state.isManager)
|
||||
|| ((!elem.onlyAdmin) && (!elem.onlyManager))) && elem.active
|
||||
|
||||
if (elem.meta && elem.meta.requiresAuth) {
|
||||
visu = visu && tools.isLoggedToSystem()
|
||||
}
|
||||
return visu
|
||||
},
|
||||
|
||||
executefunc(myself: any, table, func: number, par: IParamDialog) {
|
||||
@@ -2522,6 +2528,12 @@ export const tools = {
|
||||
}
|
||||
,
|
||||
|
||||
getUrlSite() {
|
||||
const url = window.location.href
|
||||
const arr = url.split('/')
|
||||
return arr[0] + '//' + arr[2]
|
||||
},
|
||||
|
||||
SignIncheckErrors(mythis, riscode, ispageLogin ?: boolean) {
|
||||
// console.log('SignIncheckErrors: ', riscode)
|
||||
try {
|
||||
@@ -2874,6 +2886,17 @@ export const tools = {
|
||||
isChristmasHoliday() {
|
||||
const now = new Date()
|
||||
return ((now.getMonth() === 11 && now.getDate() > 20) || (now.getMonth() === 0 && now.getDate() < 8))
|
||||
},
|
||||
|
||||
CapitalizeAllWords(str) {
|
||||
const splitStr = str.toLowerCase().split(' ')
|
||||
for (var i = 0; i < splitStr.length; i++) {
|
||||
// You do not need to check if i is larger than splitStr length, as your for does that for you
|
||||
// Assign it back to the array
|
||||
splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1)
|
||||
}
|
||||
// Directly return the joined string
|
||||
return splitStr.join(' ')
|
||||
}
|
||||
|
||||
// getLocale() {
|
||||
|
||||
Reference in New Issue
Block a user