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]);
|
const WA_LINK = useMemo(() => `https://wa.me/${WA_NUMBER}?text=${waText}`, [WA_NUMBER, waText]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (request?.autoOpenWhatsApp) {
|
// ✅ Auto open WhatsApp (more reliable than window.open): redirect same tab
|
||||||
window.open(WA_LINK, '_blank', 'noopener,noreferrer');
|
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]);
|
}, [request, WA_LINK]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container maxWidth="lg" sx={{ py: 8 }}>
|
<Container maxWidth="lg" sx={{ py: 8 }}>
|
||||||
<Box sx={{ textAlign: 'center', mb: 4 }}>
|
<Box sx={{ textAlign: 'center', mb: 4 }}>
|
||||||
<Typography variant="h3" component="h1" gutterBottom>
|
<Typography variant="h3" component="h1" gutterBottom>
|
||||||
Booking Request Sent
|
Confirm Your Booking on WhatsApp
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="h5" color="text.secondary">
|
<Typography variant="h5" color="text.secondary">
|
||||||
We received your request ✅
|
Almost done — please send the WhatsApp message ✅
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box sx={{ display: 'flex', justifyContent: 'center' }}>
|
<Box sx={{ display: 'flex', justifyContent: 'center' }}>
|
||||||
<Paper sx={{ p: 4, width: '100%', maxWidth: 720 }}>
|
<Paper sx={{ p: 4, width: '100%', maxWidth: 720 }}>
|
||||||
<Typography variant="body1" sx={{ textAlign: 'center', mb: 3 }}>
|
<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>
|
</Typography>
|
||||||
|
|
||||||
{request && (
|
{request && (
|
||||||
|
|||||||
Reference in New Issue
Block a user