edit booking confirmation
This commit is contained in:
@@ -35,26 +35,38 @@ const BookingConfirmation = () => {
|
||||
const WA_LINK = useMemo(() => `https://wa.me/${WA_NUMBER}?text=${waText}`, [WA_NUMBER, waText]);
|
||||
|
||||
useEffect(() => {
|
||||
if (request?.autoOpenWhatsApp) {
|
||||
window.open(WA_LINK, '_blank', 'noopener,noreferrer');
|
||||
}
|
||||
// ✅ Auto open WhatsApp (more reliable than window.open): redirect same tab
|
||||
if (!request?.autoOpenWhatsApp) return;
|
||||
if (!WA_LINK) return;
|
||||
|
||||
// prevent loop on refresh/back
|
||||
const key = `wa_opened_${request.bookingNumber || request.phone || 'latest'}`;
|
||||
if (sessionStorage.getItem(key)) return;
|
||||
sessionStorage.setItem(key, '1');
|
||||
|
||||
const t = setTimeout(() => {
|
||||
window.location.href = WA_LINK;
|
||||
}, 600);
|
||||
|
||||
return () => clearTimeout(t);
|
||||
}, [request, WA_LINK]);
|
||||
|
||||
return (
|
||||
<Container maxWidth="lg" sx={{ py: 8 }}>
|
||||
<Box sx={{ textAlign: 'center', mb: 4 }}>
|
||||
<Typography variant="h3" component="h1" gutterBottom>
|
||||
Booking Request Sent
|
||||
Confirm Your Booking on WhatsApp
|
||||
</Typography>
|
||||
<Typography variant="h5" color="text.secondary">
|
||||
We received your request ✅
|
||||
Almost done — please send the WhatsApp message ✅
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
<Box sx={{ display: 'flex', justifyContent: 'center' }}>
|
||||
<Paper sx={{ p: 4, width: '100%', maxWidth: 720 }}>
|
||||
<Typography variant="body1" sx={{ textAlign: 'center', mb: 3 }}>
|
||||
Thank you! Our team will contact you soon. You can also confirm faster via WhatsApp.
|
||||
Your request has been recorded. To complete the booking, tap <b>Open WhatsApp</b> below and press <b>Send</b>.
|
||||
Our team will reply to confirm availability.
|
||||
</Typography>
|
||||
|
||||
{request && (
|
||||
|
||||
Reference in New Issue
Block a user