- Provincia obbligatoria, chiedo conferma se non vuole entrare nel circuito.

This commit is contained in:
Surya Paolo
2023-03-22 15:54:56 +01:00
parent 59af1d0b8b
commit 175bba7720
6 changed files with 98 additions and 11 deletions

View File

@@ -97,6 +97,7 @@ export default defineComponent({
if ((step.value === STEP_CIRCUIT - 1) || (step.value === STEP_CIRCUIT )) {
mycircuit.value = circuitStore.getCircuitByProvince(strProv.value)
userStore.savenoCircuit(isAskedToCircuit())
}
if (step.value === STEP_NAME_SURNAME + 1) {
@@ -129,7 +130,9 @@ export default defineComponent({
extratitle: function () { return ': ' + contact.value!.profile.resid_province },
label: t('tutorial.step_residence'),
checkOk: function () { return contact.value ? !!contact.value.profile.resid_province : false },
icon: 'house'
checkOkReal: function () { return this.checkOk() },
icon: 'house',
required: true,
},
{
step: STEP_NAME_SURNAME, // 2
@@ -137,7 +140,9 @@ export default defineComponent({
extratitle: function () { return ': ' + (contact.value ? tools.getNomeUtenteEUsernameByRecUser(contact.value) : '') },
label: t('tutorial.step_nomecognome'),
checkOk: function () { return ((contact.value ? !!contact.value.name : false) || userStore.my.profile.noNameSurname) },
icon: 'user'
checkOkReal: function () { return ((contact.value ? !!contact.value.name : false)) },
icon: 'user',
required: false,
},
{
step: STEP_CIRCUIT,
@@ -147,12 +152,20 @@ export default defineComponent({
label_ok: t('tutorial.step_circuito_ok'),
checkOk: function () {
if (mycircuit.value) {
return (userStore.IsMyCircuitByName(mycircuit.value.name) ||
userStore.IsAskedCircuitByName(mycircuit.value.name))
return ((userStore.IsMyCircuitByName(mycircuit.value.name) ||
userStore.IsAskedCircuitByName(mycircuit.value.name))) || userStore.my.profile.noCircuit
}
return false
},
checkOkReal: function () {
if (mycircuit.value) {
return ((userStore.IsMyCircuitByName(mycircuit.value.name) ||
userStore.IsAskedCircuitByName(mycircuit.value.name)))
}
return false
},
icon: 'img: images/1ris_rosso_100.png',
required: false,
},
{
step: 4,
@@ -162,7 +175,9 @@ export default defineComponent({
checkOk: function () {
return userStore.my.profile.calc.numGoodsAndServices! > 0
},
checkOkReal: function () { return this.checkOk() },
icon: 'fas fa-tshirt',
required: false,
},
{
step: STEP_FOTO,
@@ -172,7 +187,9 @@ export default defineComponent({
checkOk: function () {
return !!userStore.my.profile.img
},
checkOkReal: function () { return this.checkOk() },
icon: 'fas fa-tshirt',
required: false,
},
{
step: 6,
@@ -182,7 +199,9 @@ export default defineComponent({
checkOk: function () {
return true
},
checkOkReal: function () { return this.checkOk() },
icon: 'fas fa-tshirt',
required: false,
},
]
@@ -302,6 +321,14 @@ export default defineComponent({
}
function isNextDisable() {
try {
return arrStep[step.value - 1].required && !arrStep[step.value - 1].checkOk()
} catch (e) {
return false
}
}
function numStepCompleted() {
return prStep.value
}
@@ -327,6 +354,37 @@ export default defineComponent({
}
function isAskedToCircuit(): boolean {
return !!(mycircuit.value && ((!userStore.IsMyCircuitByName(mycircuit.value.name) && !userStore.IsAskedCircuitByName(mycircuit.value.name))))
}
function isSalta() {
return step.value === STEP_CIRCUIT && (mycircuit.value && isAskedToCircuit())
}
function askToConfirmSkip() {
return $q.dialog({
message: t('circuit.skipentercircuit'),
html: true,
ok: {
label: t('dialog.yes'),
push: false,
},
title: '',
cancel: true,
persistent: false,
}).onOk(() => {
step.value++
return true
}).onCancel(() => {
return false
})
}
function getColorDone(step: number) {
return arrStep[step - 1].checkOkReal() ? 'positive' : 'negative'
}
onMounted(mounted)
return {
@@ -349,6 +407,7 @@ export default defineComponent({
mycircuit,
userStore,
clickFinish,
isNextDisable,
mycards,
filtroutente,
getColor,
@@ -357,6 +416,9 @@ export default defineComponent({
getColorTutorial,
getFirstStepToFill,
STEP_CIRCUIT,
isSalta,
askToConfirmSkip,
getColorDone,
}
},
})