implement unified checkout address layout with dynamic delivery/pickup selection and Uber delivery fee integration

This commit is contained in:
Alaguraj0361 2026-04-06 22:33:39 +05:30
parent d06d252b94
commit 0334bb324c

View File

@ -23,11 +23,17 @@
<!-- 3. MAIN FORM: Optimized Pickup/Delivery Layout -->
<template id="chennora_address_unified" inherit_id="website_sale.address" name="Chennora Address Unified" priority="99">
<!-- Safely hide the 'Billing address' title -->
<!-- Hide the 'Billing address' title -->
<xpath expr="//div[contains(@class, 'oe_cart')]//*[self::h2 or self::h3][1]" position="attributes">
<attribute name="class" add="d-none" separator=" "/>
</xpath>
<!-- NEW: Hide the yellow 'Be aware' alert box -->
<xpath expr="//div[hasclass('alert-warning')][contains(., 'billing and shipping')]" position="attributes">
<attribute name="class" add="d-none" separator=" "/>
<attribute name="style">display: none !important;</attribute>
</xpath>
<!-- Inject Selection Cards -->
<xpath expr="//form" position="before">
<style>
@ -87,22 +93,19 @@
const msgDiv = document.getElementById('uber_message');
const submitBtn = document.querySelector('button[type="submit"]') || document.querySelector('.btn-primary');
// Select all address-related field containers for aggressive hiding
function getAddressContainers() {
const addressNames = ['street', 'street2', 'city', 'zip', 'country_id', 'state_id'];
let containers = [];
addressNames.forEach(name => {
const input = document.querySelector(`[name="${name}"]`);
if (input) {
// Go up until we hit a col- or the parent with mb- class
const container = input.closest('div[class*="col-"]') || input.closest('.mb-3') || input.closest('.mb-4');
if (container) containers.push(container);
}
});
return [...new Set(containers)]; // Unique containers
return [...new Set(containers)];
}
// Dynamic Address Header
let addrHeader = document.getElementById('dynamic_address_header');
if (!addrHeader &amp;&amp; document.querySelector('[name="street"]')) {
addrHeader = document.createElement('div');
@ -162,11 +165,8 @@
});
}
// Event handlers
const triggers = document.querySelectorAll('input[name="street"], input[name="zip"]');
triggers.forEach(t => t.addEventListener('blur', checkUber));
// Force initial refresh
setOrderType('delivery');
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initUnifiedForm); else initUnifiedForm();