From e86e7719c577aa5fd7ff1ef7fd288cdca4c451aa Mon Sep 17 00:00:00 2001 From: Frede Hundewadt <22748698+fhdk@users.noreply.github.com> Date: Sat, 18 Jun 2022 10:35:58 +0200 Subject: [PATCH] wip v.0.8.7 --- Wonky.Client/Components/ColorCoding.razor | 10 +-- Wonky.Client/Components/Home.razor | 60 +++-------------- Wonky.Client/Components/Home.razor.cs | 10 +-- .../HttpInterceptorService.cs | 13 ++-- Wonky.Client/Pages/ActivityCreate.razor | 1 + Wonky.Client/Pages/ActivityToday.razor | 66 +++++++++++++++++++ Wonky.Client/Pages/ActivityToday.razor.cs | 48 ++++++++++++++ Wonky.Client/Pages/CompanyEdit.razor | 8 ++- Wonky.Client/Pages/CompanyList.razor | 2 +- Wonky.Client/Pages/CompanyView.razor | 3 +- Wonky.Client/Pages/CreateCompany.razor | 15 +++-- Wonky.Client/Pages/Info.razor | 59 +++++++++-------- Wonky.Client/Pages/ItemCatalog.razor | 4 +- Wonky.Client/Pages/ItemView.razor | 4 +- Wonky.Client/Pages/ReportCreate.razor | 40 +++++------ Wonky.Client/Pages/ReportView.razor | 4 -- Wonky.Client/Shared/MainLayout.razor | 6 +- Wonky.Client/Shared/NavMenu.razor | 19 ++++-- Wonky.Client/wwwroot/appsettings.json | 2 +- 19 files changed, 226 insertions(+), 148 deletions(-) create mode 100644 Wonky.Client/Pages/ActivityToday.razor create mode 100644 Wonky.Client/Pages/ActivityToday.razor.cs diff --git a/Wonky.Client/Components/ColorCoding.razor b/Wonky.Client/Components/ColorCoding.razor index 96c5e58f..34abd06d 100644 --- a/Wonky.Client/Components/ColorCoding.razor +++ b/Wonky.Client/Components/ColorCoding.razor @@ -11,7 +11,7 @@ state - Ok + Er besøgt. @@ -19,7 +19,7 @@ state - Planlæg besøg + Planlæg besøg. @@ -27,7 +27,7 @@ state - Interval overskredet + Besøges nu! @@ -35,7 +35,7 @@ state - Opdatering nødvendig + Opdater besøgsdato og/eller CVR/ORG nummer. @@ -43,7 +43,7 @@ state - Virksomhed ophørt + Virksomhed ophørt! diff --git a/Wonky.Client/Components/Home.razor b/Wonky.Client/Components/Home.razor index d7713c98..5e8f9b06 100644 --- a/Wonky.Client/Components/Home.razor +++ b/Wonky.Client/Components/Home.razor @@ -1,4 +1,3 @@ -@using Microsoft.AspNetCore.Authorization @* // Copyright (C) 2022 FCS Frede's Computer Services. // This program is free software: you can redistribute it and/or modify @@ -16,58 +15,19 @@ // *@ +@using Microsoft.AspNetCore.Authorization Inno Web CRM - - -
-
- @(string.IsNullOrWhiteSpace(_workDate) ? "" : $"{DateTime.Parse(_workDate).ToLongDateString()}") -
-
- +
+
+
+
+

Kalender

+
- - -
-
Dagens aktivitet
- - - - - - - - - - - @if (_view != null) - { - foreach (var activity in _view.Activities) - { - - - - - - - } - } - -
KundeDemoSalgSum
- @activity.Company.Name - - @activity.Demo - - @activity.SalesResume - - @activity.OrderAmount -
- - - Login - - + +
+
\ No newline at end of file diff --git a/Wonky.Client/Components/Home.razor.cs b/Wonky.Client/Components/Home.razor.cs index 5169138b..14708771 100644 --- a/Wonky.Client/Components/Home.razor.cs +++ b/Wonky.Client/Components/Home.razor.cs @@ -34,10 +34,7 @@ public partial class Home : IDisposable [Inject] public UserPreferenceService UserPrefs { get; set; } [Inject] public ILogger Logger { get; set; } [Inject] private HttpInterceptorService Interceptor { get; set; } - [Inject] private NavigationManager Navigator { get; set; } - [Inject] private IActivityHttpRepository ActivityRepo { get; set; } [Inject] private IToastService _toast { get; set; } - private NgActivityListView _view { get; set; } = new(); private Preferences _prefs { get; set; } = new(); private string _workDate { get; set; } = $"{DateTime.Now:yyyy-MM-dd}"; @@ -50,15 +47,12 @@ public partial class Home : IDisposable Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); - await GetActivities(_workDate); + await GetCalender(_workDate); } - private async Task GetActivities(string workDate) + private async Task GetCalender(string workDate) { - _toast.ShowInfo("Vent nogle sekunder for data"); _workDate = workDate; - _view = new NgActivityListView(); - _view = await ActivityRepo.GetActivities(workDate); } public void Dispose() diff --git a/Wonky.Client/HttpInterceptors/HttpInterceptorService.cs b/Wonky.Client/HttpInterceptors/HttpInterceptorService.cs index 1a0fc942..8f36d43c 100644 --- a/Wonky.Client/HttpInterceptors/HttpInterceptorService.cs +++ b/Wonky.Client/HttpInterceptors/HttpInterceptorService.cs @@ -62,7 +62,7 @@ namespace Wonky.Client.HttpInterceptors _interceptor.BeforeSendAsync -= InterceptBeforeSendAsync; } - public async Task InterceptBeforeSendAsync(object sender, HttpClientInterceptorEventArgs e) + private async Task InterceptBeforeSendAsync(object sender, HttpClientInterceptorEventArgs e) { var absolutePath = e.Request.RequestUri.AbsolutePath; @@ -78,27 +78,24 @@ namespace Wonky.Client.HttpInterceptors } } - public void AfterSend (object sender, HttpClientInterceptorEventArgs e) + private void AfterSend (object sender, HttpClientInterceptorEventArgs e) { if (e.Response == null || e.Response.IsSuccessStatusCode) return; string message; var currDoc = _navigation.ToBaseRelativePath(_navigation.Uri); + if (currDoc.Contains("login")) + currDoc = "/"; switch (e.Response.StatusCode) { case HttpStatusCode.NotFound: //_navigation.NavigateTo("/404"); - message = "Der er ingen data ..."; + message = "Der var ingen data ..."; _toast.ShowInfo(message); break; case HttpStatusCode.BadRequest: - ClearInfo(); - _navigation.NavigateTo($"/login/{currDoc}"); - message = "Login info skal fornyes ..."; - _toast.ShowInfo(message); - break; case HttpStatusCode.Unauthorized: ClearInfo(); _navigation.NavigateTo($"/login/{currDoc}"); diff --git a/Wonky.Client/Pages/ActivityCreate.razor b/Wonky.Client/Pages/ActivityCreate.razor index f1503c3e..4538eea8 100644 --- a/Wonky.Client/Pages/ActivityCreate.razor +++ b/Wonky.Client/Pages/ActivityCreate.razor @@ -19,6 +19,7 @@ @using Microsoft.AspNetCore.Authorization @attribute [Authorize(Roles = "Adviser")] @using Wonky.Client.Components +
@_workDate.ToLongDateString()
diff --git a/Wonky.Client/Pages/ActivityToday.razor b/Wonky.Client/Pages/ActivityToday.razor new file mode 100644 index 00000000..69c8bc8a --- /dev/null +++ b/Wonky.Client/Pages/ActivityToday.razor @@ -0,0 +1,66 @@ +@* +// Copyright (C) 2022 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] +// +*@ +@using Microsoft.AspNetCore.Authorization +@using Wonky.Client.Components +@attribute [Authorize(Roles = "Adviser")] +@page "/activity-today" + +
+
+ @(string.IsNullOrWhiteSpace(_workDate) ? "" : $"{DateTime.Parse(_workDate).ToLongDateString()}") +
+
+ +
+
+
+
+ +
+
Dagens aktivitet
+ + + + + + + + + + + @if (_view != null) + { + foreach (var activity in _view.Activities) + { + + + + + + + } + } + +
KundeDemoSalgSum
+ @activity.Company.Name + + @activity.Demo + + @activity.SalesResume + + @activity.OrderAmount +
\ No newline at end of file diff --git a/Wonky.Client/Pages/ActivityToday.razor.cs b/Wonky.Client/Pages/ActivityToday.razor.cs new file mode 100644 index 00000000..2024b008 --- /dev/null +++ b/Wonky.Client/Pages/ActivityToday.razor.cs @@ -0,0 +1,48 @@ +using Blazored.Toast.Services; +using Microsoft.AspNetCore.Components; +using Wonky.Client.Components; +using Wonky.Client.HttpInterceptors; +using Wonky.Client.HttpRepository; +using Wonky.Client.Services; +using Wonky.Entity.Views; + +namespace Wonky.Client.Pages; + +public partial class ActivityToday +{ + [Inject] public UserPreferenceService UserPrefs { get; set; } + [Inject] public ILogger Logger { get; set; } + [Inject] private HttpInterceptorService Interceptor { get; set; } + [Inject] private NavigationManager Navigator { get; set; } + [Inject] private IActivityHttpRepository ActivityRepo { get; set; } + [Inject] private IToastService _toast { get; set; } + private NgActivityListView _view { get; set; } = new(); + private Preferences _prefs { get; set; } = new(); + private string _workDate { get; set; } = $"{DateTime.Now:yyyy-MM-dd}"; + + protected override async Task OnInitializedAsync() + { + _prefs = await UserPrefs.GetPreferences(); + if(!string.IsNullOrWhiteSpace(_prefs.WorkDate)) + _workDate = _prefs.WorkDate; + + Interceptor.RegisterEvent(); + Interceptor.RegisterBeforeSendEvent(); + + await GetActivities(_workDate); + } + + private async Task GetActivities(string workDate) + { + _toast.ShowInfo("Vent nogle sekunder for data"); + _workDate = workDate; + _view = new NgActivityListView(); + _view = await ActivityRepo.GetActivities(workDate); + } + + public void Dispose() + { + Interceptor.DisposeEvent(); + } + +} \ No newline at end of file diff --git a/Wonky.Client/Pages/CompanyEdit.razor b/Wonky.Client/Pages/CompanyEdit.razor index 8083d2e5..c2602ca9 100644 --- a/Wonky.Client/Pages/CompanyEdit.razor +++ b/Wonky.Client/Pages/CompanyEdit.razor @@ -69,7 +69,9 @@ CVR/ORG - + + + @@ -154,7 +156,9 @@ Næste besøg - + + + Dato kan ikke vær før sidste besøg diff --git a/Wonky.Client/Pages/CompanyList.razor b/Wonky.Client/Pages/CompanyList.razor index 2d2894b7..cf1aefe8 100644 --- a/Wonky.Client/Pages/CompanyList.razor +++ b/Wonky.Client/Pages/CompanyList.razor @@ -48,4 +48,4 @@
- + \ No newline at end of file diff --git a/Wonky.Client/Pages/CompanyView.razor b/Wonky.Client/Pages/CompanyView.razor index d322486a..99ff5528 100644 --- a/Wonky.Client/Pages/CompanyView.razor +++ b/Wonky.Client/Pages/CompanyView.razor @@ -21,6 +21,7 @@ @using Wonky.Client.Helpers @attribute [Authorize(Roles = "Adviser")] + @if (_companyDto != null) {
@@ -81,5 +82,5 @@ } else { - + } \ No newline at end of file diff --git a/Wonky.Client/Pages/CreateCompany.razor b/Wonky.Client/Pages/CreateCompany.razor index 1ba3c786..3b63bd4c 100644 --- a/Wonky.Client/Pages/CreateCompany.razor +++ b/Wonky.Client/Pages/CreateCompany.razor @@ -21,6 +21,7 @@ @using System.Xml @attribute [Authorize(Roles = "Adviser")] +

Opret kunde

@@ -31,7 +32,7 @@ @if (_dk) { - + } @@ -69,7 +70,9 @@ - + } @@ -81,7 +84,7 @@
Moms/Org Reg.nr.AdresseAdresse
@info.Name @info.States[^1].State + +
- + @@ -123,7 +126,9 @@ - +
Moms/Org Reg. + + @@ -194,4 +199,4 @@ - + \ No newline at end of file diff --git a/Wonky.Client/Pages/Info.razor b/Wonky.Client/Pages/Info.razor index d16e2ec1..d417c6cd 100644 --- a/Wonky.Client/Pages/Info.razor +++ b/Wonky.Client/Pages/Info.razor @@ -18,36 +18,38 @@ @using Wonky.Client.Components @using Microsoft.Extensions.Options @using Wonky.Entity.Configuration +@using Microsoft.AspNetCore.Authorization @page "/info" - - -
-
- Wonky Logo -
-
-
Browservalg
- Det anbefales at bruge en Chrome baseret browser f.eks. Edge, Safari, Vivaldi, Chrome eller Chromium -
-
-
-
- -
-
-
-
-
- App version -
- -
-
-
-
+ +@attribute [Authorize(Roles = "Adviser,Admin")] +
+
+ Wonky Logo +
+
+
Browservalg
+ Det anbefales at bruge en Chrome baseret browser f.eks. Edge, Safari, Vivaldi, Chrome eller Chromium +
+
+
+
+ +
+
+
+
+
+ App version +
+ +
+
+ @code{ - [Inject] IOptions? AppInfo { get; set; } + [Inject] + IOptions? AppInfo { get; set; } + private AppInfo? _app; protected override void OnInitialized() @@ -55,5 +57,4 @@ _app = AppInfo?.Value; } -} - +} \ No newline at end of file diff --git a/Wonky.Client/Pages/ItemCatalog.razor b/Wonky.Client/Pages/ItemCatalog.razor index 995ea55e..48bdb9e9 100644 --- a/Wonky.Client/Pages/ItemCatalog.razor +++ b/Wonky.Client/Pages/ItemCatalog.razor @@ -26,10 +26,10 @@
- +
- +
diff --git a/Wonky.Client/Pages/ItemView.razor b/Wonky.Client/Pages/ItemView.razor index 285bc5ad..bc2b1086 100644 --- a/Wonky.Client/Pages/ItemView.razor +++ b/Wonky.Client/Pages/ItemView.razor @@ -18,6 +18,8 @@ @page "/sales-item/{salesItemId}" @using Microsoft.AspNetCore.Authorization @attribute [Authorize(Roles = "Adviser,Admin")] + +

@Item.Name

@@ -61,6 +63,6 @@
\ No newline at end of file diff --git a/Wonky.Client/Pages/ReportCreate.razor b/Wonky.Client/Pages/ReportCreate.razor index dbaf318d..15ea71a9 100644 --- a/Wonky.Client/Pages/ReportCreate.razor +++ b/Wonky.Client/Pages/ReportCreate.razor @@ -17,7 +17,6 @@ @using Microsoft.AspNetCore.Authorization @using Wonky.Client.Components @attribute [Authorize(Roles = "Adviser")] - @page "/sales-report" @@ -62,15 +61,15 @@ - + @if (_report.DayTypeEnum.ToLower().Contains("leave")) { - + - + } else @@ -85,12 +84,16 @@ } - + - + @@ -108,12 +111,12 @@ - + - - + + @@ -130,15 +133,15 @@ + disabled="@(_noFigures)"/> - + + disabled="@(_noFigures)"/> @@ -239,12 +242,11 @@ @(_report.Figures.TotalSaleCountMonth) @(_report.Figures.TotalTurnoverMonth) - - + + }
- - + \ No newline at end of file diff --git a/Wonky.Client/Pages/ReportView.razor b/Wonky.Client/Pages/ReportView.razor index 0387d0bc..5e6e6e9e 100644 --- a/Wonky.Client/Pages/ReportView.razor +++ b/Wonky.Client/Pages/ReportView.razor @@ -4,7 +4,6 @@ @attribute [Authorize(Roles = "Adviser,Admin,Supervisor")] -
@if (_report.Activities.Any()) { @@ -101,9 +100,6 @@ @(_report.Report.TotalSaleCountMonth) @(_report.Report.TotalTurnoverMonth) - - -
\ No newline at end of file diff --git a/Wonky.Client/Shared/MainLayout.razor b/Wonky.Client/Shared/MainLayout.razor index 318471cb..9b0e1eb7 100644 --- a/Wonky.Client/Shared/MainLayout.razor +++ b/Wonky.Client/Shared/MainLayout.razor @@ -30,10 +30,6 @@
@Body
- + diff --git a/Wonky.Client/Shared/NavMenu.razor b/Wonky.Client/Shared/NavMenu.razor index d5cc92bf..e461763d 100644 --- a/Wonky.Client/Shared/NavMenu.razor +++ b/Wonky.Client/Shared/NavMenu.razor @@ -34,7 +34,7 @@ @@ -43,28 +43,33 @@ + diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index 413c3939..71707855 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -18,7 +18,7 @@ }, "appInfo": { "name": "Wonky Client", - "version": "0.8.6", + "version": "0.8.7", "isBeta": true, "image": "grumpy-coder.png" },