diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml index 37762811..d06dac29 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml @@ -8,47 +8,75 @@ @if (!Model.Items.Any()) {
-

- - Your basket is empty. Click to a product to add it! - -

+ + + +

@L["EmptyBasket"]

+
+
+ + @L["CheckOtherProducts"] @L["ContinueShopping"] + +
+ +
+
+
} else {
-
+
@foreach (var item in Model.Items) { -
- @if (!item.ImageName.IsNullOrEmpty()) - { - - } - else - { - - } - @item.ProductName - @if (item.Count > 1) - { - (@("x" + item.Count)) - } - - $@item.TotalPrice.ToString("0.00") - + string imageName = item.ImageName.IsNullOrEmpty() ? "/product-images/noimage.jpg" : $"/product-images/{item.ImageName}"; + var price = (item.TotalPrice * item.Count).ToString("0.00"); +
+
+
+
+ +
+
+
+
+ @item.ProductName +
+
+ $@price +
+
+ @L["FreeCargo"] +
+
+
+
+ +
+ +
+
+
} -
-
- @L["Total"]: $@Model.TotalPrice.ToString("0.00") -
-
- @await Component.InvokeAsync(typeof(PurchaseWidgetViewComponent), - new { Basket = Model, ButtonDescription = "CompletePurchase"}) +
+ @await Component.InvokeAsync(typeof(PurchaseWidgetViewComponent), + new {Basket = Model, ButtonDescription = "CompletePurchase"})
} diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/Default.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/Default.cshtml index f8a60683..1722a34c 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/Default.cshtml +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/Default.cshtml @@ -4,18 +4,59 @@ @model PurchaseWidgetViewComponent.PurchaseViewModel @inject IStringLocalizer L -
-
-

Total Selected (@Model.Basket.Items.Count)

-
-
-

$@Model.Basket.TotalPrice.ToString("0.00")

-
-
-
- @Html.AntiForgeryToken() - - - +@{ + var totalCount = Model?.Basket.Items.Count ?? 0; + var totalPrice = Model.Basket.TotalPrice; + var demoDiscountPercentage = 10; + var discountTotal = totalPrice * demoDiscountPercentage / 100; + var grandTotal = totalPrice - discountTotal; +} +
+
+
+
+
@L["TotalSelected", totalCount]
+
+
+

$@totalPrice.ToString("0.00")

+
+
+
+
+

@L["Purchase:OrderSummary"]

+
+
+
+
@L["Purchase:Products"]:
+
@totalPrice.ToString("0.00") $
+
+
+
@L["Purchase:CargoAndPackaging"]:
+
0.00 $
+
+
+
@L["Purchase:Total"]:
+
@totalPrice.ToString("0.00") $
+
+
+
@L["Purchase:GiftCards"]:
+
@discountTotal.ToString("0.00") $
+
+
+
+
+
+
@L["Purchase:OrderTotal"]:
+
+
+
@grandTotal.ToString("0.00") $
+
+
+
+
+ @Html.AntiForgeryToken() + + +
\ No newline at end of file diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml index bb9388f2..569f0dbb 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml @@ -11,7 +11,6 @@ @inject IStringLocalizer L
- @*

@L["YourBasket"]

*@
@await Component.InvokeAsync(typeof(BasketWidgetViewComponent))
diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket/basket-widget.css b/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket/basket-widget.css index 44989ae5..06d922a6 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket/basket-widget.css +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket/basket-widget.css @@ -1,42 +1,132 @@ -.basket-list -{ +.basket-list { + +} + +.basket-list-item { + width:-webkit-fill-available; background-color: #fff; - padding: 1em; - border: 1px solid #666; + border: 1px solid #eee; border-radius: 3px; box-shadow: 0 0 10px rgba(0, 0, 0, .05); - margin-bottom: 0.5em; transition: all .2s; + cursor: default; } -.basket-list:hover { +.basket-list-item:hover { box-shadow: 0 0 20px rgba(0, 0, 0, .1); } -.basket-list-item { - margin-top: 1em; +.flex-container { + display: flex; + justify-content: space-between; + align-items: center; +} + +.horizontal { + flex-direction: row; + width: 100%; } -.basket-list-item:first-child{ - margin-top: 0; +.horizontal .flex-item { + flex: 1; } -.basket-list-item img { - height: 1em; +.vertical { + flex-direction: column; } -.basket-total-area -{ - margin-bottom: 1em; +.flex-item { + /*background: tomato;*/ + padding: 5px; + max-width: 100vh; + margin: 5px; + font-size: 3em; + text-align: center; +} + +.image-container { + border: 2px solid #ccc !important; + border-radius: 10px; + background-color: white; + max-width: 3em; +} + +.basket-item-image { + min-width: 1em; + width: 2em; + max-width: 80%; +} + +.description-container { + align-items: baseline; +} + +.description-header { + line-height: 50px; + text-align: left; + font-weight: 500; + font-size: 1.2rem; + margin-bottom: 0.5rem; + overflow: hidden; +} + +.description-header > span { + line-height: 20px; + vertical-align: top; +} + +.description-price { + text-align: center; + font-size: 1.1rem; font-weight: bold; + line-height: 30px; + color: rgb(72, 72, 72); } -.basket-item-remove { - cursor: pointer; - color: red; - opacity: 0.25; +.description-price > span { + line-height: 20px; + vertical-align: top; +} +.description-cargo{ + color: #189c38; + text-align: center; + font-size: 1rem; } +.description-cargo> span { + line-height: 20px; + vertical-align: top; + } -.basket-list-item:hover .basket-item-remove { +.remove-container { + color: #bb2d3b; + max-width: 2em; + font-size: 1.5rem; + line-height: initial; +} + +.actions-container { + font-weight: 600; + color: #523e02; + max-width: 2em; + font-size: 1.25rem; + line-height: 40px; +} + +.hide { + opacity: 0; + -webkit-transition: all 500ms ease-in-out; + -moz-transition: all 500ms ease-in-out; + -ms-transition: all 500ms ease-in-out; + -o-transition: all 500ms ease-in-out; + transition: all 500ms ease-in-out; +} + +.basket-list-item:hover .hide { opacity: 1.0; +} +.sticky { + position: -webkit-sticky; /* for Safari */ + position: sticky; + top: 1rem; + align-self: flex-start; /* <-- this is the fix */ } \ No newline at end of file diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket/basket-widget.js b/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket/basket-widget.js index 688a0158..f368e8da 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket/basket-widget.js +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket/basket-widget.js @@ -1,8 +1,6 @@ (function () { - let anonymousId = abp.utils.getCookieValue("anonymous_id"); - abp.widgets.BasketWidget = function ($wrapper) { var widgetManager = $wrapper.data('abp-widget-manager'); @@ -10,23 +8,55 @@ $wrapper .find('.basket-item-remove') .click(function () { - var $this = $(this); - var productId = $this.parent('.basket-list-item').attr('data-product-id'); + let $this = $(this); + let productId = $this.parents('.basket-list-item').attr('data-product-id'); eShopOnAbp.basketService.basket.removeProduct({ productId: productId, anonymousId: anonymousId }).then(function () { - widgetManager.refresh(); - $('.abp-widget-wrapper[data-widget-name="CartWidget"]') .data('abp-widget-manager') .refresh(); - abp.notify.info("Removed the product from your basket.", "Removed basket item"); }); }); + $wrapper + .find('.basket-item-increase') + .click(function (e) { + e.preventDefault(); + let $this = $(this); + let productId = $this.parents('.basket-list-item').attr('data-product-id'); + eShopOnAbp.basketService.basket.addProduct({ + productId: productId, + count: 1, + anonymousId: anonymousId + }).then(function () { + widgetManager.refresh(); + $('.abp-widget-wrapper[data-widget-name="CartWidget"]') + .data('abp-widget-manager') + .refresh(); + }); + }); + + $wrapper + .find('.basket-item-decrease') + .click(function (e) { + e.preventDefault(); + let $this = $(this); + let productId = $this.parents('.basket-list-item').attr('data-product-id'); + eShopOnAbp.basketService.basket.removeProduct({ + productId: productId, + count: 1, + anonymousId: anonymousId + }).then(function () { + widgetManager.refresh(); + $('.abp-widget-wrapper[data-widget-name="CartWidget"]') + .data('abp-widget-manager') + .refresh(); + }); + }); }; return { diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/purchase/purchase-widget.css b/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/purchase/purchase-widget.css index e69de29b..3428b345 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/purchase/purchase-widget.css +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/purchase/purchase-widget.css @@ -0,0 +1,12 @@ +.m-result { + text-align: end; +} + +.summary { + color: #0F1111; + font-size: 1rem; +} + +.order-total { + font-size: 1.2rem; +} \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/en.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/en.json index c6389ed1..f9a57b29 100644 --- a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/en.json +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/en.json @@ -4,8 +4,19 @@ "Menu:Home": "Home", "Login": "Login", "YourBasket": "Your Basket", + "EmptyBasket": "Empyt basket", + "CheckOtherProducts": "You can check the recommended products below or", + "ContinueShopping": "continue shopping.", "Total": "Total", + "TotalSelected": "Total Selected ({0})", "OurProducts": "Our Products", + "FreeCargo": "Free Cargo", + "Purchase:GiftCards":"Gift Cards", + "Purchase:CargoAndPackaging": "Cargo & Packaging", + "Purchase:Total": "Total", + "Purchase:OrderSummary": "Order Summary", + "Purchase:Products": "Products", + "Purchase:OrderTotal": "Order Total", "CatalogServiceNotAvailable": "Catalog Service is unavailable right now! Try again later...", "StockCount": "Stock Count", "RemoveFromBasket": "Remove from basket", diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/tr.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/tr.json index 7b0c9f7e..a010152d 100644 --- a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/tr.json +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/tr.json @@ -4,8 +4,19 @@ "Menu:Home": "Ana Sayfa", "Login": "Giriş", "YourBasket": "Sepetiniz", + "EmptyBasket": "Sepetiniz boş", + "CheckOtherProducts": "Aşağıdaki önerilen öğeleri takip edebilirsiniz veya", + "ContinueShopping": "alışverişe devam edin.", "Total": "Toplam", + "TotalSelected": "Seçilen Ürünler ({0})", "OurProducts": "Ürünlerimiz", + "FreeCargo": "Ücretsiz Kargo", + "Purchase:GiftCards":"Hediye Çekleri", + "Purchase:CargoAndPackaging": "Kargo ve Paketleme", + "Purchase:Total": "Toplam", + "Purchase:OrderSummary": "Sipariş Özeti", + "Purchase:Products": "Ürünler", + "Purchase:OrderTotal": "Sipariş Toplamı", "CatalogServiceNotAvailable": "Ürün servisine şu anda ulaşılamıyor! Lütfen sonra tekrar deneyiniz...", "StockCount": "Stokta", "RemoveFromBasket": "Sepetten kaldır",