diff --git a/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.html b/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.html index e5d4fd1..7d73e68 100644 --- a/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.html +++ b/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.html @@ -1212,7 +1212,7 @@
- @@ -1276,10 +1276,10 @@ onchange={handlePageSizeChange}> A4 -
diff --git a/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.js b/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.js index 2a863c6..bb3cfe1 100644 --- a/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.js +++ b/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.js @@ -830,11 +830,23 @@ export default class PropertyTemplateSelector extends LightningElement { case "sample-template": this.selectedTemplateId = "sample-template"; break; - case "luxury-mansion-template": - this.selectedTemplateId = "luxury-mansion-template"; - break; - default: - break; + case "luxury-mansion-template": + this.selectedTemplateId = "luxury-mansion-template"; + break; + case "modern-home-a3-template": + this.selectedTemplateId = "modern-home-a3-template"; + break; + case "grand-oak-villa-a3-template": + this.selectedTemplateId = "grand-oak-villa-a3-template"; + break; + case "serenity-house-a3-template": + this.selectedTemplateId = "serenity-house-a3-template"; + break; + case "luxury-mansion-a3-template": + this.selectedTemplateId = "luxury-mansion-a3-template"; + break; + default: + break; } // Visually mark the selected template card with a black border @@ -1143,24 +1155,52 @@ export default class PropertyTemplateSelector extends LightningElement { // Initialize viewport with exact PDF dimensions this.initializeViewportDimensions(); - // Special handling for A3 mode to prevent image reset - if (newPageSize === "A3") { - console.log("A3 mode selected - preserving all image positions"); - // For A3, we need to be extra careful about position preservation - setTimeout(() => { - this.restoreCurrentImageState(currentImageState); - // Additional position preservation for A3 - this.preserveElementPositions(); - // Extra A3-specific position lock - setTimeout(() => { - this.preserveElementPositions(); - console.log("A3 mode - final position preservation completed"); - }, 100); - }, 300); - } else { - // Normal restoration for other page sizes - this.restoreCurrentImageState(currentImageState); - } + // Switch to appropriate A3 template if switching to A3, or back to A4 template + if (newPageSize === "A3") { + // Switch to A3 version of current template + if (this.selectedTemplateId === "modern-home-template") { + this.selectedTemplateId = "modern-home-a3-template"; + } else if (this.selectedTemplateId === "grand-oak-villa-template") { + this.selectedTemplateId = "grand-oak-villa-a3-template"; + } else if (this.selectedTemplateId === "serenity-house-template") { + this.selectedTemplateId = "serenity-house-a3-template"; + } else if (this.selectedTemplateId === "luxury-mansion-template") { + this.selectedTemplateId = "luxury-mansion-a3-template"; + } + } else if (newPageSize === "A4") { + // Switch back to A4 version of current template + if (this.selectedTemplateId === "modern-home-a3-template") { + this.selectedTemplateId = "modern-home-template"; + } else if (this.selectedTemplateId === "grand-oak-villa-a3-template") { + this.selectedTemplateId = "grand-oak-villa-template"; + } else if (this.selectedTemplateId === "serenity-house-a3-template") { + this.selectedTemplateId = "serenity-house-template"; + } else if (this.selectedTemplateId === "luxury-mansion-a3-template") { + this.selectedTemplateId = "luxury-mansion-template"; + } + } + + // Clear cached content to force regeneration with new template + this.cachedTemplateContent = null; + + // Special handling for A3 mode to prevent image reset + if (newPageSize === "A3") { + console.log("A3 mode selected - preserving all image positions"); + // For A3, we need to be extra careful about position preservation + setTimeout(() => { + this.restoreCurrentImageState(currentImageState); + // Additional position preservation for A3 + this.preserveElementPositions(); + // Extra A3-specific position lock + setTimeout(() => { + this.preserveElementPositions(); + console.log("A3 mode - final position preservation completed"); + }, 100); + }, 300); + } else { + // Normal restoration for other page sizes + this.restoreCurrentImageState(currentImageState); + } // Re-fit to width when page size changes setTimeout(() => this.fitToWidth(), 0); @@ -4109,6 +4149,14 @@ export default class PropertyTemplateSelector extends LightningElement { return this.createSerenityHouseTemplate(); case "luxury-mansion-template": return this.createLuxuryMansionTemplate(); + case "modern-home-a3-template": + return this.createModernHomeA3Template(); + case "grand-oak-villa-a3-template": + return this.createGrandOakVillaA3Template(); + case "serenity-house-a3-template": + return this.createSerenityHouseA3Template(); + case "luxury-mansion-a3-template": + return this.createLuxuryMansionA3Template(); default: return this.createBlankTemplate(); } @@ -5486,7 +5534,7 @@ export default class PropertyTemplateSelector extends LightningElement {
- +
@@ -8499,6 +8547,1509 @@ ${galleryPagesHTML} } } + // A3 Template Functions + createModernHomeA3Template() { + const data = this.propertyData || {}; + const dimensions = this.getPageDimensions(); // A3 dimensions + + console.log("data-----------", data); + + const propertyName = data.Name || data.propertyName; + const propertyType = data.Property_Type__c || data.propertyType; + const location = data.Address__c || data.location; + // Use price toggle and selected pricing fields to determine what to display + let price = "Price on Request"; + if (this.showPrice) { + const selectedPrices = []; + + // Add selected pricing fields based on step 2 selection + if (this.pricingSelection.includeRentPriceMin && data.rentPriceMin && data.rentPriceMin !== "N/A") { + selectedPrices.push(data.rentPriceMin); + } + if (this.pricingSelection.includeRentPriceMax && data.rentPriceMax && data.rentPriceMax !== "N/A") { + selectedPrices.push(data.rentPriceMax); + } + if (this.pricingSelection.includeSalePriceMin && data.salePriceMin && data.salePriceMin !== "N/A") { + selectedPrices.push(data.salePriceMin); + } + if (this.pricingSelection.includeSalePriceMax && data.salePriceMax && data.salePriceMax !== "N/A") { + selectedPrices.push(data.salePriceMax); + } + + // If no pricing fields are selected, fall back to default price + if (selectedPrices.length === 0) { + price = data.Price__c || data.price || "Price on Request"; + } else { + // Join selected prices with " | " separator + price = selectedPrices.join(" | "); + } + } + const bedrooms = data.Bedrooms__c || data.bedrooms; + const bathrooms = data.Bathrooms__c || data.bathrooms; + const area = data.Square_Feet__c || data.area; + + // Get description and format it dynamically + const rawDescription = data.Description_English__c || + data.descriptionEnglish || + data.description || + "This beautiful property offers exceptional value and modern amenities. Located in a prime area, it represents an excellent investment opportunity."; + + const description = this.formatDescriptionForPDF(rawDescription); + + // Add dynamic class based on description length for CSS targeting + const descriptionLength = rawDescription.length; + const descriptionClass = descriptionLength > 500 ? 'description-long' : + descriptionLength > 200 ? 'description-medium' : 'description-short'; + + const referenceId = + data.pcrm__Title_English__c || data.Name || data.propertyName || ""; + + // Define logoUrl for template usage + const logoUrl = "https://tso3listingimages.s3.amazonaws.com/00DFV000001HtSX/a0LFV000001NhJq2AK/companyLogo.jpeg?t=1757764346286"; + + // Agent information from loaded agent data + const agentName = this.agentData.name || "N/A"; + const agentPhone = this.agentData.phone || "N/A"; + const agentEmail = this.agentData.email || "N/A"; + + // Dynamic gallery and amenities + const propertyGallery = this.generatePropertyGalleryHTML(); + const amenitiesHTML = this.generateAmenitiesHTML(data); + + // Additional computed fields for full dynamic rendering + const status = data.Status__c || data.status || "Available"; + const floor = data.Floor__c || data.floor || "N/A"; + const parking = + data.Parking_Spaces__c || data.parkingSpaces || data.parking || "N/A"; + const yearBuilt = data.Build_Year__c || data.buildYear || "N/A"; + const furnishing = data.Furnished__c || data.furnished || "N/A"; + const maintenanceFee = + data.Maintenance_Fee__c || data.maintenanceFee || "N/A"; + const serviceCharge = data.Service_Charge__c || data.serviceCharge || "N/A"; + + const ownerName = data.Owner_Name__c || data.ownerName || "N/A"; + const ownerPhone = data.Owner_Phone__c || data.ownerPhone || "N/A"; + + const landmarks = data.Nearby_Landmarks__c || data.nearbyLandmarks || "N/A"; + const transportation = + data.Transportation__c || data.transportation || "N/A"; + const schools = data.Schools__c || data.schools || "N/A"; + const hospitals = data.Hospitals__c || data.hospitals || "N/A"; + const shopping = data.Shopping_Centers__c || data.shoppingCenters || "N/A"; + const airportDistance = + data.Airport_Distance__c || data.airportDistance || "N/A"; + + const petFriendly = + data.Pet_Friendly__c !== "N/A" + ? data.Pet_Friendly__c + ? "Yes" + : "No" + : data.petFriendly || "N/A"; + const smokingAllowed = + data.Smoking_Allowed__c !== "N/A" + ? data.Smoking_Allowed__c + ? "Yes" + : "No" + : data.smokingAllowed || "N/A"; + const availableFrom = + data.Rent_Available_From__c || + data.Available_From__c || + data.availableFrom || + "N/A"; + const minimumContract = + data.Minimum_Contract__c || data.minimumContract || "N/A"; + const securityDeposit = + data.Security_Deposit__c || data.securityDeposit || "N/A"; + + const mapsImageUrl = + this.getMapsImageUrl() || + "https://plus.unsplash.com/premium_photo-1676467963268-5a20d7a7a448?q=80&w=687&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"; + + // Build dynamic gallery pages with responsive grid + const allImages = Array.isArray(this.realPropertyImages) + ? this.realPropertyImages + : []; + const imagesPerPage = 12; // 3x4 grid for A3 - more images per page + let galleryPagesHTML = ""; + if (allImages.length > 0) { + for (let i = 0; i < allImages.length; i += imagesPerPage) { + const chunk = allImages.slice(i, i + imagesPerPage); + const pageNumber = Math.floor(i / imagesPerPage) + 1; + const totalPages = Math.ceil(allImages.length / imagesPerPage); + + const chunkHTML = chunk + .map((img, idx) => { + const title = + img.title || + img.pcrm__Title__c || + `Property Image ${i + idx + 1}`; + + // Ensure image URL is absolute for PDF generation + const imageUrl = img.url && img.url.startsWith('http') ? img.url : + img.url ? `https://salesforce.tech4biz.io${img.url}` : + 'https://via.placeholder.com/400x200?text=No+Image'; + + // First image gets half height, others get standard height + const imageHeight = idx === 0 ? '100px' : '150px'; + + return ``; + }) + .join(""); + galleryPagesHTML += ` +
+
+ +
+
${chunkHTML}
+
+
+ +
`; + } + } + + return ` + + + + + Property Brochure - A3 Size + + + + + +
+
+
+

${propertyName}

+

${location}

+
+
${price}
+
+ ${bedrooms} Beds + ${bathrooms} Baths + ${area} +
+
+
+
+ +
+
+

About this Property

+ ${description} +
+ + +
+ + +
+ +
+
+ +
+ +
+
+

Specifications

+
+
Status: ${status}
+
Type: ${propertyType}
+
Floor: ${floor}
+
Parking: ${parking}
+
Year Built: ${yearBuilt}
+
Furnishing: ${furnishing}
+
+
+ +
+

Amenities & Features

+
+ ${amenitiesHTML} +
+
+
+ + +
+ + ${galleryPagesHTML} + + +`; + } + + createGrandOakVillaA3Template() { + const data = this.propertyData || {}; + const dimensions = this.getPageDimensions(); // A3 dimensions + + const propertyName = data.Name || data.propertyName || "Property Name"; + const propertyType = data.Property_Type__c || data.propertyType || "N/A"; + const location = data.Address__c || data.location || "Location"; + const referenceId = data.pcrm__Title_English__c || data.Name || data.propertyName || ""; + const agentName = this.agentData.name || "N/A"; + const agentPhone = this.agentData.phone || "N/A"; + const agentEmail = this.agentData.email || "N/A"; + const ownerName = data.Owner_Name__c || data.ownerName || "N/A"; + const ownerPhone = data.Owner_Phone__c || data.ownerPhone || "N/A"; + const ownerEmail = data.Owner_Email__c || data.ownerEmail || "N/A"; + + // Define logoUrl for template usage + const logoUrl = "https://tso3listingimages.s3.amazonaws.com/00DFV000001HtSX/a0LFV000001NhJq2AK/companyLogo.jpeg?t=1757764346286"; + + // Dynamic pricing with fallbacks - use price toggle and selected pricing fields + let price = "Price on Request"; + if (this.showPrice) { + const selectedPrices = []; + + // Add selected pricing fields based on step 2 selection + if (this.pricingSelection.includeRentPriceMin && data.rentPriceMin && data.rentPriceMin !== "N/A") { + selectedPrices.push(data.rentPriceMin); + } + if (this.pricingSelection.includeRentPriceMax && data.rentPriceMax && data.rentPriceMax !== "N/A") { + selectedPrices.push(data.rentPriceMax); + } + if (this.pricingSelection.includeSalePriceMin && data.salePriceMin && data.salePriceMin !== "N/A") { + selectedPrices.push(data.salePriceMin); + } + if (this.pricingSelection.includeSalePriceMax && data.salePriceMax && data.salePriceMax !== "N/A") { + selectedPrices.push(data.salePriceMax); + } + + // If no pricing fields are selected, fall back to default price + if (selectedPrices.length === 0) { + price = data.Sale_Price_Min__c || + data.Rent_Price_Min__c || + data.Price__c || + data.salePriceMin || + data.rentPriceMin || + data.price || "Price on Request"; + } else { + // Join selected prices with " | " separator + price = selectedPrices.join(" | "); + } + } + + const bedrooms = data.Bedrooms__c || data.bedrooms || "N/A"; + const bathrooms = data.Bathrooms__c || data.bathrooms || "N/A"; + const squareFeet = data.Square_Feet__c || data.squareFeet || data.area || "N/A"; + const status = data.Status__c || data.status || "Available"; + const yearBuilt = data.Build_Year__c || data.buildYear || "N/A"; + const floor = data.Floor__c || data.floor || "N/A"; + const parking = data.Parking_Spaces__c || data.parkingSpaces || data.parking || "N/A"; + const furnishing = data.Furnished__c || data.furnished || "N/A"; + + // Get description and format it dynamically + const rawDescription = data.Description_English__c || + data.descriptionEnglish || + data.description || + "This exceptional property represents the pinnacle of luxury living. Meticulously designed with attention to every detail, it offers an unparalleled lifestyle experience in one of the most prestigious locations."; + + const description = this.formatDescriptionForPDF(rawDescription); + + // Dynamic gallery and amenities + const propertyGallery = this.generatePropertyGalleryHTML(); + const amenitiesHTML = this.generateAmenitiesHTML(data); + + // Additional computed fields for full dynamic rendering + const maintenanceFee = data.Maintenance_Fee__c || data.maintenanceFee || "N/A"; + const serviceCharge = data.Service_Charge__c || data.serviceCharge || "N/A"; + + const landmarks = data.Nearby_Landmarks__c || data.nearbyLandmarks || "N/A"; + const transportation = data.Transportation__c || data.transportation || "N/A"; + const schools = data.Schools__c || data.schools || "N/A"; + const hospitals = data.Hospitals__c || data.hospitals || "N/A"; + const shopping = data.Shopping_Centers__c || data.shoppingCenters || "N/A"; + const airportDistance = data.Airport_Distance__c || data.airportDistance || "N/A"; + + const petFriendly = data.Pet_Friendly__c !== "N/A" ? data.Pet_Friendly__c ? "Yes" : "No" : data.petFriendly || "N/A"; + const smokingAllowed = data.Smoking_Allowed__c !== "N/A" ? data.Smoking_Allowed__c ? "Yes" : "No" : data.smokingAllowed || "N/A"; + const availableFrom = data.Rent_Available_From__c || data.Available_From__c || data.availableFrom || "N/A"; + const minimumContract = data.Minimum_Contract__c || data.minimumContract || "N/A"; + const securityDeposit = data.Security_Deposit__c || data.securityDeposit || "N/A"; + + const mapsImageUrl = this.getMapsImageUrl() || "https://plus.unsplash.com/premium_photo-1676467963268-5a20d7a7a448?q=80&w=687&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"; + + // Build dynamic gallery pages with responsive grid for A3 + const allImages = Array.isArray(this.realPropertyImages) ? this.realPropertyImages : []; + const imagesPerPage = 12; // 3x4 grid for A3 - more images per page + let galleryPagesHTML = ""; + if (allImages.length > 0) { + for (let i = 0; i < allImages.length; i += imagesPerPage) { + const chunk = allImages.slice(i, i + imagesPerPage); + const pageNumber = Math.floor(i / imagesPerPage) + 1; + const totalPages = Math.ceil(allImages.length / imagesPerPage); + + const chunkHTML = chunk + .map((img, idx) => { + const title = img.title || img.pcrm__Title__c || `Property Image ${i + idx + 1}`; + const imageUrl = img.url && img.url.startsWith('http') ? img.url : + img.url ? `https://salesforce.tech4biz.io${img.url}` : + 'https://via.placeholder.com/400x200?text=No+Image'; + + return ``; + }) + .join(""); + galleryPagesHTML += ` +
+
+ +
+
${chunkHTML}
+
+
+ +
`; + } + } + + return ` + + + + + Prestige Real Estate Brochure - A3 Size + + + + + + + + +
+
+ +
+
+

Property Overview

+
+
+ Property Name: + ${propertyName} +
+
+ Location: + ${location} +
+
+ Price: + ${price} +
+
+ Reference ID: + ${referenceId} +
+
+
+ +
+

Specifications

+
+
+ Bedrooms: + ${bedrooms} +
+
+ Bathrooms: + ${bathrooms} +
+
+ Area: + ${squareFeet} +
+
+ Status: + ${status} +
+
+ Year Built: + ${yearBuilt} +
+
+ Floor: + ${floor} +
+
+
+ +
+

Description

+
+ ${description} +
+
+ +
+

Amenities & Features

+
+ ${amenitiesHTML} +
+
+
+ +
+
+ + ${galleryPagesHTML} + + +`; + } + + createSerenityHouseA3Template() { + const data = this.propertyData || {}; + const dimensions = this.getPageDimensions(); // A3 dimensions + + const propertyName = data.Name || data.propertyName || "Property Name"; + const location = data.Address__c || data.location || "Location"; + const referenceId = data.pcrm__Title_English__c || data.Name || data.propertyName || ""; + const agentName = this.agentData.name || "N/A"; + const agentPhone = this.agentData.phone || "N/A"; + const agentEmail = this.agentData.email || "N/A"; + + const logoUrl = "https://tso3listingimages.s3.amazonaws.com/00DFV000001HtSX/a0LFV000001NhJq2AK/companyLogo.jpeg?t=1757764346286"; + + // Dynamic pricing + let price = "Price on Request"; + if (this.showPrice) { + const selectedPrices = []; + if (this.pricingSelection.includeRentPriceMin && data.rentPriceMin && data.rentPriceMin !== "N/A") { + selectedPrices.push(data.rentPriceMin); + } + if (this.pricingSelection.includeRentPriceMax && data.rentPriceMax && data.rentPriceMax !== "N/A") { + selectedPrices.push(data.rentPriceMax); + } + if (this.pricingSelection.includeSalePriceMin && data.salePriceMin && data.salePriceMin !== "N/A") { + selectedPrices.push(data.salePriceMin); + } + if (this.pricingSelection.includeSalePriceMax && data.salePriceMax && data.salePriceMax !== "N/A") { + selectedPrices.push(data.salePriceMax); + } + + if (selectedPrices.length === 0) { + price = data.Sale_Price_Min__c || data.Rent_Price_Min__c || data.Price__c || data.salePriceMin || data.rentPriceMin || data.price || "Price on Request"; + } else { + price = selectedPrices.join(" | "); + } + } + + const bedrooms = data.Bedrooms__c || data.bedrooms || "N/A"; + const bathrooms = data.Bathrooms__c || data.bathrooms || "N/A"; + const squareFeet = data.Square_Feet__c || data.squareFeet || data.area || "N/A"; + const status = data.Status__c || data.status || "Available"; + const yearBuilt = data.Build_Year__c || data.buildYear || "N/A"; + const floor = data.Floor__c || data.floor || "N/A"; + const parking = data.Parking_Spaces__c || data.parkingSpaces || data.parking || "N/A"; + const furnishing = data.Furnished__c || data.furnished || "N/A"; + + const rawDescription = data.Description_English__c || data.descriptionEnglish || data.description || "This serene property offers a peaceful retreat from the hustle and bustle of city life. Designed with tranquility in mind, it provides the perfect sanctuary for modern living."; + const description = this.formatDescriptionForPDF(rawDescription); + + const amenitiesHTML = this.generateAmenitiesHTML(data); + + // Build dynamic gallery pages for A3 + const allImages = Array.isArray(this.realPropertyImages) ? this.realPropertyImages : []; + const imagesPerPage = 12; // 3x4 grid for A3 + let galleryPagesHTML = ""; + if (allImages.length > 0) { + for (let i = 0; i < allImages.length; i += imagesPerPage) { + const chunk = allImages.slice(i, i + imagesPerPage); + const chunkHTML = chunk + .map((img, idx) => { + const title = img.title || img.pcrm__Title__c || `Property Image ${i + idx + 1}`; + const imageUrl = img.url && img.url.startsWith('http') ? img.url : + img.url ? `https://salesforce.tech4biz.io${img.url}` : + 'https://via.placeholder.com/400x200?text=No+Image'; + + return ``; + }) + .join(""); + galleryPagesHTML += ` +
+
+ +
+
${chunkHTML}
+
+
+ +
`; + } + } + + return ` + + + + + Serenity House Brochure - A3 Size + + + + + + + +
+
+ +
+
+

Property Overview

+
+
+ Property Name: + ${propertyName} +
+
+ Location: + ${location} +
+
+ Price: + ${price} +
+
+ Reference ID: + ${referenceId} +
+
+
+ +
+

Specifications

+
+
+ Bedrooms: + ${bedrooms} +
+
+ Bathrooms: + ${bathrooms} +
+
+ Area: + ${squareFeet} +
+
+ Status: + ${status} +
+
+ Year Built: + ${yearBuilt} +
+
+ Floor: + ${floor} +
+
+
+ +
+

Description

+
+ ${description} +
+
+ +
+

Amenities & Features

+
+ ${amenitiesHTML} +
+
+
+ +
+
+ + ${galleryPagesHTML} + +`; + } + + createLuxuryMansionA3Template() { + const data = this.propertyData || {}; + const dimensions = this.getPageDimensions(); // A3 dimensions + + const propertyName = data.Name || data.propertyName || "Property Name"; + const propertyType = data.Property_Type__c || data.propertyType || "N/A"; + const location = data.Address__c || data.location || "Location"; + const referenceId = data.pcrm__Title_English__c || data.Name || data.propertyName || ""; + const agentName = this.agentData.name || "N/A"; + const agentPhone = this.agentData.phone || "N/A"; + const agentEmail = this.agentData.email || "N/A"; + + const logoUrl = "https://tso3listingimages.s3.amazonaws.com/00DFV000001HtSX/a0LFV000001NhJq2AK/companyLogo.jpeg?t=1757764346286"; + + // Dynamic pricing + let price = "Price on Request"; + if (this.showPrice) { + const selectedPrices = []; + if (this.pricingSelection.includeRentPriceMin && data.rentPriceMin && data.rentPriceMin !== "N/A") { + selectedPrices.push(data.rentPriceMin); + } + if (this.pricingSelection.includeRentPriceMax && data.rentPriceMax && data.rentPriceMax !== "N/A") { + selectedPrices.push(data.rentPriceMax); + } + if (this.pricingSelection.includeSalePriceMin && data.salePriceMin && data.salePriceMin !== "N/A") { + selectedPrices.push(data.salePriceMin); + } + if (this.pricingSelection.includeSalePriceMax && data.salePriceMax && data.salePriceMax !== "N/A") { + selectedPrices.push(data.salePriceMax); + } + + if (selectedPrices.length === 0) { + price = data.Sale_Price_Min__c || data.Rent_Price_Min__c || data.Price__c || data.salePriceMin || data.rentPriceMin || data.price || "Price on Request"; + } else { + price = selectedPrices.join(" | "); + } + } + + const bedrooms = data.Bedrooms__c || data.bedrooms || "N/A"; + const bathrooms = data.Bathrooms__c || data.bathrooms || "N/A"; + const squareFeet = data.Square_Feet__c || data.squareFeet || data.area || "N/A"; + const status = data.Status__c || data.status || "Available"; + const yearBuilt = data.Build_Year__c || data.buildYear || "N/A"; + const floor = data.Floor__c || data.floor || "N/A"; + const parking = data.Parking_Spaces__c || data.parkingSpaces || data.parking || "N/A"; + const furnishing = data.Furnished__c || data.furnished || "N/A"; + + const rawDescription = data.Description_English__c || data.descriptionEnglish || data.description || "This magnificent luxury mansion represents the epitome of sophisticated living. Every detail has been carefully crafted to provide an unparalleled residential experience."; + const description = this.formatDescriptionForPDF(rawDescription); + + const amenitiesHTML = this.generateAmenitiesHTML(data); + + // Build dynamic gallery pages for A3 + const allImages = Array.isArray(this.realPropertyImages) ? this.realPropertyImages : []; + const imagesPerPage = 12; // 3x4 grid for A3 + let galleryPagesHTML = ""; + if (allImages.length > 0) { + for (let i = 0; i < allImages.length; i += imagesPerPage) { + const chunk = allImages.slice(i, i + imagesPerPage); + const chunkHTML = chunk + .map((img, idx) => { + const title = img.title || img.pcrm__Title__c || `Property Image ${i + idx + 1}`; + const imageUrl = img.url && img.url.startsWith('http') ? img.url : + img.url ? `https://salesforce.tech4biz.io${img.url}` : + 'https://via.placeholder.com/400x200?text=No+Image'; + + return ``; + }) + .join(""); + galleryPagesHTML += ` +
+
+ +
+
${chunkHTML}
+
+
+ +
`; + } + } + + return ` + + + + + Luxury Mansion Brochure - A3 Size + + + + + + + +
+
+ +
+
+

Property Overview

+
+
+ Property Name: + ${propertyName} +
+
+ Location: + ${location} +
+
+ Price: + ${price} +
+
+ Reference ID: + ${referenceId} +
+
+
+ +
+

Specifications

+
+
+ Bedrooms: + ${bedrooms} +
+
+ Bathrooms: + ${bathrooms} +
+
+ Area: + ${squareFeet} +
+
+ Status: + ${status} +
+
+ Year Built: + ${yearBuilt} +
+
+ Floor: + ${floor} +
+
+
+ +
+

Description

+
+ ${description} +
+
+ +
+

Amenities & Features

+
+ ${amenitiesHTML} +
+
+
+ +
+
+ + ${galleryPagesHTML} + +`; + } + // Helper function to get template-specific footer getTemplateSpecificFooter() { const logoUrl = 'https://tso3listingimages.s3.amazonaws.com/00DFV000001HtSX/a0LFV000001NhJq2AK/companyLogo.jpeg?t=1757834589169'; @@ -8548,6 +10099,50 @@ ${galleryPagesHTML} `; + case 'modern-home-a3-template': + return ` + `; + + case 'grand-oak-villa-a3-template': + return ` + `; + + case 'serenity-house-a3-template': + return ` + `; + + case 'luxury-mansion-a3-template': + return ` + `; + default: return `