- Invia Ris a e Ricevi Ris

- Tutorial Guidato Passi da Compiere
- Provincia in cui vivi
- Policy aggiornata
This commit is contained in:
Surya Paolo
2023-03-11 01:01:23 +01:00
parent 7a9689125b
commit 80610b3627
61 changed files with 2308 additions and 925 deletions

View File

@@ -73,6 +73,10 @@ export const useCircuitStore = defineStore('CircuitStore', {
return this.listcircuits.find((rec: ICircuit) => rec.name === circuitname)
},
getCircuitByProvince(prov: string): ICircuit | undefined | null {
return this.listcircuits.find((rec: ICircuit) => rec.strProv === prov)
},
getCircuitByCircuitId(circuitId: string): ICircuit | null | undefined {
return this.listcircuits.find((rec: ICircuit) => rec._id === circuitId)
},
@@ -138,5 +142,9 @@ export const useCircuitStore = defineStore('CircuitStore', {
return arr
},
getSortFieldsAvailable(): any[] {
return [{ label: 'Nome', value: 'name' }, { label: 'Iscritti', value: 'numMembers' }]
},
},
})

View File

@@ -227,7 +227,7 @@ export const costanti = {
{
visible: true,
title: 'Assistenza',
to: '/faq',
to: '/istruzioni',
icon: 'fas fa-question',
color: 'yellow',
hint: '',
@@ -291,6 +291,7 @@ export const costanti = {
USER_CIRCUITS: 60,
REQ_CIRCUIT: 65,
ENTER_TO_THE_CIRCUIT: 70,
CMD_DELETE: 1,
CMD_MODIFY: 2,

View File

@@ -749,7 +749,7 @@ export const colmyUserGroup = [
name: 'groupname', label_trans: 'reg.groupname', required: false,
maxlength: 30,
allowchar: costanti.ALLOWCHAR_CODE,
showWhen: costanti.showWhen.InPage + costanti.showWhen.InEdit
showWhen: costanti.showWhen.InPage + costanti.showWhen.NewRec
}),
AddCol({
name: 'idCity',
@@ -2808,6 +2808,20 @@ export const colTableCircuitComplete = [
remote_field: 'comune',
required: true,
}),
AddCol({
name: 'strProv',
label_trans: 'reg.provincia',
fieldtype: costanti.FieldType.select,
jointable: 'provinces',
tablesel: 'provinces',
noshowlabel: true,
icon: 'fas fa-map-marker-alt',
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
required: true,
}),
// AddCol({ name: 'strProv', label_trans: 'reg.provincia', fieldtype: costanti.FieldType.string,
// showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
// }),
AddCol({
name: 'visibility',
label_trans: 'bot.visibility',
@@ -2880,7 +2894,7 @@ export const colTableCircuitComplete = [
]
export const colTableCircuit = [
AddCol({ name: '_id', label_trans: 'circuit.Id' }), // da togliere poi
// AddCol({ name: '_id', label_trans: 'circuit.Id' }), // da togliere poi
AddCol({
name: 'name', label_trans: 'circuit.name',
required: true,
@@ -2909,6 +2923,17 @@ export const colTableCircuit = [
remote_field: 'comune',
required: true,
}),
AddCol({
name: 'strProv',
label_trans: 'reg.provincia',
fieldtype: costanti.FieldType.select,
jointable: 'provinces',
tablesel: 'provinces',
noshowlabel: true,
icon: 'fas fa-map-marker-alt',
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
required: true,
}),
AddCol({
name: 'visibility',
label_trans: 'bot.visibility',

View File

@@ -23,7 +23,7 @@ import { lists } from '@store/Modules/lists'
import { costanti } from '@store/Modules/costanti'
import { copyToClipboard, date, Screen, useQuasar, colors, Cookies, scroll } from 'quasar'
const { getScrollTarget, setScrollPosition } = scroll
const { getScrollTarget, setVerticalScrollPosition } = scroll
import { func_tools, toolsext } from '@store/Modules/toolsext'
import { preloadedimages, static_data } from '@src/db/static_data'
import { useGlobalStore } from '@store/globalStore'
@@ -2672,8 +2672,8 @@ export const tools = {
})
},
showPositiveNotif(q: any, msg: string) {
this.showNotif(q, msg, { color: 'positive', icon: 'notifications' })
showPositiveNotif(q: any, msg: string, time?: number) {
this.showNotif(q, msg, { color: 'positive', icon: 'notifications' }, time)
},
showNegativeNotif(q: any, msg: string, time = 5000) {
@@ -4180,6 +4180,9 @@ export const tools = {
return Cookies.remove(mytok)
},
scrollToTopAll() {
window.scrollTo(0,0);
},
scrollToTop() {
const element = document.getElementById('mypage')
this.scrollToElement(element)
@@ -4194,7 +4197,7 @@ export const tools = {
const offset = el.offsetTop
const duration = 500
console.log('target', target, 'offset', offset, 'duration', duration)
setScrollPosition(target, offset, duration)
setVerticalScrollPosition(target, offset, duration)
}
},
@@ -7693,6 +7696,56 @@ export const tools = {
return user.name ? user.name + ' ' + (user.surname ? user.surname : '') : user.username
},
getNomeUtenteEUsernameByRecUser(user: IUserFields) {
if (user.name)
return user.name + ' ' + user.surname + ' (' + user.username + ')'
else
return user.username
},
updateLink(link: string) {
const userStore = useUserStore()
if (link === '/circuits') {
let path = userStore.my.profile.last_circuitpath
if (path) {
return '/circuit/' + path
}
return link
}
return link
},
async receiveRis($q: any, t: any) {
const userStore = useUserStore()
let username = userStore.my.username
await userStore.setUserReceiveRIS(username, '').then((data) => {
if (data.code === serv_constants.RIS_CODE_OK) {
this.showPositiveNotif($q, t('circuit.coins_requestedris', {username}), 6000)
} else {
this.showNegativeNotif($q, t('db.recfailed'))
}
})
},
async receiveRisGroup(groupname: string, $q: any, t: any) {
const userStore = useUserStore()
await userStore.setUserReceiveRIS('', groupname).then((data) => {
if (data.code === serv_constants.RIS_CODE_OK) {
this.showPositiveNotif($q, t('circuit.coins_requestedris', {groupname}), 6000)
} else {
this.showNegativeNotif($q, t('db.recfailed'))
}
})
},
// FINE !
// getLocale() {

View File

@@ -69,6 +69,8 @@ export const DefaultUser: IUserFields = {
handshake: [],
mygroups: [],
mycircuits: [],
last_circuitpath: '',
lastdate_reqRis: tools.getLastDateReadReset(),
manage_mygroups: [],
asked_friends: [],
asked_groups: [],
@@ -79,6 +81,8 @@ export const DefaultUser: IUserFields = {
notif_regions: [],
notif_sectors: [],
notif_sector_goods: [],
stepTutorial: 0,
noNameSurname: false,
asked_circuits: [],
refused_circuits: [],
manage_mycircuits: [],
@@ -128,6 +132,7 @@ export const DefaultProfile: IUserProfile = {
handshake: [],
mygroups: [],
mycircuits: [],
last_circuitpath: '',
manage_mygroups: [],
asked_friends: [],
asked_groups: [],
@@ -138,7 +143,8 @@ export const DefaultProfile: IUserProfile = {
notif_regions: [],
notif_sectors: [],
notif_sector_goods: [],
stepTutorial: 0,
noNameSurname: false,
asked_circuits: [],
refused_circuits: [],
manage_mycircuits: [],
@@ -218,6 +224,15 @@ export const useUserStore = defineStore('UserStore', {
},
actions: {
getMypaginationMembers(): any {
return { sortBy: 'name,username', descending: '1,1', page: 1, rowsNumber: 0, rowsPerPage: 10 }
},
getSortFieldsAvailable(): any[] {
return [{ label: 'Username', value: 'username,name' }, { label: 'Nome', value: 'name,username' }, { label: 'Ultimi reg.', value: 'date_reg,username' }]
},
IsMyFriendByUsername(username: string): boolean {
if (this.my.profile.friends)
return this.my.profile.friends.findIndex((rec) => rec.username === username) >= 0
@@ -416,6 +431,7 @@ export const useUserStore = defineStore('UserStore', {
},
IsMyCircuitByName(circuitname: string): boolean {
if (this.my.profile.mycircuits)
@@ -483,7 +499,7 @@ export const useUserStore = defineStore('UserStore', {
if (acc.circuit) {
chi += ' (' + circuitStore.getNameByCircuitId(acc.circuitId) + ')'
}
arr.push({label: chi, value: acc._id})
arr.push({ label: chi, value: acc._id })
}
}
return arr
@@ -823,6 +839,27 @@ export const useUserStore = defineStore('UserStore', {
})
},
async saveStepTutorial(step: number) {
const mydata = {
_id: this.my._id,
dbop: 'saveStepTut',
value: step,
}
this.my.profile.stepTutorial = step
return await this.execDbOp({mydata})
},
async savenoNameSurname(val: boolean) {
const mydata = {
_id: this.my._id,
dbop: 'noNameSurname',
value: val,
}
if (this.my.profile.noNameSurname !== val) {
this.my.profile.noNameSurname = val
return await this.execDbOp({mydata})
}
},
async newsletterload(paramquery: any) {
return Api.SendReq('/news/load', 'POST', paramquery)
@@ -1323,6 +1360,22 @@ export const useUserStore = defineStore('UserStore', {
},
async setUserReceiveRIS(username: string, groupname: string) {
const data = {
username,
groupname,
}
return Api.SendReq('/users/receiveris', 'POST', data)
.then((ris) => {
console.log('out:', ris)
return ris.data
}).catch((error) => {
return {}
})
},
async loadGroup(groupname: string, idnotif: string) {
const data = {
groupname,
@@ -1348,6 +1401,7 @@ export const useUserStore = defineStore('UserStore', {
return Api.SendReq('/circuit/load', 'POST', data)
.then((res) => {
this.my.profile.last_circuitpath = path
if (res && res.data.arrrecnotif) {
notifStore.updateArrRecNotifFromServer(res.data.arrrecnotif)
}

View File

@@ -1688,7 +1688,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
return Api.SendReq('/site/load', 'POST', paramquery)
.then((res) => {
// console.log('datastat', res)
console.log('datastat', res)
this.datastat = res.data.datastat
return this.datastat
}).catch((error) => {