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