Spaces:
Running
Running
Update script.js
Browse files
script.js
CHANGED
|
@@ -219,14 +219,20 @@ document.addEventListener('DOMContentLoaded', function () {
|
|
| 219 |
let totalAmount = 0;
|
| 220 |
|
| 221 |
cart.forEach(item => {
|
| 222 |
-
const
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
});
|
| 231 |
|
| 232 |
// Отображаем общую сумму
|
|
|
|
| 219 |
let totalAmount = 0;
|
| 220 |
|
| 221 |
cart.forEach(item => {
|
| 222 |
+
const products = JSON.parse(localStorage.getItem('products')) || [];
|
| 223 |
+
const product = products.find(p => p.id === item.id);
|
| 224 |
+
|
| 225 |
+
if (product) {
|
| 226 |
+
const row = receiptTable.insertRow();
|
| 227 |
+
row.innerHTML = `
|
| 228 |
+
<td>${item.name}</td>
|
| 229 |
+
<td>${item.quantity}</td>
|
| 230 |
+
<td>${product.itemsPerPack}</td>
|
| 231 |
+
<td>${item.salePrice}</td>
|
| 232 |
+
<td>${item.quantity * item.salePrice}</td>
|
| 233 |
+
`;
|
| 234 |
+
totalAmount += item.quantity * item.salePrice;
|
| 235 |
+
}
|
| 236 |
});
|
| 237 |
|
| 238 |
// Отображаем общую сумму
|