Add Movement !
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
ITodo,
|
||||
IUserFields,
|
||||
Privacy,
|
||||
TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, IAccount, IMyCircuit,
|
||||
TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, IAccount, IMyCircuit, ISendCoin,
|
||||
} from '@model'
|
||||
|
||||
import { addToDate } from '@quasar/quasar-ui-qcalendar'
|
||||
@@ -4784,6 +4784,29 @@ export const tools = {
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
acceptCoins($q: any, username: string, recsendcoin: ISendCoin) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
userStore.setCircuitCmd($q, t, username, recsendcoin.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT, 0, recsendcoin)
|
||||
.then((res: any) => {
|
||||
if (res) {
|
||||
tools.showPositiveNotif($q, t('circuit.coins_accepted'))
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
refuseCoins($q: any, username: string, recsendcoin: ISendCoin) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
userStore.setCircuitCmd($q, t, username, recsendcoin.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_REFUSE, recsendcoin)
|
||||
.then((res: any) => {
|
||||
if (res) {
|
||||
tools.showPositiveNotif($q, t('circuit.coins_refused'))
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
refuseReqGroup($q: any, username: string, groupnameDest: string) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
@@ -4863,7 +4886,7 @@ export const tools = {
|
||||
const mygrp = userStore.my.profile.manage_mygroups.find((rec: IMyGroup) => rec.groupname === groupnameDest)
|
||||
console.log('mygrp', mygrp)
|
||||
if (mygrp && mygrp.admins) {
|
||||
mygrp.admins = [...mygrp.admins, {username, date: new Date}]
|
||||
mygrp.admins = [...mygrp.admins, { username, date: new Date }]
|
||||
console.log('mygrp.admins', mygrp.admins)
|
||||
tools.showPositiveNotif($q, t('db.addedtoadmin', { username }))
|
||||
}
|
||||
@@ -5236,6 +5259,39 @@ export const tools = {
|
||||
})
|
||||
},
|
||||
|
||||
sendCoinsByCircuit($q: any, circuit: ICircuit, sendcoinrec: ISendCoin) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const username = userStore.my.username
|
||||
|
||||
let msg = ''
|
||||
msg = t('circuit.question_sendcoinsto', { coin: circuit.symbol, dest: sendcoinrec.dest, qty: sendcoinrec.qty })
|
||||
|
||||
$q.dialog({
|
||||
message: msg,
|
||||
ok: {
|
||||
label: t('dialog.yes'),
|
||||
push: true
|
||||
},
|
||||
cancel: {
|
||||
label: t('dialog.cancel')
|
||||
},
|
||||
title: t('db.domanda')
|
||||
}).onOk(() => {
|
||||
|
||||
userStore.setCircuitCmd($q, t, username, sendcoinrec.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_REQ, true, sendcoinrec)
|
||||
.then((res: any) => {
|
||||
if (res) {
|
||||
tools.showPositiveNotif($q, t('circuit.coins_sendrequest_sent'))
|
||||
|
||||
} else {
|
||||
tools.showNegativeNotif($q, t('db.coins_sendrequest_failed'))
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
cancelReqCircuit($q: any, username: string, circuitname: string) {
|
||||
const userStore = useUserStore()
|
||||
$q.dialog({
|
||||
@@ -5315,7 +5371,7 @@ export const tools = {
|
||||
const mycircuit = userStore.my.profile.manage_mycircuits.find((rec: ICircuit) => rec.name === circuitname)
|
||||
console.log('mycircuit', mycircuit)
|
||||
if (mycircuit && mycircuit.admins) {
|
||||
mycircuit.admins = [...mycircuit.admins, {username, date: new Date}]
|
||||
mycircuit.admins = [...mycircuit.admins, { username, date: new Date }]
|
||||
console.log('mycircuit.admins', mycircuit.admins)
|
||||
tools.showPositiveNotif($q, t('db.addedtoadmin', { username }))
|
||||
}
|
||||
@@ -5362,7 +5418,7 @@ export const tools = {
|
||||
if (res) {
|
||||
if (userStore.my.profile.manage_mycircuits) {
|
||||
userStore.my.profile.manage_mycircuits = userStore.my.profile.manage_mycircuits.filter((rec: ICircuit) => rec.name !== circuitname)
|
||||
tools.showPositiveNotif($q, t('circuit.deleted', { circuitname } ))
|
||||
tools.showPositiveNotif($q, t('circuit.deleted', { circuitname }))
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -6151,7 +6207,7 @@ export const tools = {
|
||||
VUE_APP_BACKEND_API_URL: window?.appConfig?.VUE_APP_BACKEND_API_URL || process.env.VUE_APP_BACKEND_API_URL
|
||||
}
|
||||
|
||||
return config[name];
|
||||
return config[name]
|
||||
},
|
||||
|
||||
getArrSector(table: string, rec: any) {
|
||||
@@ -6160,7 +6216,7 @@ export const tools = {
|
||||
else if ((table === toolsext.TABMYBACHECAS) || (table === toolsext.TABMYSKILLS))
|
||||
return rec.sector
|
||||
else if (table === toolsext.TABMYGROUPS)
|
||||
return [{descr: rec.sector}]
|
||||
return [{ descr: rec.sector }]
|
||||
else if (table === toolsext.TABMYHOSPS)
|
||||
return []
|
||||
|
||||
@@ -6178,8 +6234,35 @@ export const tools = {
|
||||
return []
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
findCommonElements(arr1: any, arr2: any) {
|
||||
return arr1.some((item: any) => arr2.includes(item))
|
||||
},
|
||||
|
||||
// Function to return commonElements
|
||||
getCommon(arr1: any, arr2: any, field: string): any[] {
|
||||
arr1.sort((a: any, b: any) => b[field] - a[field]) // Sort both the arrays
|
||||
arr2.sort((a: any, b: any) => b[field] - a[field])
|
||||
let common = [] // Array to contain common elements
|
||||
let i = 0, j = 0 // i points to arr1 and j to arr2
|
||||
// Break if one of them runs out
|
||||
while (i < arr1.length && j < arr2.length) {
|
||||
|
||||
if (arr1[i][field] == arr2[j][field]) { // If both are same, add it to result
|
||||
common.push(arr1[i][field])
|
||||
i++
|
||||
j++
|
||||
} else if (arr1[i][field] < arr2[j][field]) { // Increment the smaller value so that
|
||||
i++ // it could be matched with the larger
|
||||
} // element
|
||||
else {
|
||||
j++
|
||||
}
|
||||
}
|
||||
|
||||
return common
|
||||
},
|
||||
// getLocale() {
|
||||
// if (navigator.languages && navigator.languages.length > 0) {
|
||||
// return navigator.languages[0]
|
||||
|
||||
Reference in New Issue
Block a user