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 344adf6a..4eac7762 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml @@ -1,4 +1,5 @@ @using EShopOnAbp.Localization +@using EShopOnAbp.PublicWeb.Components.Purchase @using Microsoft.Extensions.Localization @model EShopOnAbp.BasketService.BasketDto @inject IStringLocalizer L @@ -17,7 +18,7 @@ else {
-
+
@foreach (var item in Model.Items) { @@ -45,20 +46,12 @@
-
-
-

Total Selected (@Model.Items.Count)

-
-
-

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

-
-
-
- @Html.AntiForgeryToken() - - - -
+
+ @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 new file mode 100644 index 00000000..f8a60683 --- /dev/null +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/Default.cshtml @@ -0,0 +1,21 @@ +@using EShopOnAbp.Localization +@using EShopOnAbp.PublicWeb.Components.Purchase +@using Microsoft.Extensions.Localization +@model PurchaseWidgetViewComponent.PurchaseViewModel +@inject IStringLocalizer L + +
+
+

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

+
+
+

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

+
+
+
+ @Html.AntiForgeryToken() + + + +
+
\ No newline at end of file diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/PurchaseWidgetScriptContributor.cs b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/PurchaseWidgetScriptContributor.cs new file mode 100644 index 00000000..59f67e87 --- /dev/null +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/PurchaseWidgetScriptContributor.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Volo.Abp.AspNetCore.Mvc.UI.Bundling; +using Volo.Abp.AspNetCore.Mvc.UI.Packages.SignalR; +using Volo.Abp.Modularity; + +namespace EShopOnAbp.PublicWeb.Components.Purchase; + +[DependsOn(typeof(SignalRBrowserScriptContributor))] +public class PurchaseWidgetScriptContributor : BundleContributor +{ + public override void ConfigureBundle(BundleConfigurationContext context) + { + context.Files.AddIfNotContains("/components/purchase/purchase-widget.js"); + } +} \ No newline at end of file diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/PurchaseWidgetStyleContributor.cs b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/PurchaseWidgetStyleContributor.cs new file mode 100644 index 00000000..ae81185b --- /dev/null +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/PurchaseWidgetStyleContributor.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using Volo.Abp.AspNetCore.Mvc.UI.Bundling; + +namespace EShopOnAbp.PublicWeb.Components.Purchase; + +public class PurchaseWidgetStyleContributor : BundleContributor +{ + public override void ConfigureBundle(BundleConfigurationContext context) + { + context.Files.AddIfNotContains("/components/purchase/purchase-widget.css"); + } +} \ No newline at end of file diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/PurchaseWidgetViewComponent.cs b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/PurchaseWidgetViewComponent.cs new file mode 100644 index 00000000..ca7699b5 --- /dev/null +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Purchase/PurchaseWidgetViewComponent.cs @@ -0,0 +1,37 @@ +using System.Threading.Tasks; +using EShopOnAbp.BasketService; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace EShopOnAbp.PublicWeb.Components.Purchase; + +[Widget( + AutoInitialize = true, + RefreshUrl = "/Widgets/Basket", + StyleTypes = new[] {typeof(PurchaseWidgetStyleContributor)}, + ScriptTypes = new[] {typeof(PurchaseWidgetScriptContributor)} +)] +public class PurchaseWidgetViewComponent : AbpViewComponent +{ + public PurchaseViewModel ViewModel { get; set; } + + public Task InvokeAsync(string buttonDescription, BasketDto basket) + { + ViewModel = new PurchaseViewModel + { + ButtonDescription = buttonDescription, + Basket = basket + }; + + return Task.FromResult( + View("~/Components/Purchase/Default.cshtml", ViewModel) + ); + } + + public class PurchaseViewModel + { + public string ButtonDescription { get; set; } + public BasketDto Basket { get; set; } + } +} \ No newline at end of file diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Payment.cshtml.cs b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Payment.cshtml.cs index 33a37564..831ff457 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Payment.cshtml.cs +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Payment.cshtml.cs @@ -6,6 +6,5 @@ public class PaymentModel : AbpPageModel { public void OnGet() { - } } \ No newline at end of file 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 new file mode 100644 index 00000000..e69de29b diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/purchase/purchase-widget.js b/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/purchase/purchase-widget.js new file mode 100644 index 00000000..3a3021ae --- /dev/null +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/purchase/purchase-widget.js @@ -0,0 +1,3 @@ +(function () { + +})(); \ 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 44e7594e..00b556ae 100644 --- a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/en.json +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/en.json @@ -3,12 +3,12 @@ "texts": { "Menu:Home": "Home", "Login": "Login", - "Catalog": "Catalog", "YourBasket": "Your Basket", - "Purchase": "Purchase", "Total": "Total", "OurProducts": "Our Products", "StockCount": "Stock Count", - "RemoveFromBasket": "Remove from basket" + "RemoveFromBasket": "Remove from basket", + "CompletePurchase": "Complete purchase", + "CompleteOrder": "Complete order" } } diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/tr.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/tr.json index b803def2..159c5c5e 100644 --- a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/tr.json +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/tr.json @@ -3,12 +3,12 @@ "texts": { "Menu:Home": "Ana Sayfa", "Login": "Giriş", - "Catalog": "Katalog", "YourBasket": "Sepetiniz", - "Purchase": "Alışverişi tamamla", "Total": "Toplam", "OurProducts": "Ürünlerimiz", "StockCount": "Stokta", - "RemoveFromBasket": "Sepetten kaldır" + "RemoveFromBasket": "Sepetten kaldır", + "CompletePurchase": "Alışverişi tamamla", + "CompleteOrder": "Siparişi onayla" } }