diff --git a/src/app/[slug]/agendar/page.tsx b/src/app/[slug]/agendar/page.tsx index afefce2..2024a1c 100644 --- a/src/app/[slug]/agendar/page.tsx +++ b/src/app/[slug]/agendar/page.tsx @@ -26,6 +26,7 @@ export default function PublicBookingPage({ params }: { params: Promise<{ slug: const [establishment, setEstablishment] = useState({ name: '', type: 'barbearia', description: '', phone: '', address: '', rating: 5.0, reviews: 0, + allowOnlineBooking: true, bookingAdvanceMin: 60, bookingAdvanceMaxDays: 30 }); // Algoritmo dinâmico de fatiamento de grade @@ -68,6 +69,9 @@ export default function PublicBookingPage({ params }: { params: Promise<{ slug: address: fullAddress || '', rating: 5.0, reviews: 0, + allowOnlineBooking: profile.allowOnlineBooking !== false, + bookingAdvanceMin: profile.bookingAdvanceMin || 60, + bookingAdvanceMaxDays: profile.bookingAdvanceMaxDays || 30, }); // Gerar slots com horários do tenant @@ -105,7 +109,8 @@ export default function PublicBookingPage({ params }: { params: Promise<{ slug: }, [slug]); const today = new Date(); - const dates = Array.from({ length: 14 }, (_, i) => { + const maxDays = establishment.bookingAdvanceMaxDays || 30; + const dates = Array.from({ length: maxDays }, (_, i) => { const d = new Date(today); d.setDate(d.getDate() + i); return d; @@ -195,6 +200,20 @@ export default function PublicBookingPage({ params }: { params: Promise<{ slug: ); } + if (!establishment.allowOnlineBooking && !booked) { + return ( +
O agendamento online está temporariamente desativado para este estabelecimento. Por favor, entre em contato diretamente pelo WhatsApp ou telefone.
+