renamed files

This commit is contained in:
Frede Hundewadt 2023-09-29 08:07:29 +02:00
parent 71aeb5f0ad
commit 72d44d1dd4
2 changed files with 25 additions and 20 deletions

View file

@ -13,10 +13,8 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // 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" tabindex="-1" role="dialog" style="display:@_modalDisplay">
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen"> <div class="modal-dialog modal-dialog-scrollable modal-lg">
<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>
@ -32,18 +30,21 @@
<th scope="col">Antal</th> <th scope="col">Antal</th>
<th scope="col">Rabat</th> <th scope="col">Rabat</th>
<th scope="col">Pris</th> <th scope="col">Pris</th>
@* <th scope="col"></th> *@ <th scope="col"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var entry in History) @if (ProductHistory.Any())
{ {
<tr> @foreach (var entry in ProductHistory)
<td>@entry.DeliveryDate</td> {
<td>@entry.Quantity</td> <tr>
<td>@entry.Discount</td> <td>@entry.DeliveryDate</td>
<td>@entry.Price</td> <td>@entry.Quantity</td>
</tr> <td>@entry.Discount</td>
<td>@entry.Price</td>
</tr>
}
} }
</tbody> </tbody>
</table> </table>

View file

@ -13,35 +13,39 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Wonky.Client.HttpRepository; using Wonky.Client.HttpRepository;
using Wonky.Entity.Views; using Wonky.Entity.Views;
namespace Wonky.Client.OverlayB2B;
#pragma warning disable CS8618 #pragma warning disable CS8618
public partial class B2BProductHistoryOverlay namespace Wonky.Client.OverlayB2B;
public partial class B2BProductPriceHistoryOverlay
{ {
// ############################################################## // ##############################################################
[Inject] public IB2BRepository HistoryRepo { get; set; } [Inject] public IB2BRepository HistoryRepo { get; set; }
// ############################################################## // ##############################################################
[Parameter] public string CompanyId { get; set; } = ""; [Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string ItemSku { get; set; } = ""; [Parameter] public string Sku { get; set; } = "";
// ############################################################## // ##############################################################
private List<ProductHistoryView>? History { get; set; } private List<ProductHistoryView>? ProductHistory { get; set; }
private string ProductName { get; set; } = ""; private string ProductName { get; set; } = "";
private string _modalDisplay = ""; private string _modalDisplay = "";
private bool _showBackdrop; private bool _showBackdrop;
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
History = await HistoryRepo.GetCustomerProductHistory(CompanyId, ItemSku); if (string.IsNullOrWhiteSpace(Sku))
if (History.Any()) return;
ProductHistory = await HistoryRepo.GetCustomerProductHistory(CompanyId, Sku);
if (ProductHistory.Any())
{ {
ProductName = History[0].Description; ProductName = ProductHistory[0].Description;
} }
} }
@ -60,4 +64,4 @@ public partial class B2BProductHistoryOverlay
_showBackdrop = false; _showBackdrop = false;
StateHasChanged(); StateHasChanged();
} }
} }