WIP b2b
This commit is contained in:
parent
5a8b97618a
commit
71a7584575
10 changed files with 227 additions and 93 deletions
|
@ -15,12 +15,21 @@
|
|||
|
||||
|
||||
@using System.Security.Claims
|
||||
<AuthorizeView>
|
||||
<AuthorizeView Roles="Admin,Advisor,Management,Office,Supervisor,Warehouse">
|
||||
<Authorized>
|
||||
<div class="d-print-none">
|
||||
<a class="btn btn-outline-light" href="/logout" title="Log af" ><i class="bi-lock"></i> Lås</a>
|
||||
<a class="btn btn-outline-light" href="/logout" title="Log af"><i class="bi-lock"></i> Lås</a>
|
||||
<a class="btn btn-outline-light" href="/info" title="Information"><i class="bi-life-preserver"></i> Hjælp</a>
|
||||
<a class="btn btn-outline-light" href="/preferences" title="Indstillinger"><i class="bi-sliders"></i></a>
|
||||
<a class="btn btn-outline-light" href="/preferences" title="Indstillinger">
|
||||
<i class="bi-sliders"></i>
|
||||
</a>
|
||||
</div>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
<AuthorizeView Roles="EShop">
|
||||
<Authorized>
|
||||
<div class="d-print-none">
|
||||
<a class="btn btn-outline-light" href="/logout" title="Log af"><i class="bi-lock"></i> Lås</a>
|
||||
</div>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
62
Wonky.Client/OverlayB2B/B2BProductHistoryOverlay.razor
Normal file
62
Wonky.Client/OverlayB2B/B2BProductHistoryOverlay.razor
Normal file
|
@ -0,0 +1,62 @@
|
|||
@* Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||
*@
|
||||
|
||||
@using Wonky.Client.Components
|
||||
@using Wonky.Client.Helpers
|
||||
<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">
|
||||
<h5 class="modal-title">@ProductName</h5>
|
||||
<button type="button" class="btn btn-danger" @onclick="@Hide" data-bs-dismiss="modal" aria-label="Luk"><i class="bi-x-lg"></i></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@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>
|
||||
<td>@entry.DeliveryDate</td>
|
||||
<td>@entry.Quantity</td>
|
||||
<td>@entry.Discount</td>
|
||||
<td>@entry.Price</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h3>Ingen data</h3>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (_showBackdrop)
|
||||
{
|
||||
<div class="modal-backdrop fade show"></div>
|
||||
}
|
63
Wonky.Client/OverlayB2B/B2BProductHistoryOverlay.razor.cs
Normal file
63
Wonky.Client/OverlayB2B/B2BProductHistoryOverlay.razor.cs
Normal file
|
@ -0,0 +1,63 @@
|
|||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||
//
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Wonky.Client.HttpRepository;
|
||||
using Wonky.Entity.Views;
|
||||
|
||||
namespace Wonky.Client.OverlayB2B;
|
||||
#pragma warning disable CS8618
|
||||
|
||||
public partial class B2BProductHistoryOverlay
|
||||
{
|
||||
// ##############################################################
|
||||
[Inject] public IB2BRepository HistoryRepo { get; set; }
|
||||
|
||||
// ##############################################################
|
||||
[Parameter] public string CompanyId { get; set; } = "";
|
||||
[Parameter] public string ItemSku { get; set; } = "";
|
||||
|
||||
// ##############################################################
|
||||
private List<ProductHistoryView>? History { get; set; }
|
||||
private string ProductName { get; set; } = "";
|
||||
private string _modalDisplay = "";
|
||||
private bool _showBackdrop;
|
||||
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
History = await HistoryRepo.GetCustomerProductHistory(CompanyId, ItemSku);
|
||||
if (History.Any())
|
||||
{
|
||||
ProductName = History[0].Description;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Show()
|
||||
{
|
||||
_modalDisplay = "block;";
|
||||
_showBackdrop = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
private void Hide()
|
||||
{
|
||||
_modalDisplay = "none;";
|
||||
_showBackdrop = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
|
@ -18,51 +18,48 @@
|
|||
@attribute [Authorize(Roles = "EShop")]
|
||||
@page "/b2b/{countryCode}/{companyId}"
|
||||
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-6">
|
||||
@if (!string.IsNullOrWhiteSpace(_businessInfo.Name))
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>@_businessInfo.Name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@_businessInfo.Address1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@_businessInfo.Address2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@_businessInfo.ZipCode @_businessInfo.City</td>
|
||||
</tr>
|
||||
<tr><td>@_businessInfo.Phone</td></tr>
|
||||
<tr><td>@_businessInfo.Email</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
@_businessInfo.Name
|
||||
</h5>
|
||||
<p class="card-text">
|
||||
@_businessInfo.Address1<br/>
|
||||
@_businessInfo.Address2<br/>
|
||||
@_businessInfo.ZipCode @_businessInfo.City<br/>
|
||||
</p>
|
||||
<p class="card-text">
|
||||
<i class="bi-card-heading"></i> @_businessInfo.Account<br/>
|
||||
<i class="bi-phone"></i> @_businessInfo.Phone<br/>
|
||||
<i class="bi-at"></i> @_businessInfo.Email<br/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6">
|
||||
@if (!string.IsNullOrWhiteSpace(_advisorInfo.Name))
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Konsulent</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>@_advisorInfo.Name</td>
|
||||
<td>@_advisorInfo.Email</td>
|
||||
<td>@_advisorInfo.Phone</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
@_advisorInfo.Name
|
||||
</h5>
|
||||
<p class="card-text">
|
||||
<i class="bi-phone"></i> @_advisorInfo.Phone<br/>
|
||||
<i class="bi-at"></i> @_advisorInfo.Email<br/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@if (_productInventory.Any())
|
||||
{
|
||||
|
@ -83,14 +80,17 @@
|
|||
<td>@product.LastInvoiceDate</td>
|
||||
<td>@product.Description</td>
|
||||
<td>@product.Quantity</td>
|
||||
<td><button type="button" class="btn btn-primary">Genbestil</button></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-primary">Genbestil</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<B2BProductHistoryOverlay CompanyId="@CompanyId" Sku="" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<WorkingThreeDots />
|
||||
<WorkingThreeDots/>
|
||||
}
|
||||
</div>
|
|
@ -1,7 +1,10 @@
|
|||
using System.Globalization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Wonky.Client.HttpInterceptors;
|
||||
using Wonky.Client.HttpRepository;
|
||||
using Wonky.Client.OverlayB2B;
|
||||
using Wonky.Client.Shared;
|
||||
using Wonky.Entity.Configuration;
|
||||
using Wonky.Entity.DTO;
|
||||
using Wonky.Entity.Views;
|
||||
|
@ -18,6 +21,8 @@ public partial class BusinessCustomerLandingPage : IDisposable
|
|||
[Inject] private IOptions<ApiConfig> Config { get; set; }
|
||||
|
||||
// ##############################################################
|
||||
[CascadingParameter] private DraftStateProvider DraftProvider { get; set; } = new();
|
||||
|
||||
[Parameter] public string CountryCode { get; set; } = "";
|
||||
[Parameter] public string CompanyId { get; set; } = "";
|
||||
|
||||
|
@ -27,6 +32,9 @@ public partial class BusinessCustomerLandingPage : IDisposable
|
|||
private List<ProductHistoryView> _productHistory = new();
|
||||
private List<ProductInventoryItemView> _productInventory = new();
|
||||
private ApiConfig _config = new();
|
||||
private B2BProductHistoryOverlay PriceOverlay { get; set; }
|
||||
private string Price { get; set; } = "0";
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
@ -45,6 +53,39 @@ public partial class BusinessCustomerLandingPage : IDisposable
|
|||
}
|
||||
|
||||
|
||||
private void ShowPriceHistoryOverlay()
|
||||
{
|
||||
PriceOverlay.Show();
|
||||
}
|
||||
|
||||
|
||||
// private async Task PriceCatalogOverlayCallback(ItemSelect selectedItem)
|
||||
// {
|
||||
// // get selected item
|
||||
// if (string.IsNullOrWhiteSpace(selectedItem.ItemNo))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// _selectedItem = await CatalogRepo.GetSalesItemSku(_company.CountryCode, selectedItem.ItemNo);
|
||||
// ShowItem = true;
|
||||
// Price = selectedItem.Rate;
|
||||
// Quantity = selectedItem.Quantity;
|
||||
// StateHasChanged();
|
||||
// }
|
||||
|
||||
|
||||
private void PriceHistoryOverlayCallback(decimal price)
|
||||
{
|
||||
if (price == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Price = price.ToString("N2", CultureInfo.InvariantCulture);
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Interceptor.DisposeEvent();
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||
//
|
||||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
#pragma warning disable CS8618
|
||||
|
||||
public partial class BusinessCustomerWebShopPage
|
||||
{
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
@* Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||
*@
|
||||
|
||||
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@attribute [Authorize(Roles = "EShop")]
|
||||
@page "/b2b/{countryCode}/{companyId}/webshop"
|
||||
<h3>BusinessCustomerWebshopPage</h3>
|
|
@ -34,7 +34,7 @@
|
|||
<div class="content d-none d-print-block">
|
||||
@Body
|
||||
</div>
|
||||
<BlazoredToasts Position="ToastPosition.BottomRight" Timeout="5" MaxToastCount="3" ShowProgressBar="true" />
|
||||
<BlazoredToasts Position="ToastPosition.TopRight" Timeout="5" MaxToastCount="5" ShowProgressBar="true" />
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -3800,4 +3800,5 @@
|
|||
<None Remove="wwwroot\icons\**" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -2,6 +2,7 @@ namespace Wonky.Entity.DTO;
|
|||
|
||||
public class B2BBusinessInfo
|
||||
{
|
||||
public string Account { get; set; } = "";
|
||||
public string Address1 { get; set; } = "";
|
||||
public string Address2 { get; set; } = "";
|
||||
public string City { get; set; } = "";
|
||||
|
|
Loading…
Reference in a new issue