- comune residenza anche sulla email

- comune non obbligatorio... Skippa
This commit is contained in:
Surya Paolo
2025-11-27 03:14:56 +01:00
parent 2dca358cd3
commit 281be361ba
7 changed files with 117 additions and 19 deletions

View File

@@ -145,7 +145,7 @@ export default defineComponent({
});
const userstoverify = computed(() => {
return userStore.my.profile.userstoverify;
return contact.value.profile.userstoverify;
});
// Step definitions
@@ -159,15 +159,20 @@ export default defineComponent({
},
label: t('tutorial.step_residence'),
checkOk: function (): boolean {
return contact.value
? (!!contact.value.profile.resid_str_comune &&
contact.value.profile.resid_str_comune !== '' &&
contact.value.profile.resid_str_comune !== '0') ||
contact.value.profile.noComune
: false;
},
checkOkReal: function (): boolean {
return contact.value
? !!contact.value.profile.resid_str_comune &&
contact.value.profile.resid_str_comune !== '' &&
contact.value.profile.resid_str_comune !== '0'
: false;
},
checkOkReal: function (): boolean {
return this.checkOk();
},
icon: 'fas fa-map-marker-alt',
required: true,
}));
@@ -185,7 +190,8 @@ export default defineComponent({
return (
userStore.IsMyCircuitByName(mycircuit.value.name) ||
userStore.IsAskedCircuitByName(mycircuit.value.name) ||
userStore.my.profile.noCircuit
contact.value.profile.noCircuit ||
contact.value.profile.noComune
);
}
return false;
@@ -215,9 +221,10 @@ export default defineComponent({
return (
userStore.IsMyCircuitByName(circuititalia.value.name) ||
userStore.IsAskedCircuitByName(circuititalia.value.name) ||
userStore.my.profile.noCircIta ||
userStore.my.profile.noCircuit ||
userStore.my.profile.insert_circuito_ita
contact.value.profile.noCircIta ||
contact.value.profile.noCircuit ||
contact.value.profile.noComune ||
contact.value.profile.insert_circuito_ita
);
}
return false;
@@ -422,6 +429,12 @@ export default defineComponent({
return isSalta(currentStep.value.step);
});
const isCurrentStepComune = computed(() => {
if (!currentStep.value) return false;
// Mostra bottone Salta se lo step corrente è un circuito (locale o italia)
return currentStep.value.step === STEP_CITY;
});
const isCurrentStepCircuit = computed(() => {
if (!currentStep.value) return false;
// Mostra bottone Salta se lo step corrente è un circuito (locale o italia)
@@ -500,7 +513,7 @@ export default defineComponent({
try {
const response = await Api.SendReq('/api/telegram/generate-token', 'POST', {
username: userStore.my.username,
username: contact.value.username,
});
verificationToken.value = response.data.token;
@@ -699,10 +712,9 @@ export default defineComponent({
function isSalta(step: number) {
return (
(step === STEP_CIRCUIT && mycircuit.value && userStore.my.profile.noCircuit) ||
(step === STEP_CIRCUIT_ITALIA &&
circuititalia.value &&
userStore.my.profile.noCircIta)
(step === STEP_CITY && contact.value.profile.noComune) ||
(step === STEP_CIRCUIT && contact.value.profile.noCircuit) ||
(step === STEP_CIRCUIT_ITALIA && contact.value.profile.noCircIta)
);
}
@@ -721,7 +733,7 @@ export default defineComponent({
persistent: false,
})
.onOk(() => {
userStore.savenoCircuit(isAskedToCircuit());
userStore.savenoCircuit(true); // isAskedToCircuit()
// Avanza allo step successivo
if (canGoNext.value) {
goToNextStep();
@@ -733,6 +745,8 @@ export default defineComponent({
});
} else if (mystep === STEP_CIRCUIT_ITALIA) {
askToConfirmSkipItalia(mystep);
} else if (mystep === STEP_CITY) {
askToConfirmSkipComune(mystep);
}
}
@@ -763,6 +777,39 @@ export default defineComponent({
return false;
});
}
function askToConfirmSkipComune(mystep: number) {
let msg = t('circuit.skipcomune');
if (!stepCircuit.value.checkOk()) {
msg = t('circuit.skipcomune_circuiti_non_entrato');
}
return $q
.dialog({
message: msg,
html: true,
ok: {
label: t('dialog.yes'),
push: false,
},
title: '',
cancel: true,
persistent: false,
})
.onOk(() => {
if (mystep === STEP_CITY) {
userStore.savenoComune(true);
}
// Avanza allo step successivo
if (canGoNext.value) {
goToNextStep();
}
return true;
})
.onCancel(() => {
return false;
});
}
// ========================================
// TUTORIAL METHODS
@@ -782,6 +829,7 @@ export default defineComponent({
const firstIncompleteIndex = orderedSteps.value.findIndex(
(step) => !step.completed
);
console.log('firstIncompleteIndex', firstIncompleteIndex);
if (firstIncompleteIndex !== -1) {
currentStepIndex.value = firstIncompleteIndex;
updateExpandedSteps();
@@ -798,6 +846,12 @@ export default defineComponent({
strProv.value,
card.value
);
// Se la provincia selezionata non esiste, mostra comunque il primo Circuito in cui si è entrati !
if (!strProv.value && contact.value.profile.mycircuits.length >= 0) {
mycircuit.value = circuitStore.getCircuitByName(
contact.value.profile.mycircuits[0].circuitname
);
}
if (!globalStore.isPresenteCardsByProv(strProv.value)) {
if (contact.value && contact.value.profile.resid_card) {
contact.value.profile.resid_card = '';
@@ -882,6 +936,11 @@ export default defineComponent({
card.value
);
}
if (!mycircuit.value && !strProv.value && contact.value.profile.mycircuits.length >= 0) {
mycircuit.value = circuitStore.getCircuitByName(
contact.value.profile.mycircuits[0].circuitname
);
}
}
});
@@ -955,6 +1014,7 @@ export default defineComponent({
t,
updateContact,
strProv,
isCurrentStepComune,
};
},
});

View File

@@ -216,11 +216,16 @@
class="q-mt-md"
/>
<p class="step-description">
<p v-if="contact.profile.resid_province" class="step-description">
Entra nel circuito locale per scambiare beni e servizi con le persone
vicino a te.
</p>
<div v-if="!contact.profile.resid_province" class="q-ma-sm q-pa-sm bordered" style="border: 2px solid red;">
⚠️ Attenzione: Se non si sceglie il Comune di Residenza (il passaggio precedente) non è possibile poter scegliere la Provincia in cui accedere al Circuito RIS del tuo territorio.
</div>
<q-select
v-if="mylistcircuits && mylistcircuits.length > 1"
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
@@ -293,9 +298,9 @@
<q-space />
<!-- Bottone Salta (Solo per circuiti) -->
<!-- Bottone Salta (Solo per circuiti e Comune) -->
<q-btn
v-if="isCurrentStepCircuit"
v-if="isCurrentStepCircuit || isCurrentStepComune"
rounded
color="negative"
icon="skip_next"