build v0.8.10-beta

This commit is contained in:
Frede Hundewadt 2022-06-19 17:42:13 +02:00
parent 4edfb9b7c3
commit 248e968f47
9 changed files with 115 additions and 32 deletions

View file

@ -1,5 +1,69 @@
<h3>ReportTableComponent</h3> @if (ReportList != null)
{
@code { <div class="list-group list-group-flush">
<div class="list-group-item ">
<div class="row">
<div class="fw-bold col">
Dato
</div>
<div class="fw-bold col">
Dag
</div>
<div class="fw-bold col">
Start
</div>
<div class="fw-bold col">
Slut
</div>
<div class="fw-bold col text-end">
Resultat
</div>
</div>
</div>
@foreach (var report in ReportList)
{
<a class="list-group-item list-group-item-action" href="/sales-reports/view/@report.ReportDate">
<div class="row">
<div class="col">
@report.ReportDate
</div>
<div class="col">
@{
switch (report.DayTypeEnum)
{
case "Sales":
<span>Salgsdag</span>
break;
case "SickLeave":
<span>Sygdom</span>
break;
case "Office":
<span>Kontordag</span>
break;
case "Meeting":
<span>Salgsmøde</span>
break;
case "Leave":
<span>Ferie</span>
break;
}
}
</div>
<div class="col">
@report.FromDateTime
</div>
<div class="col">
@report.ToDateTime
</div>
<div class="col text-end">
@report.Turnover
</div>
</div>
</a>
}
</div>
}
else
{
<AppSpinner/>
} }

View file

@ -1,6 +1,9 @@
using Microsoft.AspNetCore.Components;
using Wonky.Entity.Views;
namespace Wonky.Client.Components; namespace Wonky.Client.Components;
public class ReportTableComponent_razor public partial class ReportTableComponent
{ {
[Parameter] public List<NgSalesReportListView> ReportList { get; set; }
} }

View file

@ -7,7 +7,7 @@ namespace Wonky.Client.HttpRepository;
public interface IReportHttpRepository public interface IReportHttpRepository
{ {
Task<bool> ReportExist(string workDate); Task<bool> ReportExist(string workDate);
Task<List<NgSalesReport>> GetReports(); Task<List<NgSalesReportListView>> GetReports();
Task<NgSalesReportView> GetReport(string workDate); Task<NgSalesReportView> GetReport(string workDate);
Task<ReportInitDto> InitializeReportData(string workDate); Task<ReportInitDto> InitializeReportData(string workDate);
Task<ApiResponse> PostReport(string workDate, ReportDto reportDto); Task<ApiResponse> PostReport(string workDate, ReportDto reportDto);

View file

@ -30,13 +30,9 @@ public class ReportHttpRepository :IReportHttpRepository
_apiConfig = configuration.Value; _apiConfig = configuration.Value;
} }
public async Task<List<NgSalesReport>> GetReports() public async Task<List<NgSalesReportListView>> GetReports()
{ {
var response = await _client.GetStringAsync($"{_apiConfig.ReportEndpoint}"); return await _client.GetFromJsonAsync<List<NgSalesReportListView>>($"{_apiConfig.ReportEndpoint}");
Console.WriteLine(response);
return new List<NgSalesReport>();
} }
public async Task<bool> ReportExist(string workDate) public async Task<bool> ReportExist(string workDate)
{ {

View file

@ -16,6 +16,7 @@
using System.Runtime.Intrinsics; using System.Runtime.Intrinsics;
using System.Text.Json; using System.Text.Json;
using Blazored.Toast.Services; using Blazored.Toast.Services;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Components.Forms;
using Wonky.Client.HttpInterceptors; using Wonky.Client.HttpInterceptors;
@ -27,7 +28,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
public partial class ReportCreate public partial class ReportCreate : IDisposable
{ {
[Inject] private HttpInterceptorService Interceptor { get; set; } [Inject] private HttpInterceptorService Interceptor { get; set; }
[Inject] private UserPreferenceService UserPrefs { get; set; } [Inject] private UserPreferenceService UserPrefs { get; set; }

View file

@ -14,17 +14,17 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@using Wonky.Client.Components
@page "/sales-reports" @page "/sales-reports"
<h3>SalesReportList</h3> <div class="card">
@if (_reports != null) <div class="card-header">
{ <div class="row">
foreach (var report in _reports) <div class="col">
{ <h3>Rapport Arkiv</h3>
<span>@report.Name</span> </div>
} </div>
} </div>
else <div class="card-body">
{ <ReportTableComponent ReportList="_reports"></ReportTableComponent>
<AppSpinner /> </div>
} </div>

View file

@ -1,19 +1,28 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Toolbelt.Blazor; using Toolbelt.Blazor;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository; using Wonky.Client.HttpRepository;
using Wonky.Entity.Views; using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
public partial class SalesReportList public partial class SalesReportList : IDisposable
{ {
[Inject] public IReportHttpRepository ReportRepo { get; set; } [Inject] public IReportHttpRepository ReportRepo { get; set; }
[Inject] public IHttpClientInterceptor Interceport { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
private List<NgSalesReport> _reports { get; set; } private List<NgSalesReportListView> _reports { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
_reports = await ReportRepo.GetReports(); _reports = await ReportRepo.GetReports();
} }
public void Dispose()
{
Interceptor.DisposeEvent();
}
} }

View file

@ -23,7 +23,7 @@
"image": "grumpy-coder.png" "image": "grumpy-coder.png"
}, },
"apiConfig": { "apiConfig": {
"baseAddress": "https://dev.innotec.dk", "baseAddress": "https://staging.innotec.dk",
"tokenPath": "token", "tokenPath": "token",
"userInfo": "api/auth/userinfo", "userInfo": "api/auth/userinfo",
"customerEndpoint": "api/v2/crm/companies", "customerEndpoint": "api/v2/crm/companies",

View file

@ -2,5 +2,15 @@ namespace Wonky.Entity.Views;
public class NgSalesReportListView public class NgSalesReportListView
{ {
public string ReportId { get; set; } = "";
public string Name { get; set; } = "";
public string Description { get; set; } = "";
public string ReportDate { get; set; } = "";
public string DayTypeEnum { get; set; } = "";
public string FromDateTime { get; set; } = "";
public string ToDateTime { get; set; } = "";
public decimal Turnover { get; set; }
public int VisitCount { get; set; }
public int DemoCount { get; set; }
public int SaleCount { get; set; }
} }