From 5cc95de0695bccb9fe7301b6a8c0fa554b55661a Mon Sep 17 00:00:00 2001 From: Frede Hundewadt <22748698+fhdk@users.noreply.github.com> Date: Sat, 9 Apr 2022 18:34:04 +0200 Subject: [PATCH] refactoring --- Wonky.Client/AppId.cs | 3 +-- .../Components/CompanySearchDropdown.razor | 6 ++--- .../Components/CompanySortDropdown.razor | 4 ++-- Wonky.Client/Components/CompanyTable.razor | 13 ++++------- .../Components/ItemSearchDropdown.razor | 6 ++--- .../Components/ItemSortDropdown.razor | 4 ++-- Wonky.Client/Pages/CompanyCreate.razor | 4 ++-- Wonky.Client/Pages/CompanyUpdate.razor | 6 ++--- Wonky.Client/Pages/CompanyUpdate.razor.cs | 19 ++++++---------- Wonky.Client/Pages/CompanyView.razor | 22 +++++++------------ Wonky.Client/Shared/NavMenu.razor | 14 ++++++++++++ 11 files changed, 49 insertions(+), 52 deletions(-) diff --git a/Wonky.Client/AppId.cs b/Wonky.Client/AppId.cs index 0bfad7ba..147b9e58 100644 --- a/Wonky.Client/AppId.cs +++ b/Wonky.Client/AppId.cs @@ -2,8 +2,7 @@ namespace Wonky.Client; public class AppId { - public string Version { get; set; } = "0.2.12"; + public string Version { get; set; } = "0.2.15"; public string Name { get; set; } = "wwo"; - public bool IsBeta { get; set; } = true; } \ No newline at end of file diff --git a/Wonky.Client/Components/CompanySearchDropdown.razor b/Wonky.Client/Components/CompanySearchDropdown.razor index 10173686..83cb439c 100644 --- a/Wonky.Client/Components/CompanySearchDropdown.razor +++ b/Wonky.Client/Components/CompanySearchDropdown.razor @@ -17,9 +17,9 @@ diff --git a/Wonky.Client/Components/CompanySortDropdown.razor b/Wonky.Client/Components/CompanySortDropdown.razor index 12d4d13b..4ead8fd4 100644 --- a/Wonky.Client/Components/CompanySortDropdown.razor +++ b/Wonky.Client/Components/CompanySortDropdown.razor @@ -17,6 +17,6 @@ \ No newline at end of file diff --git a/Wonky.Client/Components/CompanyTable.razor b/Wonky.Client/Components/CompanyTable.razor index de595741..d058fe11 100644 --- a/Wonky.Client/Components/CompanyTable.razor +++ b/Wonky.Client/Components/CompanyTable.razor @@ -19,25 +19,20 @@ @using Wonky.Client.Helpers; @if (Companies.Any()) { -
-
+ } else { diff --git a/Wonky.Client/Components/ItemSearchDropdown.razor b/Wonky.Client/Components/ItemSearchDropdown.razor index 67c49936..4b64e1a6 100644 --- a/Wonky.Client/Components/ItemSearchDropdown.razor +++ b/Wonky.Client/Components/ItemSearchDropdown.razor @@ -17,7 +17,7 @@ \ No newline at end of file diff --git a/Wonky.Client/Components/ItemSortDropdown.razor b/Wonky.Client/Components/ItemSortDropdown.razor index 2f81875e..81408146 100644 --- a/Wonky.Client/Components/ItemSortDropdown.razor +++ b/Wonky.Client/Components/ItemSortDropdown.razor @@ -17,6 +17,6 @@ \ No newline at end of file diff --git a/Wonky.Client/Pages/CompanyCreate.razor b/Wonky.Client/Pages/CompanyCreate.razor index 7d1814cc..040605ca 100644 --- a/Wonky.Client/Pages/CompanyCreate.razor +++ b/Wonky.Client/Pages/CompanyCreate.razor @@ -79,14 +79,14 @@ - Adresse + Conavn - Adresse2 + Adresse diff --git a/Wonky.Client/Pages/CompanyUpdate.razor b/Wonky.Client/Pages/CompanyUpdate.razor index dbfa41bd..3e2380e0 100644 --- a/Wonky.Client/Pages/CompanyUpdate.razor +++ b/Wonky.Client/Pages/CompanyUpdate.razor @@ -20,7 +20,7 @@ @attribute [Authorize(Roles = "Adviser")] @page "/company/{companyId}/update" -@if (_company.Name != "") +@if (_company != null) {
@@ -37,7 +37,7 @@
- +
@@ -121,7 +121,7 @@ diff --git a/Wonky.Client/Pages/CompanyUpdate.razor.cs b/Wonky.Client/Pages/CompanyUpdate.razor.cs index fb86d3ab..7ca3e47f 100644 --- a/Wonky.Client/Pages/CompanyUpdate.razor.cs +++ b/Wonky.Client/Pages/CompanyUpdate.razor.cs @@ -77,18 +77,13 @@ public partial class CompanyUpdate : IDisposable StateHasChanged(); return; } - var lv = DateTime.TryParse(_company.LastVisit, out var lvValidated); - var nv = DateTime.TryParse(_company.NextVisit, out var nvValidated); - if (lv && nv) - { - _company.LastVisit = $"{lvValidated:yyyy-MM-dd}"; - _company.NextVisit = $"{nvValidated:yyyy-MM-dd}"; - - await CompanyRepo.UpdateCompany(_company); - - ToastService.ShowSuccess($"Godt så. Firma '{_company!.Name}' er opdateret."); - Navigation.NavigateTo($"/company/{_company.CompanyId}"); - } + _company.LastVisit = $"{LastVisit:yyyy-MM-dd}"; + _company.NextVisit = $"{NextVisit:yyyy-MM-dd}"; + Console.WriteLine(JsonSerializer.Serialize(_company)); + await CompanyRepo.UpdateCompany(_company); + + ToastService.ShowSuccess($"Godt så. Firma '{_company!.Name}' er opdateret."); + Navigation.NavigateTo($"/company/{_company.CompanyId}"); } private async Task GetInfoFromVat(string vatNumber) { diff --git a/Wonky.Client/Pages/CompanyView.razor b/Wonky.Client/Pages/CompanyView.razor index 556ffe99..8228f374 100644 --- a/Wonky.Client/Pages/CompanyView.razor +++ b/Wonky.Client/Pages/CompanyView.razor @@ -24,19 +24,17 @@
-
-
tombstone @_company.Name
-
+
tombstone @_company.Name
- - + + - + @@ -77,14 +75,10 @@
Navn@_company.NameKonto@_company.Account
CO navnConavn @_company.Address1
diff --git a/Wonky.Client/Shared/NavMenu.razor b/Wonky.Client/Shared/NavMenu.razor index bbb61642..c94efcd9 100644 --- a/Wonky.Client/Shared/NavMenu.razor +++ b/Wonky.Client/Shared/NavMenu.razor @@ -36,6 +36,15 @@ Start
+ + + + + +