Circuit table...

This commit is contained in:
paoloar77
2022-08-26 03:32:50 +02:00
parent ed6abf2b07
commit a3c904c2ac
39 changed files with 2012 additions and 77 deletions

View File

@@ -1,6 +1,7 @@
import { defineStore } from 'pinia'
import {
ICircuit,
IFriends, IMsgGlobParam,
ISigninOptions,
ISignupOptions, IUserFields, IUserNotifType, IUserProfile, IUserState,
@@ -63,6 +64,10 @@ export const DefaultUser: IUserFields = {
notif_regions: [],
notif_sectors: [],
notif_sector_goods: [],
asked_circuits: [],
refused_circuits: [],
listUserAccounts: [],
manage_mycircuits: [],
},
cart: {
userId: '',
@@ -115,6 +120,11 @@ export const DefaultProfile: IUserProfile = {
notif_regions: [],
notif_sectors: [],
notif_sector_goods: [],
asked_circuits: [],
refused_circuits: [],
listUserAccounts: [],
manage_mycircuits: [],
}
export const useUserStore = defineStore('UserStore', {
@@ -202,6 +212,16 @@ export const useUserStore = defineStore('UserStore', {
return false
},
IsMyCircuitByGroupname(mycircuit: string): boolean {
/*if (this.my.profile.mycircuit)
return this.my.profile.mycircuit.findIndex((rec) => rec.name === name) >= 0
else
return false
*/
},
IsAskedFriendByUsername(username: string): boolean {
if (this.my.profile.asked_friends)
return this.my.profile.asked_friends.findIndex((rec) => rec.username === username) >= 0
@@ -277,6 +297,15 @@ export const useUserStore = defineStore('UserStore', {
return ''
},
getImgByCircuit(circ: ICircuit): string {
try {
return costanti.DIR_UPLOAD + 'circuits/' + circ.img_logo
} catch (e) {
}
return 'images/noimg.png'
},
getImgByGroup(group: IMyGroup): string {
try {
@@ -1063,6 +1092,21 @@ export const useUserStore = defineStore('UserStore', {
},
async loadCIrcuit(name: string, idnotif: string) {
const data = {
name,
idnotif,
}
return Api.SendReq('/circuit/load', 'POST', data)
.then((res) => {
return {data: res.data, status: res.status}
}).catch((error) => {
return {data: null, status: error.status}
})
},
async loadSkill(idSkill: string) {
const data = {
idSkill
@@ -1116,6 +1160,16 @@ export const useUserStore = defineStore('UserStore', {
},
async loadCircuits() {
return Api.SendReq('/users/circuits', 'POST', null)
.then((res) => {
return res.data
}).catch((error) => {
return {}
})
},
async setFriendsCmd($q: any, t: any, usernameOrig: string, usernameDest: string, cmd: number, value: any) {
return Api.SendReq('/users/friends/cmd', 'POST', { usernameOrig, usernameDest, cmd, value })
.then((res) => {