diff --git a/app/templates/admin/vendor-edit.html b/app/templates/admin/vendor-edit.html index 4dbbf574..9245cacf 100644 --- a/app/templates/admin/vendor-edit.html +++ b/app/templates/admin/vendor-edit.html @@ -200,7 +200,7 @@
Contact Email - (from company) @@ -208,7 +208,7 @@
@@ -305,14 +305,14 @@
Business Address - (from company)
diff --git a/static/admin/js/vendor-edit.js b/static/admin/js/vendor-edit.js index 1df1c662..d5c2d352 100644 --- a/static/admin/js/vendor-edit.js +++ b/static/admin/js/vendor-edit.js @@ -65,15 +65,18 @@ function adminVendorEdit() { this.vendor = response; // Initialize form data + // For contact fields: empty if inherited (shows placeholder), actual value if override this.formData = { name: response.name || '', subdomain: response.subdomain || '', description: response.description || '', - contact_email: response.contact_email || '', - contact_phone: response.contact_phone || '', - website: response.website || '', - business_address: response.business_address || '', - tax_number: response.tax_number || '', + // Contact fields: empty string for inherited (will show company value as placeholder) + contact_email: response.contact_email_inherited ? '' : (response.contact_email || ''), + contact_phone: response.contact_phone_inherited ? '' : (response.contact_phone || ''), + website: response.website_inherited ? '' : (response.website || ''), + business_address: response.business_address_inherited ? '' : (response.business_address || ''), + tax_number: response.tax_number_inherited ? '' : (response.tax_number || ''), + // Marketplace URLs (no inheritance) letzshop_csv_url_fr: response.letzshop_csv_url_fr || '', letzshop_csv_url_en: response.letzshop_csv_url_en || '', letzshop_csv_url_de: response.letzshop_csv_url_de || '' @@ -272,11 +275,6 @@ function adminVendorEdit() { editLog.info(`Resetting ${fieldName} to inherit from company`); this.formData[fieldName] = ''; - - // Update the vendor object to reflect inheritance (UI indicator) - if (this.vendor) { - this.vendor[`${fieldName}_inherited`] = true; - } }, /** @@ -288,23 +286,18 @@ function adminVendorEdit() { const contactFields = ['contact_email', 'contact_phone', 'website', 'business_address', 'tax_number']; contactFields.forEach(field => { this.formData[field] = ''; - if (this.vendor) { - this.vendor[`${field}_inherited`] = true; - } }); Utils.showToast('All contact fields reset to company defaults', 'info'); }, /** - * Check if any contact field has a vendor-level override (not inherited). - * @returns {boolean} True if at least one contact field is overridden + * Check if any contact field has a value (not empty = has override). + * @returns {boolean} True if at least one contact field has a value */ hasAnyContactOverride() { - if (!this.vendor) return false; - const contactFields = ['contact_email', 'contact_phone', 'website', 'business_address', 'tax_number']; - return contactFields.some(field => !this.vendor[`${field}_inherited`]); + return contactFields.some(field => this.formData[field]); } }; }