- Statistiche
- Menu e Sottomenu - Lista ultimi Movimenti
This commit is contained in:
89
src/components/CMovements/CMovements.ts
Executable file
89
src/components/CMovements/CMovements.ts
Executable file
@@ -0,0 +1,89 @@
|
||||
import { defineComponent, ref, computed, PropType, toRef, onMounted } from 'vue'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
|
||||
import { CMyImgUser } from '@/components/CMyImgUser'
|
||||
import { CCurrencyValue } from '@/components/CCurrencyValue'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { IMovQuery, IMovement } from '@src/model'
|
||||
|
||||
import { shared_consts } from '@src/common/shared_vuejs'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CMovements',
|
||||
components: { CMyImgUser, CCurrencyValue },
|
||||
props: {
|
||||
numcol: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 3
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
const $router = useRouter()
|
||||
const globalStore = useGlobalStore()
|
||||
const { t } = useI18n();
|
||||
|
||||
const datastat = ref(<any>{})
|
||||
|
||||
const mylist = computed(() => {
|
||||
if (globalStore.datastat)
|
||||
return globalStore.datastat.last_transactions
|
||||
else
|
||||
return []
|
||||
})
|
||||
|
||||
async function mounted() {
|
||||
|
||||
}
|
||||
|
||||
function getFromToStr(mov: any) {
|
||||
|
||||
let mystr = ''
|
||||
if (mov) {
|
||||
|
||||
mystr += mov.str
|
||||
}
|
||||
return mystr
|
||||
}
|
||||
|
||||
function navigabyMov(mov: IMovQuery, from: boolean) {
|
||||
let link = ''
|
||||
if (from) {
|
||||
if (mov.tipocontofrom === shared_consts.AccountType.USER) {
|
||||
link = `/my/` + mov.userfrom.username
|
||||
} else if (mov.tipocontofrom === shared_consts.AccountType.COLLECTIVE_ACCOUNT) {
|
||||
link = tools.getPathByGroup(mov.groupfrom)
|
||||
} else if (mov.tipocontofrom === shared_consts.AccountType.COMMUNITY_ACCOUNT) {
|
||||
link = '' // mov.contocomfrom.name
|
||||
}
|
||||
} else {
|
||||
if (mov.tipocontoto === shared_consts.AccountType.USER) {
|
||||
link = `/my/` + mov.userto.username
|
||||
} else if (mov.tipocontoto === shared_consts.AccountType.COLLECTIVE_ACCOUNT) {
|
||||
link = tools.getPathByGroup(mov.groupto)
|
||||
} else if (mov.tipocontoto === shared_consts.AccountType.COMMUNITY_ACCOUNT) {
|
||||
link = ''
|
||||
}
|
||||
}
|
||||
$router.push(link)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
mounted()
|
||||
})
|
||||
|
||||
return {
|
||||
userStore,
|
||||
tools,
|
||||
mylist,
|
||||
getFromToStr,
|
||||
t,
|
||||
navigabyMov,
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user