Circuit table...
This commit is contained in:
@@ -180,6 +180,7 @@ export const costanti = {
|
||||
FIND_PEOPLE: 10,
|
||||
|
||||
GROUPS: 11,
|
||||
CIRCUITS: 12,
|
||||
GRP_REJECTED: 14,
|
||||
REQ_GROUP: 15,
|
||||
ASK_SENT_GROUP: 16,
|
||||
@@ -189,6 +190,12 @@ export const costanti = {
|
||||
CREATE_GROUP: 30,
|
||||
MANAGE_GROUPS: 31,
|
||||
ADMIN_GROUPS: 40,
|
||||
FIND_CIRCUIT: 50,
|
||||
MY_USERACCOUNTS: 51,
|
||||
CREATE_CIRCUIT: 52,
|
||||
MANAGE_CIRCUITS: 53,
|
||||
ADMIN_CIRCUITS: 54,
|
||||
ASK_SENT_CIRCUIT: 55,
|
||||
|
||||
CMD_DELETE: 1,
|
||||
CMD_MODIFY: 2,
|
||||
|
||||
@@ -614,13 +614,6 @@ export const colmyUserGroup = [
|
||||
sortable: true,
|
||||
showWhen: 0
|
||||
}),
|
||||
AddCol({
|
||||
name: 'date_updated', label_trans: 'reg.pub_updated', fieldtype: costanti.FieldType.onlydate,
|
||||
required: false,
|
||||
visible: false,
|
||||
sortable: true,
|
||||
showWhen: 0
|
||||
}),
|
||||
AddCol({
|
||||
name: 'photos',
|
||||
label_trans: 'skill.photos',
|
||||
@@ -2416,6 +2409,28 @@ export const colTableCircuitComplete = [
|
||||
AddCol({ name: 'ultimo_deper', label_trans: 'circuit.ultimo_deper', fieldtype: costanti.FieldType.date }),
|
||||
AddCol({ name: 'durata_deper', label_trans: 'circuit.durata_deper', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'img_logo', label_trans: 'circuit.img_logo' }),
|
||||
AddCol({
|
||||
name: 'admins',
|
||||
label_trans: 'groups.admins',
|
||||
fieldtype: costanti.FieldType.multiselect,
|
||||
jointable: 'friendsandme',
|
||||
field_outtype: costanti.FieldType.object,
|
||||
showWhen: costanti.showWhen.InView_OnlyifExist,
|
||||
}),
|
||||
AddCol({
|
||||
name: 'date_created', label_trans: 'reg.pub_created', fieldtype: costanti.FieldType.onlydate,
|
||||
required: false,
|
||||
visible: false,
|
||||
sortable: true,
|
||||
showWhen: 0
|
||||
}),
|
||||
AddCol({
|
||||
name: 'date_updated', label_trans: 'reg.pub_updated', fieldtype: costanti.FieldType.onlydate,
|
||||
required: false,
|
||||
visible: false,
|
||||
sortable: true,
|
||||
showWhen: 0
|
||||
}),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
@@ -2435,7 +2450,7 @@ export const colTableCircuit = [
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
|
||||
export const colTableAccount = [
|
||||
export const colmyUserCircuit = [
|
||||
AddCol({ name: 'circuitId', label_trans: 'account.circuitId', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'userId', label_trans: 'account.users', fieldtype: costanti.FieldType.select, jointable: 'users', }),
|
||||
AddCol({ name: 'name', label_trans: 'circuit.name' }),
|
||||
@@ -2575,7 +2590,7 @@ export const fieldsTable = {
|
||||
},
|
||||
|
||||
accountslist() {
|
||||
return colTableAccount
|
||||
return colmyUserCircuit
|
||||
},
|
||||
|
||||
movslist() {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
IColGridTable,
|
||||
IColl,
|
||||
ICollaborations, IDataToSet,
|
||||
IEvents, IFriends, IMyGroup,
|
||||
IEvents, IFriends, IMyGroup, ICircuit,
|
||||
IListRoutes,
|
||||
IParamDialog,
|
||||
IPathFile,
|
||||
@@ -36,6 +36,7 @@ import { serv_constants } from '@store/Modules/serv_constants'
|
||||
import { useProjectStore } from '@store/Projects'
|
||||
import { useTodoStore } from '@store/Todos'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useCircuitStore } from '@store/CircuitStore'
|
||||
import { useCalendarStore } from '@store/CalendarStore'
|
||||
import { Router } from 'vue-router'
|
||||
import { AxiosResponse, default as Axios } from 'axios'
|
||||
@@ -65,6 +66,7 @@ export const tools = {
|
||||
|
||||
FRIENDS_SEARCH: 'FR_SE',
|
||||
GROUP_SEARCH: 'GR_SE',
|
||||
CIRCUIT_SEARCH: 'CI_SE',
|
||||
|
||||
getprefCountries: ['it', 'es', 'us'],
|
||||
|
||||
@@ -5159,6 +5161,28 @@ export const tools = {
|
||||
|
||||
return risultato
|
||||
|
||||
},
|
||||
iAmAdminCircuit(name: string) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
let risultato = false
|
||||
|
||||
if (userStore.my.profile.manage_mycircuits) {
|
||||
const ris = userStore.my.profile.manage_mycircuits.find((circuit: ICircuit) => {
|
||||
if (circuit.name === name) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
// console.log('ris', ris)
|
||||
if (ris && ris.admins) {
|
||||
const isadmin = ris.admins.find((user: IFriends) => user.username === userStore.my.username)
|
||||
risultato = !!isadmin
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return risultato
|
||||
|
||||
},
|
||||
|
||||
iAmPartOfThisGroup(grp: IMyGroup) {
|
||||
@@ -5238,6 +5262,68 @@ export const tools = {
|
||||
|
||||
return risultato
|
||||
|
||||
},
|
||||
iAmTheCreatorOfTheCircuit(name: string) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
let risultato = false
|
||||
|
||||
if (userStore.my.profile.manage_mycircuits) {
|
||||
const ris = userStore.my.profile.manage_mycircuits.find((circuit: ICircuit) => {
|
||||
if (circuit.name === name) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
// console.log('ris', ris)
|
||||
return (ris && ris.createdBy === userStore.my.username)
|
||||
|
||||
}
|
||||
|
||||
return risultato
|
||||
|
||||
},
|
||||
|
||||
isUserTheCreatorOfThCircuit(name: string, username: string) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
let risultato = false
|
||||
|
||||
if (userStore.my.profile.manage_mycircuits) {
|
||||
const ris = userStore.my.profile.manage_mycircuits.find((circuit: ICircuit) => {
|
||||
if (circuit.name === name) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
// console.log('ris', ris)
|
||||
return (ris && ris.createdBy === username)
|
||||
|
||||
}
|
||||
|
||||
return risultato
|
||||
|
||||
},
|
||||
|
||||
isUserAdminCircuit(name: string, username: string) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
let risultato = false
|
||||
|
||||
if (userStore.my.profile.manage_mycircuits) {
|
||||
const ris = userStore.my.profile.manage_mycircuits.find((circuit: ICircuit) => {
|
||||
if (circuit.name === name) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
// console.log('ris', ris)
|
||||
if (ris && ris.admins) {
|
||||
const isadmin = ris.admins.find((user: IFriends) => user.username === username)
|
||||
risultato = !!isadmin
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return risultato
|
||||
|
||||
},
|
||||
|
||||
setCmd($q: any, cmd: number, username: string, value: any, dest: string) {
|
||||
@@ -5457,6 +5543,15 @@ export const tools = {
|
||||
link_telegram: '',
|
||||
}
|
||||
},
|
||||
getdefaultnewrec_Circuit(): any {
|
||||
return {
|
||||
_id: 0,
|
||||
name: '',
|
||||
subname: '',
|
||||
img_logo: '',
|
||||
admins: [],
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
getdefaultnewrec_MyBacheca(): any {
|
||||
@@ -5508,6 +5603,8 @@ export const tools = {
|
||||
return 'mygood'
|
||||
} else if (table === toolsext.TABMYGROUPS) {
|
||||
return 'grp'
|
||||
} else if (table === toolsext.TABCIRCUITS) {
|
||||
return 'circuit'
|
||||
}
|
||||
|
||||
return ''
|
||||
@@ -5516,6 +5613,8 @@ export const tools = {
|
||||
getFullFileName(arrimage: IImgGallery[], table: string, username: string, groupname: string) {
|
||||
if (shared_consts.TABLES_DIRECTORY_A_PARTE.includes(table)) {
|
||||
return `upload/${table}/` + groupname + '/' + arrimage[0].imagefile
|
||||
} else if (shared_consts.TABLES_DIRECTORY_SINGLE_IMG.includes(table)) {
|
||||
return `upload/${table}/` + groupname + '/' + arrimage[0].imagefile
|
||||
} else {
|
||||
if (arrimage && arrimage.length > 0) {
|
||||
return 'upload/profile/' + username + '/' + table + '/' + arrimage[0].imagefile
|
||||
@@ -5533,7 +5632,7 @@ export const tools = {
|
||||
if ((userStore.isAdmin || userStore.isManager))
|
||||
return true
|
||||
|
||||
if (tablesel === toolsext.TABMYGROUPS) {
|
||||
if (shared_consts.TABLES_WITH_ADMINS.includes(tablesel)) {
|
||||
// is Admin ?
|
||||
if (rec.admins) {
|
||||
const trovato = rec.admins.find((myuser: any) => myuser.username === userStore.my.username)
|
||||
@@ -5561,6 +5660,8 @@ export const tools = {
|
||||
return '/' + tools.getDirectoryByTable(table) + '/' + rec['_id']
|
||||
} else if (table === toolsext.TABMYGROUPS) {
|
||||
return '/grp/' + rec.groupname
|
||||
} else if (table === toolsext.TABCIRCUITS) {
|
||||
return '/circuit/' + rec.name
|
||||
}
|
||||
|
||||
return ''
|
||||
@@ -5570,6 +5671,10 @@ export const tools = {
|
||||
return '/' + tools.getDirectoryByTable(table) + '/' + grp.groupname
|
||||
},
|
||||
|
||||
getPathByCircuit(grp: any, table: string) {
|
||||
return '/' + tools.getDirectoryByTable(table) + '/' + grp.name
|
||||
},
|
||||
|
||||
getPathByTable(table: string, pagename: string) {
|
||||
return '/' + tools.getDirectoryByTable(table) + '/' + pagename
|
||||
},
|
||||
@@ -5693,6 +5798,30 @@ export const tools = {
|
||||
return []
|
||||
},
|
||||
|
||||
async loadCircuits() {
|
||||
const userStore = useUserStore()
|
||||
const circuitStore = useCircuitStore()
|
||||
// Carica il profilo di quest'utente
|
||||
|
||||
await userStore.loadCircuits().then((ris) => {
|
||||
// console.log('ris', ris)
|
||||
if (ris) {
|
||||
|
||||
circuitStore.listcircuits = ris.listcircuits ? ris.listcircuits : []
|
||||
|
||||
// to Refresh Data User Accounts:
|
||||
userStore.my.profile.listUserAccounts = ris.listUserAccounts ? ris.listUserAccounts : []
|
||||
|
||||
// Others not loaded at the beginning:
|
||||
userStore.my.profile.asked_circuits = ris.listSentRequestCircuits ? ris.listSentRequestCircuits : []
|
||||
userStore.my.profile.refused_circuits = ris.listRefusedCircuits ? ris.listRefusedCircuits : []
|
||||
return [{ userId: userStore.my._id }]
|
||||
}
|
||||
})
|
||||
|
||||
return []
|
||||
},
|
||||
|
||||
async loadrecProfile() {
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
@@ -93,6 +93,7 @@ export const toolsext = {
|
||||
TABLOCACCOM: 'locaccoms',
|
||||
TABPREF: 'hosps_preferences',
|
||||
TABPEOPLE: 'people',
|
||||
TABCIRCUITS: 'circuits',
|
||||
SERVKEY_VERS: 'vers',
|
||||
|
||||
ERR_GENERICO: -1,
|
||||
|
||||
Reference in New Issue
Block a user