2023-03-04 10:20:49 +01:00
|
|
|
import { defineComponent, onMounted, PropType, ref, watch, computed } from 'vue'
|
|
|
|
|
import { useUserStore } from '@store/UserStore'
|
|
|
|
|
import { ICircuit, IImgGallery, IUserFields, IUserProfile } from 'model'
|
|
|
|
|
import { costanti } from '@costanti'
|
|
|
|
|
import { shared_consts } from '@/common/shared_vuejs'
|
|
|
|
|
import { tools } from '@store/Modules/tools'
|
|
|
|
|
import { useQuasar } from 'quasar'
|
|
|
|
|
import { CSendCoins } from '@/components/CSendCoins'
|
|
|
|
|
import { CMyFieldRec } from '@/components/CMyFieldRec'
|
|
|
|
|
import { CSaldo } from '@/components/CSaldo'
|
|
|
|
|
import { CMySelectCity } from '@/components/CMySelectCity'
|
|
|
|
|
import { CMySelect } from '@/components/CMySelect'
|
|
|
|
|
import { CUserInfoAccount } from '@/components/CUserInfoAccount'
|
|
|
|
|
import { useI18n } from '@/boot/i18n'
|
|
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
|
|
import { useCircuitStore } from '@store/CircuitStore'
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
name: 'CMyProfileTutorial',
|
2023-03-05 22:04:28 +01:00
|
|
|
components: {
|
|
|
|
|
CSendCoins, CSaldo, CUserInfoAccount,
|
|
|
|
|
CMySelectCity, CMyFieldRec, CMySelect
|
|
|
|
|
},
|
2023-03-04 10:20:49 +01:00
|
|
|
emits: ['setCmd'],
|
|
|
|
|
props: {
|
|
|
|
|
mycontact: {
|
|
|
|
|
type: Object as PropType<IUserFields | null>,
|
|
|
|
|
required: false,
|
|
|
|
|
default: null,
|
|
|
|
|
},
|
|
|
|
|
myusername: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: null,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
setup(props, { emit }) {
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const circuitStore = useCircuitStore()
|
|
|
|
|
const $q = useQuasar()
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
const $router = useRouter()
|
|
|
|
|
const $route = useRoute()
|
|
|
|
|
|
|
|
|
|
const showAccountInfo = ref(false)
|
2023-03-05 22:04:28 +01:00
|
|
|
const slidestep = ref('1')
|
2023-03-04 10:20:49 +01:00
|
|
|
|
|
|
|
|
const username = ref('')
|
|
|
|
|
const showsendCoinTo = ref(false)
|
|
|
|
|
|
|
|
|
|
const contact = ref(<IUserFields | null>null)
|
|
|
|
|
const circuit = ref(<ICircuit | null | undefined>null)
|
|
|
|
|
|
2023-03-05 22:04:28 +01:00
|
|
|
const arrStep = [
|
|
|
|
|
{
|
|
|
|
|
label: t('tutorial.step_residence_title'),
|
|
|
|
|
checkOk: function () { return contact.value ? !!contact.value.profile.resid_province : false },
|
|
|
|
|
step: '1',
|
|
|
|
|
icon: 'house'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const numstep = computed(() => arrStep.length)
|
|
|
|
|
|
|
|
|
|
const progressStep = computed(() => {
|
|
|
|
|
let prStep = 0
|
|
|
|
|
|
|
|
|
|
return prStep / numstep.value
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const progressLabel = computed(() => (progressStep.value * 100).toFixed(2) + '%')
|
|
|
|
|
|
2023-03-04 10:20:49 +01:00
|
|
|
watch(() => props.mycontact, (newval, oldval) => {
|
|
|
|
|
console.log('watch: mycontact')
|
|
|
|
|
mounted()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function mounted() {
|
|
|
|
|
if (!props.mycontact) {
|
|
|
|
|
if (props.myusername) {
|
|
|
|
|
username.value = props.myusername
|
|
|
|
|
//++Todo: carica contact
|
|
|
|
|
contact.value = null
|
|
|
|
|
} else {
|
|
|
|
|
contact.value = userStore.my
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (props.mycontact) {
|
|
|
|
|
contact.value = props.mycontact
|
|
|
|
|
username.value = props.mycontact.username
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// circuit.value = circuitStore.getCircuitByName(props.circuitname)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getImgUser(profile: IUserFields) {
|
|
|
|
|
return userStore.getImgByProfile(profile)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function naviga(path: string) {
|
|
|
|
|
$router.push(path)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setCmd($q: any, cmd: number, myusername: string, value: any, dest: string) {
|
|
|
|
|
emit('setCmd', $q, cmd, myusername, value, dest)
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-05 22:04:28 +01:00
|
|
|
function getLabelByStatusStep(step: string) {
|
|
|
|
|
let mystr = ''
|
|
|
|
|
|
|
|
|
|
return mystr
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-04 10:20:49 +01:00
|
|
|
const checkifDisabled = computed(() => {
|
|
|
|
|
let ret = true
|
2023-03-05 22:04:28 +01:00
|
|
|
let mystep = parseInt(slidestep.value)
|
|
|
|
|
if (mystep > 0) {
|
|
|
|
|
return !arrStep[mystep - 1].checkOk()
|
|
|
|
|
} else {
|
|
|
|
|
return false
|
2023-03-04 10:20:49 +01:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
onMounted(mounted)
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
contact,
|
|
|
|
|
costanti,
|
|
|
|
|
checkifDisabled,
|
|
|
|
|
getImgUser,
|
|
|
|
|
naviga,
|
|
|
|
|
setCmd,
|
|
|
|
|
shared_consts,
|
|
|
|
|
tools,
|
|
|
|
|
showsendCoinTo,
|
|
|
|
|
circuit,
|
|
|
|
|
showAccountInfo,
|
2023-03-05 22:04:28 +01:00
|
|
|
slidestep,
|
|
|
|
|
numstep,
|
|
|
|
|
progressLabel,
|
|
|
|
|
arrStep,
|
2023-03-04 10:20:49 +01:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
})
|