Spaces:
Running
Running
inicializa el costo de la tela en 25 - Follow Up Deployment
Browse files- index.html +38 -5
index.html
CHANGED
@@ -34,7 +34,7 @@
|
|
34 |
<i class="fas fa-ruler-combined text-indigo-500 mr-2"></i>Precio por m虏 de tela ($)
|
35 |
</label>
|
36 |
<div class="relative">
|
37 |
-
<input type="number" id="fabricPrice" min="0" step="0.01" value="
|
38 |
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
39 |
<span class="absolute right-3 top-2.5 text-gray-500">$/m虏</span>
|
40 |
</div>
|
@@ -86,6 +86,18 @@
|
|
86 |
<span class="absolute right-3 top-8 text-gray-500">unidades</span>
|
87 |
</div>
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
<div>
|
90 |
<label for="orderName" class="block text-sm font-medium text-gray-700 mb-1">
|
91 |
<i class="fas fa-tag text-indigo-500 mr-2"></i>Nombre del pedido
|
@@ -121,6 +133,10 @@
|
|
121 |
<span class="text-gray-600">Costo sublimaci贸n (1 unidad):</span>
|
122 |
<span id="sublimationCostSingle" class="font-medium">$0.00</span>
|
123 |
</div>
|
|
|
|
|
|
|
|
|
124 |
<div class="border-t border-gray-200 my-2"></div>
|
125 |
<div class="flex justify-between">
|
126 |
<span class="text-gray-800 font-semibold">Total por 1 unidad:</span>
|
@@ -130,6 +146,10 @@
|
|
130 |
<span class="text-gray-600">Costo tela:</span>
|
131 |
<span id="fabricCostQuantity" class="font-medium">$0.00</span>
|
132 |
</div>
|
|
|
|
|
|
|
|
|
133 |
<div class="flex justify-between">
|
134 |
<span class="text-gray-600">Costo sublimaci贸n:</span>
|
135 |
<span id="sublimationCostQuantity" class="font-medium">$0.00</span>
|
@@ -169,12 +189,14 @@
|
|
169 |
const sublimationPriceInput = document.getElementById('sublimationPrice');
|
170 |
const fabricAreaInput = document.getElementById('fabricArea');
|
171 |
const sublimationAreaInput = document.getElementById('sublimationArea');
|
|
|
172 |
|
173 |
// Error messages
|
174 |
const fabricError = document.getElementById('fabricError');
|
175 |
const sublimationError = document.getElementById('sublimationError');
|
176 |
const areaError = document.getElementById('areaError');
|
177 |
const sublimationAreaError = document.getElementById('sublimationAreaError');
|
|
|
178 |
|
179 |
// Result fields
|
180 |
const fabricCostSingle = document.getElementById('fabricCostSingle');
|
@@ -204,6 +226,7 @@
|
|
204 |
const sublimationPrice = parseFloat(sublimationPriceInput.value);
|
205 |
const fabricArea = parseFloat(fabricAreaInput.value);
|
206 |
const sublimationArea = parseFloat(sublimationAreaInput.value);
|
|
|
207 |
|
208 |
// Validate inputs
|
209 |
let isValid = true;
|
@@ -231,18 +254,25 @@
|
|
231 |
sublimationAreaInput.classList.add('input-error');
|
232 |
isValid = false;
|
233 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
|
235 |
if (!isValid) return;
|
236 |
|
237 |
// Calculate costs
|
238 |
const fabricCostPerUnit = fabricPrice * fabricArea;
|
239 |
const sublimationCostPerUnit = sublimationPrice * sublimationArea;
|
240 |
-
const totalCostPerUnit = fabricCostPerUnit + sublimationCostPerUnit;
|
241 |
|
242 |
const quantity = parseInt(document.getElementById('quantity').value) || 1;
|
243 |
document.getElementById('quantityDisplay').textContent = quantity;
|
244 |
const fabricCostForQuantity = fabricCostPerUnit * quantity;
|
245 |
const sublimationCostForQuantity = sublimationCostPerUnit * quantity;
|
|
|
246 |
const totalCostForQuantity = totalCostPerUnit * quantity;
|
247 |
|
248 |
// Update UI with results
|
@@ -250,8 +280,10 @@
|
|
250 |
sublimationCostSingle.textContent = `${sublimationCostPerUnit.toFixed(2)}`;
|
251 |
totalCostSingle.textContent = `${totalCostPerUnit.toFixed(2)}`;
|
252 |
|
|
|
253 |
document.getElementById('fabricCostQuantity').textContent = `${fabricCostForQuantity.toFixed(2)}`;
|
254 |
document.getElementById('sublimationCostQuantity').textContent = `${sublimationCostForQuantity.toFixed(2)}`;
|
|
|
255 |
document.getElementById('totalCostQuantity').textContent = `${totalCostForQuantity.toFixed(2)}`;
|
256 |
|
257 |
// Add to history
|
@@ -262,6 +294,7 @@
|
|
262 |
sublimationPrice,
|
263 |
fabricArea,
|
264 |
sublimationArea,
|
|
|
265 |
quantity,
|
266 |
orderName,
|
267 |
totalCostPerUnit,
|
@@ -319,15 +352,15 @@
|
|
319 |
}
|
320 |
|
321 |
function resetErrors() {
|
322 |
-
[fabricError, sublimationError, areaError, sublimationAreaError].forEach(error => {
|
323 |
error.classList.add('hidden');
|
324 |
});
|
325 |
|
326 |
-
[fabricPriceInput, sublimationPriceInput, fabricAreaInput, sublimationAreaInput].forEach(input => {
|
327 |
input.classList.remove('input-error');
|
328 |
});
|
329 |
}
|
330 |
});
|
331 |
</script>
|
332 |
-
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo2" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 馃К <a href="https://enzostvs-deepsite.hf.space?remix=JymNils/calculadora-textil" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
333 |
</html>
|
|
|
34 |
<i class="fas fa-ruler-combined text-indigo-500 mr-2"></i>Precio por m虏 de tela ($)
|
35 |
</label>
|
36 |
<div class="relative">
|
37 |
+
<input type="number" id="fabricPrice" min="0" step="0.01" value="25"
|
38 |
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
39 |
<span class="absolute right-3 top-2.5 text-gray-500">$/m虏</span>
|
40 |
</div>
|
|
|
86 |
<span class="absolute right-3 top-8 text-gray-500">unidades</span>
|
87 |
</div>
|
88 |
|
89 |
+
<div>
|
90 |
+
<label for="sewingPrice" class="block text-sm font-medium text-gray-700 mb-1">
|
91 |
+
<i class="fas fa-needle text-indigo-500 mr-2"></i>Precio de costura por unidad ($)
|
92 |
+
</label>
|
93 |
+
<div class="relative">
|
94 |
+
<input type="number" id="sewingPrice" min="0" step="0.01" value="12"
|
95 |
+
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
96 |
+
<span class="absolute right-3 top-2.5 text-gray-500">$/unidad</span>
|
97 |
+
</div>
|
98 |
+
<p id="sewingError" class="text-red-500 text-xs mt-1 hidden">Ingrese un valor v谩lido</p>
|
99 |
+
</div>
|
100 |
+
|
101 |
<div>
|
102 |
<label for="orderName" class="block text-sm font-medium text-gray-700 mb-1">
|
103 |
<i class="fas fa-tag text-indigo-500 mr-2"></i>Nombre del pedido
|
|
|
133 |
<span class="text-gray-600">Costo sublimaci贸n (1 unidad):</span>
|
134 |
<span id="sublimationCostSingle" class="font-medium">$0.00</span>
|
135 |
</div>
|
136 |
+
<div class="flex justify-between">
|
137 |
+
<span class="text-gray-600">Costo costura (1 unidad):</span>
|
138 |
+
<span id="sewingCostSingle" class="font-medium">$0.00</span>
|
139 |
+
</div>
|
140 |
<div class="border-t border-gray-200 my-2"></div>
|
141 |
<div class="flex justify-between">
|
142 |
<span class="text-gray-800 font-semibold">Total por 1 unidad:</span>
|
|
|
146 |
<span class="text-gray-600">Costo tela:</span>
|
147 |
<span id="fabricCostQuantity" class="font-medium">$0.00</span>
|
148 |
</div>
|
149 |
+
<div class="flex justify-between">
|
150 |
+
<span class="text-gray-600">Costo costura:</span>
|
151 |
+
<span id="sewingCostQuantity" class="font-medium">$0.00</span>
|
152 |
+
</div>
|
153 |
<div class="flex justify-between">
|
154 |
<span class="text-gray-600">Costo sublimaci贸n:</span>
|
155 |
<span id="sublimationCostQuantity" class="font-medium">$0.00</span>
|
|
|
189 |
const sublimationPriceInput = document.getElementById('sublimationPrice');
|
190 |
const fabricAreaInput = document.getElementById('fabricArea');
|
191 |
const sublimationAreaInput = document.getElementById('sublimationArea');
|
192 |
+
const sewingPriceInput = document.getElementById('sewingPrice');
|
193 |
|
194 |
// Error messages
|
195 |
const fabricError = document.getElementById('fabricError');
|
196 |
const sublimationError = document.getElementById('sublimationError');
|
197 |
const areaError = document.getElementById('areaError');
|
198 |
const sublimationAreaError = document.getElementById('sublimationAreaError');
|
199 |
+
const sewingError = document.getElementById('sewingError');
|
200 |
|
201 |
// Result fields
|
202 |
const fabricCostSingle = document.getElementById('fabricCostSingle');
|
|
|
226 |
const sublimationPrice = parseFloat(sublimationPriceInput.value);
|
227 |
const fabricArea = parseFloat(fabricAreaInput.value);
|
228 |
const sublimationArea = parseFloat(sublimationAreaInput.value);
|
229 |
+
const sewingPrice = parseFloat(sewingPriceInput.value);
|
230 |
|
231 |
// Validate inputs
|
232 |
let isValid = true;
|
|
|
254 |
sublimationAreaInput.classList.add('input-error');
|
255 |
isValid = false;
|
256 |
}
|
257 |
+
|
258 |
+
if (isNaN(sewingPrice) || sewingPrice < 0) {
|
259 |
+
sewingError.classList.remove('hidden');
|
260 |
+
sewingPriceInput.classList.add('input-error');
|
261 |
+
isValid = false;
|
262 |
+
}
|
263 |
|
264 |
if (!isValid) return;
|
265 |
|
266 |
// Calculate costs
|
267 |
const fabricCostPerUnit = fabricPrice * fabricArea;
|
268 |
const sublimationCostPerUnit = sublimationPrice * sublimationArea;
|
269 |
+
const totalCostPerUnit = fabricCostPerUnit + sublimationCostPerUnit + sewingPrice;
|
270 |
|
271 |
const quantity = parseInt(document.getElementById('quantity').value) || 1;
|
272 |
document.getElementById('quantityDisplay').textContent = quantity;
|
273 |
const fabricCostForQuantity = fabricCostPerUnit * quantity;
|
274 |
const sublimationCostForQuantity = sublimationCostPerUnit * quantity;
|
275 |
+
const sewingCostForQuantity = sewingPrice * quantity;
|
276 |
const totalCostForQuantity = totalCostPerUnit * quantity;
|
277 |
|
278 |
// Update UI with results
|
|
|
280 |
sublimationCostSingle.textContent = `${sublimationCostPerUnit.toFixed(2)}`;
|
281 |
totalCostSingle.textContent = `${totalCostPerUnit.toFixed(2)}`;
|
282 |
|
283 |
+
document.getElementById('sewingCostSingle').textContent = `${sewingPrice.toFixed(2)}`;
|
284 |
document.getElementById('fabricCostQuantity').textContent = `${fabricCostForQuantity.toFixed(2)}`;
|
285 |
document.getElementById('sublimationCostQuantity').textContent = `${sublimationCostForQuantity.toFixed(2)}`;
|
286 |
+
document.getElementById('sewingCostQuantity').textContent = `${sewingCostForQuantity.toFixed(2)}`;
|
287 |
document.getElementById('totalCostQuantity').textContent = `${totalCostForQuantity.toFixed(2)}`;
|
288 |
|
289 |
// Add to history
|
|
|
294 |
sublimationPrice,
|
295 |
fabricArea,
|
296 |
sublimationArea,
|
297 |
+
sewingPrice,
|
298 |
quantity,
|
299 |
orderName,
|
300 |
totalCostPerUnit,
|
|
|
352 |
}
|
353 |
|
354 |
function resetErrors() {
|
355 |
+
[fabricError, sublimationError, areaError, sublimationAreaError, sewingError].forEach(error => {
|
356 |
error.classList.add('hidden');
|
357 |
});
|
358 |
|
359 |
+
[fabricPriceInput, sublimationPriceInput, fabricAreaInput, sublimationAreaInput, sewingPriceInput].forEach(input => {
|
360 |
input.classList.remove('input-error');
|
361 |
});
|
362 |
}
|
363 |
});
|
364 |
</script>
|
365 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo2" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 馃К <a href="https://enzostvs-deepsite.hf.space?remix=JymNils/calculadora-textil" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p><p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 馃К <a href="https://enzostvs-deepsite.hf.space?remix=JymNils/calculadora-textil" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
366 |
</html>
|