wip - v0.8.40

This commit is contained in:
Frede Hundewadt 2022-06-27 14:46:51 +02:00
parent 0d7202cdb7
commit 6844e0ce6f
18 changed files with 163 additions and 156 deletions

View file

@ -23,6 +23,7 @@
<th scope="col">Besøg</th>
<th scope="col">Demo</th>
<th scope="col">Salg</th>
<th></th>
<th class="text-end" scope="col">Beløb</th>
</tr>
</thead>
@ -33,7 +34,8 @@
<td>@activity.Company.Name, @activity.Company.ZipCity</td>
<td>@activity.Demo</td>
<td>@activity.SalesResume</td>
<td class="text-end">@activity.OrderAmount</td>
<td>@(activity.StatusTypeEnum == "Quote" ? "Tilbud" : "Salg")</td>
<td class="text-end">@(activity.Closed ? @activity.OrderAmount : 0)</td>
</tr>
}
</tbody>

View file

@ -4,7 +4,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Components;
public partial class AdviserTableComponent
public partial class AdminAdviserTableComponent
{
[Parameter] public List<AdminAdviserListView> UserList { get; set; }
}

View file

@ -22,7 +22,7 @@
</div>
@foreach (var report in ReportList)
{
<a class="list-group-item list-group-item-action" href="/admin/users/@ErpUserId/reports/@report.ReportDate">
<a class="list-group-item list-group-item-action" href="/admin/users/@report./reports/@report.ReportDate">
<div class="row">
<div class="col">
@report.ReportDate

View file

@ -6,5 +6,5 @@ namespace Wonky.Client.Components;
public partial class AdminReportTableComponent
{
[Parameter] public List<NgSalesReportListView> ReportList { get; set; } = new();
[Parameter] public string ErpUserId { get; set; } = "";
[Parameter] public string UserId { get; set; } = "";
}

View file

@ -63,9 +63,9 @@
<div class="col">
@company.City
</div>
<div class="col">
<div class="col justify-content-end">
<ActivityButton CompanyId="@company.CompanyId"
ActionLink="/companies/$ID$/activity/new"
ActionLink="/companies/$ID$/activities/new"
ButtonText="Besøg"
ButtonType="primary"
Enabled="@company.ValidVat">

View file

@ -32,9 +32,10 @@ namespace Wonky.Client.Pages;
public partial class ActivityVisitNew : IDisposable
{
// Parameters
[CascadingParameter] DraftStateProvider DraftStateProvider { get; set; }
[Parameter] public string CompanyId { get; set; }
// todo: prevent creating activity for workDate with closed report
// Services
[Inject] private ILogger<ActivityVisitNew> _logger { get; set; }
[Inject] private IToastService _toast { get; set; }
[Inject] private NavigationManager _navigator { get; set; }
@ -45,10 +46,8 @@ public partial class ActivityVisitNew : IDisposable
[Inject] private UserPreferenceService _userPrefs { get; set; }
[Inject] private IActivityHttpRepository _activityRepo { get; set; }
[Inject] private IReportHttpRepository _reportRepo { get; set; }
private readonly JsonSerializerOptions? _options = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
};
// variables
private readonly JsonSerializerOptions? _options = new JsonSerializerOptions{PropertyNameCaseInsensitive = true};
private NgSalesItemView _selectedItem { get; set; } = new();
private List<NgSalesItemView> _caltalog { get; set; } = new();
private MetaData _metaData { get; set; } = new();
@ -69,7 +68,7 @@ public partial class ActivityVisitNew : IDisposable
private bool InvalidActivity = true;
private bool InvalidCanvas = true;
private bool _reportClosdd { get; set; } = false;
private UserInfoView Ux { get; set; } = new();
private UserInfoView _ux { get; set; } = new();
private DateTime _workDate { get; set; } = DateTime.Now;
protected override async Task OnParametersSetAsync()
@ -103,19 +102,19 @@ public partial class ActivityVisitNew : IDisposable
await GetSalesItems();
Ux = await _storage.GetItemAsync<UserInfoView>("_xu");
_ux = await _storage.GetItemAsync<UserInfoView>("_xu");
_company = await _companyRepo.GetCompanyById(CompanyId);
// set up identification
_draft.CompanyId = _company.CompanyId;
_draft.BcId = _company.BcId;
_draft.SalesRepId = Ux.Id;
_draft.SalesRepId = _ux.Id;
_draft.ActivityStatusEnum = "noSale";
_draft.VisitTypeEnum = _company.Account is "" or "NY" ? "new" : "recall";
// permanent identifications
_draft.SalesRep = Ux.Adviser;
_draft.SalesRep = _ux.Adviser;
_draft.Account = _company.Account;
_draft.VatNumber = _company.VatNumber;
_draft.EMail = _company.Email;
@ -138,6 +137,7 @@ public partial class ActivityVisitNew : IDisposable
private void SetWorkDate(string workDate)
{
Console.WriteLine($"SetWorkDate => {workDate}");
_logger.LogInformation("WorkDateComponent.OnChanged(SetWorkDate(workDate)) => {workDate}", workDate);
_workDate = DateTime.Parse(workDate);
_draft.ActivityDate = workDate;
@ -154,7 +154,7 @@ public partial class ActivityVisitNew : IDisposable
"onSite" => "B:",
_ => ""
};
_draft.OurRef = $"{activityType}{Ux.FullName.Split(" ")[0]}";
_draft.OurRef = $"{activityType}{_ux.FullName.Split(" ")[0]}";
var ln = 0;
var lines = DraftStateProvider.Draft.Items.Select(item => new ActivityLineDto
{

View file

@ -8,6 +8,6 @@
<h3>Sælgere</h3>
</div>
<div class="card-body">
<AdviserTableComponent UserList="_salesReps"></AdviserTableComponent>
<AdminAdviserTableComponent UserList="_salesReps"></AdminAdviserTableComponent>
</div>
</div>

View file

@ -27,6 +27,6 @@
</div>
</div>
<div class="card-body">
<ReportTableComponent ReportList="_reports"></ReportTableComponent>
<AdminReportTableComponent ReportList="_reports"></AdminReportTableComponent>
</div>
</div>

View file

@ -9,7 +9,7 @@ namespace Wonky.Client.Pages;
public partial class AdminSalesReportList : IDisposable
{
[Parameter] public string UserId { get; set; } = "";
[Inject] private IReportHttpRepository _reportRepo { get; set; }
[Inject] private IAdminReportHttpRepository _reportRepo { get; set; }
[Inject] private HttpInterceptorService _interceptor { get; set; }
private List<NgSalesReportListView> _reports { get; set; }
@ -19,7 +19,7 @@ public partial class AdminSalesReportList : IDisposable
_interceptor.RegisterEvent();
_interceptor.RegisterBeforeSendEvent();
_reports = await _reportRepo.GetReports();
_reports = await _reportRepo.GetReports(UserId);
}
public void Dispose()

View file

@ -21,7 +21,7 @@
@attribute [Authorize(Roles = "Adviser")]
<div class="sticky-top bg-dark bg-opacity-50 rounded-2 px-3">
<div class="sticky-top bg-success bg-opacity-50 rounded-2 px-3">
<div class="container-fluid pt-3">
<div class="row mb-2">
<div class="col-md-3">
@ -38,12 +38,10 @@
</div>
</div>
<div class="row mb-2">
<div class="col-md-6">
<div class="col-md-10">
<PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage"></PaginationComponent>
</div>
<div class="col-md-3">
</div>
<div class="col-md-3">
<div class="col-md-2 justify-content-end">
<a class="btn btn-success" href="/companies/new">Opret kunde</a>
</div>
</div>

View file

@ -21,7 +21,7 @@
@attribute [Authorize(Roles = "Adviser,Admin")]
<div class="sticky-top bg-dark bg-opacity-50 rounded-2 px-3">
<div class="sticky-top bg-success bg-opacity-50 rounded-2 px-3">
<div class="container-fluid pt-3">
<div class="row mb-3">
<div class="col">
@ -41,7 +41,7 @@
</div>
</div>
<div class="row mb-3">
<div class="col">
<div class="col-md-10">
<PaginationComponent MetaData="_metaDate" Spread="2" SelectedPage="SelectedPage"></PaginationComponent>
</div>
</div>

View file

@ -39,7 +39,8 @@
</div>
</div>
<div class="card-body">
<table class="table">
<div class="sticky-top bg-success bg-opacity-50 rounded-2 px-3">
<table class="table">
<thead>
<tr>
<th scope="col">Dagen</th>
@ -98,7 +99,8 @@
</td>
</tr>
</tbody>
</table>
</table>
</div>
@if (!_report.DayTypeEnum.ToLower().Contains("leave"))
{
<table class="table">
@ -147,16 +149,84 @@
</tr>
</tbody>
</table>
<table class="table table-striped">
<thead>
<tr class="bg-dark text-white opacity-75">
<th></th>
<th class="text-center" colspan="2" scope="col">Dagens Demo @(_report.Figures.NewDemoCount + _report.Figures.RecallDemoCount)</th>
<th class="text-center border-end" colspan="2" scope="col">Dagens Resultat</th>
<th class="text-center" colspan="4" scope="col">Måneds Resultat</th>
</tr>
</thead>
<tbody>
<tr class="bg-dark bg-opacity-50">
<td></td>
<th class="text-end text-white" scope="col">Besøg</th>
<th class="text-end text-white" scope="col">Demo</th>
<th class="text-end text-white" scope="col">Salg</th>
<th class="text-end text-white border-end" scope="col">Beløb</th>
<th class="text-end text-white" scope="col">Besøg</th>
<th class="text-end text-white" scope="col">Demo</th>
<th class="text-end text-white" scope="col">Salg</th>
<th class="text-end text-white" scope="col">Beløb</th>
</tr>
<tr>
<th scope="row">N</th>
<td class="text-end">@_report.Figures.NewVisitCount</td>
<td class="text-end">@_report.Figures.NewDemoCount</td>
<td class="text-end">@_report.Figures.NewSaleCount</td>
<td class="text-end border-end">@_report.Figures.NewTurnover</td>
<td class="text-end">@_report.Figures.NewVisitCountMonth</td>
<td class="text-end">@_report.Figures.NewDemoCountMonth</td>
<td class="text-end">@_report.Figures.NewSaleCountMonth</td>
<td class="text-end">@_report.Figures.NewTurnoverMonth</td>
</tr>
<tr>
<th scope="row">R</th>
<td class="text-end">@_report.Figures.RecallVisitCount</td>
<td class="text-end">@_report.Figures.RecallDemoCount</td>
<td class="text-end">@_report.Figures.RecallSaleCount</td>
<td class="text-end border-end">@_report.Figures.RecallTurnover</td>
<td class="text-end">@_report.Figures.RecallVisitCountMonth</td>
<td class="text-end">@_report.Figures.RecallDemoCountMonth</td>
<td class="text-end">@_report.Figures.RecallSaleCountMonth</td>
<td class="text-end">@_report.Figures.RecallTurnoverMonth</td>
</tr>
<tr>
<th scope="row">SAS</th>
<td class="bg-light"></td>
<td class="bg-light"></td>
<td class="text-end">@_report.Figures.SasCount</td>
<td class="text-end border-end">@_report.Figures.SasTurnover</td>
<td class="bg-light"></td>
<td class="bg-light"></td>
<td class="text-end">@_report.Figures.SasCountMonth</td>
<td class="text-end">@_report.Figures.SasTurnoverMonth</td>
</tr>
<tr>
<th scope="row">TOTAL</th>
<td class="text-end">@_report.Figures.TotalVisitCount</td>
<td class="text-end">@_report.Figures.TotalDemoCount</td>
<td class="text-end">@_report.Figures.TotalSaleCount</td>
<td class="text-end border-end">@_report.Figures.TotalTurnover</td>
<td class="text-end">@_report.Figures.TotalVisitCountMonth</td>
<td class="text-end">@_report.Figures.TotalDemoCountMonth</td>
<td class="text-end">@_report.Figures.TotalSaleCountMonth</td>
<td class="text-end">@_report.Figures.TotalTurnoverMonth</td>
</tr>
</tbody>
</table>
@if (_activities != null)
{
<table class="table">
<thead>
<tr>
<tr class="bg-black opacity-75 text-white">
<th scope="col">Besøg</th>
<th scope="col">Demo</th>
<th scope="col">Salg</th>
<th scope="col">Beløb</th>
<th></th>
<th class="text-end" scope="col">Beløb</th>
</tr>
</thead>
<tbody>
@ -178,75 +248,6 @@
</tbody>
</table>
}
<table class="table">
<thead>
<tr>
<th></th>
<th colspan="2" scope="col">Demo @(_report.Figures.NewDemoCount + _report.Figures.RecallDemoCount)</th>
<th colspan="2" scope="col">Resultat</th>
<th colspan="4" scope="col">Resultat Måned</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<th scope="col">Besøg</th>
<th scope="col">Demo</th>
<th scope="col">Salg</th>
<th scope="col">Beløb</th>
<th scope="col">Besøg</th>
<th scope="col">Demo</th>
<th scope="col">Salg</th>
<th scope="col">Beløb</th>
</tr>
<tr>
<th scope="row">N</th>
<td>@_report.Figures.NewVisitCount</td>
<td>@_report.Figures.NewDemoCount</td>
<td>@_report.Figures.NewSaleCount</td>
<td>@_report.Figures.NewTurnover</td>
<td>@_report.Figures.NewVisitCountMonth</td>
<td>@_report.Figures.NewDemoCountMonth</td>
<td>@_report.Figures.NewSaleCountMonth</td>
<td>@_report.Figures.NewTurnoverMonth</td>
</tr>
<tr>
<th scope="row">R</th>
<td>@_report.Figures.RecallVisitCount</td>
<td>@_report.Figures.RecallDemoCount</td>
<td>@_report.Figures.RecallSaleCount</td>
<td>@_report.Figures.RecallTurnover</td>
<td>@_report.Figures.RecallVisitCountMonth</td>
<td>@_report.Figures.RecallDemoCountMonth</td>
<td>@_report.Figures.RecallSaleCountMonth</td>
<td>@_report.Figures.RecallTurnoverMonth</td>
</tr>
<tr>
<th scope="row">SAS</th>
<td></td>
<td></td>
<td>@_report.Figures.SasCount</td>
<td>@_report.Figures.SasTurnover</td>
<td></td>
<td></td>
<td>@_report.Figures.SasCountMonth</td>
<td>@_report.Figures.SasTurnoverMonth</td>
</tr>
<tr>
<th scope="row">TOTAL</th>
<td>@(_report.Figures.TotalVisitCount)</td>
<td>@(_report.Figures.TotalDemoCount)</td>
<td>@(_report.Figures.TotalSaleCount)</td>
<td>@(_report.Figures.TotalTurnover)</td>
<td>@(_report.Figures.TotalVisitCountMonth)</td>
<td>@(_report.Figures.TotalDemoCountMonth)</td>
<td>@(_report.Figures.TotalSaleCountMonth)</td>
<td>@(_report.Figures.TotalTurnoverMonth)</td>
</tr>
</tbody>
</table>
}
</div>
</div>

View file

@ -62,6 +62,9 @@ public partial class SalesReportNew : IDisposable
_prefs = await _userPrefs.GetPreferences();
if (!string.IsNullOrWhiteSpace(_prefs.WorkDate))
_workDate = DateTime.Parse(_prefs.WorkDate);
if(await _reportRepo.ReportExist(_prefs.WorkDate))
_navigator.NavigateTo($"/sales-reports/view/{_prefs.WorkDate}");
_leaveBegin = _workDate;
_leaveEnd = _workDate;

View file

@ -1,12 +1,12 @@
{
"appInfo": {
"name": "Wonky Client",
"version": "0.8.38",
"version": "0.8.40",
"isBeta": true,
"image": "grumpy-coder.png"
},
"apiConfig": {
"innoBaseUrl": "https://dev.innotec.dk",
"innoBaseUrl": "https://staging.innotec.dk",
"glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
"glsId": "",
"virkUrl": "api/v2/services/virk",

View file

@ -31,4 +31,5 @@ public class AdviserInfoView
public bool EmailConfirmed { get; set; }
public bool IsAdviser { get; set; }
public bool IsAdmin { get; set; }
public string UserId { get; set; } = "";
}

View file

@ -4,6 +4,7 @@ public class NgReportActivityView
{
public ActivityCompanyView Company { get; set; } = new();
public string SalesHeadId { get; set; } = "";
public string StatusTypeEnum { get; set; } = "";
public bool Closed { get; set; }
public string OrderDate { get; set; } = "";
public string ReferenceNumber { get; set; } = "";

View file

@ -3,6 +3,7 @@ namespace Wonky.Entity.Views;
public class NgSalesReportListView
{
public string ReportId { get; set; } = "";
public string UserId { get; set; } = "";
public string Name { get; set; } = "";
public string Description { get; set; } = "";
public string ReportDate { get; set; } = "";