|
@@ -449,7 +449,7 @@ store.subscribe(() => {
|
|
|
textBlock.append(linkCard);
|
|
|
textBlock.append(addToCartButton)
|
|
|
|
|
|
-
|
|
|
+
|
|
|
addToCartButton.onclick = () => {
|
|
|
store.dispatch(actionCartAdd({_id, name, price, images,}));
|
|
|
};
|
|
@@ -791,31 +791,6 @@ store.subscribe(() => {
|
|
|
};
|
|
|
});
|
|
|
|
|
|
-// store.subscribe(() => {
|
|
|
-// const {orderFind} = (store.getState()).promise
|
|
|
-// const [,route, _id] = location.hash.split('/')
|
|
|
-
|
|
|
-// if (orderFind?.payload && route === 'orderFind'){
|
|
|
-// main.innerHTML='<h1>История заказов</h1>'
|
|
|
-
|
|
|
-// for (const {_id, createdAt, total,orderGoods} of orderFind.payload.reverse()){
|
|
|
-// const card = document.createElement('div')
|
|
|
-// card.style = 'width: 100%;border-style: groove;border-color: #ced4da17;padding: 10px;border-radius: 10px;margin: 5px;'
|
|
|
-// card.innerHTML = `<h3>Заказ: ${createdAt}</h3>`
|
|
|
-// for (const {count, good} of orderGoods){2
|
|
|
-// const divGood = document.createElement('div')
|
|
|
-// divGood.style= "display:flex;margin-bottom: 20px;"
|
|
|
-
|
|
|
-// divGood.innerHTML += `<div>Товар: <b>${good.name}</b><br> Цена: <b>${good.price} грн.</b><br> Количество: <b>${count} шт.</b></b></div><img style="max-width: 80px;margin-right: 20px;display: block;margin-left: auto;" src="http://shop-roles.node.ed.asmer.org.ua/${good.images[0].url}"/><br><br>`
|
|
|
-// card.append(divGood)
|
|
|
-// }
|
|
|
-// card.innerHTML += 'Дата: <b>'+new Date(+createdAt).toLocaleString().replace(/\//g, '.')+'</b>'
|
|
|
-// card.innerHTML += `<br>Всего: <b style="color:red;">${total} грн.</b>`
|
|
|
-// main.append(card)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// })
|
|
|
-
|
|
|
login.onclick = () => {
|
|
|
bPopupCreate(buttonLogin);
|
|
|
buttonLogin.onclick = () => {
|