From 263a33a22a0b7521adf6722a0aa77b774a1df55b Mon Sep 17 00:00:00 2001
From: Frede Hundewadt <22748698+fhdk@users.noreply.github.com>
Date: Sun, 7 Aug 2022 07:58:09 +0200
Subject: [PATCH] removed obsolete test page - add price select to history
popup
---
Wonky.Client/Pages/ActivityNewVisitPage.razor | 10 +-
.../Pages/ActivityNewVisitPage.razor.cs | 18 ++-
.../Pages/XTestPriceListPopupPage.razor | 118 ------------------
.../Pages/XTestPriceListPopupPage.razor.cs | 102 ---------------
.../Shared/ProductPriceHistoryModal.razor | 66 ++++++++++
.../Shared/ProductPriceHistoryModal.razor.cs | 65 ++++++++++
Wonky.Client/wwwroot/appsettings.json | 2 +-
7 files changed, 152 insertions(+), 229 deletions(-)
delete mode 100644 Wonky.Client/Pages/XTestPriceListPopupPage.razor
delete mode 100644 Wonky.Client/Pages/XTestPriceListPopupPage.razor.cs
create mode 100644 Wonky.Client/Shared/ProductPriceHistoryModal.razor
create mode 100644 Wonky.Client/Shared/ProductPriceHistoryModal.razor.cs
diff --git a/Wonky.Client/Pages/ActivityNewVisitPage.razor b/Wonky.Client/Pages/ActivityNewVisitPage.razor
index 4608ffec..ccd8f845 100644
--- a/Wonky.Client/Pages/ActivityNewVisitPage.razor
+++ b/Wonky.Client/Pages/ActivityNewVisitPage.razor
@@ -22,6 +22,7 @@
+
+ @*
+ *@
|
diff --git a/Wonky.Client/Pages/ActivityNewVisitPage.razor.cs b/Wonky.Client/Pages/ActivityNewVisitPage.razor.cs
index d0591a33..f5fb2714 100644
--- a/Wonky.Client/Pages/ActivityNewVisitPage.razor.cs
+++ b/Wonky.Client/Pages/ActivityNewVisitPage.razor.cs
@@ -49,6 +49,7 @@ public partial class ActivityNewVisitPage : IDisposable
private readonly JsonSerializerOptions? _options = new JsonSerializerOptions{PropertyNameCaseInsensitive = true};
private PriceListModal _priceListModal { get; set; }
private ProductHistoryModal _historyModal { get; set; }
+ private ProductPriceHistoryModal _priceHistoryModal { get; set; }
private SalesItemView _selectedItem { get; set; } = new();
private Preferences _prefs { get; set; } = new();
private ActivityDto _draft { get; set; } = new();
@@ -142,7 +143,7 @@ public partial class ActivityNewVisitPage : IDisposable
{
_priceListModal.Show();
}
-
+
private async Task SelectSku(SelectedSku sku)
{
// fetch selected item
@@ -160,11 +161,16 @@ public partial class ActivityNewVisitPage : IDisposable
_historyModal.Show();
}
- // private void SelectPrice(decimal price)
- // {
- // Price = price.ToString("N2");
- // StateHasChanged();
- // }
+ private void CallPriceHistoryModal()
+ {
+ _priceHistoryModal.Show();
+ }
+
+ private void SelectPrice(decimal price)
+ {
+ Price = price.ToString("N2");
+ StateHasChanged();
+ }
private async Task SetWorkDate(string workDate)
{
diff --git a/Wonky.Client/Pages/XTestPriceListPopupPage.razor b/Wonky.Client/Pages/XTestPriceListPopupPage.razor
deleted file mode 100644
index 78cf4464..00000000
--- a/Wonky.Client/Pages/XTestPriceListPopupPage.razor
+++ /dev/null
@@ -1,118 +0,0 @@
-@*
-// Copyright (C) 2022 FCS Frede's Computer Services.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-*@
-
-@page "/xtest"
-@using Microsoft.AspNetCore.Authorization
-@attribute [Authorize(Roles = "Advisor")]
-
-
-
-
- @* Order draft lines *@
-
-
-
\ No newline at end of file
diff --git a/Wonky.Client/Pages/XTestPriceListPopupPage.razor.cs b/Wonky.Client/Pages/XTestPriceListPopupPage.razor.cs
deleted file mode 100644
index a7826425..00000000
--- a/Wonky.Client/Pages/XTestPriceListPopupPage.razor.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (C) 2022 FCS Frede's Computer Services.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-
-using System.Globalization;
-using System.Text.Json;
-using Wonky.Client.HttpInterceptors;
-using Wonky.Client.HttpRepository;
-using Wonky.Client.Models;
-using Microsoft.AspNetCore.Components;
-using Wonky.Client.Shared;
-using Wonky.Entity.Views;
-
-namespace Wonky.Client.Pages;
-
-public partial class XTestPriceListPopupPage : IDisposable
-{
- [Inject] private ISalesItemHttpRepository _itemRepo { get; set; }
- [Inject] private HttpInterceptorService _interceptor { get; set; }
- [CascadingParameter] DraftStateProvider DraftStateProvider { get; set; }
- private string Quantity = "1";
- private string Price = "0";
- private string Discount = "0";
- private bool ShowItem { get; set; }
- private bool Sas { get; set; }
- private SalesItemView _selectedItem { get; set; } = new();
- private PriceListModal _priceList = new();
- private SelectedSku _sku { get; set; } = new();
-
- protected override async Task OnInitializedAsync()
- {
- _interceptor.RegisterEvent();
- _interceptor.RegisterBeforeSendEvent();
- }
-
- private void CallPriceListModal()
- {
- _priceList.Show();
- }
-
- private async Task SelectSku(SelectedSku sku)
- {
- ShowItem = true;
- Console.WriteLine($"XTextPriceList => sku: {JsonSerializer.Serialize(sku)}");
- _selectedItem = await _itemRepo.GetSalesItem(sku.ItemId);
- Price = sku.Rate;
- Quantity = sku.Quantity;
- }
-
- private async Task DeleteDraft()
- {
- await DraftStateProvider.DeleteDraftAsync();
- }
-
- private async Task AddItem(SalesItemView salesItem)
- {
- ShowItem = false;
- // create a new cart item
- var item = new DraftItem
- {
- Item = salesItem,
- Quantity = Convert.ToInt32(Quantity),
- Price = Convert.ToDecimal(Price, CultureInfo.InvariantCulture),
- Discount = Convert.ToDecimal(Discount, CultureInfo.InvariantCulture),
- Sas = Sas
- };
- // reset internals to initial state
- Sas = false;
- Quantity = "1";
- Price = "0";
- Discount = "0";
- // add it to the cart
- DraftStateProvider.Draft.Items.Add(item);
- // save the item using the CartStateProvider's save method
- await DraftStateProvider.SaveChangesAsync();
- }
-
- private async Task RemoveItem(DraftItem item)
- {
- // remove item
- DraftStateProvider.Draft.Items.Remove(item);
- // save the remaining draft
- await DraftStateProvider.SaveChangesAsync();
- }
-
-
- public void Dispose()
- {
- _interceptor.DisposeEvent();
- }
-}
\ No newline at end of file
diff --git a/Wonky.Client/Shared/ProductPriceHistoryModal.razor b/Wonky.Client/Shared/ProductPriceHistoryModal.razor
new file mode 100644
index 00000000..bb4276bb
--- /dev/null
+++ b/Wonky.Client/Shared/ProductPriceHistoryModal.razor
@@ -0,0 +1,66 @@
+@*
+// Copyright (C) 2022 FCS Frede's Computer Services.
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+*@
+@using Wonky.Client.Components
+@using Wonky.Client.Helpers
+
- @* draft line *@
- @if (_selectedItem != null && ShowItem)
- {
-
-
+
+@if (_showBackdrop)
+{
+
+}
\ No newline at end of file
diff --git a/Wonky.Client/Shared/ProductPriceHistoryModal.razor.cs b/Wonky.Client/Shared/ProductPriceHistoryModal.razor.cs
new file mode 100644
index 00000000..bc332ffd
--- /dev/null
+++ b/Wonky.Client/Shared/ProductPriceHistoryModal.razor.cs
@@ -0,0 +1,65 @@
+// Copyright (C) 2022 FCS Frede's Computer Services.
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+using Microsoft.AspNetCore.Components;
+using Wonky.Client.HttpInterceptors;
+using Wonky.Client.HttpRepository;
+using Wonky.Client.Models;
+using Wonky.Client.Services;
+using Wonky.Entity.Requests;
+using Wonky.Entity.Views;
+
+namespace Wonky.Client.Shared;
+
+public partial class ProductPriceHistoryModal
+{
+ [Parameter] public EventCallback
+
+
+ |