|
@@ -5,6 +5,7 @@
|
|
|
:style="{ height: 'env(safe-area-inset-top)' }"
|
|
:style="{ height: 'env(safe-area-inset-top)' }"
|
|
|
>
|
|
>
|
|
|
</q-header>
|
|
</q-header>
|
|
|
|
|
+
|
|
|
<q-page-container>
|
|
<q-page-container>
|
|
|
<q-page class="bg-surface main-layout-page" style="overflow: hidden;">
|
|
<q-page class="bg-surface main-layout-page" style="overflow: hidden;">
|
|
|
<q-scroll-area
|
|
<q-scroll-area
|
|
@@ -25,17 +26,24 @@
|
|
|
</q-scroll-area>
|
|
</q-scroll-area>
|
|
|
</q-page>
|
|
</q-page>
|
|
|
</q-page-container>
|
|
</q-page-container>
|
|
|
|
|
+
|
|
|
<q-footer class="provider-bottom-nav bg-white">
|
|
<q-footer class="provider-bottom-nav bg-white">
|
|
|
<nav class="provider-bottom-nav-inner">
|
|
<nav class="provider-bottom-nav-inner">
|
|
|
<router-link
|
|
<router-link
|
|
|
v-for="item in navItems"
|
|
v-for="item in navItems"
|
|
|
:key="item.name"
|
|
:key="item.name"
|
|
|
|
|
+ :class="{ 'provider-bottom-nav-item--active': isNavItemActive(item) }"
|
|
|
:to="{ name: item.name }"
|
|
:to="{ name: item.name }"
|
|
|
class="provider-bottom-nav-item"
|
|
class="provider-bottom-nav-item"
|
|
|
- :class="{ 'provider-bottom-nav-item--active': isNavItemActive(item) }"
|
|
|
|
|
>
|
|
>
|
|
|
<q-icon :name="item.icon" class="provider-bottom-nav-icon font30" />
|
|
<q-icon :name="item.icon" class="provider-bottom-nav-icon font30" />
|
|
|
- <span class="provider-bottom-nav-label font12" :class="isNavItemActive(item) ? 'fontbold' : 'fontregular'">{{ item.label }}</span>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <span
|
|
|
|
|
+ class="provider-bottom-nav-label font12"
|
|
|
|
|
+ :class="isNavItemActive(item) ? 'fontbold' : 'fontregular'"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ item.label }}
|
|
|
|
|
+ </span>
|
|
|
</router-link>
|
|
</router-link>
|
|
|
</nav>
|
|
</nav>
|
|
|
</q-footer>
|
|
</q-footer>
|
|
@@ -43,9 +51,13 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { computed, useTemplateRef, watch } from "vue";
|
|
|
|
|
-import { useRoute } from "vue-router";
|
|
|
|
|
|
|
+import { computed, onMounted, useTemplateRef, watch } from "vue";
|
|
|
import { useI18n } from "vue-i18n";
|
|
import { useI18n } from "vue-i18n";
|
|
|
|
|
+import { useQuasar } from "quasar";
|
|
|
|
|
+import { useRoute } from "vue-router";
|
|
|
|
|
+import { userStore } from "src/stores/user";
|
|
|
|
|
+import MissingBankDataDialog from "src/components/profile/MissingBankDataDialog.vue";
|
|
|
|
|
+import ProfileBankDataDialog from "src/components/profile/ProfileBankDataDialog.vue";
|
|
|
|
|
|
|
|
defineOptions({
|
|
defineOptions({
|
|
|
name: "MainLayout",
|
|
name: "MainLayout",
|
|
@@ -54,9 +66,13 @@ defineOptions({
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
|
const scrollAreaRef = useTemplateRef("scrollAreaRef");
|
|
const scrollAreaRef = useTemplateRef("scrollAreaRef");
|
|
|
const { t } = useI18n();
|
|
const { t } = useI18n();
|
|
|
|
|
+const $q = useQuasar();
|
|
|
|
|
+const user = userStore();
|
|
|
|
|
|
|
|
let oldValue = route.path;
|
|
let oldValue = route.path;
|
|
|
|
|
|
|
|
|
|
+let missingBankDataAlertShown = false;
|
|
|
|
|
+
|
|
|
const navItems = computed(() => [
|
|
const navItems = computed(() => [
|
|
|
{
|
|
{
|
|
|
name: "DashboardPage",
|
|
name: "DashboardPage",
|
|
@@ -80,12 +96,61 @@ const navItems = computed(() => [
|
|
|
},
|
|
},
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
-const isNavItemActive = (item) => route.name === item.name;
|
|
|
|
|
-
|
|
|
|
|
const scrollAreaHeight = computed(() => {
|
|
const scrollAreaHeight = computed(() => {
|
|
|
return 'height: calc(100dvh - env(safe-area-inset-top) - 60px - env(safe-area-inset-bottom)) !important;';
|
|
return 'height: calc(100dvh - env(safe-area-inset-top) - 60px - env(safe-area-inset-bottom)) !important;';
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+const checkMissingBankData = async () => {
|
|
|
|
|
+ if (!user.user?.provider && !user.user?.provider_id) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ await user.fetchUser();
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('Erro ao carregar dados do prestador:', error);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ openMissingBankDataAlert();
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const hasCompleteBankAccount = () => {
|
|
|
|
|
+ const provider = user.user?.provider;
|
|
|
|
|
+
|
|
|
|
|
+ const bankAccount = provider?.recipient_default_bank_account;
|
|
|
|
|
+
|
|
|
|
|
+ if (!provider || !bankAccount || !Object.keys(bankAccount).length) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return Boolean(
|
|
|
|
|
+ bankAccount.bank
|
|
|
|
|
+ && bankAccount.branch_number
|
|
|
|
|
+ && bankAccount.account_number
|
|
|
|
|
+ && bankAccount.account_check_digit,
|
|
|
|
|
+ );
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const isNavItemActive = (item) => route.name === item.name;
|
|
|
|
|
+
|
|
|
|
|
+const openBankDataDialog = () => {
|
|
|
|
|
+ $q.dialog({
|
|
|
|
|
+ component: ProfileBankDataDialog,
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const openMissingBankDataAlert = () => {
|
|
|
|
|
+ if (missingBankDataAlertShown || hasCompleteBankAccount()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ missingBankDataAlertShown = true;
|
|
|
|
|
+
|
|
|
|
|
+ $q.dialog({
|
|
|
|
|
+ component: MissingBankDataDialog,
|
|
|
|
|
+ }).onOk(openBankDataDialog);
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
watch(
|
|
watch(
|
|
|
() => route.path,
|
|
() => route.path,
|
|
|
(value) => {
|
|
(value) => {
|
|
@@ -96,6 +161,10 @@ watch(
|
|
|
oldValue = value;
|
|
oldValue = value;
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
|
|
+
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ checkMissingBankData();
|
|
|
|
|
+});
|
|
|
</script>
|
|
</script>
|
|
|
<style scoped>
|
|
<style scoped>
|
|
|
.main-layout {
|
|
.main-layout {
|