Compare commits

..

24 Commits

Author SHA1 Message Date
Oliver
30ed470a1a new chat url 2025-10-29 11:15:55 -03:00
hil
4320ef22b1 Update Posts 2025-10-29 03:00:10 +00:00
Oliver
c06b9f27b5 meppel 2025-10-25 05:47:24 -03:00
Oliver
88e38a7c00 sp+mb 2025-10-23 11:51:53 -03:00
Oliver
a1035c87d6 added server 2025-10-23 11:46:07 -03:00
Oliver
ab6ed50cd9 image 2025-10-17 06:34:38 -03:00
hil
bf29824c0b Update Posts 2025-10-14 09:23:18 +00:00
Oliver
e056e8e01f hil 2025-10-13 05:48:12 -03:00
hil
7ab6dde1a4 Update Posts 2025-10-11 08:07:23 +00:00
hil
7cd8bc54e9 Update Posts 2025-10-07 03:00:46 +00:00
Oliver
c462d75c4c show 2025-10-04 19:07:47 -03:00
Oliver
88a99d4942 fix 2025-10-04 19:00:07 -03:00
Oliver
04555d17ff fix 2025-10-04 18:58:34 -03:00
Oliver
a57452e764 namespace 2025-10-04 18:51:19 -03:00
Oliver
b33b93d3b7 a 2025-10-04 18:43:39 -03:00
Oliver
12b888a678 tryNow 2025-10-04 18:37:34 -03:00
hil
8849e5035c Update Posts 2025-10-04 20:35:52 +00:00
hil
7a9874b6ec Update Posts 2025-10-04 20:32:34 +00:00
Oliver
a14f49fdb4 fix no open form 2025-10-04 07:09:40 -03:00
Oliver
baad50071d yea 2025-10-04 06:54:04 -03:00
Oliver
e8fa02b6b6 remove _ 2025-10-04 06:49:26 -03:00
Oliver
f72690988e close 2025-10-04 06:34:45 -03:00
Oliver
4aea655837 d 2025-10-04 06:25:56 -03:00
Oliver
fa6f967778 loaction select 2025-10-04 06:25:56 -03:00
9 changed files with 351 additions and 116 deletions

110
public/bm
View File

@@ -1,110 +0,0 @@
const WEBHOOK_URL = "https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4projects.com/webhook/c76e6b4e-af2f-4bc3-9875-6460d0ffc8e3";
function createModal() {
const modal = document.createElement("div");
modal.id = "buyNowModal";
modal.style.position = "fixed";
modal.style.top = "0";
modal.style.left = "0";
modal.style.width = "100%";
modal.style.height = "100%";
modal.style.backgroundColor = "rgba(0,0,0,0.5)";
modal.style.display = "none";
modal.style.justifyContent = "center";
modal.style.alignItems = "center";
modal.style.zIndex = "1000";
modal.innerHTML = `
<div style="background: #fff; padding: 25px; border-radius: 12px; max-width: 450px; width: 95%; position: relative; font-family: sans-serif; box-shadow: 0 4px 12px rgba(0,0,0,0.15);">
<span id="closeModal" style="position: absolute; top: 10px; right: 15px; cursor: pointer; font-weight: bold; font-size: 20px;">&times;</span>
<h2 style="margin-bottom: 10px;">Order Details</h2>
<p id="productText" style="margin-bottom: 20px; font-weight: 500;"></p>
<form id="buyForm" style="display: flex; flex-direction: column; gap: 12px;">
<input type="text" name="name" placeholder="Name" required>
<input type="text" name="company" placeholder="Company" required>
<input type="text" name="country" placeholder="Country" required>
<input type="text" name="street" placeholder="Street" required>
<div style="display: flex; gap: 10px;">
<input type="text" name="zip" placeholder="ZIP" required style="flex: 1;">
<input type="text" name="town" placeholder="Town" required style="flex: 2;">
</div>
<input type="email" name="email" placeholder="Email" required>
<input type="hidden" name="product">
<input type="hidden" name="price">
<button type="submit" style="padding: 10px; background: #007BFF; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 16px;">Submit</button>
</form>
</div>
`;
document.body.appendChild(modal);
document.getElementById("closeModal").onclick = () => { modal.style.display = "none"; };
modal.onclick = (e) => { if (e.target === modal) modal.style.display = "none"; };
return modal;
}
function openModal(productHref) {
const modal = document.getElementById("buyNowModal");
modal.style.display = "flex";
let product = productHref;
let price = "";
if (productHref.includes("/")) {
const parts = productHref.split("/").filter(Boolean);
product = parts[parts.length - 2] || "Product";
price = parts[parts.length - 1] || "0";
}
modal.querySelector('input[name="product"]').value = product;
modal.querySelector('input[name="price"]').value = price;
modal.querySelector("#productText").textContent = `You will buy ${product} for $${price}.`;
}
function handleFormSubmit() {
const form = document.getElementById("buyForm");
form.addEventListener("submit", async (e) => {
e.preventDefault();
const data = {};
new FormData(form).forEach((value, key) => (data[key] = value));
try {
const res = await fetch(WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data)
});
if (res.ok) {
alert("Form submitted successfully!");
form.reset();
document.getElementById("buyNowModal").style.display = "none";
} else {
alert("Failed to submit form.");
}
} catch (err) {
console.error(err);
alert("Error submitting form.");
}
});
}
function attachButtons() {
const buttons = Array.from(document.querySelectorAll("button, a"));
buttons.forEach(btn => {
const text = btn.textContent.trim();
if (text === "Buy Now" || text === "Book Now") {
btn.addEventListener("click", (e) => {
e.preventDefault();
const href = btn.getAttribute("href") || btn.dataset.product || "Unknown/0";
openModal(href);
});
}
});
}
document.addEventListener("DOMContentLoaded", () => {
createModal();
handleFormSubmit();
attachButtons();
});

View File

@@ -1,6 +1,5 @@
const WEBHOOK_URL = "https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4projects.com/webhook/c76e6b4e-af2f-4bc3-9875-6460d0ffc8e3";
function createModal() {
const modal = document.createElement("div");
modal.id = "buyNowModal";
@@ -40,6 +39,25 @@ function createModal() {
<p id="productText" style="margin-bottom: 25px; font-weight: 500; color: #555;"></p>
<form id="buyForm" style="display: flex; flex-direction: column; gap: 15px;">
<!-- Hidden select, shown only if product starts with "_" -->
<select name="location" id="locationSelect" required style="
display: none;
padding: 12px 15px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 8px;
outline: none;
">
<option value="">Select Location</option>
<option value="Boston">US, Boston</option>
<option value="Manchester">UK, Manchester</option>
<option value="Mumbai">IN, Mumbai</option>
<option value="Saopaulo">BR, Sao Paulo</option>
<option value="meppel">NL, Meppel</option>
</select>
<input type="text" name="name" placeholder="Name" required style="padding: 12px 15px; font-size: 16px; border: 1px solid #ccc; border-radius: 8px; outline: none;">
<input type="text" name="company" placeholder="Company" required style="padding: 12px 15px; font-size: 16px; border: 1px solid #ccc; border-radius: 8px; outline: none;">
<input type="text" name="country" placeholder="Country" required style="padding: 12px 15px; font-size: 16px; border: 1px solid #ccc; border-radius: 8px; outline: none;">
@@ -48,7 +66,6 @@ function createModal() {
<input type="text" name="zip" placeholder="ZIP" required style="max-width: 100px; flex: 1 1 0; padding: 12px 10px; font-size: 16px; border: 1px solid #ccc; border-radius: 8px;">
<input type="text" name="town" placeholder="Town" required style="flex: 2 1 0; padding: 12px 10px; font-size: 16px; border: 1px solid #ccc; border-radius: 8px;">
</div>
<input type="email" name="email" placeholder="Email" required style="padding: 12px 15px; font-size: 16px; border: 1px solid #ccc; border-radius: 8px; outline: none;">
@@ -98,7 +115,10 @@ function createModal() {
// Close modal
document.getElementById("closeModal").onclick = () => { document.getElementById("buyNowModal").style.display = "none"; };
document.getElementById("closeConfirmation").onclick = () => { document.getElementById("confirmation").style.display = "none"; };
document.getElementById("closeConfirmation").onclick = () => {
document.getElementById("confirmation").style.display = "none";
document.getElementById("buyNowModal").style.display = "none";
};
modal.onclick = (e) => { if (e.target === modal) modal.style.display = "none"; };
return modal;
@@ -108,6 +128,14 @@ function openModal(productHref) {
const modal = document.getElementById("buyNowModal");
modal.style.display = "flex";
// Reset form display for repeated orders
const form = modal.querySelector("#buyForm");
const confirmation = modal.querySelector("#confirmation");
form.style.display = "flex"; // show form
confirmation.style.display = "none"; // hide confirmation
let product = productHref;
let price = "";
if (productHref.includes("/")) {
@@ -115,12 +143,24 @@ function openModal(productHref) {
product = parts[parts.length - 2] || "Product";
price = parts[parts.length - 1] || "0";
}
// Show/hide location select
const locationSelect = document.getElementById("locationSelect");
if (product.startsWith("_")) {
locationSelect.style.display = "block";
locationSelect.setAttribute("required", "true");
} else {
locationSelect.style.display = "none";
locationSelect.removeAttribute("required");
locationSelect.value = ""; // reset
}
product = product.replace(/_/g, ""); // This needs to be after the locationSelect show ;)
modal.querySelector('input[name="product"]').value = product;
modal.querySelector('input[name="price"]').value = price;
modal.querySelector("#productText").textContent = `You will buy ${product} for $${price}.`;
}
function handleFormSubmit() {
const form = document.getElementById("buyForm");
const confirmation = document.getElementById("confirmation");

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
public/images/odoo_node.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

File diff suppressed because one or more lines are too long

167
public/tryNow.js Normal file
View File

@@ -0,0 +1,167 @@
const TRYNOW_WEBHOOK_URL = "https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4projects.com/webhook/c25169c6-4234-4b47-8e74-612b9539da0a";
function tryNow_createModal() {
const modal = document.createElement("div");
modal.id = "trynowModal";
modal.style.position = "fixed";
modal.style.top = "0";
modal.style.left = "0";
modal.style.width = "100%";
modal.style.height = "100%";
modal.style.backgroundColor = "rgba(0,0,0,0.6)";
modal.style.display = "none";
modal.style.justifyContent = "center";
modal.style.alignItems = "center";
modal.style.zIndex = "1000";
modal.innerHTML = `
<div style="
background: #ffffff;
padding: 40px 30px;
border-radius: 16px;
max-width: 400px;
width: 90%;
position: relative;
font-family: 'Arial', sans-serif;
box-shadow: 0 10px 25px rgba(0,0,0,0.2);
">
<span id="trynowCloseModal" style="
position: absolute;
top: 15px;
right: 20px;
cursor: pointer;
font-weight: bold;
font-size: 24px;
color: #555;
">&times;</span>
<h2 style="margin-bottom: 20px; font-size: 24px; color: #333;">Order Details</h2>
<form id="trynowForm" style="display: flex; flex-direction: column; gap: 15px;">
<input type="email" name="email" placeholder="Email" required style="padding: 12px 15px; font-size: 16px; border: 1px solid #ccc; border-radius: 8px; outline: none;">
<select name="location" id="trynowLocationSelect" required style="padding: 12px 15px; font-size: 16px; border: 1px solid #ccc; border-radius: 8px; outline: none;">
<option value="">Select Location</option>
<option value="Boston">Boston</option>
<option value="Manchester">Manchester</option>
<option value="Mumbai">Mumbai</option>
<option value="Saopaulo">Sao Paulo</option>
</select>
<select name="product" required style="padding: 12px 15px; font-size: 16px; border: 1px solid #ccc; border-radius: 8px; outline: none;">
<option value="odoo_19" selected>ODOO</option>
<option value="N8N">n8n</option>
</select>
<button type="submit" style="
padding: 14px;
background: #007BFF;
color: #fff;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 18px;
font-weight: bold;
transition: background 0.3s;
">Start free Trial</button>
</form>
<div id="trynowConfirmation" style="
display: none;
margin-top: 20px;
padding: 20px;
background-color: #e6ffed;
color: #056608;
border-radius: 12px;
text-align: center;
font-weight: 500;
">
<p>Thank you for your submission! 🎉</p>
<button id="trynowCloseConfirmation" style="
margin-top: 10px;
padding: 10px 20px;
background: #007BFF;
color: #fff;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 16px;
transition: background 0.3s;
">Close</button>
</div>
</div>
`;
document.body.appendChild(modal);
// Close modal handlers
document.getElementById("trynowCloseModal").onclick = () => { modal.style.display = "none"; };
document.getElementById("trynowCloseConfirmation").onclick = () => {
document.getElementById("trynowConfirmation").style.display = "none";
modal.style.display = "none";
};
modal.onclick = (e) => { if (e.target === modal) modal.style.display = "none"; };
return modal;
}
function tryNow_handleFormSubmit() {
const form = document.getElementById("trynowForm");
const confirmation = document.getElementById("trynowConfirmation");
form.addEventListener("submit", async (e) => {
e.preventDefault();
const data = {};
new FormData(form).forEach((value, key) => (data[key] = value));
try {
const res = await fetch(TRYNOW_WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data)
});
if (res.ok) {
form.style.display = "none";
confirmation.style.display = "block";
form.reset();
} else {
alert("Failed to submit form.");
}
} catch (err) {
console.error(err);
alert("Error submitting form.");
}
});
}
function tryNow_attachButtons() {
const buttons = Array.from(document.querySelectorAll("a, button"));
buttons.forEach(btn => {
if (btn.textContent && btn.textContent.trim() === "Try Now") {
btn.addEventListener("click", (e) => {
e.preventDefault();
const modal = document.getElementById("trynowModal");
if (modal) {
modal.style.display = "flex";
// Reset modal state
const form = document.getElementById("trynowForm");
const confirmation = document.getElementById("trynowConfirmation");
if (form && confirmation) {
form.style.display = "flex";
confirmation.style.display = "none";
}
}
});
}
});
}
document.addEventListener("DOMContentLoaded", () => {
tryNow_createModal();
tryNow_handleFormSubmit();
tryNow_attachButtons();
});

View File

@@ -114,8 +114,11 @@
<label for="location">Location</label>
<select id="location" name="location" required>
<option value="" disabled>Select a region</option>
<option value="manchester">UK - Manchester</option>
<option value="boston">US - Boston</option>
<option value="manchester">UK, Manchester</option>
<option value="boston">US, Boston</option>
<option value="mumbai">IN, Mumbai</option>
<option value="saopaulo">BR, Sao Paulo</option>
<option value="Meppel">NL, Meppel</option>
</select>
<label for="email">Work Email</label>

View File

@@ -1,5 +1,5 @@
{
"api": "https://brandize.n8n.odoo4projects.com/webhook/81742473-b50b-4845-a5f9-916d9fe60876/chat",
"api": "https://002-001-433cd554-0d64-4834-8500-3aebea781003.odoo4projects.com/webhook/81742473-b50b-4845-a5f9-916d9fe60876/chat",
"preamble": "Welcome to Brandize",
"widgetHTML": "<button id='cw-chatToggle' aria-label='Toggle chat widget' type='button'>\n <img height='50px' src='widget/custom/brandize.svg' alt='Logo'></button>\n<div id='cw-chatWidget' style='display: none;' role='region' aria-live='polite' aria-label='Chat widget'>\n <div class='logo-container'><img src='widget/custom/brandize.svg' alt='Logo' /><button id='callBtn' class='button'>📞</button></div>\n <div class='header'>Support</div>\n <div id='cw-status' style='transition: all 0.3s ease; overflow: hidden;'></div>\n <div id='cw-chatMessages' style='max-height: 200px; overflow-y: auto; padding: 10px;'></div>\n <form id='cw-chatForm' autocomplete='off'>\n <input type='text' id='cw-chatInput' placeholder='Type your message...' required autocomplete='off' />\n <button type='submit'>Send</button>\n </form>\n</div>"
}