diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index 5f60372a..6e2d15ce 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -373,6 +373,10 @@ export const shared_consts = { label: 'Con Provincia inserita', value: 16777216, //FILTER_USER_PROVINCE: }, + { + label: 'Con Comune inserito', + value: 8589934592, //FILTER_USER_COMUNE: 8589934592, + }, ], RECFILTRI_UTENTE_FACIL: [ diff --git a/src/components/CProfileCompletitionBanner/CProfileCompletitionBanner.ts b/src/components/CProfileCompletitionBanner/CProfileCompletitionBanner.ts index c7588545..7bac78bd 100755 --- a/src/components/CProfileCompletitionBanner/CProfileCompletitionBanner.ts +++ b/src/components/CProfileCompletitionBanner/CProfileCompletitionBanner.ts @@ -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, }; }, }); diff --git a/src/components/CProfileCompletitionBanner/CProfileCompletitionBanner.vue b/src/components/CProfileCompletitionBanner/CProfileCompletitionBanner.vue index aa6a7d82..6a2362d4 100755 --- a/src/components/CProfileCompletitionBanner/CProfileCompletitionBanner.vue +++ b/src/components/CProfileCompletitionBanner/CProfileCompletitionBanner.vue @@ -216,11 +216,16 @@ class="q-mt-md" /> -
+
Entra nel circuito locale per scambiare beni e servizi con le persone vicino a te.
+