diff --git a/.gitignore b/.gitignore
index c567aa4b..68281069 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-*/**/appsettings.json
+appsettings.json
# ---> JetBrains
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
@@ -63,9 +63,6 @@ atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
-# SonarLint plugin
-.idea/sonarlint/
-
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
@@ -82,7 +79,7 @@ fabric.properties
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
-## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
@@ -287,6 +284,9 @@ PublishScripts/
*.nuget.props
*.nuget.targets
+# Nuget personal access tokens and Credentials
+nuget.config
+
# Microsoft Azure Build Output
csx/
*.build.csdef
@@ -375,17 +375,6 @@ node_modules/
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
-# Visual Studio 6 auto-generated project file (contains which files were open etc.)
-*.vbp
-
-# Visual Studio 6 workspace and project file (working project files containing files to include in project)
-*.dsw
-*.dsp
-
-# Visual Studio 6 technical files
-*.ncb
-*.aps
-
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
@@ -442,9 +431,6 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/
-# Visual Studio History (VSHistory) files
-.vshistory/
-
# BeatPulse healthcheck temp database
healthchecksdb
@@ -476,32 +462,6 @@ FodyWeavers.xsd
*.msp
# JetBrains Rider
+.idea/
*.sln.iml
-# ---> VisualStudioCode
-.vscode/*
-!.vscode/settings.json
-!.vscode/tasks.json
-!.vscode/launch.json
-!.vscode/extensions.json
-!.vscode/*.code-snippets
-
-# Local History for Visual Studio Code
-.history/
-
-# Built Visual Studio Code Extensions
-*.vsix
-
-# ---> AL
-.vscode/*
-!.vscode/settings.json
-!.vscode/tasks.json
-!.vscode/launch.json
-!.vscode/extensions.json
-*.code-workspace
-
-# Local History for Visual Studio Code
-.history/
-*.app
-.snapshots/*
-
diff --git a/.idea/.idea.Wonky.Client/.idea/.gitignore b/.idea/.idea.Wonky.Client/.idea/.gitignore
index 00d2f20c..666a18a2 100644
--- a/.idea/.idea.Wonky.Client/.idea/.gitignore
+++ b/.idea/.idea.Wonky.Client/.idea/.gitignore
@@ -3,9 +3,9 @@
/workspace.xml
# Rider ignored files
/modules.xml
+/contentModel.xml
/projectSettingsUpdater.xml
/.idea.Wonky.Client.iml
-/contentModel.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
diff --git a/README.md b/README.md
index 61ae4e05..6442ea03 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,2 @@
-# Wonky.Client
+# Wonky Client
-![](./Wonky.Client/wwwroot/wonky-logo.png)
diff --git a/Wonky.Client.sln b/Wonky.Client.sln
index e23480d7..d88202de 100644
--- a/Wonky.Client.sln
+++ b/Wonky.Client.sln
@@ -1,34 +1,31 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30114.105
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wonky.Client", "Wonky.Client\Wonky.Client.csproj", "{A001767F-6CA1-428E-938A-EA491A778D3E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wonky.Entity", "..\Wonky.Entity\Wonky.Entity\Wonky.Entity.csproj", "{39D1D838-9D6C-41AB-8A77-ABF4ECC35402}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wonky.Virk", "..\Wonky.Virk\Wonky.Virk\Wonky.Virk.csproj", "{69A68DBC-1CAF-496D-B8FE-7FB82E7FE0E9}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {A001767F-6CA1-428E-938A-EA491A778D3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A001767F-6CA1-428E-938A-EA491A778D3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A001767F-6CA1-428E-938A-EA491A778D3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A001767F-6CA1-428E-938A-EA491A778D3E}.Release|Any CPU.Build.0 = Release|Any CPU
- {39D1D838-9D6C-41AB-8A77-ABF4ECC35402}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {39D1D838-9D6C-41AB-8A77-ABF4ECC35402}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {39D1D838-9D6C-41AB-8A77-ABF4ECC35402}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {39D1D838-9D6C-41AB-8A77-ABF4ECC35402}.Release|Any CPU.Build.0 = Release|Any CPU
- {69A68DBC-1CAF-496D-B8FE-7FB82E7FE0E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {69A68DBC-1CAF-496D-B8FE-7FB82E7FE0E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {69A68DBC-1CAF-496D-B8FE-7FB82E7FE0E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {69A68DBC-1CAF-496D-B8FE-7FB82E7FE0E9}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.32112.339
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wonky.Client", "Wonky.Client\Wonky.Client.csproj", "{6187227B-D451-4817-B535-743B14E3111D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wonky.Entity", "Wonky.Entity\Wonky.Entity.csproj", "{CF421FF4-0AE4-4B8A-997E-C2FD8DC9349F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {6187227B-D451-4817-B535-743B14E3111D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6187227B-D451-4817-B535-743B14E3111D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6187227B-D451-4817-B535-743B14E3111D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6187227B-D451-4817-B535-743B14E3111D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CF421FF4-0AE4-4B8A-997E-C2FD8DC9349F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CF421FF4-0AE4-4B8A-997E-C2FD8DC9349F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CF421FF4-0AE4-4B8A-997E-C2FD8DC9349F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CF421FF4-0AE4-4B8A-997E-C2FD8DC9349F}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {3FB8FD1A-6DA1-4063-816A-755FD5A93F8E}
+ EndGlobalSection
+EndGlobal
diff --git a/Wonky.Client/App.razor b/Wonky.Client/App.razor
index 6e89a373..f0a0d3a0 100644
--- a/Wonky.Client/App.razor
+++ b/Wonky.Client/App.razor
@@ -1,5 +1,4 @@
-@using Wonky.Client.Shared
-@*
+@*
// 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 Affero GNU General Public License as
@@ -15,21 +14,23 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
-
-
-
-
-
- Checker autorisation ...
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+ Checker autorisation ...
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Wonky.Client/AppId.cs b/Wonky.Client/AppId.cs
index 0d73f44a..91b972b6 100644
--- a/Wonky.Client/AppId.cs
+++ b/Wonky.Client/AppId.cs
@@ -3,6 +3,7 @@ namespace Wonky.Client;
public class AppId
{
public string Version { get; set; } = "0.2.1";
- public string Name { get; set; } = "Wonky Client";
+ public string Name { get; set; } = "Inno Client";
+
public bool IsBeta { get; set; } = false;
}
\ No newline at end of file
diff --git a/Wonky.Client/AuthProviders/AuthStateProvider.cs b/Wonky.Client/AuthProviders/AuthStateProvider.cs
index 68146fa7..485f8506 100644
--- a/Wonky.Client/AuthProviders/AuthStateProvider.cs
+++ b/Wonky.Client/AuthProviders/AuthStateProvider.cs
@@ -13,8 +13,12 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Claims;
+using System.Threading.Tasks;
using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components.Authorization;
using Wonky.Entity.DTO;
diff --git a/Wonky.Client/Components/AuthLinks.razor.css b/Wonky.Client/Components/AuthLinks.razor.css
new file mode 100644
index 00000000..487b7ba3
--- /dev/null
+++ b/Wonky.Client/Components/AuthLinks.razor.css
@@ -0,0 +1,4 @@
+
+a, a:link, a:hover, a:visited, a:active {
+ color: #ffaa00;
+}
\ No newline at end of file
diff --git a/Wonky.Client/Components/CompanySearchColumn.razor b/Wonky.Client/Components/CompanySearchColumn.razor
new file mode 100644
index 00000000..95a5c0b1
--- /dev/null
+++ b/Wonky.Client/Components/CompanySearchColumn.razor
@@ -0,0 +1,25 @@
+@*
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+*@
+
+
+
diff --git a/Wonky.Client/Components/CompanySearchField.razor.cs b/Wonky.Client/Components/CompanySearchColumn.razor.cs
similarity index 84%
rename from Wonky.Client/Components/CompanySearchField.razor.cs
rename to Wonky.Client/Components/CompanySearchColumn.razor.cs
index 5e364701..1e72b9fc 100644
--- a/Wonky.Client/Components/CompanySearchField.razor.cs
+++ b/Wonky.Client/Components/CompanySearchColumn.razor.cs
@@ -19,15 +19,14 @@ using Microsoft.AspNetCore.Components;
namespace Wonky.Client.Components;
-public partial class CompanySearchField
+public partial class CompanySearchColumn
{
[Parameter]
public EventCallback OnFilterChanged { get; set; }
+ private string SearchColumn { get; set; } = "name";
private async Task ApplyFilter(ChangeEventArgs eventArgs)
{
- if (eventArgs?.Value?.ToString() == "name")
- return;
- await OnFilterChanged.InvokeAsync(eventArgs?.Value?.ToString());
+ await OnFilterChanged.InvokeAsync(SearchColumn);
}
}
\ No newline at end of file
diff --git a/Wonky.Client/Components/CompanySearchField.razor.css b/Wonky.Client/Components/CompanySearchField.razor.css
deleted file mode 100644
index 4d7d555a..00000000
--- a/Wonky.Client/Components/CompanySearchField.razor.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.search-field {
- margin-bottom: 10px;
-}
\ No newline at end of file
diff --git a/Wonky.Client/Components/CompanySort.razor b/Wonky.Client/Components/CompanySort.razor
deleted file mode 100644
index 0f612d25..00000000
--- a/Wonky.Client/Components/CompanySort.razor
+++ /dev/null
@@ -1,25 +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 Affero GNU 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
-// Affero GNU General Public License for more details.
-//
-// You should have received a copy of the Affero GNU General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-*@
-
-
-
-
\ No newline at end of file
diff --git a/Wonky.Client/Components/CompanySearchField.razor b/Wonky.Client/Components/CompanySortColumn.razor
similarity index 71%
rename from Wonky.Client/Components/CompanySearchField.razor
rename to Wonky.Client/Components/CompanySortColumn.razor
index 8882835c..4ce52495 100644
--- a/Wonky.Client/Components/CompanySearchField.razor
+++ b/Wonky.Client/Components/CompanySortColumn.razor
@@ -15,11 +15,9 @@
//
*@
-
-
-
+
+
diff --git a/Wonky.Client/Components/CompanySort.razor.cs b/Wonky.Client/Components/CompanySortColumn.razor.cs
similarity index 84%
rename from Wonky.Client/Components/CompanySort.razor.cs
rename to Wonky.Client/Components/CompanySortColumn.razor.cs
index 410179ef..a0c749ae 100644
--- a/Wonky.Client/Components/CompanySort.razor.cs
+++ b/Wonky.Client/Components/CompanySortColumn.razor.cs
@@ -19,16 +19,15 @@ using Microsoft.AspNetCore.Components;
namespace Wonky.Client.Components
{
- public partial class CompanySort
+ public partial class CompanySortColumn
{
[Parameter]
public EventCallback OnSortChanged { get; set; }
+ private string SortColumn { get; set; } = "name";
private async Task ApplySort(ChangeEventArgs eventArgs)
{
- if (eventArgs?.Value?.ToString() == "-1")
- return;
- await OnSortChanged.InvokeAsync(eventArgs?.Value?.ToString());
+ await OnSortChanged.InvokeAsync(SortColumn);
}
}
}
diff --git a/Wonky.Client/Components/CompanyTable.razor b/Wonky.Client/Components/CompanyTable.razor
index 61af00b0..c9b938f0 100644
--- a/Wonky.Client/Components/CompanyTable.razor
+++ b/Wonky.Client/Components/CompanyTable.razor
@@ -14,6 +14,8 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
+
+@using Wonky.Client.Components;
@if (Companies.Any())
{
diff --git a/Wonky.Client/Components/CounterPrint.razor b/Wonky.Client/Components/CounterPrint.razor
deleted file mode 100644
index b1ce1f12..00000000
--- a/Wonky.Client/Components/CounterPrint.razor
+++ /dev/null
@@ -1,43 +0,0 @@
-@using Microsoft.Extensions.Logging
-@implements IDisposable
-
-
@Title
-
-
Current count: @CurrentCount
-
-@code {
-
- [Parameter] public string Title { get; set; }
-
- [Parameter] public int CurrentCount { get; set; }
-
- [Inject] public ILogger Logger { get; set; }
-
- protected override void OnInitialized()
- {
- Logger.Log(LogLevel.Information,$"OnInitialized => Title: {Title}, CurrentCount: {CurrentCount}");
- }
-
- protected override void OnParametersSet()
- {
- Logger.Log(LogLevel.Information,$"OnParameterSet => Title: {Title}, CurrentCount: {CurrentCount}");
- }
-
- protected override void OnAfterRender(bool firstRender)
- {
- if (firstRender)
- {
- Logger.Log(LogLevel.Information,"This is the first render of the component");
- }
- }
-
- protected override bool ShouldRender()
- {
- return true;
- }
-
- public void Dispose()
- {
- Logger.Log(LogLevel.Information,"Component removed from the parnet's render tree.");
- }
-}
diff --git a/Wonky.Client/Components/Home.razor b/Wonky.Client/Components/Home.razor
index 95f432cc..8f5c980d 100644
--- a/Wonky.Client/Components/Home.razor
+++ b/Wonky.Client/Components/Home.razor
@@ -15,5 +15,8 @@
//
*@
-Forside
-
@Title
\ No newline at end of file
+Innotec
+
+
+
+
\ No newline at end of file
diff --git a/Wonky.Client/Components/Home.razor.cs b/Wonky.Client/Components/Home.razor.cs
index 1d9b936b..c54bcfbb 100644
--- a/Wonky.Client/Components/Home.razor.cs
+++ b/Wonky.Client/Components/Home.razor.cs
@@ -20,8 +20,6 @@ namespace Wonky.Client.Components
{
public partial class Home
{
- [Parameter] public string Title { get; set; } = "Hej";
-
- [Parameter] public RenderFragment? LoginContent { get; set; }
+ [Parameter] public RenderFragment? LoginContent { get; set; }
}
}
diff --git a/Wonky.Client/Components/SalesItemGroupFilter.razor b/Wonky.Client/Components/ItemGroupFilter.razor
similarity index 68%
rename from Wonky.Client/Components/SalesItemGroupFilter.razor
rename to Wonky.Client/Components/ItemGroupFilter.razor
index 035beb6e..c1cbf34f 100644
--- a/Wonky.Client/Components/SalesItemGroupFilter.razor
+++ b/Wonky.Client/Components/ItemGroupFilter.razor
@@ -15,14 +15,15 @@
//
*@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Wonky.Client/Components/SalesItemGroupFilter.razor.cs b/Wonky.Client/Components/ItemGroupFilter.razor.cs
similarity index 79%
rename from Wonky.Client/Components/SalesItemGroupFilter.razor.cs
rename to Wonky.Client/Components/ItemGroupFilter.razor.cs
index 9598a1e6..99392f5e 100644
--- a/Wonky.Client/Components/SalesItemGroupFilter.razor.cs
+++ b/Wonky.Client/Components/ItemGroupFilter.razor.cs
@@ -13,18 +13,19 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Components;
namespace Wonky.Client.Components;
-public partial class SalesItemGroupFilter
+public partial class ItemGroupFilter
{
[Parameter] public EventCallback OnGroupFilterChanged { get; set; }
-
+ private string GroupFilter { get; set; } = "all";
private async Task ApplyGroupFilter(ChangeEventArgs eventArgs)
{
- if (eventArgs?.Value?.ToString() == "-1")
- return;
- await OnGroupFilterChanged.InvokeAsync(eventArgs?.Value?.ToString());
+ if (GroupFilter == "all")
+ GroupFilter = "";
+ await OnGroupFilterChanged.InvokeAsync(GroupFilter);
}
}
\ No newline at end of file
diff --git a/Wonky.Client/Components/SalesItemSearchField.razor b/Wonky.Client/Components/ItemSearchColumn.razor
similarity index 68%
rename from Wonky.Client/Components/SalesItemSearchField.razor
rename to Wonky.Client/Components/ItemSearchColumn.razor
index 14315efc..b125fe20 100644
--- a/Wonky.Client/Components/SalesItemSearchField.razor
+++ b/Wonky.Client/Components/ItemSearchColumn.razor
@@ -15,11 +15,12 @@
//
*@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/Wonky.Client/Components/SalesItemSearchField.razor.cs b/Wonky.Client/Components/ItemSearchColumn.razor.cs
similarity index 71%
rename from Wonky.Client/Components/SalesItemSearchField.razor.cs
rename to Wonky.Client/Components/ItemSearchColumn.razor.cs
index 520f854d..3ec87ea5 100644
--- a/Wonky.Client/Components/SalesItemSearchField.razor.cs
+++ b/Wonky.Client/Components/ItemSearchColumn.razor.cs
@@ -17,14 +17,12 @@ using Microsoft.AspNetCore.Components;
namespace Wonky.Client.Components;
-public partial class SalesItemSearchField
+public partial class ItemSearchColumn
{
- [Parameter] public EventCallback OnSearchFieldChanged { get; set; }
-
- private async Task ApplySearchField(ChangeEventArgs eventArgs)
+ [Parameter] public EventCallback OnSearchColumnChanged { get; set; }
+ private string SearchColumn { get; set; } = "name";
+ private async Task ApplySearchColumn(ChangeEventArgs eventArgs)
{
- if (eventArgs?.Value?.ToString() == "-1")
- return;
- await OnSearchFieldChanged.InvokeAsync(eventArgs?.Value?.ToString());
- }
+ await OnSearchColumnChanged.InvokeAsync(SearchColumn);
+ }
}
\ No newline at end of file
diff --git a/Wonky.Client/Components/SalesItemSort.razor b/Wonky.Client/Components/ItemSortColumn.razor
similarity index 73%
rename from Wonky.Client/Components/SalesItemSort.razor
rename to Wonky.Client/Components/ItemSortColumn.razor
index 6ef35701..de1274b2 100644
--- a/Wonky.Client/Components/SalesItemSort.razor
+++ b/Wonky.Client/Components/ItemSortColumn.razor
@@ -15,10 +15,8 @@
//
*@
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
diff --git a/Wonky.Client/Components/SalesItemSort.razor.cs b/Wonky.Client/Components/ItemSortColumn.razor.cs
similarity index 73%
rename from Wonky.Client/Components/SalesItemSort.razor.cs
rename to Wonky.Client/Components/ItemSortColumn.razor.cs
index 0458386a..d548c4ed 100644
--- a/Wonky.Client/Components/SalesItemSort.razor.cs
+++ b/Wonky.Client/Components/ItemSortColumn.razor.cs
@@ -17,15 +17,14 @@ using Microsoft.AspNetCore.Components;
namespace Wonky.Client.Components;
-public partial class SalesItemSort
+public partial class ItemSortColumn
{
[Parameter]
- public EventCallback OnSortFieldChanged { get; set; }
+ public EventCallback OnSortColumnChanged { get; set; }
- private async Task ApplySort(ChangeEventArgs eventArgs)
+ private string SortColumn { get; set; } = "name";
+ private async Task ApplySortColumn(ChangeEventArgs eventArgs)
{
- if (eventArgs?.Value?.ToString() == "-1")
- return;
- await OnSortFieldChanged.InvokeAsync(eventArgs?.Value?.ToString());
- }
+ await OnSortColumnChanged.InvokeAsync(SortColumn);
+ }
}
\ No newline at end of file
diff --git a/Wonky.Client/Components/SalesItemTable.razor b/Wonky.Client/Components/ItemTable.razor
similarity index 96%
rename from Wonky.Client/Components/SalesItemTable.razor
rename to Wonky.Client/Components/ItemTable.razor
index 0f200e35..5a11cc93 100644
--- a/Wonky.Client/Components/SalesItemTable.razor
+++ b/Wonky.Client/Components/ItemTable.razor
@@ -30,10 +30,10 @@
{
- @salesItem.ItemName
+ @salesItem.Name
- @salesItem.ItemNumber
+ @salesItem.Sku
diff --git a/Wonky.Client/Components/SalesItemTable.razor.cs b/Wonky.Client/Components/ItemTable.razor.cs
similarity index 97%
rename from Wonky.Client/Components/SalesItemTable.razor.cs
rename to Wonky.Client/Components/ItemTable.razor.cs
index 5bd14f65..3df0822c 100644
--- a/Wonky.Client/Components/SalesItemTable.razor.cs
+++ b/Wonky.Client/Components/ItemTable.razor.cs
@@ -19,7 +19,7 @@ using Wonky.Entity.DTO;
namespace Wonky.Client.Components;
-public partial class SalesItemTable
+public partial class ItemTable
{
[Parameter] public List SalesItems { get; set; } = new();
[Parameter] public string PoDraftAccount { get; set; } = "";
diff --git a/Wonky.Client/Components/SalesItemTable.razor.css b/Wonky.Client/Components/ItemTable.razor.css
similarity index 100%
rename from Wonky.Client/Components/SalesItemTable.razor.css
rename to Wonky.Client/Components/ItemTable.razor.css
diff --git a/Wonky.Client/Components/RegInfoCompany.razor b/Wonky.Client/Components/RegInfoCompany.razor
index 4a4a82b3..fe0da788 100644
--- a/Wonky.Client/Components/RegInfoCompany.razor
+++ b/Wonky.Client/Components/RegInfoCompany.razor
@@ -27,10 +27,10 @@
CVR status @CurrentState
diff --git a/Wonky.Client/Components/RegInfoCompany.razor.cs b/Wonky.Client/Components/RegInfoCompany.razor.cs
index 3cbefd63..2dd288b9 100644
--- a/Wonky.Client/Components/RegInfoCompany.razor.cs
+++ b/Wonky.Client/Components/RegInfoCompany.razor.cs
@@ -17,7 +17,6 @@ using Microsoft.AspNetCore.Components;
using Wonky.Client.Services;
using Wonky.Entity.Models;
using Wonky.Entity.Requests;
-using Wonky.Virk.Services;
namespace Wonky.Client.Components;
@@ -30,14 +29,14 @@ public partial class RegInfoCompany
private VirkRegInfo VirkRegInfo { get; set; } = new();
private bool HideMe = true;
private bool CvrInvalid => string.IsNullOrEmpty(VatNumber);
- private VirkParams _virkParams = new();
+ private VirkParams _VirkParams = new();
private string CurrentState = "UKENDT";
private async Task GetCvrData()
{
- _virkParams.VatNumber = VatNumber;
+ _VirkParams.VatNumber = VatNumber;
if (string.IsNullOrWhiteSpace(VirkRegInfo.VatNumber))
{
- var result = await VirkRegistryService.QueryVirkRegistry(_virkParams);
+ var result = await VirkRegistryService.QueryVirkRegistry(_VirkParams);
if (result.Any())
{
CurrentState = VirkRegInfo.States[^1].State;
diff --git a/Wonky.Client/Components/RegLookupAddress.razor b/Wonky.Client/Components/RegLookupAddress.razor
index f8cc06f8..14f91af1 100644
--- a/Wonky.Client/Components/RegLookupAddress.razor
+++ b/Wonky.Client/Components/RegLookupAddress.razor
@@ -14,6 +14,8 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
+@using Microsoft.VisualBasic
+@using System.Diagnostics
diff --git a/Wonky.Client/Components/RegLookupAddress.razor.cs b/Wonky.Client/Components/RegLookupAddress.razor.cs
index 649f26e3..b25c3d56 100644
--- a/Wonky.Client/Components/RegLookupAddress.razor.cs
+++ b/Wonky.Client/Components/RegLookupAddress.razor.cs
@@ -20,7 +20,6 @@ using Wonky.Client.HttpInterceptors;
using Wonky.Client.Services;
using Wonky.Entity.Models;
using Wonky.Entity.Requests;
-using Wonky.Virk.Services;
namespace Wonky.Client.Components;
diff --git a/Wonky.Client/Components/RegLookupVatNo.razor.cs b/Wonky.Client/Components/RegLookupVatNo.razor.cs
index 18926da8..4ca83bec 100644
--- a/Wonky.Client/Components/RegLookupVatNo.razor.cs
+++ b/Wonky.Client/Components/RegLookupVatNo.razor.cs
@@ -20,7 +20,6 @@ using Wonky.Client.HttpInterceptors;
using Wonky.Client.Services;
using Wonky.Entity.Models;
using Wonky.Entity.Requests;
-using Wonky.Virk.Services;
namespace Wonky.Client.Components;
diff --git a/Wonky.Client/Components/RegStateVatNumber.razor.cs b/Wonky.Client/Components/RegStateVatNumber.razor.cs
index 106e690e..376dd792 100644
--- a/Wonky.Client/Components/RegStateVatNumber.razor.cs
+++ b/Wonky.Client/Components/RegStateVatNumber.razor.cs
@@ -18,7 +18,6 @@ using Microsoft.AspNetCore.Components;
using Wonky.Client.Services;
using Wonky.Entity.Models;
using Wonky.Entity.Requests;
-using Wonky.Virk.Services;
namespace Wonky.Client.Components;
@@ -29,15 +28,15 @@ public partial class RegStateVatNumber
[Parameter] public string VatNumber { get; set; } = "";
private VirkRegInfo VirkRegInfo { get; set; } = new();
- private readonly VirkParams _virkParams = new();
+ private readonly VirkParams _VirkParams = new();
private string CurrentRegState = "UKENDT";
protected override async Task OnParametersSetAsync()
{
- _virkParams.VatNumber = VatNumber;
+ _VirkParams.VatNumber = VatNumber;
if (!string.IsNullOrEmpty(VatNumber))
{
- var result = await VirkRegistryService.QueryVirkRegistry(_virkParams);
+ var result = await VirkRegistryService.QueryVirkRegistry(_VirkParams);
VirkRegInfo = result.Any() ? result[0] : new VirkRegInfo();
if (VirkRegInfo.States.Any())
CurrentRegState = VirkRegInfo.States[^1].State;
diff --git a/Wonky.Client/Components/SalesItemGroupFilter.razor.css b/Wonky.Client/Components/SalesItemGroupFilter.razor.css
deleted file mode 100644
index e01c1fc6..00000000
--- a/Wonky.Client/Components/SalesItemGroupFilter.razor.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.group-field {
- margin-bottom: 10px;
-}
\ No newline at end of file
diff --git a/Wonky.Client/Components/SalesItemSearchField.razor.css b/Wonky.Client/Components/SalesItemSearchField.razor.css
deleted file mode 100644
index 4d7d555a..00000000
--- a/Wonky.Client/Components/SalesItemSearchField.razor.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.search-field {
- margin-bottom: 10px;
-}
\ No newline at end of file
diff --git a/Wonky.Client/Components/SearchPhrase.razor b/Wonky.Client/Components/SearchPhrase.razor
index ce57aae5..247f2854 100644
--- a/Wonky.Client/Components/SearchPhrase.razor
+++ b/Wonky.Client/Components/SearchPhrase.razor
@@ -15,8 +15,7 @@
//
*@
-
-
-
\ No newline at end of file
+
+
diff --git a/Wonky.Client/Components/SearchPhrase.razor.cs b/Wonky.Client/Components/SearchPhrase.razor.cs
index 0cb5cb54..bf7d0fde 100644
--- a/Wonky.Client/Components/SearchPhrase.razor.cs
+++ b/Wonky.Client/Components/SearchPhrase.razor.cs
@@ -22,9 +22,8 @@ namespace Wonky.Client.Components
public partial class SearchPhrase
{
private Timer _timer = new();
- public string SearchTerm { get; set; } = "";
-
- [Parameter] public EventCallback OnSearchChanged { get; set; }
+ private string SearchTerm { get; set; } = "";
+ [Parameter] public EventCallback OnSearchPhraseChanged { get; set; }
private void SearchChanged()
{
@@ -36,7 +35,7 @@ namespace Wonky.Client.Components
private void OnTimerElapsed(object? sender, ElapsedEventArgs e)
{
- OnSearchChanged.InvokeAsync(SearchTerm);
+ OnSearchPhraseChanged.InvokeAsync(SearchTerm);
_timer.Enabled = false;
_timer.Dispose();
}
diff --git a/Wonky.Client/Components/SearchPhrase.razor.css b/Wonky.Client/Components/SearchPhrase.razor.css
deleted file mode 100644
index 32935266..00000000
--- a/Wonky.Client/Components/SearchPhrase.razor.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.search-input {
- margin-bottom: 10px;
-}
\ No newline at end of file
diff --git a/Wonky.Client/Features/JwtParser.cs b/Wonky.Client/Features/JwtParser.cs
deleted file mode 100644
index c6fdab6f..00000000
--- a/Wonky.Client/Features/JwtParser.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System.Security.Claims;
-using System.Text.Json;
-
-namespace Wonky.Client.Features;
-
-public class JwtParser
-{
- public static IEnumerable ParseClaimsFromJwt(string jwt)
- {
- var claims = new List();
- var payload = jwt.Split('.')[1];
-
- var jsonBytes = ParseBase64WithoutPadding(payload);
-
- var keyValuePairs = JsonSerializer
- .Deserialize>(jsonBytes);
-
- ExtractRolesFromJwt(claims, keyValuePairs);
-
- claims.AddRange(keyValuePairs!
- .Select(kvp => new Claim(kvp.Key, kvp.Value.ToString())));
-
- return claims;
- }
-
- private static void ExtractRolesFromJwt(List claims,
- Dictionary? keyValuePairs)
- {
- keyValuePairs.TryGetValue(ClaimTypes.Role, out object roles);
- if (roles == null) return;
- var parsedRoles = roles.ToString().Trim()
- .TrimStart('[').TrimEnd(']').Split(',');
- if (parsedRoles.Length > 1)
- {
- claims.AddRange(parsedRoles
- .Select(parsedRole => new Claim(ClaimTypes.Role, parsedRole.Trim('"'))));
- }
- else
- {
- claims.Add(new Claim(ClaimTypes.Role, parsedRoles[0]));
- }
- keyValuePairs.Remove(ClaimTypes.Role);
- }
-
-
- private static byte[] ParseBase64WithoutPadding(string base64)
- {
- switch (base64.Length % 4)
- {
- case 2: base64 += "=="; break;
- case 3: base64 += "="; break;
- }
-
- return Convert.FromBase64String(base64);
- }
-}
\ No newline at end of file
diff --git a/Wonky.Client/Features/PagingResponse.cs b/Wonky.Client/Features/PagingResponse.cs
index 6bdb5700..42bfa151 100644
--- a/Wonky.Client/Features/PagingResponse.cs
+++ b/Wonky.Client/Features/PagingResponse.cs
@@ -13,6 +13,7 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System.Collections.Generic;
using Wonky.Entity.Requests;
namespace Wonky.Client.Features;
diff --git a/Wonky.Client/Helpers/Utils.cs b/Wonky.Client/Helpers/Utils.cs
index 7331573a..f5e8e107 100644
--- a/Wonky.Client/Helpers/Utils.cs
+++ b/Wonky.Client/Helpers/Utils.cs
@@ -13,6 +13,8 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System;
+
namespace Wonky.Client.Helpers;
public static class Utils
diff --git a/Wonky.Client/HttpInterceptors/HttpInterceptorService.cs b/Wonky.Client/HttpInterceptors/HttpInterceptorService.cs
index c5cedfbe..593ebdb6 100644
--- a/Wonky.Client/HttpInterceptors/HttpInterceptorService.cs
+++ b/Wonky.Client/HttpInterceptors/HttpInterceptorService.cs
@@ -15,10 +15,12 @@
using System.Net;
using System.Net.Http.Headers;
+using System.Threading.Tasks;
using Blazored.Toast.Services;
-using Microsoft.AspNetCore.Components;
-using Toolbelt.Blazor;
using Wonky.Client.Services;
+using Microsoft.AspNetCore.Components;
+using Microsoft.Extensions.Logging;
+using Toolbelt.Blazor;
namespace Wonky.Client.HttpInterceptors
{
diff --git a/Wonky.Client/HttpInterceptors/HttpResponseException.cs b/Wonky.Client/HttpInterceptors/HttpResponseException.cs
index cf52e847..61489b32 100644
--- a/Wonky.Client/HttpInterceptors/HttpResponseException.cs
+++ b/Wonky.Client/HttpInterceptors/HttpResponseException.cs
@@ -13,6 +13,7 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System;
using System.Runtime.Serialization;
namespace Wonky.Client.HttpInterceptors
diff --git a/Wonky.Client/HttpRepository/CompanyHttpRepository.cs b/Wonky.Client/HttpRepository/CompanyHttpRepository.cs
index 60e0ce80..929cff96 100644
--- a/Wonky.Client/HttpRepository/CompanyHttpRepository.cs
+++ b/Wonky.Client/HttpRepository/CompanyHttpRepository.cs
@@ -13,12 +13,17 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
using System.Net.Http.Json;
using System.Text.Json;
+using System.Threading.Tasks;
+using Wonky.Client.Features;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
+using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-using Wonky.Client.Features;
using Wonky.Entity.Configuration;
using Wonky.Entity.DTO;
using Wonky.Entity.Requests;
@@ -55,12 +60,12 @@ public class CompanyHttpRepository : ICompanyHttpRepository
{
["pageNumber"] = pagingParameters.PageNumber.ToString(),
["pageSize"] = pagingParameters.PageSize.ToString(),
- ["searchTerm"] = string.IsNullOrEmpty(pagingParameters.SearchTerm) ? "" : pagingParameters.SearchTerm,
- ["orderBy"] = string.IsNullOrEmpty(pagingParameters.OrderBy) ? "" : pagingParameters.OrderBy,
- ["searchColumn"] = string.IsNullOrEmpty(pagingParameters.SearchColumn) ? "" : pagingParameters.SearchColumn
+ ["searchTerm"] = pagingParameters.SearchTerm,
+ ["searchColumn"] = pagingParameters.SearchColumn,
+ ["orderBy"] = pagingParameters.OrderBy
};
var response = await _client
- .GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.CrmCompanies}", queryString));
+ .GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.CrmCompanies}/page", queryString));
var content = await response.Content.ReadAsStringAsync();
diff --git a/Wonky.Client/HttpRepository/ICompanyHttpRepository.cs b/Wonky.Client/HttpRepository/ICompanyHttpRepository.cs
index 65003abd..0292ae26 100644
--- a/Wonky.Client/HttpRepository/ICompanyHttpRepository.cs
+++ b/Wonky.Client/HttpRepository/ICompanyHttpRepository.cs
@@ -13,6 +13,7 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System.Threading.Tasks;
using Wonky.Client.Features;
using Wonky.Entity.DTO;
using Wonky.Entity.Requests;
diff --git a/Wonky.Client/HttpRepository/IKrvProductHttpRepository.cs b/Wonky.Client/HttpRepository/IKrvProductHttpRepository.cs
deleted file mode 100644
index 59fce7ff..00000000
--- a/Wonky.Client/HttpRepository/IKrvProductHttpRepository.cs
+++ /dev/null
@@ -1,29 +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 Affero GNU 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
-// Affero GNU General Public License for more details.
-//
-// You should have received a copy of the Affero GNU General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-
-using Wonky.Client.Features;
-using Wonky.Entity.DTO;
-using Wonky.Entity.Requests;
-
-namespace Wonky.Client.HttpRepository;
-
-public interface IKrvProductHttpRepository
-{
- Task> GetProducts(PagingParams pagingParameters);
- Task GetProduct(string productId);
- Task CreateProduct(KrvProductDto product);
- Task UploadImage(MultipartFormDataContent content, string productId);
- Task UpdateProduct(KrvProductDto product);
-}
\ No newline at end of file
diff --git a/Wonky.Client/HttpRepository/IKrvVariantHttpRepository.cs b/Wonky.Client/HttpRepository/IKrvVariantHttpRepository.cs
deleted file mode 100644
index b67ce000..00000000
--- a/Wonky.Client/HttpRepository/IKrvVariantHttpRepository.cs
+++ /dev/null
@@ -1,29 +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 Affero GNU 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
-// Affero GNU General Public License for more details.
-//
-// You should have received a copy of the Affero GNU General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-
-using Wonky.Client.Features;
-using Wonky.Entity.DTO;
-using Wonky.Entity.Requests;
-
-namespace Wonky.Client.HttpRepository;
-
-public interface IKrvVariantHttpRepository
-{
- Task> GetVariants(PagingParams pagingParameters);
- Task GetVariant(string variantId);
- Task CreateVariant(KrvVariantDto variantDto);
- Task UploadImage(MultipartFormDataContent content, string variantId);
- Task UpdateVariant(KrvVariantDto variant);
-}
\ No newline at end of file
diff --git a/Wonky.Client/HttpRepository/ISalesItemHttpRepository.cs b/Wonky.Client/HttpRepository/ISalesItemHttpRepository.cs
index d988b2a7..ab3bec04 100644
--- a/Wonky.Client/HttpRepository/ISalesItemHttpRepository.cs
+++ b/Wonky.Client/HttpRepository/ISalesItemHttpRepository.cs
@@ -13,6 +13,7 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System.Threading.Tasks;
using Wonky.Client.Features;
using Wonky.Entity.DTO;
using Wonky.Entity.Requests;
diff --git a/Wonky.Client/HttpRepository/KrvProductHttpRepository.cs b/Wonky.Client/HttpRepository/KrvProductHttpRepository.cs
deleted file mode 100644
index 05558ab7..00000000
--- a/Wonky.Client/HttpRepository/KrvProductHttpRepository.cs
+++ /dev/null
@@ -1,108 +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 Affero GNU 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
-// Affero GNU General Public License for more details.
-//
-// You should have received a copy of the Affero GNU General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-
-using System.Net.Http.Json;
-using System.Text.Json;
-using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.WebUtilities;
-using Microsoft.Extensions.Options;
-using Wonky.Client.Features;
-using Wonky.Entity.Configuration;
-using Wonky.Entity.DTO;
-using Wonky.Entity.Requests;
-
-namespace Wonky.Client.HttpRepository;
-
-public class KrvProductHttpRepository : IKrvProductHttpRepository
-{
- private readonly JsonSerializerOptions? _options = new JsonSerializerOptions
- {
- PropertyNameCaseInsensitive = true
- };
-
- private readonly NavigationManager _navigation;
- private ILogger _logger;
- private readonly HttpClient _client;
- private readonly ApiConfig _apiConfig;
-
- public KrvProductHttpRepository(HttpClient client,
- ILogger logger,
- NavigationManager navigation, IOptions configuration)
- {
- _client = client;
- _logger = logger;
- _navigation = navigation;
- _apiConfig = configuration.Value;
- }
-
- public async Task> GetProducts(PagingParams pagingParameters)
- {
- var queryString = new Dictionary
- {
- ["pageNumber"] = pagingParameters.PageNumber.ToString(),
- ["pageSize"] = pagingParameters.PageSize.ToString(),
- ["searchTerm"] = string.IsNullOrEmpty(pagingParameters.SearchTerm) ? "" : pagingParameters.SearchTerm,
- ["orderBy"] = string.IsNullOrEmpty(pagingParameters.OrderBy) ? "" : pagingParameters.OrderBy
- };
- var response = await _client
- .GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.KrvProducts}", queryString))
- ;
-
- var content = await response.Content
- .ReadAsStringAsync()
- ;
-
- var pagingResponse = new PagingResponse
- {
- Items = JsonSerializer.Deserialize>(content, _options),
- MetaData = JsonSerializer.Deserialize(
- response.Headers.GetValues("X-Pagination").First(), _options)
- };
- return pagingResponse;
- }
-
- public async Task GetProduct(string productId)
- {
- var product = await _client
- .GetFromJsonAsync($"{_apiConfig.KrvProducts}/get/id({productId})")
- ;
- return product ?? new KrvProductDto();
- }
-
- public async Task CreateProduct(KrvProductDto productDto)
- {
- await _client
- .PostAsJsonAsync($"{_apiConfig.KrvProducts}", productDto)
- ;
- }
-
- public async Task UploadImage(MultipartFormDataContent content, string productId)
- {
- var postResult = await _client
- .PostAsync($"{_apiConfig.ImageUpload}/products/id({productId})/image", content)
- ;
-
- var postContent = await postResult.Content.ReadAsStringAsync();
-
- return postContent;
- }
-
- public async Task UpdateProduct(KrvProductDto product)
- {
- Console.WriteLine(product.ProductId);
-
- await _client.PutAsJsonAsync($"{_apiConfig.KrvProducts}/put/id({product.ProductId})", product);
- }
-}
\ No newline at end of file
diff --git a/Wonky.Client/HttpRepository/KrvVariantHttpRepository.cs b/Wonky.Client/HttpRepository/KrvVariantHttpRepository.cs
deleted file mode 100644
index ea7b3e45..00000000
--- a/Wonky.Client/HttpRepository/KrvVariantHttpRepository.cs
+++ /dev/null
@@ -1,112 +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 Affero GNU 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
-// Affero GNU General Public License for more details.
-//
-// You should have received a copy of the Affero GNU General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-
-using System.Net.Http.Json;
-using System.Text.Json;
-using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.WebUtilities;
-using Microsoft.Extensions.Options;
-using Wonky.Client.Features;
-using Wonky.Entity.Configuration;
-using Wonky.Entity.DTO;
-using Wonky.Entity.Requests;
-
-namespace Wonky.Client.HttpRepository;
-
-public class KrvVariantHttpRepository : IKrvVariantHttpRepository
-{
- private readonly JsonSerializerOptions _options = new JsonSerializerOptions
- {
- PropertyNameCaseInsensitive = true
- };
-
- private readonly NavigationManager _navigation;
- private ILogger _logger;
- private readonly HttpClient _client;
- private readonly ApiConfig _apiConfig;
-
- public KrvVariantHttpRepository(HttpClient client,
- ILogger logger,
- NavigationManager navigation, IOptions configuration)
- {
- _client = client;
- _logger = logger;
- _navigation = navigation;
- _apiConfig = configuration.Value;
- }
-
- public async Task> GetVariants(PagingParams pagingParameters)
- {
- var queryString = new Dictionary
- {
- ["pageNumber"] = pagingParameters.PageNumber.ToString(),
- ["pageSize"] = pagingParameters.PageSize.ToString(),
- ["searchTerm"] = string.IsNullOrEmpty(pagingParameters.SearchTerm) ? "" : pagingParameters.SearchTerm,
- ["orderBy"] = string.IsNullOrEmpty(pagingParameters.OrderBy) ? "" : pagingParameters.OrderBy
- };
- var response = await _client
- .GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.KrvVariants}", queryString))
- ;
-
- var content = await response.Content
- .ReadAsStringAsync()
- ;
-
- var pagingResponse = new PagingResponse
- {
- Items = JsonSerializer.Deserialize>(content, _options),
- MetaData = JsonSerializer.Deserialize(
- response.Headers.GetValues("X-Pagination").First(), _options)
- };
- return pagingResponse;
- }
-
- public async Task GetVariant(string variantId)
- {
- var variant = await _client
- .GetFromJsonAsync($"{_apiConfig.KrvVariants}/get/id({variantId})")
- ;
- return variant ?? new KrvVariantDto();
- }
-
- public async Task CreateVariant(KrvVariantDto variantDto)
- {
- await _client
- .PostAsJsonAsync($"v2/", variantDto)
- ;
- }
-
- public async Task UploadImage(MultipartFormDataContent content, string variantId)
- {
- Console.WriteLine($" Repo -> UploadImage -> {variantId}");
-
- var postResult = await _client
- .PostAsync($"{_apiConfig.ImageUpload}/variants/id({variantId})/image", content)
- ;
-
- var postContent = await postResult.Content.ReadAsStringAsync();
-
- Console.WriteLine(postContent);
-
- return postContent;
- }
-
- public async Task UpdateVariant(KrvVariantDto variant)
- {
- Console.WriteLine(variant.VariantId);
-
- await _client.PutAsJsonAsync($"{_apiConfig.KrvVariants}/put/id({variant.VariantId})", variant);
- }
-}
\ No newline at end of file
diff --git a/Wonky.Client/HttpRepository/SalesItemHttpRepository.cs b/Wonky.Client/HttpRepository/SalesItemHttpRepository.cs
index 47a1697b..3bd25ca8 100644
--- a/Wonky.Client/HttpRepository/SalesItemHttpRepository.cs
+++ b/Wonky.Client/HttpRepository/SalesItemHttpRepository.cs
@@ -13,12 +13,16 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
using System.Net.Http.Json;
using System.Text.Json;
+using System.Threading.Tasks;
+using Wonky.Client.Features;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Options;
-using Wonky.Client.Features;
using Wonky.Entity.Configuration;
using Wonky.Entity.DTO;
using Wonky.Entity.Requests;
@@ -53,11 +57,13 @@ public class SalesItemHttpRepository : ISalesItemHttpRepository
{
["pageNumber"] = pagingParameters.PageNumber.ToString(),
["pageSize"] = pagingParameters.PageSize.ToString(),
- ["searchTerm"] = string.IsNullOrEmpty(pagingParameters.SearchTerm) ? "" : pagingParameters.SearchTerm,
- ["orderBy"] = string.IsNullOrEmpty(pagingParameters.OrderBy) ? "" : pagingParameters.OrderBy
+ ["searchTerm"] = pagingParameters.SearchTerm,
+ ["searchColumn"] = pagingParameters.SearchColumn,
+ ["orderBy"] = pagingParameters.OrderBy,
+ ["selectGroup"] = pagingParameters.SelectGroup
};
var response = await _client
- .GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.PriceCatalog}", queryString));
+ .GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.PriceCatalog}/page", queryString));
var content = await response.Content.ReadAsStringAsync();
diff --git a/Wonky.Client/Models/PurchaseOrder.cs b/Wonky.Client/Models/PurchaseOrder.cs
index b546367d..8a85eaa7 100644
--- a/Wonky.Client/Models/PurchaseOrder.cs
+++ b/Wonky.Client/Models/PurchaseOrder.cs
@@ -13,6 +13,7 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Wonky.Entity.DTO;
diff --git a/Wonky.Client/Models/Quote.cs b/Wonky.Client/Models/Quote.cs
index 0c9cfca2..ff1a0d32 100644
--- a/Wonky.Client/Models/Quote.cs
+++ b/Wonky.Client/Models/Quote.cs
@@ -13,6 +13,8 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System.Collections.Generic;
+
namespace Wonky.Client.Models
{
public class Quote
diff --git a/Wonky.Client/Pages/About.razor b/Wonky.Client/Pages/About.razor
index 96a1a1f3..77948602 100644
--- a/Wonky.Client/Pages/About.razor
+++ b/Wonky.Client/Pages/About.razor
@@ -1,6 +1,12 @@
+@using Wonky.Client.Components
@page "/About"
-
Hvad er Wonky Online
+
+
+
-Wonky Online er Innotec Danmarks egen udviklede ordresystem.
+
+
+
+
+
-
\ No newline at end of file
diff --git a/Wonky.Client/Pages/ActivityList.razor b/Wonky.Client/Pages/ActivityList.razor
deleted file mode 100644
index e79c5923..00000000
--- a/Wonky.Client/Pages/ActivityList.razor
+++ /dev/null
@@ -1,9 +0,0 @@
-@page "/activites"
-
-
Salgs Aktivitet
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Wonky.Client/Pages/ActivityList.razor.cs b/Wonky.Client/Pages/ActivityList.razor.cs
deleted file mode 100644
index e519af77..00000000
--- a/Wonky.Client/Pages/ActivityList.razor.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System.Diagnostics;
-using Microsoft.AspNetCore.Components;
-
-namespace Wonky.Client.Pages;
-
-public partial class ActivityList
-{
- public List Activities { get; set; } = new();
-
-}
\ No newline at end of file
diff --git a/Wonky.Client/Pages/ActivityList.razor.css b/Wonky.Client/Pages/ActivityList.razor.css
deleted file mode 100644
index e69de29b..00000000
diff --git a/Wonky.Client/Pages/CompanyCreate.razor b/Wonky.Client/Pages/CompanyCreate.razor
index d74dbc04..188b2c4f 100644
--- a/Wonky.Client/Pages/CompanyCreate.razor
+++ b/Wonky.Client/Pages/CompanyCreate.razor
@@ -17,7 +17,6 @@
@page "/create-company"
@using Microsoft.AspNetCore.Authorization
-@using Microsoft.AspNetCore.Components
@attribute [Authorize(Roles = "Adviser")]
Opret firma
diff --git a/Wonky.Client/Pages/CompanyCreate.razor.cs b/Wonky.Client/Pages/CompanyCreate.razor.cs
index 73aa7638..7b9d0045 100644
--- a/Wonky.Client/Pages/CompanyCreate.razor.cs
+++ b/Wonky.Client/Pages/CompanyCreate.razor.cs
@@ -13,18 +13,21 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System;
using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Threading.Tasks;
using Blazored.LocalStorage;
using Blazored.Toast.Services;
-using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.Components.Forms;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository;
using Wonky.Client.Services;
+using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.Components.Forms;
+using Microsoft.Extensions.Logging;
using Wonky.Entity.DTO;
using Wonky.Entity.Models;
using Wonky.Entity.Requests;
-using Wonky.Virk.Services;
namespace Wonky.Client.Pages
{
diff --git a/Wonky.Client/Pages/CompanyList.razor b/Wonky.Client/Pages/CompanyList.razor
index 3b8e5b18..e2034697 100644
--- a/Wonky.Client/Pages/CompanyList.razor
+++ b/Wonky.Client/Pages/CompanyList.razor
@@ -16,21 +16,20 @@
*@
@page "/companies"
+@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Adviser")]
-
+
-
+
-
-
-
-
+
+
Nyt firma
diff --git a/Wonky.Client/Pages/CompanyList.razor.cs b/Wonky.Client/Pages/CompanyList.razor.cs
index f10939e8..ce4eca25 100644
--- a/Wonky.Client/Pages/CompanyList.razor.cs
+++ b/Wonky.Client/Pages/CompanyList.razor.cs
@@ -13,9 +13,12 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
-using Microsoft.AspNetCore.Components;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository;
+using Microsoft.AspNetCore.Components;
using Wonky.Entity.DTO;
using Wonky.Entity.Requests;
@@ -27,7 +30,7 @@ namespace Wonky.Client.Pages
public MetaData? MetaData { get; set; } = new();
private PagingParams _paging = new();
-
+
[Inject]
public ICompanyHttpRepository CompanyRepo { get; set; }
@@ -56,6 +59,7 @@ namespace Wonky.Client.Pages
private async Task FilterChanged(string? searchColumn)
{
+ _paging.SearchTerm = "";
_paging.SearchColumn = searchColumn;
_paging.PageNumber = 1;
await GetCompanies();
diff --git a/Wonky.Client/Pages/CompanyUpdate.razor b/Wonky.Client/Pages/CompanyUpdate.razor
index 9be2ebf6..4ecf3375 100644
--- a/Wonky.Client/Pages/CompanyUpdate.razor
+++ b/Wonky.Client/Pages/CompanyUpdate.razor
@@ -17,6 +17,7 @@
@page "/update-company/{account}"
@using Microsoft.AspNetCore.Authorization
+@using Wonky.Client.Components
@using Microsoft.AspNetCore.Components
@attribute [Authorize(Roles = "Adviser")]
diff --git a/Wonky.Client/Pages/CompanyUpdate.razor.cs b/Wonky.Client/Pages/CompanyUpdate.razor.cs
index e8913272..e08927f2 100644
--- a/Wonky.Client/Pages/CompanyUpdate.razor.cs
+++ b/Wonky.Client/Pages/CompanyUpdate.razor.cs
@@ -13,11 +13,14 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System;
+using System.Threading.Tasks;
using Blazored.Toast.Services;
-using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.Components.Forms;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository;
+using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.Components.Forms;
+using Microsoft.Extensions.Logging;
using Wonky.Entity.DTO;
namespace Wonky.Client.Pages;
diff --git a/Wonky.Client/Pages/CompanyView.razor b/Wonky.Client/Pages/CompanyView.razor
index e608c7fc..701eba5e 100644
--- a/Wonky.Client/Pages/CompanyView.razor
+++ b/Wonky.Client/Pages/CompanyView.razor
@@ -18,6 +18,7 @@
@page "/company/account/{account}"
@page "/company/{companyId}"
@using Microsoft.AspNetCore.Authorization
+@using Wonky.Client.Components;
@attribute [Authorize(Roles = "Adviser")]
@@ -34,7 +35,7 @@
- Tilbud
+ TilbudOrdreFakturaProdukter
diff --git a/Wonky.Client/Pages/CompanyView.razor.cs b/Wonky.Client/Pages/CompanyView.razor.cs
index 176138ff..aa79f743 100644
--- a/Wonky.Client/Pages/CompanyView.razor.cs
+++ b/Wonky.Client/Pages/CompanyView.razor.cs
@@ -13,9 +13,11 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
-using Microsoft.AspNetCore.Components;
+using System;
+using System.Threading.Tasks;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository;
+using Microsoft.AspNetCore.Components;
using Wonky.Entity.DTO;
namespace Wonky.Client.Pages;
diff --git a/Wonky.Client/Pages/Index.razor b/Wonky.Client/Pages/Index.razor
index 0586e4d2..dd13f3c3 100644
--- a/Wonky.Client/Pages/Index.razor
+++ b/Wonky.Client/Pages/Index.razor
@@ -18,8 +18,9 @@
@page "/"
@page "/index"
@inject IWebAssemblyHostEnvironment _hostEnvironment
+@using Wonky.Client.Components;
-
+
@code{
}
diff --git a/Wonky.Client/Pages/Login.razor b/Wonky.Client/Pages/Login.razor
index e19901e2..230bba62 100644
--- a/Wonky.Client/Pages/Login.razor
+++ b/Wonky.Client/Pages/Login.razor
@@ -31,15 +31,15 @@
-
+
-
-
+
@@ -48,7 +48,7 @@
-
+
\ No newline at end of file
diff --git a/Wonky.Client/Pages/Login.razor.cs b/Wonky.Client/Pages/Login.razor.cs
index e5b2226c..a8d636bd 100644
--- a/Wonky.Client/Pages/Login.razor.cs
+++ b/Wonky.Client/Pages/Login.razor.cs
@@ -13,8 +13,9 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
-using Microsoft.AspNetCore.Components;
+using System.Threading.Tasks;
using Wonky.Client.Services;
+using Microsoft.AspNetCore.Components;
using Wonky.Entity.DTO;
namespace Wonky.Client.Pages;
@@ -31,20 +32,23 @@ public partial class Login
[Parameter] public string ReturnUrl { get; set; } = "";
private bool ShowAuthError { get; set; }
private string? Error { get; set; }
+ private bool execLogin;
private async Task ExecuteLogin()
{
ShowAuthError = false;
+ execLogin = true;
var result = await AuthenticationService.Login(_userAuthenticationDto);
if (!result.IsSuccess)
{
Error = result.ErrorMessage;
ShowAuthError = true;
+ execLogin = false;
}
else
{
- var returnUrl = string.IsNullOrEmpty(ReturnUrl) ? "/companies" : ReturnUrl;
+ var returnUrl = string.IsNullOrEmpty(ReturnUrl) ? "/Companies" : ReturnUrl;
NavigationManager.NavigateTo(returnUrl);
}
}
diff --git a/Wonky.Client/Pages/Logout.razor.cs b/Wonky.Client/Pages/Logout.razor.cs
index 81eed805..91182c12 100644
--- a/Wonky.Client/Pages/Logout.razor.cs
+++ b/Wonky.Client/Pages/Logout.razor.cs
@@ -13,8 +13,9 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
-using Microsoft.AspNetCore.Components;
+using System.Threading.Tasks;
using Wonky.Client.Services;
+using Microsoft.AspNetCore.Components;
namespace Wonky.Client.Pages;
diff --git a/Wonky.Client/Pages/ProductCreate.razor b/Wonky.Client/Pages/ProductCreate.razor
deleted file mode 100644
index d212864c..00000000
--- a/Wonky.Client/Pages/ProductCreate.razor
+++ /dev/null
@@ -1,54 +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 Affero GNU 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
-// Affero GNU General Public License for more details.
-//
-// You should have received a copy of the Affero GNU General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-*@
-
-@page "/create-product"
-@using Microsoft.AspNetCore.Authorization
-@using Microsoft.AspNetCore.Components
-@attribute [Authorize(Roles = "Admin")]
-
Opret KRV Produkt
-@* *@
-
-
- @* *@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Wonky.Client/Pages/ProductCreate.razor.cs b/Wonky.Client/Pages/ProductCreate.razor.cs
deleted file mode 100644
index 1f4ec1df..00000000
--- a/Wonky.Client/Pages/ProductCreate.razor.cs
+++ /dev/null
@@ -1,87 +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 Affero GNU 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
-// Affero GNU General Public License for more details.
-//
-// You should have received a copy of the Affero GNU General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-
-using Blazored.Toast.Services;
-using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.Components.Forms;
-using Wonky.Client.HttpInterceptors;
-using Wonky.Client.HttpRepository;
-using Wonky.Entity.DTO;
-
-namespace Wonky.Client.Pages
-{
- public partial class ProductCreate : IDisposable
- {
- private KrvProductDto _productDto { get; set; } = new();
-
- private EditContext _editContext;
- private bool _formInvalid = true;
-
- [Inject]
- public IKrvProductHttpRepository ProductRepo { get; set; }
-
- [Inject]
- public HttpInterceptorService Interceptor { get; set; }
-
- [Inject]
- public IToastService ToastService { get; set; }
-
- [Inject]
- public ILogger Logger { get; set; }
-
- protected override void OnInitialized()
- {
- _editContext = new EditContext(_productDto);
- _editContext.OnFieldChanged += HandleFieldChanged;
- Interceptor.RegisterEvent();
- Interceptor.RegisterBeforeSendEvent();
- }
-
- private async Task Create()
- {
- Logger.LogDebug($"{_productDto}");
- await ProductRepo.CreateProduct(_productDto);
- ToastService.ShowSuccess($"Godt så. Produktet '{_productDto.TradingName}' er oprettet.");
- _productDto = new KrvProductDto();
- _editContext.OnValidationStateChanged += ValidationChanged;
- _editContext.NotifyValidationStateChanged();
- }
-
- private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
- {
- _formInvalid = !_editContext.Validate();
- StateHasChanged();
- }
-
- private void ValidationChanged(object sender, ValidationStateChangedEventArgs e)
- {
- _formInvalid = true;
- _editContext.OnFieldChanged -= HandleFieldChanged;
- _editContext = new EditContext(_productDto);
- _editContext.OnFieldChanged += HandleFieldChanged;
- _editContext.OnValidationStateChanged -= ValidationChanged;
- }
-
- public void Dispose()
- {
- Interceptor.DisposeEvent();
- _editContext.OnFieldChanged -= HandleFieldChanged;
- _editContext.OnValidationStateChanged -= ValidationChanged;
- }
-
- private void AssignImageUrl(string imgUrl) => _productDto.PictureLink = imgUrl;
- }
-}
-
diff --git a/Wonky.Client/Pages/PurchaseOrderCreate.razor b/Wonky.Client/Pages/PurchaseOrderCreate.razor
index 1309aac1..d9342c39 100644
--- a/Wonky.Client/Pages/PurchaseOrderCreate.razor
+++ b/Wonky.Client/Pages/PurchaseOrderCreate.razor
@@ -18,6 +18,7 @@
@page "/company/{account}/activity"
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Adviser")]
+@using Wonky.Client.Components
@_purchaseOrder.Name
@@ -104,7 +105,7 @@
-
+
diff --git a/Wonky.Client/Pages/PurchaseOrderCreate.razor.cs b/Wonky.Client/Pages/PurchaseOrderCreate.razor.cs
index 3580ee27..0ba37de3 100644
--- a/Wonky.Client/Pages/PurchaseOrderCreate.razor.cs
+++ b/Wonky.Client/Pages/PurchaseOrderCreate.razor.cs
@@ -13,14 +13,17 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
using Blazored.LocalStorage;
using Blazored.Toast.Services;
-using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.Components.Forms;
using Wonky.Client.Helpers;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository;
using Wonky.Client.Models;
+using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.Components.Forms;
using Wonky.Entity.DTO;
using Wonky.Entity.Requests;
diff --git a/Wonky.Client/Pages/Registration.razor b/Wonky.Client/Pages/Registration.razor
deleted file mode 100644
index 5b504c96..00000000
--- a/Wonky.Client/Pages/Registration.razor
+++ /dev/null
@@ -1,66 +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 Affero GNU 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
-// Affero GNU General Public License for more details.
-//
-// You should have received a copy of the Affero GNU General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-*@
-
-@page "/register"
-@using Microsoft.AspNetCore.Components
-
-
\ No newline at end of file
diff --git a/Wonky.Client/Pages/Registration.razor.cs b/Wonky.Client/Pages/Registration.razor.cs
deleted file mode 100644
index df6ea013..00000000
--- a/Wonky.Client/Pages/Registration.razor.cs
+++ /dev/null
@@ -1,54 +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 Affero GNU 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
-// Affero GNU General Public License for more details.
-//
-// You should have received a copy of the Affero GNU 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.Services;
-using Wonky.Entity.DTO;
-
-namespace Wonky.Client.Pages
-{
- public partial class Registration
- {
- private UserRegistrationDto _userRegistration = new ();
-
- [Inject]
- public IAuthenticationService AuthenticationService { get; set; }
-
- [Inject]
- public NavigationManager NavigationManager { get; set; }
-
- public bool ShowRegistrationErrors { get; set; }
- public IEnumerable? Errors { get; set; }
-
- public async Task Register()
- {
- ShowRegistrationErrors = false;
-
- var result = await AuthenticationService.RegisterUser(_userRegistration);
- if (!result.IsSuccess)
- {
- Errors = result.Errors;
- ShowRegistrationErrors = true;
- }
- else
- {
- // todo: redirect to login page
- // todo: store url
- // var returnUrl = NavigationManager.Uri;
- NavigationManager.NavigateTo("/login");
- }
- }
- }
-}
diff --git a/Wonky.Client/Pages/SalesItemCatalog.razor b/Wonky.Client/Pages/SalesItemCatalog.razor
index 01d1b5bd..f4a0a08f 100644
--- a/Wonky.Client/Pages/SalesItemCatalog.razor
+++ b/Wonky.Client/Pages/SalesItemCatalog.razor
@@ -16,21 +16,23 @@
*@
@page "/price-catalog"
+@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Adviser,Admin")]
-
+ }
+
+ // Show the cart contents if there are items in it.
+ @if (CartStateProvider != null && CartStateProvider.ShoppingCart.Items.Count > 0)
+ {
+
+
Your Cart:
+
Total: $@CartStateProvider.ShoppingCart.Total
+
+ @foreach (var item in CartStateProvider.ShoppingCart.Items)
+ {
+
+
+
+
+
+
+
Name:
+
@item.Item.Name
+
+
+
Description:
+
@item.Item.Description
+
+
+
Price:
+
$@item.Item.Price
+
+
+
Quantity:
+
@item.Quantity
+
+
+
Total:
+
$@item.Total
+
+
+
+ @*Clicking this button passes the item so we can remove it*@
+
+
+
+ }
+
+
+
Total: $@CartStateProvider.ShoppingCart.Total
+ }
+}
+@code {
+ [CascadingParameter] CartStateProvider CartStateProvider { get; set; }
+ private bool ShowItem;
+ private string Quantity = "1";
+ private List AllItems { get; set; } = new();
+ private Item SelectedItem { get; set; } = new();
+
+ void ItemSelected(ChangeEventArgs args)
+ {
+ // Item has been selected
+ SelectedItem = (from x in AllItems where x.Id == Convert.ToInt32(args.Value) select x).First();
+ Quantity = "1";
+ ShowItem = true;
+ }
+
+ async Task AddToCart()
+ {
+ // create a new cart item
+ var item = new CartItem
+ {
+ Item = SelectedItem,
+ Quantity = Convert.ToInt32(Quantity)
+ };
+
+ // add it to the cart
+ CartStateProvider.ShoppingCart.Items.Add(item);
+
+ // save the item using the CartStateProvider's save method
+ await CartStateProvider.SaveChangesAsync();
+
+ // hide the selected item
+ ShowItem = false;
+ }
+
+ async Task RemoveItem(CartItem item)
+ {
+ // click on remove
+ CartStateProvider.ShoppingCart.Items.Remove(item);
+
+ // save the cart
+ await CartStateProvider.SaveChangesAsync();
+ }
+
+ protected override void OnInitialized()
+ {
+ // TODO load the items from server
+ // just create some for now
+ AllItems = new List();
+ AllItems.Add(new Item()
+ {
+ Id = 1,
+ Name = "TEST 1",
+ Description = "Description 1",
+ Price = (decimal)10.99
+ });
+ AllItems.Add(new Item()
+ {
+ Id = 2,
+ Name = "TEST 2",
+ Description = "Description 2",
+ Price = (decimal)19.99
+ });
+
+ }
+}
\ No newline at end of file
diff --git a/Wonky.Client/Pages/VirkDataLookup.razor b/Wonky.Client/Pages/VirkDataLookup.razor
deleted file mode 100644
index 1977e24b..00000000
--- a/Wonky.Client/Pages/VirkDataLookup.razor
+++ /dev/null
@@ -1,38 +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 Affero GNU 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
-// Affero GNU General Public License for more details.
-//
-// You should have received a copy of the Affero GNU General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-*@
-
-@page "/VirkData"
-Innotec Danmark
-
-
Virk CVR Database
-
-
-
CVR opslag
-
-
-
-
-
-
-
-
Adresse opslag
-
-
-
-
-
-
diff --git a/Wonky.Client/Program.cs b/Wonky.Client/Program.cs
index 54d472a2..84af82c1 100644
--- a/Wonky.Client/Program.cs
+++ b/Wonky.Client/Program.cs
@@ -12,6 +12,7 @@
// You should have received a copy of the Affero GNU General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.AspNetCore.Components.Authorization;
@@ -25,7 +26,6 @@ using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository;
using Wonky.Client.Services;
using Wonky.Entity.Configuration;
-using Wonky.Virk.Services;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add("#app");
@@ -43,14 +43,11 @@ builder.Services.AddHttpClient("InnoAPI", (sp, cl) =>
});
builder.Services.AddBlazoredToast();
-
builder.Services.AddHttpClientInterceptor();
builder.Services.Configure(builder.Configuration.GetSection("ApiConfig"));
builder.Services.AddScoped();
-builder.Services.AddScoped();
-builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
diff --git a/Wonky.Client/Properties/launchSettings.json b/Wonky.Client/Properties/launchSettings.json
index ac9f3170..e14599a8 100644
--- a/Wonky.Client/Properties/launchSettings.json
+++ b/Wonky.Client/Properties/launchSettings.json
@@ -1,30 +1,30 @@
-{
- "iisSettings": {
- "windowsAuthentication": false,
- "anonymousAuthentication": true,
- "iisExpress": {
- "applicationUrl": "http://localhost:33781",
- "sslPort": 44330
- }
- },
- "profiles": {
- "Wonky.Client": {
- "commandName": "Project",
- "dotnetRunMessages": true,
- "launchBrowser": true,
- "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
- "applicationUrl": "https://localhost:7207;http://localhost:5101",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
- },
- "IIS Express": {
- "commandName": "IISExpress",
- "launchBrowser": true,
- "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
- }
- }
-}
+{
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:61714",
+ "sslPort": 44308
+ }
+ },
+ "profiles": {
+ "Wonky.Client": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
+ "applicationUrl": "https://localhost:7174;http://localhost:5280",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/Wonky.Client/Services/AuthenticationService.cs b/Wonky.Client/Services/AuthenticationService.cs
index 4e5b7dcd..2608ac2b 100644
--- a/Wonky.Client/Services/AuthenticationService.cs
+++ b/Wonky.Client/Services/AuthenticationService.cs
@@ -17,9 +17,9 @@ using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;
using Blazored.LocalStorage;
+using Wonky.Client.AuthProviders;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.Extensions.Options;
-using Wonky.Client.AuthProviders;
using Wonky.Entity.Configuration;
using Wonky.Entity.DTO;
diff --git a/Wonky.Client/Services/IAuthenticationService.cs b/Wonky.Client/Services/IAuthenticationService.cs
index 022012eb..4c63df81 100644
--- a/Wonky.Client/Services/IAuthenticationService.cs
+++ b/Wonky.Client/Services/IAuthenticationService.cs
@@ -13,6 +13,7 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System.Threading.Tasks;
using Wonky.Entity.DTO;
namespace Wonky.Client.Services
diff --git a/Wonky.Client/Services/RefreshTokenService.cs b/Wonky.Client/Services/RefreshTokenService.cs
index 7a24a840..c8a3a4e0 100644
--- a/Wonky.Client/Services/RefreshTokenService.cs
+++ b/Wonky.Client/Services/RefreshTokenService.cs
@@ -13,7 +13,10 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System;
+using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Authorization;
+using Microsoft.Extensions.Logging;
namespace Wonky.Client.Services;
diff --git a/Wonky.Client/Services/VirkRegistryService.cs b/Wonky.Client/Services/VirkRegistryService.cs
new file mode 100644
index 00000000..e9a34630
--- /dev/null
+++ b/Wonky.Client/Services/VirkRegistryService.cs
@@ -0,0 +1,75 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+using System.Text.Json;
+using Microsoft.AspNetCore.WebUtilities;
+using Microsoft.Extensions.Options;
+using Wonky.Entity.Configuration;
+using Wonky.Entity.Models;
+using Wonky.Entity.Requests;
+
+namespace Wonky.Client.Services;
+
+public class VirkRegistryService
+{
+ private readonly JsonSerializerOptions _options = new() { PropertyNameCaseInsensitive = true };
+ private readonly HttpClient _client;
+ private readonly IOptions _apiConfig;
+ private readonly List _noData = new() { new VirkRegInfo { Name = "INGEN DATA" } };
+
+ public VirkRegistryService(HttpClient client, IOptions apiConfig)
+ {
+ _client = client;
+ _apiConfig = apiConfig;
+ }
+
+ public async Task> QueryVirkRegistry(VirkParams query)
+ {
+ if(!ValidateCvrQuery(query))
+ {
+ throw new ArgumentException("CvrQuery does not validate");
+ }
+ var queryString = new Dictionary
+ {
+ ["vatNumber"] = query.VatNumber,
+ ["streetName"] = query.StreetName,
+ ["houseNumber"] = query.HouseNumber,
+ ["zipCode"] = query.ZipCode
+ };
+ var endpoint = QueryHelpers.AddQueryString(_apiConfig.Value.CvrLookup , queryString);
+ var response = await _client.GetAsync(endpoint);
+ var content = await response.Content.ReadAsStringAsync();
+
+ var jsonResult = JsonSerializer.Deserialize>(content, _options);
+
+ if (string.IsNullOrWhiteSpace(content) || !jsonResult.Any()) return _noData;
+
+ if (!string.IsNullOrWhiteSpace(query.VatNumber)) return jsonResult;
+
+ var result = jsonResult
+ .Where(x => x.States[^1].State == "NORMAL")
+ .OrderBy(x => x.Name).ToList();
+
+ return result.Count == 0 ? _noData : result;
+ }
+
+ private static bool ValidateCvrQuery(VirkParams query)
+ {
+ if (!string.IsNullOrWhiteSpace(query.VatNumber))
+ return true;
+ return !string.IsNullOrWhiteSpace(query.HouseNumber) && !string.IsNullOrWhiteSpace(query.StreetName) &&
+ !string.IsNullOrWhiteSpace(query.ZipCode);
+ }
+}
\ No newline at end of file
diff --git a/Wonky.Client/Shared/PoStateProvider.razor b/Wonky.Client/Shared/CartStateProvider.razor
similarity index 95%
rename from Wonky.Client/Shared/PoStateProvider.razor
rename to Wonky.Client/Shared/CartStateProvider.razor
index 9a6e7dd2..ef013766 100644
--- a/Wonky.Client/Shared/PoStateProvider.razor
+++ b/Wonky.Client/Shared/CartStateProvider.razor
@@ -15,7 +15,7 @@
//
*@
-@if (hasLoaded)
+@if (_hasLoaded)
{
@ChildContent
@@ -23,5 +23,5 @@
}
else
{
-
Indlæser...
+
Indlæser ...
}
\ No newline at end of file
diff --git a/Wonky.Client/Shared/PoStateProvider.razor.cs b/Wonky.Client/Shared/CartStateProvider.razor.cs
similarity index 60%
rename from Wonky.Client/Shared/PoStateProvider.razor.cs
rename to Wonky.Client/Shared/CartStateProvider.razor.cs
index cab00b6d..1ef4fbc1 100644
--- a/Wonky.Client/Shared/PoStateProvider.razor.cs
+++ b/Wonky.Client/Shared/CartStateProvider.razor.cs
@@ -13,33 +13,45 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
+using System.Threading.Tasks;
using Blazored.LocalStorage;
-using Microsoft.AspNetCore.Components;
using Wonky.Client.Models;
+using Microsoft.AspNetCore.Components;
+using Wonky.Entity.Models;
namespace Wonky.Client.Shared;
-public partial class PoStateProvider
+public partial class CartStateProvider
{
[Parameter] public RenderFragment ChildContent { get; set; }
- public PurchaseOrder PurchaseOrder { get; set; }
- [Parameter] public string Account { get; set; } = "";
+ public Cart ShoppingCart { get; set; }
+ [Parameter] public string Account { get; set; } = "MyCart";
[Inject] public ILocalStorageService LocalStorageService { get; set; }
- private bool hasLoaded;
+ private bool _hasLoaded;
protected override async Task OnParametersSetAsync()
{
- PurchaseOrder = await LocalStorageService.GetItemAsync(Account);
+ ShoppingCart = await LocalStorageService.GetItemAsync(Account);
- if (PurchaseOrder == null || PurchaseOrder.Lines.Count == 0)
- PurchaseOrder = new PurchaseOrder();
+ if (ShoppingCart == null || ShoppingCart.Items.Count == 0)
+ {
+ ShoppingCart = new Cart();
+ }
+ else
+ {
+ if (DateTime.Now > ShoppingCart.LastAccessed.AddSeconds(ShoppingCart.TimeToLiveInSeconds))
+ {
+ ShoppingCart = new Cart();
+ }
+ }
- hasLoaded = true;
+ ShoppingCart.LastAccessed = DateTime.Now;
+ _hasLoaded = true;
}
public async Task SaveChangesAsync()
{
- await LocalStorageService.SetItemAsync(Account, PurchaseOrder);
+ await LocalStorageService.SetItemAsync(Account, ShoppingCart);
}
}
\ No newline at end of file
diff --git a/Wonky.Client/Shared/MainLayout.razor b/Wonky.Client/Shared/MainLayout.razor
index b9c05dd5..b68ccc79 100644
--- a/Wonky.Client/Shared/MainLayout.razor
+++ b/Wonky.Client/Shared/MainLayout.razor
@@ -15,6 +15,7 @@
//
*@
@inherits LayoutComponentBase
+@using Wonky.Client.Components
diff --git a/Wonky.Client/Shared/ProductImageUpload.razor.cs b/Wonky.Client/Shared/ProductImageUpload.razor.cs
deleted file mode 100644
index f75113b2..00000000
--- a/Wonky.Client/Shared/ProductImageUpload.razor.cs
+++ /dev/null
@@ -1,62 +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 Affero GNU 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
-// Affero GNU General Public License for more details.
-//
-// You should have received a copy of the Affero GNU General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-
-using System.Net.Http.Headers;
-using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.Components.Forms;
-using Wonky.Client.HttpRepository;
-
-namespace Wonky.Client.Shared
-{
- public partial class ProductImageUpload
- {
- private string _fileUploadMessage = "Ingen fil valgt";
-
- [Parameter]
- public string ImgUrl { get; set; } = "";
-
- [Parameter]
- public string ProductId { get; set; } = "";
- private EventCallback OnChange { get; set; }
-
- [Inject]
- public IKrvProductHttpRepository ProductRepo { get; set; }
-
- private async Task HandleSelected(InputFileChangeEventArgs e)
- {
- var imageFile = e.File;
- if (imageFile.Size == 0)
- return;
-
- _fileUploadMessage = string.Empty;
- _fileUploadMessage += $"{imageFile.Name}";
-
- var resizedFile = await imageFile.RequestImageFileAsync("image/png", 500, 500);
-
- await using var ms = resizedFile.OpenReadStream(resizedFile.Size);
-
- var content = new MultipartFormDataContent();
-
- content.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data");
-
- content.Add(new StreamContent(ms,
- Convert.ToInt32(resizedFile.Size)), "image", imageFile.Name);
-
- ImgUrl = await ProductRepo.UploadImage(content, ProductId);
-
- await OnChange.InvokeAsync(ImgUrl);
- }
- }
-}
diff --git a/Wonky.Client/Shared/ProductImageUpload.razor.css b/Wonky.Client/Shared/ProductImageUpload.razor.css
deleted file mode 100644
index 97d15716..00000000
--- a/Wonky.Client/Shared/ProductImageUpload.razor.css
+++ /dev/null
@@ -1,8 +0,0 @@
-/* product image upload */
-.image-name {
- margin-left: 10px;
-}
-.image-preview {
- width: 300px;
- margin-top: 15px;
-}
\ No newline at end of file
diff --git a/Wonky.Client/Shared/VariantImageUpload.razor.cs b/Wonky.Client/Shared/VariantImageUpload.razor.cs
deleted file mode 100644
index eea0c304..00000000
--- a/Wonky.Client/Shared/VariantImageUpload.razor.cs
+++ /dev/null
@@ -1,64 +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 Affero GNU 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
-// Affero GNU General Public License for more details.
-//
-// You should have received a copy of the Affero GNU General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-
-using System.Net.Http.Headers;
-using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.Components.Forms;
-using Wonky.Client.HttpRepository;
-
-namespace Wonky.Client.Shared
-{
- public partial class VariantImageUpload
- {
- private string _fileUploadMessage = "Ingen fil valgt";
-
- [Parameter]
- public EventCallback OnChange { get; set; }
-
- [Parameter]
- public string PictureLink { get; set; } = "";
-
- [Parameter]
- public string VariantId { get; set; } = "";
-
- [Parameter]
- public string ImageFilename { get; set; } = "";
-
- [Inject]
- public IKrvVariantHttpRepository VariantRepo { get; set; }
-
- private async Task HandleSelected(InputFileChangeEventArgs e)
- {
- var imageFile = e.File;
- _fileUploadMessage = string.Empty;
- if (imageFile.Size == 0)
- return;
- _fileUploadMessage += $"{imageFile.Name}";
- var resizedFile = await imageFile.RequestImageFileAsync("image/png", 500, 500);
- await using var ms = resizedFile.OpenReadStream(resizedFile.Size);
-
- var content = new MultipartFormDataContent();
- content.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data");
- content.Add(new StreamContent(ms,
- Convert.ToInt32(resizedFile.Size)), "image", $"{ImageFilename}.png");
-
- PictureLink = await VariantRepo.UploadImage(content, VariantId);
-
- Console.WriteLine($"response from api - {PictureLink}");
-
- await OnChange.InvokeAsync(PictureLink);
- }
- }
-}
diff --git a/Wonky.Client/Shared/VariantImageUpload.razor.css b/Wonky.Client/Shared/VariantImageUpload.razor.css
deleted file mode 100644
index 68123e2c..00000000
--- a/Wonky.Client/Shared/VariantImageUpload.razor.css
+++ /dev/null
@@ -1,8 +0,0 @@
-/* variant image upload */
-.image-name {
- margin-left: 10px;
-}
-.image-preview {
- width: 300px;
- margin-top: 15px;
-}
\ No newline at end of file
diff --git a/Wonky.Client/Wonky.Client.csproj b/Wonky.Client/Wonky.Client.csproj
index 40c6e178..85171840 100644
--- a/Wonky.Client/Wonky.Client.csproj
+++ b/Wonky.Client/Wonky.Client.csproj
@@ -1,32 +1,63 @@
-
-
-
- net6.0
- enable
- enable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ net6.0
+ enable
+ enable
+ latestmajor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
+
+
+
+
+ <_ContentIncludedByDefault Remove="Components\AppVersion.razor" />
+ <_ContentIncludedByDefault Remove="Components\AuthLinks.razor" />
+ <_ContentIncludedByDefault Remove="Components\CompanyListHeader.razor" />
+ <_ContentIncludedByDefault Remove="Components\CompanySearchField.razor" />
+ <_ContentIncludedByDefault Remove="Components\CompanySort.razor" />
+ <_ContentIncludedByDefault Remove="Components\CompanyTable.razor" />
+ <_ContentIncludedByDefault Remove="Components\Home.razor" />
+ <_ContentIncludedByDefault Remove="Components\PageSizeDropDown.razor" />
+ <_ContentIncludedByDefault Remove="Components\Pagination.razor" />
+ <_ContentIncludedByDefault Remove="Components\PoLineCreate.razor" />
+ <_ContentIncludedByDefault Remove="Components\PurchaseOrderLinesTable.razor" />
+ <_ContentIncludedByDefault Remove="Components\PurchaseOrderTable.razor" />
+ <_ContentIncludedByDefault Remove="Components\RegInfoCompany.razor" />
+ <_ContentIncludedByDefault Remove="Components\RegLookupAddress.razor" />
+ <_ContentIncludedByDefault Remove="Components\RegLookupVatNo.razor" />
+ <_ContentIncludedByDefault Remove="Components\RegStateVatNumber.razor" />
+ <_ContentIncludedByDefault Remove="Components\SalesItemGroupFilter.razor" />
+ <_ContentIncludedByDefault Remove="Components\SalesItemSearchField.razor" />
+ <_ContentIncludedByDefault Remove="Components\SalesItemSort.razor" />
+ <_ContentIncludedByDefault Remove="Components\SalesItemTable.razor" />
+ <_ContentIncludedByDefault Remove="Components\SearchPhrase.razor" />
+
+
+
diff --git a/Wonky.Client/_Imports.razor b/Wonky.Client/_Imports.razor
index 00d258bb..bdbd02e8 100644
--- a/Wonky.Client/_Imports.razor
+++ b/Wonky.Client/_Imports.razor
@@ -6,12 +6,12 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop
+@using Wonky.Client
+@using Wonky.Client.Shared
@using Blazored.Toast
@using Blazored.Toast.Services
@using Blazored.Toast.Configuration
@using Microsoft.AspNetCore.Components.WebAssembly.Hosting
@using Microsoft.AspNetCore.Components.Authorization
-@using DnetIndexedDb
@using Wonky.Entity
-@using Wonky.Virk
diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json
index 88bdcfc1..9af3a118 100644
--- a/Wonky.Client/wwwroot/appsettings.json
+++ b/Wonky.Client/wwwroot/appsettings.json
@@ -1,19 +1,21 @@
{
- "Logging": {
- "LogLevel": {
- "Default": "Debug",
- "System": "Debug",
- "Microsoft": "Information"
+ "Logging": {
+ "LogLevel": {
+ "Default": "Debug",
+ "System": "Debug",
+ "Microsoft": "Information"
+ }
+ },
+ "apiConfig": {
+ "baseAddress": "https://api.innotec.dk",
+ "tokenPath": "token",
+ "userInfo": "api/auth/userinfo",
+ "crmCompanies": "api/v2/crm/companies",
+ "priceCatalog": "api/v2/crm/catalog",
+ "cvrLookup": "/api/v2/services/virk",
+ "krvProducts": "api/v2/admin/q/products",
+ "krvVariants": "api/v2/admin/q/variants",
+ "imageUpload": "api/v2/admin/upload2",
+ "userRegistration": "api/auth/register"
}
- },
- "apiConfig": {
- "baseAddress": "https://api.innotec.dk",
- "tokenPath": "token",
- "userInfo": "api/auth/userinfo",
- "crmCompanies": "api/v2/crm/companies/page",
- "priceCatalog": "api/v2/crm/catalog/page",
- "cvrLookup": "/api/v2/services/virk",
- "imageUpload": "api/v2/admin/upload2",
- "userRegistration": "api/auth/register"
- }
}
\ No newline at end of file
diff --git a/Wonky.Client/wwwroot/css/app.css b/Wonky.Client/wwwroot/css/app.css
index c47b2569..3848a5f4 100644
--- a/Wonky.Client/wwwroot/css/app.css
+++ b/Wonky.Client/wwwroot/css/app.css
@@ -22,10 +22,6 @@ a, .btn-link {
border-color: #1861ac;
}
-.card {
- padding: 0;
-}
-
.content {
padding-top: 1.1rem;
}
diff --git a/Wonky.Client/wwwroot/index.html b/Wonky.Client/wwwroot/index.html
index 8f39ff5f..3d7c56b0 100644
--- a/Wonky.Client/wwwroot/index.html
+++ b/Wonky.Client/wwwroot/index.html
@@ -8,9 +8,8 @@
-
+
-
@@ -23,13 +22,6 @@
-
-
-
-
-
-
-
diff --git a/Wonky.Entity/Configuration/ApiConfig.cs b/Wonky.Entity/Configuration/ApiConfig.cs
new file mode 100644
index 00000000..0770641e
--- /dev/null
+++ b/Wonky.Entity/Configuration/ApiConfig.cs
@@ -0,0 +1,29 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+namespace Wonky.Entity.Configuration;
+
+public class ApiConfig
+{
+ public string BaseAddress { get; set; } = "";
+ public string CrmCompanies { get; set; } = "";
+ public string PriceCatalog { get; set; } = "";
+ public string KrvVariants { get; set; } = "";
+ public string KrvProducts { get; set; } = "";
+ public string ImageUpload { get; set; } = "";
+ public string UserRegistration { get; set; } = "";
+ public string UserInfo { get; set; } = "";
+ public string CvrLookup { get; set; } = "";
+ public string TokenPath { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Wonky.Entity/DTO/AuthResponseDto.cs b/Wonky.Entity/DTO/AuthResponseDto.cs
new file mode 100644
index 00000000..0d982634
--- /dev/null
+++ b/Wonky.Entity/DTO/AuthResponseDto.cs
@@ -0,0 +1,39 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+using System.Text.Json.Serialization;
+
+namespace Wonky.Entity.DTO;
+
+public class AuthResponseDto
+{
+
+ public bool IsSuccess { get; set; }
+ public string ErrorMessage { get; set; } = "";
+ [JsonPropertyName("access_token")] public string? AccessToken { get; set; } = "";
+ [JsonPropertyName("token_type")] public string TokenType { get; set; } = "";
+ [JsonPropertyName("expires_in")] public long ExpiresIn { get; set; }
+ [JsonPropertyName("refresh_token")] public string RefreshToken { get; set; } = "";
+ [JsonPropertyName(".issued")] public string Issued { get; set; } = "";
+ [JsonPropertyName(".expires")] public string Expires { get; set; } = "";
+ /*{
+ "access_token": "",
+ "token_type": "bearer",
+ "expires_in": 1209599,
+ "refresh_token": "",
+ ".issued": "Fri, 14 Jan 2022 07:05:48 GMT",
+ ".expires": "Fri, 28 Jan 2022 07:05:48 GMT"
+ }*/
+}
\ No newline at end of file
diff --git a/Wonky.Entity/DTO/CompanyDto.cs b/Wonky.Entity/DTO/CompanyDto.cs
new file mode 100644
index 00000000..4eef8ff3
--- /dev/null
+++ b/Wonky.Entity/DTO/CompanyDto.cs
@@ -0,0 +1,41 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.Text.Json.Serialization;
+
+namespace Wonky.Entity.DTO;
+
+public class CompanyDto
+{
+ [Required(ErrorMessage = "Navn skal udyldes")] public string Name { get; set; } = "";
+ [Required(ErrorMessage = "Postnummer skal udfyldes")] public string ZipCode { get; set; } = "";
+ [Required(ErrorMessage = "Bynavn skal udfyldes")] public string City { get; set; } = "";
+ [Required(ErrorMessage = "CVR nummer skal udfyldes")] public string VatNumber { get; set; } = "";
+
+ public string CompanyId { get; set; } = "";
+ public string SalesRepId { get; set; } = "";
+ public string Address1 { get; set; } = "";
+ public string Address2 { get; set; } = "";
+ public string Account { get; set; } = "";
+ public string Phone { get; set; } = "";
+ public string Mobile { get; set; } = "";
+ public string Email { get; set; } = "";
+ public string Attention { get; set; } = "";
+ [JsonPropertyName("LastVisitTimestamp")] public DateTime LastVisitDate { get; set; }
+ [JsonPropertyName("NextVisitTimestamp")] public DateTime NextVisitDate { get; set; }
+ public int Interval { get; set; } = 12;
+}
\ No newline at end of file
diff --git a/Wonky.Client/Pages/CompanyInfo.razor b/Wonky.Entity/DTO/CreateCompanyResponse.cs
similarity index 92%
rename from Wonky.Client/Pages/CompanyInfo.razor
rename to Wonky.Entity/DTO/CreateCompanyResponse.cs
index 96302a36..3d5e0f6b 100644
--- a/Wonky.Client/Pages/CompanyInfo.razor
+++ b/Wonky.Entity/DTO/CreateCompanyResponse.cs
@@ -1,4 +1,3 @@
-@*
// 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 Affero GNU General Public License as
@@ -13,11 +12,9 @@
// You should have received a copy of the Affero GNU General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
-*@
-@page "/CompanyInfo"
-
CompanyInfo
+namespace Wonky.Entity.DTO;
-@code {
-
+public class CreateCompanyResponse
+{
}
\ No newline at end of file
diff --git a/Wonky.Entity/DTO/CrmActivity.cs b/Wonky.Entity/DTO/CrmActivity.cs
new file mode 100644
index 00000000..b6f8bb3f
--- /dev/null
+++ b/Wonky.Entity/DTO/CrmActivity.cs
@@ -0,0 +1,34 @@
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+
+namespace Wonky.Entity.DTO;
+
+public class CrmActivity
+{
+ public int ActivityId { get; set; }
+
+ public string CompanyId { get; set; } = "";
+ // From company row
+ [Required(ErrorMessage = "Konto skal udfyldes")] public string Account { get; set; } = "";
+ [Required(ErrorMessage = "Moms nummer skal udfyldes")] public string VatNumber { get; set; } = "";
+ [Required(ErrorMessage = "Navn skal udfyldes")] public string Name { get; set; } = "";
+ public string Address { get; set; } = "";
+ public string Address2 { get; set; } = "";
+ [Required(ErrorMessage = "Bynavn skal udfyldes")] public string City { get; set; }= "";
+ [Required(ErrorMessage = "Postnummer skal udfyldes")] public string ZipCode { get; set; } = "";
+ [Required(ErrorMessage = "Salgskonsulent skal udfyldes")] public string SalesRep { get; set; } = "";
+ public string Phone { get; set; } = "";
+ public string EMail { get; set; } = "";
+ // Form entries
+ public string ReferenceNumber { get; set; } = "";
+ [Required(ErrorMessage = "Reference skal udfyldes")] public string YourRef { get; set; } = "";
+ public string OurRef { get; set; } = "";
+ [MaxLength(255, ErrorMessage = "Du kan h�jst bruge 255 tegn")] public string OrderMessage { get; set; } = "";
+ // From company or form entry
+ public string DlvName { get; set; } = "";
+ public string DlvAddress1 { get; set; } = "";
+ public string DlvAddress2 { get; set; } = "";
+ public string DlvZipCode { get; set; } = "";
+ public string DlvCity { get; set; } = "";
+ public List Lines { get; set; } = new();
+}
diff --git a/Wonky.Client/Shared/VariantImageUpload.razor b/Wonky.Entity/DTO/CrmActivityLine.cs
similarity index 64%
rename from Wonky.Client/Shared/VariantImageUpload.razor
rename to Wonky.Entity/DTO/CrmActivityLine.cs
index 957ac163..0dd5f5cf 100644
--- a/Wonky.Client/Shared/VariantImageUpload.razor
+++ b/Wonky.Entity/DTO/CrmActivityLine.cs
@@ -1,4 +1,4 @@
-@*
+
// 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 Affero GNU General Public License as
@@ -13,19 +13,17 @@
// You should have received a copy of the Affero GNU General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
-*@
+namespace Wonky.Entity.DTO;
-
-
-
- @_fileUploadMessage
-
-@if(!string.IsNullOrWhiteSpace(PictureLink))
+public class CrmActivityLine
{
-
-
-
+ public int ActivityLineId { get; set; }
+ public int ActivityId { get; set; }
+ public string Sku { get; set; } = "";
+ public string Text { get; set; } = "";
+ public int Qty { get; set; }
+ public decimal Price { get; set; }
+ public decimal Discount { get; set; }
+ public decimal LineAmount { get; set; }
+ public int LineNumber { get; set; }
}
\ No newline at end of file
diff --git a/Wonky.Entity/DTO/KrvProductDto.cs b/Wonky.Entity/DTO/KrvProductDto.cs
new file mode 100644
index 00000000..40df0427
--- /dev/null
+++ b/Wonky.Entity/DTO/KrvProductDto.cs
@@ -0,0 +1,30 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+using System.ComponentModel.DataAnnotations;
+
+namespace Wonky.Entity.DTO;
+
+public class KrvProductDto
+{
+ [Required]
+ public string ProductId { get; set; } = "";
+ [Required]
+ public string TradingName { get; set; } = "";
+ [Required]
+ public string PictureLink { get; set; } = "";
+ [Required]
+ public string ProductCategoryEnum { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Wonky.Entity/DTO/KrvVariantDto.cs b/Wonky.Entity/DTO/KrvVariantDto.cs
new file mode 100644
index 00000000..f0d79b1f
--- /dev/null
+++ b/Wonky.Entity/DTO/KrvVariantDto.cs
@@ -0,0 +1,38 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+using System.ComponentModel.DataAnnotations;
+
+namespace Wonky.Entity.DTO;
+
+public class KrvVariantDto
+{
+ [Required]
+ public string VariantId { get; set; } = "";
+ [Required]
+ public string Name { get; set; } = "";
+ [Required]
+ public string Sku { get; set; } = "";
+ [Required]
+ public string ErpSku { get; set; } = "";
+ [Required]
+ public string ErpName { get; set; } = "";
+ [Required]
+ public string ShortName { get; set; } = "";
+ [Required]
+ public string SdsLink { get; set; } = "";
+ // [Required]
+ public string PictureLink { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Wonky.Entity/DTO/RefreshTokenDto.cs b/Wonky.Entity/DTO/RefreshTokenDto.cs
new file mode 100644
index 00000000..9c0bffc6
--- /dev/null
+++ b/Wonky.Entity/DTO/RefreshTokenDto.cs
@@ -0,0 +1,21 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+namespace Wonky.Entity.DTO;
+
+public class RefreshTokenDto
+{
+ public string Token { get; set; } = "";
+ public string RefreshToken { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Wonky.Entity/DTO/ResponseDto.cs b/Wonky.Entity/DTO/ResponseDto.cs
new file mode 100644
index 00000000..1e30904a
--- /dev/null
+++ b/Wonky.Entity/DTO/ResponseDto.cs
@@ -0,0 +1,24 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+using System.Collections.Generic;
+
+namespace Wonky.Entity.DTO;
+
+public class ResponseDto
+{
+ public bool IsSuccess { get; set; }
+ public IEnumerable? Errors { get; set; }
+}
\ No newline at end of file
diff --git a/Wonky.Entity/DTO/SalesItemDto.cs b/Wonky.Entity/DTO/SalesItemDto.cs
new file mode 100644
index 00000000..497049c0
--- /dev/null
+++ b/Wonky.Entity/DTO/SalesItemDto.cs
@@ -0,0 +1,29 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+using System.Collections.Generic;
+
+namespace Wonky.Entity.DTO;
+
+public class SalesItemDto
+{
+ public string ItemId { get; set; } = "";
+ public string Name { get; set; } = "";
+ public string Sku { get; set; } = "";
+ public string ShortName { get; set; } = "";
+ public string ProductGroup { get; set; } = "";
+ public string PictureLink { get; set; } = "";
+ public List Rates { get; set; } = new();
+}
\ No newline at end of file
diff --git a/Wonky.Client/Pages/CompanyActivity.razor b/Wonky.Entity/DTO/SalesRateDto.cs
similarity index 84%
rename from Wonky.Client/Pages/CompanyActivity.razor
rename to Wonky.Entity/DTO/SalesRateDto.cs
index c3164ed7..488ffb32 100644
--- a/Wonky.Client/Pages/CompanyActivity.razor
+++ b/Wonky.Entity/DTO/SalesRateDto.cs
@@ -1,4 +1,3 @@
-@*
// 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 Affero GNU General Public License as
@@ -13,11 +12,10 @@
// You should have received a copy of the Affero GNU General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
-*@
+namespace Wonky.Entity.DTO;
-@page "/CompanyActivity"
-
CompanyActivity
-
-@code {
-
+public class SalesRateDto
+{
+ public string Quantity { get; set; } = "";
+ public string Rate { get; set; } = "";
}
\ No newline at end of file
diff --git a/Wonky.Entity/DTO/UpdateCompanyDto.cs b/Wonky.Entity/DTO/UpdateCompanyDto.cs
new file mode 100644
index 00000000..50128c0f
--- /dev/null
+++ b/Wonky.Entity/DTO/UpdateCompanyDto.cs
@@ -0,0 +1,33 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+using System.ComponentModel.DataAnnotations;
+
+namespace Wonky.Entity.DTO;
+
+public class UpdateCompanyDto
+{
+ [MaxLength(100)] public string Name { get; set; } = "";
+ [MaxLength(30)] public string City { get; set; } = "";
+ [MaxLength(20)] public string ZipCode { get; set; } = "";
+ [MaxLength(20)] public string VatNumber { get; set; } = "";
+ public string CompanyId { get; set; } = "";
+ [MaxLength(30)] public string Phone { get; set; } = "";
+ [MaxLength(100)] public string Address1 { get; set; } = "";
+ [MaxLength(50)] public string Address2 { get; set; } = "";
+ [MaxLength(100)] public string Attention { get; set; } = "";
+ [MaxLength(80)] public string Email { get; set; } = "";
+ [MaxLength(30)] public string Mobile { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Wonky.Client/Pages/CompanyProducts.razor b/Wonky.Entity/DTO/UploadResponse.cs
similarity index 88%
rename from Wonky.Client/Pages/CompanyProducts.razor
rename to Wonky.Entity/DTO/UploadResponse.cs
index 9a63c2c9..628e5218 100644
--- a/Wonky.Client/Pages/CompanyProducts.razor
+++ b/Wonky.Entity/DTO/UploadResponse.cs
@@ -1,4 +1,3 @@
-@*
// 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 Affero GNU General Public License as
@@ -13,11 +12,9 @@
// You should have received a copy of the Affero GNU General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
-*@
+namespace Wonky.Entity.DTO;
-@page "/CompanyProducts"
-
CompanyProducts
-
-@code {
-
+public class UploadResponse
+{
+ public string Message { get; set; } = "";
}
\ No newline at end of file
diff --git a/Wonky.Entity/DTO/UserAuthenticationDto.cs b/Wonky.Entity/DTO/UserAuthenticationDto.cs
new file mode 100644
index 00000000..731cb699
--- /dev/null
+++ b/Wonky.Entity/DTO/UserAuthenticationDto.cs
@@ -0,0 +1,27 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+using System.ComponentModel.DataAnnotations;
+
+namespace Wonky.Entity.DTO;
+
+public class UserAuthenticationDto
+{
+ [Required(ErrorMessage = "Email skal angives")]
+ public string Email { get; set; } = "";
+
+ [Required(ErrorMessage = "Password skal angives")]
+ public string Password { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Wonky.Entity/DTO/UserInfoDto.cs b/Wonky.Entity/DTO/UserInfoDto.cs
new file mode 100644
index 00000000..e8f9148a
--- /dev/null
+++ b/Wonky.Entity/DTO/UserInfoDto.cs
@@ -0,0 +1,35 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+using System.Text.Json.Serialization;
+
+namespace Wonky.Entity.DTO;
+
+public class UserInfoDto
+{
+ [JsonPropertyName("Id")] public string Id { get; set; } = "";
+ [JsonPropertyName("adviser")] public string Adviser { get; set; } = "";
+ [JsonPropertyName("companyId")] public string CrmCompanyKey { get; set; } = "";
+ [JsonPropertyName("countryCode")] public string CountryCode { get; set; } = "";
+ [JsonPropertyName("countryName")] public string CountryName { get; set; } = "";
+ [JsonPropertyName("email")] public string Email { get; set; } = "";
+ [JsonPropertyName("fullName")] public string FullName { get; set; } = "";
+ [JsonPropertyName("phoneNumber")] public string PhoneNumber { get; set; } = "";
+ [JsonPropertyName("isAdmin")] public bool IsAdmin { get; set; }
+ [JsonPropertyName("isAdviser")] public bool IsAdviser { get; set; }
+ [JsonPropertyName("isEDoc")] public bool IsEDoc { get; set; }
+ [JsonPropertyName("isEShop")] public bool IsEShop { get; set; }
+ [JsonPropertyName("isSupervisor")] public bool IsSupervisor { get; set; }
+}
\ No newline at end of file
diff --git a/Wonky.Entity/DTO/UserRegistrationDto.cs b/Wonky.Entity/DTO/UserRegistrationDto.cs
new file mode 100644
index 00000000..4e7776a2
--- /dev/null
+++ b/Wonky.Entity/DTO/UserRegistrationDto.cs
@@ -0,0 +1,38 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+
+using System.ComponentModel.DataAnnotations;
+
+namespace Wonky.Entity.DTO;
+
+public class UserRegistrationDto
+{
+ [Required(ErrorMessage = "Login skal angives")]
+ public string? Email { get; set; }
+
+ [Required(ErrorMessage = "Kode skal angives")]
+ public string? Password { get; set; }
+
+ [Compare(nameof(Password), ErrorMessage = "Adgangskoder skal være identiske")]
+ public string? ConfirmPassword { get; set; }
+
+ public string FirstName { get; set; } = "";
+ public string LastName { get; set; } = "";
+ public string CountryCode { get; set; } = "dk";
+ public string SalesRep { get; set; } = "";
+ public string PhoneNumber { get; set; } = "";
+ public string UserName { get; set; } = "";
+ public string Roles { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Wonky.Entity/Models/Cart.cs b/Wonky.Entity/Models/Cart.cs
new file mode 100644
index 00000000..85d2632d
--- /dev/null
+++ b/Wonky.Entity/Models/Cart.cs
@@ -0,0 +1,38 @@
+namespace Wonky.Entity.Models;
+
+public class Item
+{
+ public int Id { get; set; }
+ public string Name { get; set; }
+ public string Description { get; set; }
+ public decimal Price { get; set; }
+}
+
+public class CartItem
+{
+ public int Quantity { get; set; }
+ public Item Item { get; set; }
+
+ public decimal Total
+ {
+ get
+ {
+ return Item.Price * Quantity;
+ }
+ }
+}
+
+public class Cart
+{
+ public List Items { get; set; } = new List();
+
+ public decimal Total
+ {
+ get
+ {
+ return Items.Sum(item => item.Total);
+ }
+ }
+ public DateTime LastAccessed { get; set; }
+ public int TimeToLiveInSeconds { get; set; } = 60; // default
+}
\ No newline at end of file
diff --git a/Wonky.Client/Pages/CompanyKApv.razor b/Wonky.Entity/Models/TimeFrame.cs
similarity index 83%
rename from Wonky.Client/Pages/CompanyKApv.razor
rename to Wonky.Entity/Models/TimeFrame.cs
index 6403491d..5b19b5f5 100644
--- a/Wonky.Client/Pages/CompanyKApv.razor
+++ b/Wonky.Entity/Models/TimeFrame.cs
@@ -1,4 +1,3 @@
-@*
// 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 Affero GNU General Public License as
@@ -13,11 +12,10 @@
// You should have received a copy of the Affero GNU General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
-*@
+namespace Wonky.Entity.Models;
-@page "/CompanyKApv"
-
CompanyKApv
-
-@code {
-
+public class TimeFrame
+{
+ public string StartDate { get; set; } = "";
+ public string EndDate { get; set; } = "";
}
\ No newline at end of file
diff --git a/Wonky.Client/Shared/ProductImageUpload.razor b/Wonky.Entity/Models/VirkRegInfo.cs
similarity index 64%
rename from Wonky.Client/Shared/ProductImageUpload.razor
rename to Wonky.Entity/Models/VirkRegInfo.cs
index 6aebbb8e..67b3070c 100644
--- a/Wonky.Client/Shared/ProductImageUpload.razor
+++ b/Wonky.Entity/Models/VirkRegInfo.cs
@@ -1,4 +1,3 @@
-@*
// 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 Affero GNU General Public License as
@@ -13,18 +12,18 @@
// You should have received a copy of the Affero GNU General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
-*@
-
+using System.Collections.Generic;
-
- @_fileUploadMessage
+namespace Wonky.Entity.Models;
-@if (!string.IsNullOrEmpty(ImgUrl))
+public class VirkRegInfo
{
-
-
-
+ public string VatNumber { get; set; } = "";
+ public string Name { get; set; } = "";
+ public string CoName { get; set; } = "";
+ public string Address { get; set; } = "";
+ public string City { get; set; } = "";
+ public string ZipCode { get; set; } = "";
+ public List States { get; set; } = new ();
}
\ No newline at end of file
diff --git a/Wonky.Entity/Models/VirkState.cs b/Wonky.Entity/Models/VirkState.cs
new file mode 100644
index 00000000..4370dcdd
--- /dev/null
+++ b/Wonky.Entity/Models/VirkState.cs
@@ -0,0 +1,22 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+namespace Wonky.Entity.Models;
+
+public class VirkState
+{
+ public string State { get; set; } = "UKENDT";
+ public string LastUpdate { get; set; } = "";
+ public TimeFrame TimeFrame { get; set; } = new();
+}
\ No newline at end of file
diff --git a/Wonky.Entity/Requests/MetaData.cs b/Wonky.Entity/Requests/MetaData.cs
new file mode 100644
index 00000000..9b4e9f5a
--- /dev/null
+++ b/Wonky.Entity/Requests/MetaData.cs
@@ -0,0 +1,25 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+namespace Wonky.Entity.Requests;
+
+public class MetaData
+{
+ public int CurrentPage { get; set; }
+ public int TotalPages { get; set; }
+ public int PageSize { get; set; }
+ public int TotalCount { get; set; }
+ public bool HasPrevious => CurrentPage > 1;
+ public bool HasNext => CurrentPage < TotalPages;
+}
\ No newline at end of file
diff --git a/Wonky.Entity/Requests/PagingParams.cs b/Wonky.Entity/Requests/PagingParams.cs
new file mode 100644
index 00000000..9dbaea94
--- /dev/null
+++ b/Wonky.Entity/Requests/PagingParams.cs
@@ -0,0 +1,32 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+namespace Wonky.Entity.Requests;
+
+public class PagingParams
+{
+ private const int MaxPageSize = 50;
+ private int _pageSize = 5;
+ public int PageNumber { get; set; } = 1;
+ public int PageSize
+ {
+ get => _pageSize;
+ set => _pageSize = (value > MaxPageSize) ? MaxPageSize : value;
+ }
+
+ public string SearchTerm { get; set; } = "";
+ public string OrderBy { get; set; } = "name";
+ public string SearchColumn { get; set; } = "name";
+ public string SelectGroup { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Wonky.Entity/Requests/VirkParams.cs b/Wonky.Entity/Requests/VirkParams.cs
new file mode 100644
index 00000000..ca99ec47
--- /dev/null
+++ b/Wonky.Entity/Requests/VirkParams.cs
@@ -0,0 +1,23 @@
+// 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 Affero GNU 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
+// Affero GNU General Public License for more details.
+//
+// You should have received a copy of the Affero GNU General Public License
+// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
+//
+namespace Wonky.Entity.Requests;
+
+public class VirkParams
+{
+ public string VatNumber { get; set; } = "";
+ public string StreetName { get; set; } = "";
+ public string HouseNumber { get; set; } = "";
+ public string ZipCode { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Wonky.Entity/Wonky.Entity.csproj b/Wonky.Entity/Wonky.Entity.csproj
new file mode 100644
index 00000000..44ee6765
--- /dev/null
+++ b/Wonky.Entity/Wonky.Entity.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/global.json b/global.json
new file mode 100644
index 00000000..87aef9f1
--- /dev/null
+++ b/global.json
@@ -0,0 +1,7 @@
+{
+ "sdk": {
+ "version": "6.0.0",
+ "rollForward": "latestMajor",
+ "allowPrerelease": false
+ }
+}
\ No newline at end of file