done - customer inventory overlay
This commit is contained in:
parent
2f91e10f32
commit
17f27cad5c
13 changed files with 136 additions and 30 deletions
|
@ -47,5 +47,5 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div>Venter ...</div>
|
<div>Ingen data</div>
|
||||||
}
|
}
|
|
@ -156,19 +156,18 @@ else
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row g-2">
|
<div class="row g-2 mb-3">
|
||||||
<div class="col-sm-4 d-grid mx-auto">
|
<div class="col-sm-3 d-grid mx-auto">
|
||||||
<button class="btn btn-danger" disabled="@string.IsNullOrWhiteSpace(Activity.ActivityTypeEnum)" @onclick="ShowInvoiceOverlay">Faktura</button>
|
<button class="btn btn-danger" disabled="@string.IsNullOrWhiteSpace(Activity.ActivityTypeEnum)" @onclick="ShowInvoiceOverlay">Faktura</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4 d-grid mx-auto">
|
<div class="col-sm-3 d-grid mx-auto">
|
||||||
<button class="btn btn-warning" disabled>Tidl. besøg</button>
|
<button class="btn btn-warning" disabled>Tidl. besøg</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4 d-grid mx-auto">
|
<div class="col-sm-3 d-grid mx-auto">
|
||||||
<button class="btn btn-success" disabled>Produkter</button>
|
<button class="btn btn-success" disabled="@string.IsNullOrWhiteSpace(Activity.ActivityTypeEnum)" @onclick="ShowInventoryOverlay">Produkter</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="this-draft" style="@(Activity.ActivityStatusEnum is "order" or "quote" ? "display: block" : "display:none")">
|
<div id="this-draft" style="@(Activity.ActivityStatusEnum is "order" or "quote" ? "display: block" : "display:none")">
|
||||||
@* Draft lines in draft -----------------------------------------------------*@
|
@* Draft lines in draft -----------------------------------------------------*@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -336,9 +335,15 @@ else
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<ConfirmWorkDateModal BodyMessage="@PromptDateConfirm" OnOkClicked="WorkDateConfirmCallback" @ref="ConfirmWorkDateModal"/>
|
<ConfirmWorkDateModal BodyMessage="@PromptDateConfirm"
|
||||||
<PriceCatalogModal CountryCode="@Company.CountryCode.ToLower()" OnSelected="PriceListCallback" @ref="PriceCatalogModal"/>
|
OnOkClicked="WorkDateConfirmCallback" @ref="ConfirmWorkDateModal"/>
|
||||||
|
<PriceCatalogModal CountryCode="@Company.CountryCode.ToLower()"
|
||||||
|
OnSelected="PriceListCallback" @ref="PriceCatalogModal"/>
|
||||||
<ProductHistoryModal CompanyId="@CompanyId" ItemSku="@SelectedItem.Sku" @ref="HistoryModal"/>
|
<ProductHistoryModal CompanyId="@CompanyId" ItemSku="@SelectedItem.Sku" @ref="HistoryModal"/>
|
||||||
<ProductPriceHistoryModal OnSelected="PriceHistoryCallback" CompanyId="@CompanyId" Sku="@SelectedItem.Sku" @ref="PriceHistoryModal"/>
|
<ProductPriceHistoryModal CompanyId="@CompanyId" Sku="@SelectedItem.Sku"
|
||||||
<ConfirmProductCheckModal BodyMessage="" CompanyId="@CompanyId" Products="CheckList" OnOkClicked="ConfirmProductCheckCallback" @ref="ConfirmProductCheckModal" />
|
OnSelected="PriceHistoryCallback" @ref="PriceHistoryModal"/>
|
||||||
|
<ConfirmProductCheckModal BodyMessage="" CompanyId="@CompanyId" Products="CheckList"
|
||||||
|
OnOkClicked="ConfirmProductCheckCallback" @ref="ConfirmProductCheckModal" />
|
||||||
<CustomerInvoiceOverlay CustomerInvoices="CompanyInvoices" @ref="InvoiceOverlay" />
|
<CustomerInvoiceOverlay CustomerInvoices="CompanyInvoices" @ref="InvoiceOverlay" />
|
||||||
|
<CustomerInventoryOverlay CompanyName="@Company.Name" CompanyId="@CompanyId" CountryCode="@Company.CountryCode"
|
||||||
|
OnInventorySelected="OnInventoryCallback" Inventory="Inventory" @ref="InventoryOverlay" />
|
|
@ -32,9 +32,6 @@ namespace Wonky.Client.Pages;
|
||||||
|
|
||||||
public partial class AdvisorActivityCreatePage : IDisposable
|
public partial class AdvisorActivityCreatePage : IDisposable
|
||||||
{
|
{
|
||||||
// Parameters
|
|
||||||
[CascadingParameter] DraftStateProvider DraftProvider { get; set; }
|
|
||||||
[Parameter] public string CompanyId { get; set; }
|
|
||||||
// Services
|
// Services
|
||||||
[Inject] private ILogger<AdvisorActivityCreatePage> Logger { get; set; }
|
[Inject] private ILogger<AdvisorActivityCreatePage> Logger { get; set; }
|
||||||
[Inject] private HttpInterceptorService Interceptor { get; set; }
|
[Inject] private HttpInterceptorService Interceptor { get; set; }
|
||||||
|
@ -47,6 +44,10 @@ public partial class AdvisorActivityCreatePage : IDisposable
|
||||||
[Inject] private IAdvisorActivityRepository Actitivites { get; set; }
|
[Inject] private IAdvisorActivityRepository Actitivites { get; set; }
|
||||||
[Inject] private IAdvisorReportRepository Reports { get; set; }
|
[Inject] private IAdvisorReportRepository Reports { get; set; }
|
||||||
[Inject] private IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
|
[Inject] private IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
|
||||||
|
|
||||||
|
[CascadingParameter] private DraftStateProvider DraftProvider { get; set; } = new();
|
||||||
|
[Parameter] public string CompanyId { get; set; }
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
private readonly JsonSerializerOptions _options = new() {PropertyNameCaseInsensitive = true};
|
private readonly JsonSerializerOptions _options = new() {PropertyNameCaseInsensitive = true};
|
||||||
private SalesItemView SelectedItem { get; set; } = new();
|
private SalesItemView SelectedItem { get; set; } = new();
|
||||||
|
@ -79,6 +80,8 @@ public partial class AdvisorActivityCreatePage : IDisposable
|
||||||
private bool OrgWarning { get; set; }
|
private bool OrgWarning { get; set; }
|
||||||
private CustomerInvoiceOverlay InvoiceOverlay { get; set; }
|
private CustomerInvoiceOverlay InvoiceOverlay { get; set; }
|
||||||
private InvoiceListView CompanyInvoices { get; set; } = new();
|
private InvoiceListView CompanyInvoices { get; set; } = new();
|
||||||
|
private CustomerInventoryOverlay InventoryOverlay { get; set; } = new();
|
||||||
|
private List<ProductInventoryView> Inventory { get; set; } = new();
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -156,6 +159,23 @@ public partial class AdvisorActivityCreatePage : IDisposable
|
||||||
Working = false;
|
Working = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task ShowInventoryOverlay()
|
||||||
|
{
|
||||||
|
Logger.LogDebug("ShowInventoryOverlay - wait for inventory");
|
||||||
|
|
||||||
|
InventoryOverlay.Show();
|
||||||
|
Inventory = await HistoryRepo.FetchInventory(CompanyId);
|
||||||
|
await Task.Delay(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnInventoryCallback(DraftItem item)
|
||||||
|
{
|
||||||
|
Activity.ActivityStatusEnum = "order";
|
||||||
|
DraftProvider.Draft.DraftType = "order";
|
||||||
|
DraftProvider.Draft.Items.Add(item);
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
private async Task ShowInvoiceOverlay()
|
private async Task ShowInvoiceOverlay()
|
||||||
{
|
{
|
||||||
Logger.LogDebug("ShowInvoiceOverlay - wait for invoices");
|
Logger.LogDebug("ShowInvoiceOverlay - wait for invoices");
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*@
|
*@
|
||||||
@using Wonky.Client.Components
|
@using Wonky.Client.Components
|
||||||
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
||||||
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen-lg-down modal-xl modal-lg">
|
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h2 class="modal-title">PRODUKT GENNEMGANG</h2>
|
<h2 class="modal-title">PRODUKT GENNEMGANG</h2>
|
||||||
|
|
|
@ -1,5 +1,20 @@
|
||||||
<h3>CustomerInventoryOverlay</h3>
|
@using Wonky.Client.Components
|
||||||
|
|
||||||
@code {
|
|
||||||
|
|
||||||
|
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
||||||
|
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-title">@CompanyName - Produktoversigt</h3>
|
||||||
|
<button type="button" class="btn-close" @onclick="Hide" data-bs-dismiss="modal" aria-label="Luk"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<CustomerInventoryListComponent OnReorderSelected="OnReorderCallback" CompanyId="@CompanyId" Inventory="@Inventory"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@if (_showBackdrop)
|
||||||
|
{
|
||||||
|
<div class="modal-backdrop fade show"></div>
|
||||||
}
|
}
|
||||||
|
<InventoryReorderModal CompanyId="@CompanyId" SalesItem="SalesItem" OnSelected="OnInventorySelected" @ref="ReorderModal" />
|
|
@ -1,6 +1,71 @@
|
||||||
namespace Wonky.Client.Overlays;
|
using System.Text.Json;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Wonky.Client.HttpInterceptors;
|
||||||
|
using Wonky.Client.HttpInterfaces;
|
||||||
|
using Wonky.Client.Models;
|
||||||
|
using Wonky.Client.Shared;
|
||||||
|
using Wonky.Entity.DTO;
|
||||||
|
using Wonky.Entity.Views;
|
||||||
|
|
||||||
public partial class CustomerInventoryOverlay
|
namespace Wonky.Client.Shared;
|
||||||
|
|
||||||
|
public partial class CustomerInventoryOverlay : IDisposable
|
||||||
{
|
{
|
||||||
|
[Inject] private HttpInterceptorService Interceptor { get; set; }
|
||||||
|
[Inject] private ICountryCatalogRepository Catalog { get; set; }
|
||||||
|
[Inject] private ILogger<CustomerInventoryOverlay> Logger { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public string CompanyName { get; set; } = "";
|
||||||
|
[Parameter] public string CompanyId { get; set; } = "";
|
||||||
|
[Parameter] public string CountryCode { get; set; } = "";
|
||||||
|
[Parameter] public List<ProductInventoryView> Inventory { get; set; } = new();
|
||||||
|
|
||||||
|
[Parameter] public EventCallback<DraftItem> OnInventorySelected { get; set; }
|
||||||
|
|
||||||
|
private string _modalDisplay = "";
|
||||||
|
private bool _showBackdrop;
|
||||||
|
private CompanyDto _company { get; set; } = new();
|
||||||
|
private List<ProductInventoryView> _inventory { get; set; } = new();
|
||||||
|
private DraftItem DraftItem { get; set; } = new();
|
||||||
|
private SalesItemView SalesItem { get; set; } = new();
|
||||||
|
private InventoryReorderModal ReorderModal { get; set; } = new();
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
Interceptor.RegisterEvent();
|
||||||
|
Interceptor.RegisterBeforeSendEvent();
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnReorderCallback(string sku)
|
||||||
|
{
|
||||||
|
SalesItem = await Catalog.GetSalesItemSku(CountryCode.ToLower(), sku);
|
||||||
|
ReorderModal.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnSelectedItem(DraftItem draftItem)
|
||||||
|
{
|
||||||
|
await OnInventorySelected.InvokeAsync(draftItem);
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Show()
|
||||||
|
{
|
||||||
|
_modalDisplay = "block;";
|
||||||
|
_showBackdrop = true;
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Hide()
|
||||||
|
{
|
||||||
|
_modalDisplay = "none;";
|
||||||
|
_showBackdrop = false;
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Interceptor.DisposeEvent();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
@using Wonky.Client.Components
|
@using Wonky.Client.Components
|
||||||
|
|
||||||
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
||||||
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen-lg-down modal-xl modal-lg">
|
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
|
||||||
|
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
@using Wonky.Client.Components
|
@using Wonky.Client.Components
|
||||||
@using Wonky.Client.Helpers
|
@using Wonky.Client.Helpers
|
||||||
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
||||||
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen-lg-down modal-xl modal-lg">
|
@* <div class="modal-dialog modal-dialog-scrollable modal-fullscreen-lg-down modal-xl modal-lg"> *@
|
||||||
|
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title">@SalesItem.Name @SalesItem.Sku (@SalesItem.BoxSize stk/colli)</h4>
|
<h4 class="modal-title">@SalesItem.Name @SalesItem.Sku (@SalesItem.BoxSize stk/colli)</h4>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
@using Wonky.Client.Components
|
@using Wonky.Client.Components
|
||||||
@using Wonky.Client.Helpers
|
@using Wonky.Client.Helpers
|
||||||
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
||||||
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen-lg-down modal-xl modal-lg">
|
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">Faktura</h5>
|
<h5 class="modal-title">Faktura</h5>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
@using Wonky.Client.Components
|
@using Wonky.Client.Components
|
||||||
@using Wonky.Client.Helpers
|
@using Wonky.Client.Helpers
|
||||||
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
||||||
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen-lg-down modal-xl modal-lg">
|
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">Pris Katalog</h5>
|
<h5 class="modal-title">Pris Katalog</h5>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
@using Wonky.Client.Components
|
@using Wonky.Client.Components
|
||||||
@using Wonky.Client.Helpers
|
@using Wonky.Client.Helpers
|
||||||
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
||||||
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen-lg-down modal-xl modal-lg">
|
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">@ProductName</h5>
|
<h5 class="modal-title">@ProductName</h5>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
@using Wonky.Client.Components
|
@using Wonky.Client.Components
|
||||||
@using Wonky.Client.Helpers
|
@using Wonky.Client.Helpers
|
||||||
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
||||||
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen-lg-down modal-xl modal-lg">
|
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">@ProductName</h5>
|
<h5 class="modal-title">@ProductName</h5>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
{
|
{
|
||||||
"appInfo": {
|
"appInfo": {
|
||||||
"name": "Wonky Online",
|
"name": "Wonky Online",
|
||||||
"version": "0.105.1",
|
"version": "0.106.3",
|
||||||
"rc": true,
|
"rc": true,
|
||||||
"sandBox": false,
|
"sandBox": false,
|
||||||
"image": "grumpy-coder.png"
|
"image": "grumpy-coder.png"
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Debug",
|
"Default": "Information",
|
||||||
"System": "Information",
|
"System": "Information",
|
||||||
"Microsoft": "Information"
|
"Microsoft": "Information"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue