loaction select
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
const WEBHOOK_URL = "https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4projects.com/webhook/c76e6b4e-af2f-4bc3-9875-6460d0ffc8e3";
|
const WEBHOOK_URL = "https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4projects.com/webhook/c76e6b4e-af2f-4bc3-9875-6460d0ffc8e3";
|
||||||
|
|
||||||
|
|
||||||
function createModal() {
|
function createModal() {
|
||||||
const modal = document.createElement("div");
|
const modal = document.createElement("div");
|
||||||
modal.id = "buyNowModal";
|
modal.id = "buyNowModal";
|
||||||
@@ -40,6 +39,21 @@ function createModal() {
|
|||||||
<p id="productText" style="margin-bottom: 25px; font-weight: 500; color: #555;"></p>
|
<p id="productText" style="margin-bottom: 25px; font-weight: 500; color: #555;"></p>
|
||||||
|
|
||||||
<form id="buyForm" style="display: flex; flex-direction: column; gap: 15px;">
|
<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">Boston</option>
|
||||||
|
<option value="Manchester">Manchester</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="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="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;">
|
<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 +62,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="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;">
|
<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>
|
</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;">
|
<input type="email" name="email" placeholder="Email" required style="padding: 12px 15px; font-size: 16px; border: 1px solid #ccc; border-radius: 8px; outline: none;">
|
||||||
|
|
||||||
@@ -119,6 +132,17 @@ function openModal(productHref) {
|
|||||||
modal.querySelector('input[name="product"]').value = product;
|
modal.querySelector('input[name="product"]').value = product;
|
||||||
modal.querySelector('input[name="price"]').value = price;
|
modal.querySelector('input[name="price"]').value = price;
|
||||||
modal.querySelector("#productText").textContent = `You will buy ${product} for $${price}.`;
|
modal.querySelector("#productText").textContent = `You will buy ${product} for $${price}.`;
|
||||||
|
|
||||||
|
// 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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFormSubmit() {
|
function handleFormSubmit() {
|
||||||
|
|||||||
Reference in New Issue
Block a user