From dd9f9136d8c982170db3533427ff225daf926d20 Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Wed, 28 Sep 2022 19:18:20 +0200 Subject: [PATCH] wip v0.24 --- .../Components/DisplayStateComponent.razor | 2 +- .../DisplayStateComponent.razor.css | 26 --- .../OfficeActivityTableComponent.razor | 6 +- .../OfficeActivityTableComponent.razor.cs | 8 +- .../Components/ProcessStateComponent.razor | 8 +- .../ProcessStateComponent.razor.css | 12 -- .../Components/ReportItemComponent.razor | 31 ++- .../Components/ReportItemComponent.razor.css | 6 + .../ICrmActivityHttpRepository.cs | 6 +- .../HttpInterfaces/ISendMailService.cs | 9 + .../CrmActivityHttpRepository.cs | 24 ++- .../HttpRepository/SendMailService.cs | 40 ++++ Wonky.Client/Pages/CrmViewActivityPage.razor | 35 ++-- .../Pages/CrmViewActivityPage.razor.cs | 5 - .../Pages/CrmViewActivityPage.razor.css | 2 +- .../Pages/OfficeViewActivityPage.razor | 133 ++++++++++++ .../Pages/OfficeViewActivityPage.razor.cs | 86 ++++++++ .../Pages/OfficeViewActivityPage.razor.css | 6 + Wonky.Client/Pages/OfficeViewReportPage.razor | 2 +- .../Pages/OfficeViewSalesActivityPage.razor | 6 - .../OfficeViewSalesActivityPage.razor.cs | 25 --- Wonky.Client/Program.cs | 1 + Wonky.Client/wwwroot/appsettings.json | 11 +- Wonky.Client/wwwroot/css/app-v0.22.0.css | 154 -------------- Wonky.Client/wwwroot/css/app-v0.23.0.css | 196 ++++++++++++++++++ Wonky.Client/wwwroot/index.html | 4 +- Wonky.Entity/Configuration/ApiConfig.cs | 5 +- Wonky.Entity/DTO/EmailMessage.cs | 15 ++ Wonky.Entity/Views/ReportItemView.cs | 2 + 29 files changed, 575 insertions(+), 291 deletions(-) delete mode 100644 Wonky.Client/Components/DisplayStateComponent.razor.css delete mode 100644 Wonky.Client/Components/ProcessStateComponent.razor.css create mode 100644 Wonky.Client/Components/ReportItemComponent.razor.css create mode 100644 Wonky.Client/HttpInterfaces/ISendMailService.cs create mode 100644 Wonky.Client/HttpRepository/SendMailService.cs create mode 100644 Wonky.Client/Pages/OfficeViewActivityPage.razor create mode 100644 Wonky.Client/Pages/OfficeViewActivityPage.razor.cs create mode 100644 Wonky.Client/Pages/OfficeViewActivityPage.razor.css delete mode 100644 Wonky.Client/Pages/OfficeViewSalesActivityPage.razor delete mode 100644 Wonky.Client/Pages/OfficeViewSalesActivityPage.razor.cs delete mode 100644 Wonky.Client/wwwroot/css/app-v0.22.0.css create mode 100644 Wonky.Client/wwwroot/css/app-v0.23.0.css create mode 100644 Wonky.Entity/DTO/EmailMessage.cs diff --git a/Wonky.Client/Components/DisplayStateComponent.razor b/Wonky.Client/Components/DisplayStateComponent.razor index 5cf9c40a..9e859db8 100644 --- a/Wonky.Client/Components/DisplayStateComponent.razor +++ b/Wonky.Client/Components/DisplayStateComponent.razor @@ -16,7 +16,7 @@ *@ @* state *@ -state +state @code{ [Parameter] public string StateClass { get; set; } = ""; } diff --git a/Wonky.Client/Components/DisplayStateComponent.razor.css b/Wonky.Client/Components/DisplayStateComponent.razor.css deleted file mode 100644 index 6e9f9df7..00000000 --- a/Wonky.Client/Components/DisplayStateComponent.razor.css +++ /dev/null @@ -1,26 +0,0 @@ -/* begin state elements */ -.state { - width: 16px; - height: 16px; - min-width: 16px; - min-height: 16px; -} -.the-good { - background-color: green; -} -.the-bad { - background-color: orange; -} -.the-ugly { - background-color: #ff0000; -} -.the-draw { - background-color: #9b02fc; -} -.no-vat { - background-color: red; -} -.the-dead { - background-color: #0dcaf0; -} -/* end state elements */ diff --git a/Wonky.Client/Components/OfficeActivityTableComponent.razor b/Wonky.Client/Components/OfficeActivityTableComponent.razor index 6e0b7760..2896d8f6 100644 --- a/Wonky.Client/Components/OfficeActivityTableComponent.razor +++ b/Wonky.Client/Components/OfficeActivityTableComponent.razor @@ -46,15 +46,15 @@ @(activity.StatusTypeEnum == "Quote" ? $"{0:N2}" : $"{activity.OrderAmount:N2}") @if (activity.OurRef.Contains("T:")) - {} + {} @if (activity.Express) - {} + {} @if (activity.StatusTypeEnum == "Quote") - {} + {} @if (activity.Lines.Any()) diff --git a/Wonky.Client/Components/OfficeActivityTableComponent.razor.cs b/Wonky.Client/Components/OfficeActivityTableComponent.razor.cs index f768f61d..c8836897 100644 --- a/Wonky.Client/Components/OfficeActivityTableComponent.razor.cs +++ b/Wonky.Client/Components/OfficeActivityTableComponent.razor.cs @@ -27,10 +27,10 @@ public partial class OfficeActivityTableComponent { return processStatus.ToLower() switch { - "none" => "the-good-fg", - "picked" => "the-bad-fg", - "packed" => "the-ugly-fg", - "shipped" => "the-dead-fg", + "none" => "the-good", + "picked" => "the-bad", + "packed" => "the-ugly", + "shipped" => "the-dead", _ => "the-draw" }; } diff --git a/Wonky.Client/Components/ProcessStateComponent.razor b/Wonky.Client/Components/ProcessStateComponent.razor index 2b68e373..951dffdb 100644 --- a/Wonky.Client/Components/ProcessStateComponent.razor +++ b/Wonky.Client/Components/ProcessStateComponent.razor @@ -25,10 +25,10 @@ { _icon = StateClass switch { - "the-good-fg" => "file-earmark", - "the-bad-fg" => "file-earmark-check", - "the-ugly-fg" => "box2-fill", - "the-dead-fg" => "truck", + "the-good" => "file-earmark", + "the-bad" => "file-earmark-check", + "the-ugly" => "box2-fill", + "the-dead" => "truck", _ => "question-square" }; } diff --git a/Wonky.Client/Components/ProcessStateComponent.razor.css b/Wonky.Client/Components/ProcessStateComponent.razor.css deleted file mode 100644 index f9b2768b..00000000 --- a/Wonky.Client/Components/ProcessStateComponent.razor.css +++ /dev/null @@ -1,12 +0,0 @@ -.the-good-fg { - color: black; -} -.the-bad-fg { - color: black; -} -.the-ugly-fg { - color: black; -} -.the-draw-fg { - color: black; -} \ No newline at end of file diff --git a/Wonky.Client/Components/ReportItemComponent.razor b/Wonky.Client/Components/ReportItemComponent.razor index 0abf2348..8518b009 100644 --- a/Wonky.Client/Components/ReportItemComponent.razor +++ b/Wonky.Client/Components/ReportItemComponent.razor @@ -28,14 +28,14 @@ {

TILBUD

} + @if (ReportItem.Express) + { +

HASTER

+ } @if (ReportItem.VisitTypeEnum.ToLower() == "phone" || ReportItem.OurRef.Contains("T:")) {
TELEFONORDRE
} - @if (ReportItem.Express) - { -

HASTER

- } @@ -115,6 +115,15 @@ Ordresum @ReportItem.OrderAmount + @if (ReportItem.Express) + { + + + +
HASTER
+ + + } @if (!string.IsNullOrWhiteSpace(@ReportItem.OfficeNote)) @@ -127,13 +136,23 @@ } +@if (ReportItem.Express && ReportItem.ProcessStatusEnum.ToLower() == "none") +{ +
+ +
+} + + @code{ - [Parameter] public ReportItemView ReportItem { get; set; } = new(); + + [Parameter] + public ReportItemView ReportItem { get; set; } = new(); protected override void OnParametersSet() { var lines = ReportItem.Lines.OrderBy(x => x.Location).ToList(); ReportItem.Lines = lines; } - + } \ No newline at end of file diff --git a/Wonky.Client/Components/ReportItemComponent.razor.css b/Wonky.Client/Components/ReportItemComponent.razor.css new file mode 100644 index 00000000..459ee105 --- /dev/null +++ b/Wonky.Client/Components/ReportItemComponent.razor.css @@ -0,0 +1,6 @@ +.report-item-express { + position: relative; + z-index: 999; + top: 10px; + right: 0; +} \ No newline at end of file diff --git a/Wonky.Client/HttpInterfaces/ICrmActivityHttpRepository.cs b/Wonky.Client/HttpInterfaces/ICrmActivityHttpRepository.cs index e47671e3..ed74ffae 100644 --- a/Wonky.Client/HttpInterfaces/ICrmActivityHttpRepository.cs +++ b/Wonky.Client/HttpInterfaces/ICrmActivityHttpRepository.cs @@ -20,12 +20,12 @@ namespace Wonky.Client.HttpInterfaces; public interface ICrmActivityHttpRepository { - Task GetReportItem(string id); - Task GetActivity(string id); + Task GetReportItem(string salesHeadId); + Task GetActivity(string salesHeadId); Task CreateActivity(ActivityDto model); Task AcceptOffer(string id); Task GetActivities(string activityDate); Task> GetCustomerActivities(string customerId); Task UpdateOfficeNote(ActivityOfficeNote model); - Task UpdateExpressStatus(string id); + Task UpdateExpressStatus(string id); } \ No newline at end of file diff --git a/Wonky.Client/HttpInterfaces/ISendMailService.cs b/Wonky.Client/HttpInterfaces/ISendMailService.cs new file mode 100644 index 00000000..12ce7dbf --- /dev/null +++ b/Wonky.Client/HttpInterfaces/ISendMailService.cs @@ -0,0 +1,9 @@ +using Wonky.Entity.DTO; +using Wonky.Entity.Views; + +namespace Wonky.Client.HttpInterfaces; + +public interface ISendMailService +{ + Task SendMail(EmailMessage message); +} \ No newline at end of file diff --git a/Wonky.Client/HttpRepository/CrmActivityHttpRepository.cs b/Wonky.Client/HttpRepository/CrmActivityHttpRepository.cs index 1a2671be..46508ae1 100644 --- a/Wonky.Client/HttpRepository/CrmActivityHttpRepository.cs +++ b/Wonky.Client/HttpRepository/CrmActivityHttpRepository.cs @@ -55,9 +55,15 @@ public class CrmActivityHttpRepository : ICrmActivityHttpRepository _api = configuration.Value; } - public async Task UpdateExpressStatus(string id) + public async Task UpdateExpressStatus(string id) { - await _client.PostAsync($"{_api.CrmSales}/express/{id}/?status=express", null); + var response = await _client.PostAsync($"{_api.CrmSales}/express/{id}/?status=express", null); + var content = await response.Content.ReadAsStringAsync(); + var result = JsonSerializer.Deserialize(content, _options); + if (result.IsSuccess) return result!; + var msg = JsonSerializer.SerializeToElement(result.Message, _options); + result.Message = msg.ToString(); + return result!; } public async Task UpdateOfficeNote(ActivityOfficeNote model) @@ -88,24 +94,24 @@ public class CrmActivityHttpRepository : ICrmActivityHttpRepository { var response = await _client.PostAsJsonAsync($"{_api.CrmSales}", model, _options); var content = await response.Content.ReadAsStringAsync(); - _logger.LogDebug("ActivityRepo => CreateActivity => ResponseContent <= {}", content); var result = JsonSerializer.Deserialize(content, _options); - var msg = JsonSerializer.SerializeToElement(result.Message); - _logger.LogDebug("Message content <= {}", msg); + if (result.IsSuccess) return result!; + var msg = JsonSerializer.SerializeToElement(result.Message, _options); + result.Message = msg.ToString(); return result!; } - public async Task GetReportItem(string id) + public async Task GetReportItem(string salesHeadId) { var salesItem = await _client - .GetFromJsonAsync($"{_api.CrmSales}/{id}"); + .GetFromJsonAsync($"{_api.CrmSales}/{salesHeadId}"); return salesItem ?? new ReportItemView(); } - public async Task GetActivity(string id) + public async Task GetActivity(string salesHeadId) { var salesItem = await _client - .GetFromJsonAsync($"{_api.CrmSales}/{id}"); + .GetFromJsonAsync($"{_api.CrmSales}/{salesHeadId}"); return salesItem ?? new ActivityDto(); } diff --git a/Wonky.Client/HttpRepository/SendMailService.cs b/Wonky.Client/HttpRepository/SendMailService.cs new file mode 100644 index 00000000..c32036d0 --- /dev/null +++ b/Wonky.Client/HttpRepository/SendMailService.cs @@ -0,0 +1,40 @@ +using System.Net.Http.Json; +using System.Text.Json; +using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Options; +using Wonky.Client.HttpInterfaces; +using Wonky.Entity.Configuration; +using Wonky.Entity.DTO; +using Wonky.Entity.Views; + +namespace Wonky.Client.HttpRepository; + +public class SendMailService : ISendMailService +{ + private readonly JsonSerializerOptions? _options = new JsonSerializerOptions + { + PropertyNameCaseInsensitive = true + }; + + private readonly NavigationManager _navigation; + private ILogger _logger; + private readonly HttpClient _client; + private readonly ApiConfig _api; + + public SendMailService(HttpClient client, ILogger logger, + NavigationManager navigation, IOptions configuration) + { + _client = client; + _logger = logger; + _navigation = navigation; + _api = configuration.Value; + } + public async Task SendMail(EmailMessage message) + { + var response = await _client.PostAsJsonAsync("", message, _options); + var content = await response.Content.ReadAsStringAsync(); + _logger.LogDebug("SendMail => ResponseContent <= {}", content); + var result = JsonSerializer.Deserialize(content, _options); + return result!; + } +} \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmViewActivityPage.razor b/Wonky.Client/Pages/CrmViewActivityPage.razor index 8d496888..80a67deb 100644 --- a/Wonky.Client/Pages/CrmViewActivityPage.razor +++ b/Wonky.Client/Pages/CrmViewActivityPage.razor @@ -22,33 +22,11 @@ } @if (ReportItem.Express) { -

HASTER

+

HASTER

} - @if (ReportItem.Express && ReportItem.ProcessStatusEnum.ToLower() == "none") - { -
- -
- - - - - - - - - - - } - else - { -
- -
- } @@ -123,6 +101,13 @@ Ordresum @ReportItem.OrderAmount + @if (ReportItem.Express) + { + + +
HASTER
+ + } @* Office Note *@ @@ -152,3 +137,7 @@ else } } + +
+ +
diff --git a/Wonky.Client/Pages/CrmViewActivityPage.razor.cs b/Wonky.Client/Pages/CrmViewActivityPage.razor.cs index 28ac032d..3d4ce918 100644 --- a/Wonky.Client/Pages/CrmViewActivityPage.razor.cs +++ b/Wonky.Client/Pages/CrmViewActivityPage.razor.cs @@ -37,11 +37,6 @@ public partial class CrmViewActivityPage : IDisposable _logger.LogDebug("ReportItem => \n {}", JsonSerializer.Serialize(ReportItem)); } - private async Task SetExpressState() - { - - } - private void HandleFieldChanged(object sender, FieldChangedEventArgs e) { StateHasChanged(); diff --git a/Wonky.Client/Pages/CrmViewActivityPage.razor.css b/Wonky.Client/Pages/CrmViewActivityPage.razor.css index ae5e83ba..6396fa53 100644 --- a/Wonky.Client/Pages/CrmViewActivityPage.razor.css +++ b/Wonky.Client/Pages/CrmViewActivityPage.razor.css @@ -1,6 +1,6 @@ #watermark { position: fixed; z-index: 999; - top: 30px; + top: 10px; right: 0; } \ No newline at end of file diff --git a/Wonky.Client/Pages/OfficeViewActivityPage.razor b/Wonky.Client/Pages/OfficeViewActivityPage.razor new file mode 100644 index 00000000..f82c8739 --- /dev/null +++ b/Wonky.Client/Pages/OfficeViewActivityPage.razor @@ -0,0 +1,133 @@ +@using Microsoft.AspNetCore.Authorization +@using Wonky.Client.Components +@attribute [Authorize(Roles = "Admin,Office,Warehouse,Advisor")] +@page "/office/customers/{CompanyId}/orders/{OrderId}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

@ReportItem.Company.Name

+ @if (ReportItem.StatusTypeEnum.ToLower() is "quote") + { +

TILBUD

+ } + @if (ReportItem.Express) + { +

HASTER

+ } + @if (ReportItem.Express && ReportItem.ProcessStatusEnum == "None") + { +
+ +
+ + +
+
+
+ +
+
+ +
+
+
+
+
+ } + @if (ReportItem.VisitTypeEnum.ToLower() == "phone" || ReportItem.OurRef.Contains("T:")) + { +
TELEFONORDRE
+ } +
+
Dato@ReportItem.OrderDateKonto@ReportItem.Company.Account
Telefon@ReportItem.Company.PhoneKøber@ReportItem.YourRef
CVR/VAT@ReportItem.Company.VatNumberRekvisition@ReportItem.ReferenceNumber
Navn@ReportItem.Company.NameLev.Navn@ReportItem.DlvName
Adresse@ReportItem.Company.Address1Lev.Adresse@ReportItem.DlvAddress1
Adresse@ReportItem.Company.Address2Lev.Adresse@ReportItem.DlvAddress2
Postnr By@ReportItem.Company.ZipCode @ReportItem.Company.CityLev.Postnr By@ReportItem.DlvZipCity
+ + + + + + + + + + + + + @foreach (var line in ReportItem.Lines) + { + + + + + + + + + } + + + + + + @if (ReportItem.Express) + { + + + } + +
AntalVarnrBeskrivelsePrisR%Beløb
@line.Quantity@line.Sku@line.Description@($"{line.Price:N2}")@($"{line.Discount:N2}")@($"{line.LineSum:N2}")
Ordresum@ReportItem.OrderAmount
HASTER
+@if (!string.IsNullOrWhiteSpace(ReportItem.OfficeNote)) +{ +
+

@ReportItem.OfficeNote

+
+} diff --git a/Wonky.Client/Pages/OfficeViewActivityPage.razor.cs b/Wonky.Client/Pages/OfficeViewActivityPage.razor.cs new file mode 100644 index 00000000..41de5f82 --- /dev/null +++ b/Wonky.Client/Pages/OfficeViewActivityPage.razor.cs @@ -0,0 +1,86 @@ +using System.Text; +using System.Text.Json; +using Blazored.Toast.Services; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Forms; +using Wonky.Client.HttpInterceptors; +using Wonky.Client.HttpInterfaces; +using Wonky.Client.HttpRepository; +using Wonky.Entity.DTO; +using Wonky.Entity.Views; +using System.Security.Claims; +using Blazored.LocalStorage; +using Wonky.Client.Services; + +namespace Wonky.Client.Pages; + +public partial class OfficeViewActivityPage : IDisposable +{ + [Parameter] public string CompanyId { get; set; } = ""; + [Parameter] public string OrderId { get; set; } = ""; + [Inject] public HttpInterceptorService Interceptor { get; set; } + [Inject] public ICrmActivityHttpRepository ActivityRepo { get; set; } + [Inject] public ISendMailService SendMailService { get; set; } + [Inject] public ILocalStorageService Storage { get; set; } + [Inject] public IOfficeUserHttpRepository UserRepo { get; set; } + [Inject] public ILogger Logger { get; set; } + [Inject] public IToastService Toast { get; set; } + private ReportItemView ReportItem { get; set; } = new(); + + protected override async Task OnInitializedAsync() + { + Interceptor.RegisterEvent(); + Interceptor.RegisterBeforeSendEvent(); + ReportItem = await ActivityRepo.GetReportItem(OrderId); + Logger.LogDebug("ReportItem => \n {}", JsonSerializer.Serialize(ReportItem)); + } + + private async Task SetExpressState() + { + var responseView = await ActivityRepo.UpdateExpressStatus(ReportItem.ActivityId); + if (responseView.IsSuccess) + { + var user = await Storage.GetItemAsync("_ux"); + var salesRep = await UserRepo.GetAdvisorInfo(responseView.Id); + var body = new StringBuilder(); + body.AppendLine($"Kvittering for behandling af hasteordre {ReportItem.ESalesNumber}"); + body.AppendLine($"Konto : {ReportItem.Company.Account}"); + body.AppendLine($"Navn : {ReportItem.Company.Name}"); + body.AppendLine( + $"Post Bynavn: {salesRep.CountryCode.ToLower()}-{ReportItem.Company.ZipCode} {ReportItem.Company.City}"); + body.AppendLine(); + body.AppendLine("Med venlig hilsen"); + body.AppendLine($"{user.FullName}"); + body.AppendLine($"{user.PhoneNumber}"); + + var msg = new EmailMessage + { + Body = body.ToString(), + Subject = $"{ReportItem.ESalesNumber} {ReportItem.Company.Name} er registreret.", + To = { new EmailContact + { + Email = salesRep.Email, + Name = $"{salesRep.FirstName} {salesRep.LastName}" + }} + }; + + var sendMail = await SendMailService.SendMail(msg); + if (sendMail.IsSuccess) + { + Toast.ShowSuccess($"Status er opdateret og notifikation sendt til {salesRep.FirstName}.", "OK"); + } + else + { + Toast.ShowWarning($"Notifikation til {salesRep.FirstName} kunne ikke sendes. {sendMail.Message}", "ADVARSEL"); + } + return; + } + Toast.ShowError($"{responseView.Message}", "FEJL"); + } + + public void Dispose() + { + Interceptor.DisposeEvent(); + } + +} \ No newline at end of file diff --git a/Wonky.Client/Pages/OfficeViewActivityPage.razor.css b/Wonky.Client/Pages/OfficeViewActivityPage.razor.css new file mode 100644 index 00000000..6396fa53 --- /dev/null +++ b/Wonky.Client/Pages/OfficeViewActivityPage.razor.css @@ -0,0 +1,6 @@ +#watermark { + position: fixed; + z-index: 999; + top: 10px; + right: 0; +} \ No newline at end of file diff --git a/Wonky.Client/Pages/OfficeViewReportPage.razor b/Wonky.Client/Pages/OfficeViewReportPage.razor index 21457787..d38c4885 100644 --- a/Wonky.Client/Pages/OfficeViewReportPage.razor +++ b/Wonky.Client/Pages/OfficeViewReportPage.razor @@ -61,7 +61,7 @@ @if (_items.Any()) { - @foreach (var item in _items.Where(item => item.StatusTypeEnum.ToLower() != "offer" || item.ProcessStatusEnum.ToLower() == "none")) + @foreach (var item in _items.Where(item => item.StatusTypeEnum != "Offer" && item.ProcessStatusEnum == "None")) { } diff --git a/Wonky.Client/Pages/OfficeViewSalesActivityPage.razor b/Wonky.Client/Pages/OfficeViewSalesActivityPage.razor deleted file mode 100644 index 812d854a..00000000 --- a/Wonky.Client/Pages/OfficeViewSalesActivityPage.razor +++ /dev/null @@ -1,6 +0,0 @@ -@using Microsoft.AspNetCore.Authorization -@using Wonky.Client.Components -@attribute [Authorize(Roles = "Admin,Office,Warehouse,Advisor")] -@page "/office/customers/{CompanyId}/orders/{OrderId}" - - diff --git a/Wonky.Client/Pages/OfficeViewSalesActivityPage.razor.cs b/Wonky.Client/Pages/OfficeViewSalesActivityPage.razor.cs deleted file mode 100644 index 887afc49..00000000 --- a/Wonky.Client/Pages/OfficeViewSalesActivityPage.razor.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using Microsoft.AspNetCore.Components; -using Wonky.Client.HttpInterceptors; -using Wonky.Client.HttpInterfaces; -using Wonky.Client.HttpRepository; -using Wonky.Entity.DTO; -using Wonky.Entity.Views; - -namespace Wonky.Client.Pages; - -public partial class OfficeViewSalesActivityPage -{ - [Parameter] public string CompanyId { get; set; } = ""; - [Parameter] public string OrderId { get; set; } = ""; - [Inject] public HttpInterceptorService _interceptor { get; set; } - [Inject] public ICrmActivityHttpRepository CrmActivityRepo { get; set; } - private ReportItemView _item { get; set; } = new(); - - protected override async Task OnParametersSetAsync() - { - _interceptor.RegisterEvent(); - _interceptor.RegisterBeforeSendEvent(); - _item = await CrmActivityRepo.GetReportItem(OrderId); - } -} \ No newline at end of file diff --git a/Wonky.Client/Program.cs b/Wonky.Client/Program.cs index 3930a078..c666fb96 100644 --- a/Wonky.Client/Program.cs +++ b/Wonky.Client/Program.cs @@ -67,6 +67,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddBlazoredLocalStorage(); diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index 3b76c95a..67efb110 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,13 +1,13 @@ { "appInfo": { "name": "Wonky Client", - "version": "0.23.1", - "rc": true, - "sandBox": true, + "version": "0.24.1", + "rc": false, + "sandBox": false, "image": "grumpy-coder.png" }, "apiConfig": { - "innoBaseUrl": "https://dev.innotec.dk", + "innoBaseUrl": "https://eta.innotec.dk", "glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=", "glsId": "", "serviceVirk": "api/v2/services/virk", @@ -29,7 +29,8 @@ "officeUserPasswd": "api/v2/office/users/passwd", "officeCustomers": "api/v2/office/customers", "officeReports": "api/v2/office/reports", - "warehouse": "api/v2/warehouse/packages" + "warehouse": "api/v2/warehouse/packages", + "sendMail": "api/v2/" }, "Logging": { "LogLevel": { diff --git a/Wonky.Client/wwwroot/css/app-v0.22.0.css b/Wonky.Client/wwwroot/css/app-v0.22.0.css deleted file mode 100644 index c91a7e71..00000000 --- a/Wonky.Client/wwwroot/css/app-v0.22.0.css +++ /dev/null @@ -1,154 +0,0 @@ -@import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); -body { - font-size: 16px; -} - -.draft-expires-msg { - font-size: 0.8em; -} -.spinner { - height: 48px; -} -.workDate { - font-variant: small-caps; -} - -.btn.btn-edit { - color: #030303; - background-color: #a2a2ec; -} - -html, body { - font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -h1:focus { - outline: none; -} - -a, .btn-link { - color: #0071c1; -} - -.btn-primary { - color: #fff; - background-color: #1b6ec2; - border-color: #1861ac; -} - -.text-inno { - color: #ffaa00; -} - -.content { - padding-top: 1.1rem; -} - -.valid.modified:not([type=checkbox]) { - outline: 1px solid #26b050; -} - -.invalid { - outline: 1px solid red; -} - -.validation-message { - color: red; -} - -#blazor-error-ui { - background: lightyellow; - bottom: 0; - box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); - display: none; - left: 0; - padding: 0.6rem 1.25rem 0.7rem 1.25rem; - position: fixed; - width: 100%; - z-index: 1000; -} - - #blazor-error-ui .dismiss { - cursor: pointer; - position: absolute; - right: 0.75rem; - top: 0.5rem; - } - -.blazor-error-boundary { - background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxN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LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121; - padding: 1rem 1rem 1rem 3.7rem; - color: white; -} - - .blazor-error-boundary::after { - content: "An error has occurred." - } - -.footer { - border-top: 2px solid orange; - position: relative; - margin-top: -150px; - height: 150px; - width: 100%; - clear: both; - padding-top: 20px; -} - -footer.version { - display: block; - font-weight: bold; - padding: 0 10px 0 0; -} - -.back-to-top { - position: fixed; - bottom: 25px; - right: 25px; - display: none; -} - -/* printer classes */ -@media print { - @page { - size: a4; - } - @font-face { - font-family: 'Montserrat'; - src: url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap'); - } - html, body { - height: 290mm; - width: 210mm; - -webkit-print-color-adjust: exact; - color-adjust: exact; - } - .report-main { - font-size: 10px; - break-after: page; - height: initial; - border: initial; - border-radius: initial; - box-shadow: initial; - margin: 0; - width: initial; - -webkit-print-color-adjust: exact; - color-adjust: exact; - } - .report-visit { - break-before: page; - break-inside: avoid-page; - height: initial; - border: initial; - border-radius: initial; - box-shadow: initial; - margin: 0; - width: initial; - -webkit-print-color-adjust: exact; - color-adjust: exact; - } - .distance-ledger {} - .report-ledger { - page-break-inside: avoid; - } -} \ No newline at end of file diff --git a/Wonky.Client/wwwroot/css/app-v0.23.0.css b/Wonky.Client/wwwroot/css/app-v0.23.0.css new file mode 100644 index 00000000..b87e042b --- /dev/null +++ b/Wonky.Client/wwwroot/css/app-v0.23.0.css @@ -0,0 +1,196 @@ +@import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); +body { + font-size: 16px; +} + +.draft-expires-msg { + font-size: 0.8em; +} +.spinner { + height: 48px; +} +.workDate { + font-variant: small-caps; +} + +.btn.btn-edit { + color: #030303; + background-color: #a2a2ec; +} + +html, body { + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +h1:focus { + outline: none; +} + +a, .btn-link { + color: #0071c1; +} + +.btn-primary { + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; +} + +.text-inno { + color: #ffaa00; +} + +.content { + padding-top: 1.1rem; +} + +.valid.modified:not([type=checkbox]) { + outline: 1px solid #26b050; +} + +.invalid { + outline: 1px solid red; +} + +.validation-message { + color: red; +} + +/* begin state elements */ +.state { + width: 16px; + height: 16px; + min-width: 16px; + min-height: 16px; +} +.the-good-bg { + background-color: green; +} +.the-bad-bg { + background-color: orange; +} +.the-ugly-bg { + background-color: #ff0000; +} +.the-draw-bg { + background-color: #9b02fc; +} +.no-vat-bg { + background-color: red; +} +.the-dead-bg { + background-color: #0dcaf0; +} +.the-good { + color: green; +} +.the-bad { + color: orange; +} +.the-ugly { + color: #ff0000; +} +.the-dead { + color: #0dcaf0; +} + + +/* end state elements */ + + +/*#blazor-error-ui {*/ +/* background: lightyellow;*/ +/* bottom: 0;*/ +/* box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);*/ +/* display: none;*/ +/* left: 0;*/ +/* padding: 0.6rem 1.25rem 0.7rem 1.25rem;*/ +/* position: fixed;*/ +/* width: 100%;*/ +/* z-index: 1000;*/ +/*}*/ + +/* #blazor-error-ui .dismiss {*/ +/* cursor: pointer;*/ +/* position: absolute;*/ +/* right: 0.75rem;*/ +/* top: 0.5rem;*/ +/* }*/ + +/*.blazor-error-boundary {*/ +/* background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIH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My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;*/ +/* padding: 1rem 1rem 1rem 3.7rem;*/ +/* color: white;*/ +/*}*/ + +/* .blazor-error-boundary::after {*/ +/* content: "An error has occurred."*/ +/* }*/ + +.footer { + border-top: 2px solid orange; + position: relative; + margin-top: -150px; + height: 150px; + width: 100%; + clear: both; + padding-top: 20px; +} + +footer.version { + display: block; + font-weight: bold; + padding: 0 10px 0 0; +} + +.back-to-top { + position: fixed; + bottom: 25px; + right: 25px; + display: none; +} + +/* printer classes */ +@media print { + @page { + size: a4; + } + @font-face { + font-family: 'Montserrat'; + src: url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap'); + } + html, body { + height: 290mm; + width: 210mm; + -webkit-print-color-adjust: exact; + color-adjust: exact; + } + .report-main { + font-size: 10px; + break-after: page; + height: initial; + border: initial; + border-radius: initial; + box-shadow: initial; + margin: 0; + width: initial; + -webkit-print-color-adjust: exact; + color-adjust: exact; + } + .report-visit { + break-before: page; + break-inside: avoid-page; + height: initial; + border: initial; + border-radius: initial; + box-shadow: initial; + margin: 0; + width: initial; + -webkit-print-color-adjust: exact; + color-adjust: exact; + } + .distance-ledger {} + .report-ledger { + page-break-inside: avoid; + } +} \ No newline at end of file diff --git a/Wonky.Client/wwwroot/index.html b/Wonky.Client/wwwroot/index.html index 94c5dd1f..ab9f680c 100644 --- a/Wonky.Client/wwwroot/index.html +++ b/Wonky.Client/wwwroot/index.html @@ -18,7 +18,7 @@ - + @@ -30,7 +30,7 @@ - + diff --git a/Wonky.Entity/Configuration/ApiConfig.cs b/Wonky.Entity/Configuration/ApiConfig.cs index 44d0fc2b..4078ee33 100644 --- a/Wonky.Entity/Configuration/ApiConfig.cs +++ b/Wonky.Entity/Configuration/ApiConfig.cs @@ -131,7 +131,10 @@ public class ApiConfig /// public string Warehouse { get; set; } = ""; - + /// + /// url for sending mail message + /// + public string SendMail { get; set; } = ""; // /// // /// Application uri for reading salesReports // /// diff --git a/Wonky.Entity/DTO/EmailMessage.cs b/Wonky.Entity/DTO/EmailMessage.cs new file mode 100644 index 00000000..30965ca8 --- /dev/null +++ b/Wonky.Entity/DTO/EmailMessage.cs @@ -0,0 +1,15 @@ +namespace Wonky.Entity.DTO; + +public class EmailMessage +{ + public List To { get; set; } = new(); + public string Subject { get; set; } = ""; + public string Body { get; set; } = ""; + public bool IsBodyHtml { get; set; } +} + +public class EmailContact +{ + public string Name { get; set; } = ""; + public string Email { get; set; } = ""; +} \ No newline at end of file diff --git a/Wonky.Entity/Views/ReportItemView.cs b/Wonky.Entity/Views/ReportItemView.cs index 86b86c76..ab85398a 100644 --- a/Wonky.Entity/Views/ReportItemView.cs +++ b/Wonky.Entity/Views/ReportItemView.cs @@ -25,6 +25,8 @@ public class ReportItemView /// Lines /// public List Lines { get; set; } = new(); + + public string SalesRepId { get; set; } /// /// Activity entity id ///