diff --git a/script.js b/script.js
index 8230588..e4856a5 100644
--- a/script.js
+++ b/script.js
@@ -796,10 +796,74 @@ var si = 0,
document.querySelectorAll('.btn-empire').forEach(function(btn) {
btn.addEventListener('click', function() {
- var plan = this.getAttribute('data-plan');
- var price = parseFloat(this.getAttribute('data-price'));
- var isEmpire = this.getAttribute('data-is-empire') === 'true';
- if (plan) openOrderWidget(plan, price, isEmpire);
+ openCustomQuoteModal();
+ });
+ });
+
+ /* ---- Custom Quote Modal ---- */
+ function openCustomQuoteModal() {
+ document.getElementById('customQuotePanel').style.display = 'block';
+ document.getElementById('customQuoteModal').style.display = 'flex';
+ }
+ function closeCustomQuoteModal() {
+ document.getElementById('customQuoteModal').style.display = 'none';
+ document.getElementById('customQuoteForm').reset();
+ document.getElementById('customQuoteSuccess').style.display = 'none';
+ }
+ document.addEventListener('keydown', function(e) {
+ if (e.key === 'Escape') {
+ var modal = document.getElementById('customQuoteModal');
+ if (modal && modal.style.display === 'flex') {
+ closeCustomQuoteModal();
+ }
+ }
+ });
+
+ /* Submit custom quote form */
+ var customQuoteForm = document.getElementById('customQuoteForm');
+ if (customQuoteForm) {
+ customQuoteForm.addEventListener('submit', function(e) {
+ e.preventDefault();
+ var name = document.getElementById('cqName').value.trim();
+ var email = document.getElementById('cqEmail').value.trim();
+ var requirements = document.getElementById('cqRequirements').value.trim();
+
+ if (!name || !email || !requirements) return;
+
+ var submitBtn = customQuoteForm.querySelector('.btn-lg');
+ submitBtn.textContent = 'Sending...';
+ submitBtn.disabled = true;
+
+ fetch('https://n8n.odoo4projects.com/webhook/ODOO4projects/crm', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(UTM.inject({
+ name: name,
+ email: email,
+ requirements: requirements
+ }))
+ }).then(function() {
+ customQuoteForm.style.display = 'none';
+ document.getElementById('customQuoteSuccess').style.display = 'block';
+ submitBtn.textContent = 'Submit Request';
+ submitBtn.disabled = false;
+ }).catch(function() {
+ submitBtn.textContent = 'Submit Request';
+ submitBtn.disabled = false;
+ var errorMsg = document.createElement('div');
+ errorMsg.style.marginTop = '1rem';
+ errorMsg.style.color = '#dc3545';
+ errorMsg.textContent = 'Something went wrong. Please try again.';
+ customQuoteForm.appendChild(errorMsg);
+ setTimeout(function() { if(errorMsg.parentNode) errorMsg.parentNode.removeChild(errorMsg); }, 3000);
+ });
+ });
+ }
+
+ /* Attach "Get Custom Quote" click handlers to Empire buttons */
+ document.querySelectorAll('.btn-empire').forEach(function(btn) {
+ btn.addEventListener('click', function() {
+ openCustomQuoteModal();
});
});
})();