release 0.28

This commit is contained in:
Frede Hundewadt 2022-10-18 11:05:07 +02:00
parent 4bfb9a7757
commit 48e07d41ca
8 changed files with 148 additions and 102 deletions

View file

@ -18,6 +18,7 @@
@if (Inventory.Any()) @if (Inventory.Any())
{ {
<table class="table table-striped"> <table class="table table-striped">
@*
<thead> <thead>
<tr> <tr>
<th scope="col"> <th scope="col">
@ -34,6 +35,7 @@
</th> </th>
</tr> </tr>
</thead> </thead>
*@
<tbody> <tbody>
@foreach (var product in Inventory) @foreach (var product in Inventory)
{ {
@ -48,7 +50,7 @@
@product.Quantity @product.Quantity
</td> </td>
<td class="align-middle"> <td class="align-middle">
<button class="btn btn-info" type="button" @onclick="() => CallShowReorderModal(product.Sku)">Historik</button> <a class="btn btn-dark d-block" type="button" @onclick="() => CallShowReorderModal(product.Sku)">Historik</a>
</td> </td>
</tr> </tr>
} }

View file

@ -250,6 +250,7 @@ else
} }
</div> </div>
</div> </div>
@* end draft line ------------------------------------------------- *@
</div> </div>
<div class="accordion" id="crmActivity"> <div class="accordion" id="crmActivity">
@* @*

View file

@ -298,6 +298,7 @@ public partial class CrmActivityNewPage : IDisposable
private async Task DeleteDraft() private async Task DeleteDraft()
{ {
await DraftStateProvider.DeleteDraftAsync(); await DraftStateProvider.DeleteDraftAsync();
Activity.ActivityStatusEnum = "noSale";
} }
/// <summary> /// <summary>
/// Add item to draft /// Add item to draft
@ -322,6 +323,8 @@ public partial class CrmActivityNewPage : IDisposable
Discount = "0"; Discount = "0";
// add it to the cart // add it to the cart
DraftStateProvider.Draft.Items.Add(item); DraftStateProvider.Draft.Items.Add(item);
if(Activity.ActivityStatusEnum != "quote")
Activity.ActivityStatusEnum = "order";
// save the item using the CartStateProvider's save method // save the item using the CartStateProvider's save method
await DraftStateProvider.SaveChangesAsync(); await DraftStateProvider.SaveChangesAsync();
} }
@ -335,6 +338,8 @@ public partial class CrmActivityNewPage : IDisposable
DraftStateProvider.Draft.Items.Remove(item); DraftStateProvider.Draft.Items.Remove(item);
// save the remaining draft // save the remaining draft
await DraftStateProvider.SaveChangesAsync(); await DraftStateProvider.SaveChangesAsync();
if (!DraftStateProvider.Draft.Items.Any())
Activity.ActivityStatusEnum = "noSale";
} }
/// <summary> /// <summary>
/// Edit Context handle field change /// Edit Context handle field change

View file

@ -26,30 +26,49 @@
@if (_activities.Any()) @if (_activities.Any())
{ {
<div class="list-group"> <div class="list-group">
@foreach (var activity in _activities)
{
<div class="list-group-item"> <div class="list-group-item">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
@activity.OrderDate <h4>Dato</h4>
</div> </div>
<div class="col"> <div class="col">
@activity.Demo <h4>Demo</h4>
</div> </div>
<div class="col"> <div class="col">
@activity.Sales <h4>Salg</h4>
</div> </div>
<div class="col"> <div class="col">
@activity.VisitTypeEnum <h4>Note /Kontor</h4>
</div>
<div class="col">Note /Selv</div>
</div>
</div>
@foreach (var activity in _activities)
{
<div class="list-group-item">
<div class="row">
<div class="col">
@activity.OrderDate
</div>
<div class="col">
@activity.Demo
</div>
<div class="col">
@activity.Sales
</div>
<div class="col">
@activity.OfficeNote
</div>
<div class="col">
</div>
</div> </div>
</div> </div>
</div> }
}
</div> </div>
} }
else else
{ {
<LoaderThreeDots /> <LoaderThreeDots/>
} }

View file

@ -203,7 +203,7 @@
<a class="btn btn-light border-dark d-block" href="/companies">Kundeliste</a> <a class="btn btn-light border-dark d-block" href="/companies">Kundeliste</a>
</div> </div>
<div class="col"> <div class="col">
<a class="btn btn-light border-dark d-block" href="/companies/@_company.CompanyId/activities">Aktivitet</a> <a class="btn btn-light border-dark d-block" href="/companies/@_company.CompanyId/activities">Besøg oversigt</a>
</div> </div>
<div class="col"> <div class="col">
<a class="btn btn-light border-dark d-block" href="/companies/@_company.CompanyId/h/i">Produktkøb</a> <a class="btn btn-light border-dark d-block" href="/companies/@_company.CompanyId/h/i">Produktkøb</a>

View file

@ -20,70 +20,91 @@
<div class="modal-dialog modal-dialog-scrollable modal-lg modal-xl"> <div class="modal-dialog modal-dialog-scrollable modal-lg modal-xl">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">@ProductName</h5> <h4 class="modal-title">@SalesItem.Name @SalesItem.Sku</h4>
<button type="button" class="btn-close" @onclick="Hide" data-bs-dismiss="modal" aria-label="Luk"></button> <button type="button" class="btn-close" @onclick="Hide" data-bs-dismiss="modal" aria-label="Luk"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="row align-middle"> @* draft line ----------------------------------------------------- *@
<div class="col-sm-4 text-sm-start"> <div class="row">
@SalesItem.Name <div class="col">
</div> <table id="draft-line" class="table table-bordered">
<div class="col-sm-2 text-sm-start"> <thead>
@SalesItem.Sku <tr class="bg-dark text-white">
</div> <th scope="col" colspan="6">BESTILLING</th>
<div class="col-sm-2 text-sm-start"> </tr>
@SalesItem.ShortName
</div>
<div class="col-sm-4">
<ul class="list-group">
@foreach (var rate in SalesItem.Rates)
{
<li class="list-group-item d-flex justify-content-between align-items-end">
<div class="text-sm-end me-1">@rate.Quantity</div>
<div class="text-sm-end me-1">@rate.Rate</div>
<div>
<a class="btn btn-primary btn-sm" data-bs-dismiss="modal" @onclick="@(() => SelectItem(rate.Quantity, rate.Rate))">
<i class="oi oi-plus"></i>
</a>
</div>
</li>
}
</ul>
</div>
</div>
@if (!string.IsNullOrWhiteSpace(ProductName))
{
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Dato</th>
<th scope="col">Antal</th>
<th scope="col">Rabat</th>
<th scope="col">Pris</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach (var entry in History)
{
<tr> <tr>
<td>@entry.DeliveryDate</td> <th scope="col">Antal</th>
<td>@entry.Quantity</td> <th scope="col">Pris</th>
<td>@entry.Discount</td> <th scope="col">Rabat</th>
<td>@entry.Price</td> <th class="align-content-center justify-content-center" scope="col">SAS</th>
<td> <th scope="col"></th>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" @onclick="() => SelectLine(entry)">Overfør</button> </tr>
</thead>
<tbody>
<tr>
<td class="align-middle">
<input type="number" class="form-control" @bind-value="@SelectedItem.Quantity"/>
</td>
<td class="align-middle">
<div class="input-group">
<input type="number" class="form-control" @bind-value="@SelectedItem.Price"/>
</div>
</td>
<td class="align-middle">
<input type="number" class="form-control" @bind-value="@SelectedItem.Discount"/>
</td>
<td class="align-middle align-content-center justify-content-center">
<input type="checkbox" class="form-check" @bind-value="@SelectedItem.Sas"/>
</td>
<td class="align-middle">
<button type="button" class="btn btn-warning text-nowrap d-block" @onclick="@(() => SendToOrder(SelectedItem))">BESTIL</button>
</td> </td>
</tr> </tr>
} </tbody>
</tbody> </table>
</table> </div>
} </div>
else @* end draft line ------------------------------------------------- *@
{ @* price list item ------------------------------------------------ *@
<h3>Ingen data</h3> <div class="row align-middle">
} @foreach (var rate in SalesItem.Rates)
{
<div class="col">
<a type="button" class="btn btn-primary btn-sm" data-bs-dismiss="modal" @onclick="@(() => SelectPrice(rate.Quantity, rate.Rate))">
@rate.Quantity <i class="bi-at"></i> @rate.Rate/stk
</a>
</div>
}
</div>
@* end price list item -------------------------------------------- *@
@* product history ------------------------------------------------ *@
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Dato</th>
<th scope="col">Antal</th>
<th scope="col">Rabat</th>
<th scope="col">Pris</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach (var entry in History)
{
<tr>
<td class="align-middle">@entry.DeliveryDate</td>
<td class="align-middle">@entry.Quantity</td>
<td class="align-middle">@entry.Discount</td>
<td class="align-middle">@entry.Price</td>
<td class="align-middle">
<button type="button" class="btn btn-primary btn-sm" data-bs-dismiss="modal" @onclick="() => SelectHistory(entry)"><i class="bi-plus"></i> VÆLG</button>
</td>
</tr>
}
</tbody>
</table>
@* end product history -------------------------------------------- *@
</div> </div>
</div> </div>
</div> </div>

View file

@ -30,13 +30,13 @@ public partial class InventoryReorderModal
[Parameter] public string CompanyId { get; set; } = ""; [Parameter] public string CompanyId { get; set; } = "";
[Parameter] public SalesItemView SalesItem { get; set; } = new(); [Parameter] public SalesItemView SalesItem { get; set; } = new();
[Inject] public ICrmHistoryHttpRepository CrmHistoryRepo { get; set; } [Inject] public ICrmHistoryHttpRepository CrmHistoryRepo { get; set; }
[Parameter] public EventCallback<DraftItem> OnSelected { get; set; } [Parameter] public EventCallback<DraftItem> OnSelected { get; set; }
private List<ProductHistoryView> History { get; set; } = new();
private List<ProductHistoryView> History { get; set; } private DraftItem SelectedItem { get; set; } = new();
private string ProductName { get; set; } = ""; private string ProductName { get; set; } = "";
private string _modalDisplay = ""; private string _modalDisplay = "";
private bool _showBackdrop; private bool _showBackdrop;
private bool ShowDraft { get; set; }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
@ -44,36 +44,33 @@ public partial class InventoryReorderModal
return; return;
History = await CrmHistoryRepo.FetchHistory(CompanyId, SalesItem.Sku); History = await CrmHistoryRepo.FetchHistory(CompanyId, SalesItem.Sku);
if (History.Any()) SelectedItem.Item = SalesItem;
{ SelectedItem.Discount = 0;
ProductName = History[0].Description; SelectedItem.Quantity = 1;
} SelectedItem.Price = decimal.Parse(SalesItem.Rates[0].Rate, CultureInfo.InvariantCulture);
} }
private void SelectItem(string quantity, string rate) private async Task SendToOrder(DraftItem item)
{ {
var result = new DraftItem SelectedItem = new DraftItem();
{ await OnSelected.InvokeAsync(item);
Discount = 0,
Item = SalesItem,
Price = decimal.Parse(rate, CultureInfo.InvariantCulture),
Quantity = int.Parse(quantity)
};
OnSelected.InvokeAsync(result);
Hide(); Hide();
} }
private void SelectLine(ProductHistoryView item) private void SelectPrice(string quantity, string rate)
{ {
var result = new DraftItem SelectedItem.Discount = 0;
{ SelectedItem.Price = decimal.Parse(rate, CultureInfo.InvariantCulture);
Discount = item.Discount, SelectedItem.Quantity = int.Parse(quantity);
Item = SalesItem, StateHasChanged();
Price = item.Price, }
Quantity = item.Quantity,
}; private void SelectHistory(ProductHistoryView item)
OnSelected.InvokeAsync(result); {
Hide(); SelectedItem.Discount = item.Discount;
SelectedItem.Price = item.Price;
SelectedItem.Quantity = item.Quantity;
StateHasChanged();
} }
public void Show() public void Show()
@ -85,6 +82,7 @@ public partial class InventoryReorderModal
private void Hide() private void Hide()
{ {
SelectedItem = new DraftItem();
_modalDisplay = "none;"; _modalDisplay = "none;";
_showBackdrop = false; _showBackdrop = false;
StateHasChanged(); StateHasChanged();

View file

@ -1,13 +1,13 @@
{ {
"appInfo": { "appInfo": {
"name": "Wonky Client", "name": "Wonky Client",
"version": "0.27.2", "version": "0.28.0",
"rc": true, "rc": false,
"sandBox": false, "sandBox": false,
"image": "grumpy-coder.png" "image": "grumpy-coder.png"
}, },
"apiConfig": { "apiConfig": {
"innoBaseUrl": "https://dev.innotec.dk", "innoBaseUrl": "https://app.innotec.dk",
"glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=", "glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
"glsId": "", "glsId": "",
"serviceVirk": "api/v2/services/virk", "serviceVirk": "api/v2/services/virk",