tooltip contact integration updated
This commit is contained in:
parent
6a6d064754
commit
6b285a3ba4
@ -251,7 +251,7 @@ function ChatForm({ onClose }) {
|
||||
if (!formData.phone.trim()) errors.phone = "Phone is required.";
|
||||
if (!formData.service.trim()) errors.service = "Please select a service.";
|
||||
if (!formData.message.trim()) errors.message = "Message is required.";
|
||||
if (!captchaToken) errors.captcha = "Please verify the CAPTCHA.";
|
||||
// if (!captchaToken) errors.captcha = "Please verify the CAPTCHA.";
|
||||
|
||||
setFormErrors(errors);
|
||||
if (Object.keys(errors).length > 0) {
|
||||
@ -260,19 +260,22 @@ function ChatForm({ onClose }) {
|
||||
}
|
||||
|
||||
const emailData = {
|
||||
...formData,
|
||||
name: formData.username,
|
||||
phone: formData.phone,
|
||||
email: formData.email,
|
||||
subject: formData.service,
|
||||
message: `Service: ${formData.service}<br /><br />Message: ${formData.message}`,
|
||||
to: "bloor@rapharehab.ca",
|
||||
senderName: "Rapha Rehab Chat Form",
|
||||
senderName: "Rapha Rehab Contact Page",
|
||||
recaptchaToken: captchaToken,
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await axios.post("https://mailserver.metatronnest.com/send", emailData, {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
|
||||
// console.log("Server response:", res.data);
|
||||
const res = await axios.post(
|
||||
"https://mailserver.metatronnest.com/send",
|
||||
emailData,
|
||||
{ headers: { "Content-Type": "application/json" } }
|
||||
);
|
||||
|
||||
setAlert({
|
||||
show: true,
|
||||
@ -280,18 +283,10 @@ function ChatForm({ onClose }) {
|
||||
message: res?.data?.message || "Message sent successfully!",
|
||||
});
|
||||
|
||||
setFormData({
|
||||
username: "",
|
||||
// lname: "",
|
||||
email: "",
|
||||
phone: "",
|
||||
service: "",
|
||||
message: "",
|
||||
});
|
||||
setFormData({ username: "", email: "", phone: "", service: "", message: "" });
|
||||
setCaptchaToken(null);
|
||||
setFormErrors({});
|
||||
} catch (error) {
|
||||
// console.error("Error sending message:", error);
|
||||
setAlert({
|
||||
show: true,
|
||||
type: "danger",
|
||||
@ -314,10 +309,11 @@ function ChatForm({ onClose }) {
|
||||
zIndex: 2000,
|
||||
maxHeight: "80vh",
|
||||
overflowY: "auto",
|
||||
padding: "20px"
|
||||
}}
|
||||
>
|
||||
<div className="p-3 border-bottom d-flex justify-content-between align-items-center">
|
||||
<h5 style={{ margin: 0, color: "#bc0000" }}>Chat with Us</h5>
|
||||
<h5 className="mb-3" style={{ margin: 0, color: "#bc0000" }}>Chat with Us</h5>
|
||||
<button onClick={onClose} className="btn-close"></button>
|
||||
</div>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user