Update chat.js
Browse files
chat.js
CHANGED
@@ -98,21 +98,21 @@ function calculateTiles() {
|
|
98 |
return addMessage('bot', `β Invalid tile dimensions. Length Γ width must be greater than 0.`);
|
99 |
}
|
100 |
|
101 |
-
if (tileArea
|
102 |
return addMessage('bot', `β οΈ The tile size (${tileLength}Γ${tileWidth} = ${tileArea} sq.ft) is larger than the total area (${area} sq.ft). Please enter smaller tile dimensions.`);
|
103 |
}
|
104 |
|
105 |
if (tileArea > 50) {
|
106 |
-
addMessage('bot',
|
107 |
}
|
108 |
|
109 |
const aspectRatio = Math.max(tileLength / tileWidth, tileWidth / tileLength);
|
110 |
if (aspectRatio > 10) {
|
111 |
-
addMessage('bot', `π This tile has a very high aspect ratio (${aspectRatio.toFixed(1)}:1).
|
112 |
}
|
113 |
|
114 |
-
const numTiles = Math.ceil((area / tileArea) * 1.1); //
|
115 |
-
const numBoxes = Math.ceil(numTiles / 10); // assume 10 tiles
|
116 |
|
117 |
chatArea.insertAdjacentHTML('beforeend', `
|
118 |
<div class="bot-message bg-gray-100 rounded-lg p-4 mb-3">
|
@@ -156,9 +156,10 @@ function loadProductRecommendations(products) {
|
|
156 |
recommendations.insertAdjacentHTML('beforeend', `
|
157 |
<div class="bg-white rounded-lg overflow-hidden shadow-sm border border-gray-100">
|
158 |
<div class="h-32 bg-gray-200 flex items-center justify-center">
|
159 |
-
|
160 |
-
<
|
161 |
-
|
|
|
162 |
</div>
|
163 |
<div class="p-3">
|
164 |
<h4 class="font-medium text-gray-800">${p.name || 'Tile Product'}</h4>
|
|
|
98 |
return addMessage('bot', `β Invalid tile dimensions. Length Γ width must be greater than 0.`);
|
99 |
}
|
100 |
|
101 |
+
if (tileArea > area) {
|
102 |
return addMessage('bot', `β οΈ The tile size (${tileLength}Γ${tileWidth} = ${tileArea} sq.ft) is larger than the total area (${area} sq.ft). Please enter smaller tile dimensions.`);
|
103 |
}
|
104 |
|
105 |
if (tileArea > 50) {
|
106 |
+
addMessage('bot', `π That's a large tile (${tileArea} sq.ft). Please confirm the size is correct.`);
|
107 |
}
|
108 |
|
109 |
const aspectRatio = Math.max(tileLength / tileWidth, tileWidth / tileLength);
|
110 |
if (aspectRatio > 10) {
|
111 |
+
addMessage('bot', `π This tile has a very high aspect ratio (${aspectRatio.toFixed(1)}:1). Please double-check if that's correct.`);
|
112 |
}
|
113 |
|
114 |
+
const numTiles = Math.ceil((area / tileArea) * 1.1); // 10% buffer
|
115 |
+
const numBoxes = Math.ceil(numTiles / 10); // assume 10 tiles per box
|
116 |
|
117 |
chatArea.insertAdjacentHTML('beforeend', `
|
118 |
<div class="bot-message bg-gray-100 rounded-lg p-4 mb-3">
|
|
|
156 |
recommendations.insertAdjacentHTML('beforeend', `
|
157 |
<div class="bg-white rounded-lg overflow-hidden shadow-sm border border-gray-100">
|
158 |
<div class="h-32 bg-gray-200 flex items-center justify-center">
|
159 |
+
${p.image_url ? `<img src="${p.image_url}" class="h-full object-cover" alt="${p.name}">` : `
|
160 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
161 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z" />
|
162 |
+
</svg>`}
|
163 |
</div>
|
164 |
<div class="p-3">
|
165 |
<h4 class="font-medium text-gray-800">${p.name || 'Tile Product'}</h4>
|