JymNils commited on
Commit
62069fc
·
verified ·
1 Parent(s): 54c0a43

añade un campo costos extras en el primer panel, en el segundo panel, añade los valores de costos extras tanto en elc osto por unidad como en el costo por cantidad - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +26 -2
index.html CHANGED
@@ -105,6 +105,18 @@
105
  <input type="text" id="orderName" value="Pedido 1"
106
  class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
107
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
108
  </div>
109
 
110
  <div class="mt-6 flex justify-center">
@@ -137,6 +149,10 @@
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>
@@ -154,6 +170,10 @@
154
  <span class="text-gray-600">Costo sublimación:</span>
155
  <span id="sublimationCostQuantity" class="font-medium">$0.00</span>
156
  </div>
 
 
 
 
157
  <div class="border-t border-gray-200 my-2"></div>
158
  <div class="flex justify-between">
159
  <span class="text-gray-800 font-semibold">Total por <span id="quantityDisplay">1</span> unidad(es):</span>
@@ -227,6 +247,7 @@
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;
@@ -266,13 +287,14 @@
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
@@ -281,9 +303,11 @@
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
@@ -362,5 +386,5 @@
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>
 
105
  <input type="text" id="orderName" value="Pedido 1"
106
  class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
107
  </div>
108
+
109
+ <div>
110
+ <label for="extraCosts" class="block text-sm font-medium text-gray-700 mb-1">
111
+ <i class="fas fa-plus-circle text-indigo-500 mr-2"></i>Costos extras por unidad ($)
112
+ </label>
113
+ <div class="relative">
114
+ <input type="number" id="extraCosts" min="0" step="0.01" value="0"
115
+ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
116
+ <span class="absolute right-3 top-2.5 text-gray-500">$/unidad</span>
117
+ </div>
118
+ <p id="extraCostsError" class="text-red-500 text-xs mt-1 hidden">Ingrese un valor válido</p>
119
+ </div>
120
  </div>
121
 
122
  <div class="mt-6 flex justify-center">
 
149
  <span class="text-gray-600">Costo costura (1 unidad):</span>
150
  <span id="sewingCostSingle" class="font-medium">$0.00</span>
151
  </div>
152
+ <div class="flex justify-between">
153
+ <span class="text-gray-600">Costos extras (1 unidad):</span>
154
+ <span id="extraCostsSingle" class="font-medium">$0.00</span>
155
+ </div>
156
  <div class="border-t border-gray-200 my-2"></div>
157
  <div class="flex justify-between">
158
  <span class="text-gray-800 font-semibold">Total por 1 unidad:</span>
 
170
  <span class="text-gray-600">Costo sublimación:</span>
171
  <span id="sublimationCostQuantity" class="font-medium">$0.00</span>
172
  </div>
173
+ <div class="flex justify-between">
174
+ <span class="text-gray-600">Costos extras:</span>
175
+ <span id="extraCostsQuantity" class="font-medium">$0.00</span>
176
+ </div>
177
  <div class="border-t border-gray-200 my-2"></div>
178
  <div class="flex justify-between">
179
  <span class="text-gray-800 font-semibold">Total por <span id="quantityDisplay">1</span> unidad(es):</span>
 
247
  const fabricArea = parseFloat(fabricAreaInput.value);
248
  const sublimationArea = parseFloat(sublimationAreaInput.value);
249
  const sewingPrice = parseFloat(sewingPriceInput.value);
250
+ const extraCosts = parseFloat(document.getElementById('extraCosts').value) || 0;
251
 
252
  // Validate inputs
253
  let isValid = true;
 
287
  // Calculate costs
288
  const fabricCostPerUnit = fabricPrice * fabricArea;
289
  const sublimationCostPerUnit = sublimationPrice * sublimationArea;
290
+ const totalCostPerUnit = fabricCostPerUnit + sublimationCostPerUnit + sewingPrice + extraCosts;
291
 
292
  const quantity = parseInt(document.getElementById('quantity').value) || 1;
293
  document.getElementById('quantityDisplay').textContent = quantity;
294
  const fabricCostForQuantity = fabricCostPerUnit * quantity;
295
  const sublimationCostForQuantity = sublimationCostPerUnit * quantity;
296
  const sewingCostForQuantity = sewingPrice * quantity;
297
+ const extraCostsForQuantity = extraCosts * quantity;
298
  const totalCostForQuantity = totalCostPerUnit * quantity;
299
 
300
  // Update UI with results
 
303
  totalCostSingle.textContent = `${totalCostPerUnit.toFixed(2)}`;
304
 
305
  document.getElementById('sewingCostSingle').textContent = `${sewingPrice.toFixed(2)}`;
306
+ document.getElementById('extraCostsSingle').textContent = `${extraCosts.toFixed(2)}`;
307
  document.getElementById('fabricCostQuantity').textContent = `${fabricCostForQuantity.toFixed(2)}`;
308
  document.getElementById('sublimationCostQuantity').textContent = `${sublimationCostForQuantity.toFixed(2)}`;
309
  document.getElementById('sewingCostQuantity').textContent = `${sewingCostForQuantity.toFixed(2)}`;
310
+ document.getElementById('extraCostsQuantity').textContent = `${extraCostsForQuantity.toFixed(2)}`;
311
  document.getElementById('totalCostQuantity').textContent = `${totalCostForQuantity.toFixed(2)}`;
312
 
313
  // Add to history
 
386
  }
387
  });
388
  </script>
389
+ <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><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-textil2" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
390
  </html>