edit business owner
This commit is contained in:
@@ -4,14 +4,20 @@
|
||||
:services="landingServices"
|
||||
:loading-services="loadingLandingServices"
|
||||
:services-error="landingServicesError"
|
||||
:booking-enabled="canBookSingleBusiness"
|
||||
/>
|
||||
|
||||
<WebAppLayout v-else-if="showMobileLanding">
|
||||
<HomeHeroSection @book="goToBooking" @browse="scrollToServices" />
|
||||
<HomeHeroSection
|
||||
:show-book-button="canBookSingleBusiness"
|
||||
@book="goToBooking"
|
||||
@browse="scrollToServices"
|
||||
/>
|
||||
<HomeServicesSection
|
||||
:items="landingServices"
|
||||
:loading="loadingLandingServices"
|
||||
:error="landingServicesError"
|
||||
:booking-enabled="canBookSingleBusiness"
|
||||
/>
|
||||
<HomeFeatureBar />
|
||||
</WebAppLayout>
|
||||
@@ -43,13 +49,17 @@ import DesktopDiscoveryPage from '@/components/landing/DesktopDiscoveryPage.vue'
|
||||
import DesktopLandingPage from '@/components/landing/DesktopLandingPage.vue';
|
||||
import BusinessCardSkeleton from '@/components/ui/BusinessCardSkeleton.vue';
|
||||
import WebAppLayout from '@/layouts/WebAppLayout.vue';
|
||||
import { useOwnedBusiness } from '@/composables/useOwnedBusiness';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { useTenantStore } from '@/stores/tenant';
|
||||
import type { LandingServiceItem } from '@/types/landing';
|
||||
import { fetchLandingServices } from '@/utils/landing-services';
|
||||
|
||||
const isDesktop = useMediaQuery('(min-width: 1024px)');
|
||||
const router = useRouter();
|
||||
const auth = useAuthStore();
|
||||
const tenant = useTenantStore();
|
||||
const { ensureLoaded, isOwnBusiness } = useOwnedBusiness();
|
||||
|
||||
const landingServices = ref<LandingServiceItem[]>([]);
|
||||
const loadingLandingServices = ref(false);
|
||||
@@ -67,6 +77,12 @@ const showSingleBusinessLanding = computed(
|
||||
() => showDesktopLanding.value || showMobileLanding.value,
|
||||
);
|
||||
|
||||
const canBookSingleBusiness = computed(() => {
|
||||
const businessId = tenant.singleBusinessId;
|
||||
if (!businessId) return true;
|
||||
return !isOwnBusiness(businessId);
|
||||
});
|
||||
|
||||
async function loadLandingServices() {
|
||||
if (!tenant.singleBusinessId) return;
|
||||
|
||||
@@ -87,6 +103,11 @@ function scrollToServices() {
|
||||
}
|
||||
|
||||
function goToBooking() {
|
||||
if (!canBookSingleBusiness.value) {
|
||||
void router.push({ name: 'app-owner' });
|
||||
return;
|
||||
}
|
||||
|
||||
const id = tenant.singleBusinessId;
|
||||
if (!id) {
|
||||
scrollToServices();
|
||||
@@ -106,6 +127,11 @@ watch(showSingleBusinessLanding, (show) => {
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
if (auth.isLoggedIn) {
|
||||
await auth.loadUser();
|
||||
await ensureLoaded();
|
||||
}
|
||||
|
||||
await tenant.bootstrap();
|
||||
|
||||
if (showSingleBusinessLanding.value) {
|
||||
|
||||
Reference in New Issue
Block a user