REL: v.126.2 - supervisor functionality

This commit is contained in:
Frede Hundewadt 2023-03-26 09:49:55 +02:00
parent 9f88e94e20
commit afed319b7b
28 changed files with 81 additions and 100 deletions

View file

@ -40,7 +40,7 @@
{
@foreach (var report in ReportList)
{
<ReportListItemComponent OnShowReport="ShowThisReport" Report="@report" />
<ReportListItemComponent OnShowReport="ShowReport" Report="@report" />
}
}
else

View file

@ -34,7 +34,7 @@ public partial class OfficeReportListComponent
}
private void ShowThisReport(string reportDate)
private void ShowReport(string reportDate)
{
OnShowReport.InvokeAsync(reportDate);
}

View file

@ -38,7 +38,7 @@
{
@foreach (var report in ReportList)
{
<ReportListItemComponent Report="@report" OnShowReport="ShowThisReport" />
<ReportListItemComponent Report="@report" OnShowReport="ShowReport" OnShowDocument="ShowDocument" />
}
}
else

View file

@ -24,20 +24,26 @@ public partial class ReportListComponent
// ###########################################################################
[Parameter] public List<SalesReportListView> ReportList { get; set; } = new();
[Parameter] public EventCallback<string> OnShowReport { get; set; }
[Parameter] public EventCallback<string> OnShowDocument { get; set; }
// ###########################################################################
private List<SalesReportListView> Reports { get; set; } = new();
protected override void OnParametersSet()
{
Reports = ReportList.OrderByDescending(x => x.ReportDate).ToList();
}
private void ShowThisReport(string reportDate)
private void ShowDocument(string documentId)
{
OnShowDocument.InvokeAsync(documentId);
}
private void ShowReport(string reportDate)
{
OnShowReport.InvokeAsync(reportDate);
}

View file

@ -15,8 +15,7 @@
@using Wonky.Entity.Views
<button type="button" aria-role="navigation" class="list-group-item list-group-item-action" style="cursor: pointer"
@onclick="ShowThisReport">
<button type="button" aria-role="navigation" class="list-group-item list-group-item-action" style="cursor: pointer" @onclick="ShowReport">
<div class="row">
<div class="col">
@Report.ReportDate

View file

@ -23,9 +23,16 @@ public partial class ReportListItemComponent
// #############################################################
[Parameter] public SalesReportListView Report { get; set; } = new();
[Parameter] public EventCallback<string> OnShowReport { get; set; }
[Parameter] public EventCallback<string> OnShowDocument { get; set; }
private void ShowDocument(string documentId)
{
OnShowDocument.InvokeAsync(documentId);
}
private void ShowThisReport()
private void ShowReport()
{
OnShowReport.InvokeAsync(Report.ReportDate);
}

View file

@ -38,7 +38,7 @@
@foreach (var activity in ActivityList)
{
<tr class="border-bottom">
<td class="align-middle"><a class="link-info" href="#" @onclick="() => ShowDocument(activity.ActivityId)">@activity.Company.Name</a></td>
<td class="align-middle d-grid"><button aria-role="navigation" class="btn btn-info" @onclick="() => ShowDocument(activity.ActivityId)">@activity.Company.Name</button></td>
<td class="align-middle">@activity.Company.City</td>
<td class="align-middle">@activity.Demo</td>
<td class="align-middle">@activity.Sales</td>

View file

@ -19,7 +19,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Components;
public partial class ReportActivityListComponent
public partial class ReportViewActivityListComponent
{
// ##############################################################################
[Parameter] public List<ReportItemView> ActivityList { get; set; } = new();

View file

@ -18,7 +18,7 @@ using Microsoft.AspNetCore.Components;
namespace Wonky.Client.Components;
public partial class ReportDistanceLedgerComponent
public partial class ReportViewDistanceLedgerComponent
{
[Parameter] public ReportData ReportData { get; set; } = new();

View file

@ -19,7 +19,7 @@ using Microsoft.AspNetCore.Components;
namespace Wonky.Client.Components;
public partial class ReportSummaryComponent
public partial class ReportViewSummaryComponent
{
[Parameter] public ReportData ReportData { get; set; } = new();

View file

@ -127,7 +127,7 @@
@if (ReportItem.Express)
{
<tr>
<td class="bg-dark" colspan="4"></td>
<td colspan="4"></td>
<td colspan="2">
<h5 class="fw-bold text-end"><i class="bi-lightning-charge the-fast" style="font-size: 1rem;"></i> HASTER</h5>
</td>

View file

@ -18,12 +18,11 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Components;
public partial class ReportItemComponent
public partial class ReportVisitComponent
{
// ##############################################################################
[Parameter] public ReportItemView ReportItem { get; set; } = new();
protected override void OnParametersSet()
{
var lines = ReportItem.Lines.OrderBy(x => x.Location).ToList();

View file

@ -44,14 +44,14 @@
</div>
<div class="row">
<div class="w-75">
<ReportSummaryComponent ReportData="Report.ReportData"/>
<ReportViewSummaryComponent ReportData="Report.ReportData"/>
</div>
<div class="w-25">
<ReportDistanceLedgerComponent ReportData="Report.ReportData"/>
<ReportViewDistanceLedgerComponent ReportData="Report.ReportData"/>
</div>
</div>
<AdvisorActivityListComponent ActivityList="Report.ReportItems"/>
<ReportActivityLedgerComponent ReportData="Report.ReportData"/>
<ReportViewActivityLedgerComponent ReportData="Report.ReportData"/>
}
else
{
@ -65,6 +65,6 @@
{
@foreach (var item in Activities)
{
<ReportItemComponent ReportItem="@item"></ReportItemComponent>
<ReportVisitComponent ReportItem="@item"></ReportVisitComponent>
}
}

View file

@ -38,7 +38,7 @@
{
foreach (var item in Items.Where(item => item.StatusTypeEnum.ToLower() == "order" && item.ProcessStatusEnum.ToLower() == "none"))
{
<ReportItemComponent ReportItem="@item" />
<ReportVisitComponent ReportItem="@item" />
}
}
else

View file

@ -39,12 +39,12 @@
</div>
<div class="row">
<div class="w-75">
<ReportSummaryComponent ReportData="Report.ReportData"/>
<ReportViewSummaryComponent ReportData="Report.ReportData"/>
</div>
<div class="w-25">
<ReportDistanceLedgerComponent ReportData="Report.ReportData"/>
<ReportViewDistanceLedgerComponent ReportData="Report.ReportData"/>
</div>
</div>
<OfficeReportActivityListComponent ActivityList="Report.ReportItems"/>
<ReportActivityLedgerComponent ReportData="Report.ReportData"/>
<ReportViewActivityLedgerComponent ReportData="Report.ReportData"/>
</div>

View file

@ -45,14 +45,14 @@
</div>
<div class="row">
<div class="w-75">
<ReportSummaryComponent ReportData="Report.ReportData"/>
<ReportViewSummaryComponent ReportData="Report.ReportData"/>
</div>
<div class="w-25">
<ReportDistanceLedgerComponent ReportData="Report.ReportData"/>
<ReportViewDistanceLedgerComponent ReportData="Report.ReportData"/>
</div>
</div>
<OfficeReportActivityListComponent ActivityList="Report.ReportItems"/>
<ReportActivityLedgerComponent ReportData="Report.ReportData"/>
<ReportViewActivityLedgerComponent ReportData="Report.ReportData"/>
}
else
{
@ -66,6 +66,6 @@
{
foreach (var item in Activities.Where(item => item.StatusTypeEnum.ToLower() == "order" && item.ProcessStatusEnum.ToLower() == "none"))
{
<ReportItemComponent ReportItem="@item" />
<ReportVisitComponent ReportItem="@item" />
}
}

View file

@ -29,14 +29,14 @@
</div>
<div class="row">
<div class="w-75">
<ReportSummaryComponent ReportData="Report.ReportData"/>
<ReportViewSummaryComponent ReportData="Report.ReportData"/>
</div>
<div class="w-25">
<ReportDistanceLedgerComponent ReportData="Report.ReportData"/>
<ReportViewDistanceLedgerComponent ReportData="Report.ReportData"/>
</div>
</div>
<OfficeReportActivityListComponent ActivityList="Report.ReportItems"/>
<ReportActivityLedgerComponent ReportData="Report.ReportData"/>
<ReportViewActivityListComponent ActivityList="Report.ReportItems" OnShowDocument="ShowDocument"/>
<ReportViewActivityLedgerComponent ReportData="Report.ReportData"/>
}
else
{

View file

@ -39,11 +39,11 @@ public partial class SupervisorAdvisorReportViewPage : IDisposable
[Inject] public ILogger<SupervisorAdvisorReportViewPage> Logger { get; set; }
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public IJSRuntime JsRuntime { get; set; }
[Inject] public IToastService Toaster { get; set; }
[Inject] public IOrderProcessRepository ProcessRepo { get; set; }
// [Inject] public EventCallback<string> OnShowDocument { get; set; }
// #############################################################
[Parameter] public string CountryCode { get; set; } = "";
[Parameter] public string UserId { get; set; } = "";
@ -71,57 +71,18 @@ public partial class SupervisorAdvisorReportViewPage : IDisposable
await FetchUserReport(ReportDate);
}
protected override async Task OnAfterRenderAsync(bool firstRender)
/// <summary>
/// Event handler to show the document by Id
/// </summary>
/// <param name="documentId"></param>
private void ShowDocument(string documentId)
{
if (firstRender)
{
JsModule = await JsRuntime
.InvokeAsync<IJSObjectReference>("import", "/scripts/print-invoke.js");
}
}
// shoe order/activity document
// the supervisor version
Navigator.NavigateTo($"/supervisor/advisors/{UserId}/reports/{ReportDate}/activities/{documentId}");
}
// private void Print(PrintTarget target)
// {
// _returnUrl = new Uri(Navigator.Uri).AbsolutePath;
// switch (target)
// {
// case PrintTarget.OrderPage:
// Navigator.NavigateTo($"/report/print/orders/{CountryCode}/{UserId}/{ReportDate}?returnUrl={_returnUrl}");
// break;
// case PrintTarget.FrontPage:
// Navigator.NavigateTo($"/report/print/summary/{CountryCode}/{UserId}/{ReportDate}?returnUrl={_returnUrl}");
// break;
// case PrintTarget.None:
// break;
// case PrintTarget.All:
// break;
// default:
// throw new ArgumentOutOfRangeException(nameof(target), target, null);
// }
// }
//
//
// private async Task Print()
// {
// var current = 0;
// var orders = Report.ReportItems
// .Where(x => x is { StatusTypeEnum: "Order", ProcessStatusEnum: "None" } );
// var count = orders.Count();
// foreach (var item in orders)
// {
// Toaster.ShowInfo($"Behandler {current++} af {count} ordrer. Vent venligst");
// await ProcessRepo.UpdateWarehouseOrderStatus(new OrderProcessState
// {
// OrderId = item.ActivityId,
// ProcessStatusEnum = Utils.EnumToString(ProcessStatus.Printed)
// });
// }
// Toaster.ClearAll();
// await JsModule.InvokeVoidAsync("printInvoke");
// }
/// <summary>
/// Work date component event handler
/// </summary>
@ -170,6 +131,7 @@ public partial class SupervisorAdvisorReportViewPage : IDisposable
Working = false;
}
private void ProfileServiceOnOnChange(UserPreference userPreference)
{
Logger.LogDebug("OfficeReportViewPage => ProfileServiceOnOnChange");
@ -180,6 +142,7 @@ public partial class SupervisorAdvisorReportViewPage : IDisposable
StateHasChanged();
}
public void Dispose()
{
Interceptor.DisposeEvent();

View file

@ -25,7 +25,7 @@
Rapport Arkiv - @AdvisorInfo.FirstName @AdvisorInfo.LastName
</div>
</div>
<OfficeReportListComponent OnShowReport="ShowThisReport" CountryCode="@AdvisorInfo.CountryCode" UserId="@UserId" ReportList="@ActivityReports" />
<ReportListComponent OnShowReport="ShowReport" ReportList="@ActivityReports" />
</div>
@if (Working)

View file

@ -16,9 +16,11 @@ public partial class SupervisorAdvisorViewPage : IDisposable
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public ILogger<SupervisorAdvisorViewPage> Logger { get; set; }
// #############################################################
[Parameter] public string UserId { get; set; } = "";
// #############################################################
private UserAdvisorInfoView AdvisorInfo { get; set; } = new();
private List<SalesReportListView> ActivityReports { get; set; } = new();
@ -42,17 +44,19 @@ public partial class SupervisorAdvisorViewPage : IDisposable
ActivityReports = reports.OrderByDescending(x => x.ReportDate).ToList();
}
protected override void OnInitialized()
{
Working = false;
}
private void ShowThisReport(string reportDate)
private void ShowReport(string reportDate)
{
var uri = new Uri(Navigator.Uri);
var url = uri.AbsoluteUri;
Logger.LogDebug("ShowThisReport\n => {}\n =>{}", reportDate, url);
Logger.LogDebug("ShowThisReport => NavigateTo => {}",$"{url}/report/{reportDate}");
Logger.LogDebug("ShowReport\n => {}\n =>{}", reportDate, url);
Logger.LogDebug("ShowReport => NavigateTo => {}",$"{url}/reports/{reportDate}");
Navigator.NavigateTo($"{url}/reports/{reportDate}");
}

View file

@ -16,8 +16,8 @@
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Admin,Office,Warehouse")]
@page "/supervisor/advisors/{UserId}/reports/{ReportDate}/{ActivityId}"
@attribute [Authorize(Roles = "Supervisor")]
@page "/supervisor/advisors/{UserId}/reports/{ReportDate}/activities/{DocumentId}"
<PageTitle>@ReportItem.ESalesNumber - @ReportItem.Company.Name</PageTitle>
<table class="table table-sm table-striped d-print-table">
<thead>
@ -136,13 +136,13 @@
</div>
</div>
<div class="card-body">
<div class="card-title">
<div class="card-title fw-bold h5">
Kontor
</div>
@ReportItem.OfficeNote
</div>
<div class="card-body">
<div class="card-title">
<div class="card-title fw-bold h5">
Kundekort
</div>
@ReportItem.CrmNote

View file

@ -40,10 +40,13 @@ public partial class SupervisorVisitViewPage : IDisposable
[Inject] public IToastService Toast { get; set; }
[Inject] public IUserInfoService UserInfoService { get; set; }
// #############################################################
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string OrderId { get; set; } = "";
[Parameter] public string UserId { get; set; } = "";
[Parameter] public string DocumentId { get; set; } = "";
[Parameter] public string ReportDate { get; set; } = "";
// #############################################################
private ReportItemView ReportItem { get; set; } = new();
private bool IsNotified { get; set; }
@ -59,7 +62,7 @@ public partial class SupervisorVisitViewPage : IDisposable
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
// fetch order from backend
ReportItem = await AdvisorActivityRepo.GetReportItem(OrderId);
ReportItem = await AdvisorActivityRepo.GetReportItem(DocumentId);
Logger.LogDebug("ReportItem => \n {}", JsonSerializer.Serialize(ReportItem, _options));
Working = false;
}

View file

@ -120,7 +120,7 @@
<AuthorizeView Roles="Admin">
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/system">
<i class="bi-gear-wide-connected pe-2" style="font-size:1.3em;" aria-hidden="true"></i> System
<i class="bi-gear-wide-connected pe-2" style="font-size:1.3em;" aria-hidden="true"></i> System Vedligehold
</NavLink>
</div>
</AuthorizeView>

View file

@ -1,15 +1,15 @@
{
"appInfo": {
"name": "Wonky Online",
"version": "0.126.0",
"version": "0.126.2",
"rc": true,
"sandBox": false,
"image": "grumpy-coder.png"
},
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Debug",
"Default": "Information",
"System": "Information",
"Microsoft": "Information"
},
"Debug": {
@ -19,7 +19,7 @@
}
},
"apiConfig": {
"baseUrl": "https://dev.innotec.dk",
"baseUrl": "https://zeta.innotec.dk",
"catalog": "api/v2/catalog/country",
"crmCustomers": "api/v2/crm/companies",
"crmInventoryExt": "history/inventory",