Add project files.

This commit is contained in:
pkus
2025-01-24 13:37:01 +01:00
parent ee70a3c8af
commit ed726eea09
94 changed files with 4591 additions and 0 deletions

View File

@@ -0,0 +1,269 @@
@page "/edicustomerorder/{CustomerOrderId}"
@inject EdiCustomerOrderService EdiCustomerOrderService
@using SytelineSaAppEfDataModel.Dtos
@inherits LayoutComponentBase
<div class="row">
<h3>Zamówienie Klienta EDI</h3>
</div>
<div class="row">
<div class="col">
<SortableList TItem="EdiCustomerOrderDto" Data="_ediCustomerOrder">
<ItemTemplate>
<u>Numer zamówienia EDI:</u>&emsp;<b>@context.CustomerOrderNumber</b><br />
<u>Numer zamówienia Klienta:</u>&emsp;<b>@context.CustomerPoNumber</b><br />
<u>Numer klienta:</u>&emsp;<b>@context.CustomerNumber</b><br />
<u>Klient:</u>&emsp;<b>@context.CustomerName</b><br />
<u>Numer odbiorcy:</u>&emsp;<b>@(context.CustomerSequence?.ToString() ?? "N/A")</b><br />
<u>Data otrzymania:</u>&emsp;<b>@(context.RecivedDate?.ToString("dd.MM.yyyy HH:mm:ss") ?? "N/A")</b><br />
<u>Wysłano do Syteline?:</u>&emsp;<b>@((context.Posted?.ToString() ?? "0") == "0" ? "NIE" : "TAK")</b><br />
<u>Data wysyłki do Syteline:</u>&emsp;<b>@(context.PostedDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "N/A")</b><br />
<u>Data zamówienia:</u>&emsp;<b>@(context.OrderDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "N/A")</b><br />
</ItemTemplate>
</SortableList>
</div>
<div class="col">
<SortableList TItem="EdiCustomerOrderDto" Data="_ediCustomerOrder" Class="bg-light">
<ItemTemplate>
<u>Cena:</u>&emsp;<b>@(context.Price?.ToString("F2") ?? "N/A")</b><br />
<u>Waga:</u>&emsp;<b>@(context.Weight?.ToString("F2") ?? "N/A")</b><br />
<u>Magazyn:</u>&emsp;<b>@context.Warehouse</b><br />
<u>Gate:</u>&emsp;<b>@context.Gate</b><br />
<u>Kod odbiorcy:</u>&emsp;<b>@context.RecipientCode</b><br />
<u>Kod wysyłającego:</u>&emsp;<b>@context.SenderCode</b><br />
<u>Kod sprzedawcy:</u>&emsp;<b>@context.SellerCode</b><br />
<u>Kod kupującego:</u>&emsp;<b>@context.BuyerCode</b><br />
<u>Typ dokumentu:</u>&emsp;<b>@context.DocType</b><br />
</ItemTemplate>
</SortableList>
</div>
</div>
<br/>
<SortableList TItem="EdiCustomerOrderTranslateDto" Data="_ediCustomerOrderTranslate">
<ItemTemplate>
<u>Id:</u>&emsp;<b>@context.Id</b><br />
<u>CoEdiOrder:</u>&emsp;<b>@context.CoEdiOrder</b><br />
<u>CoRowPointer:</u>&emsp;<b>@context.CoRowPointer</b><br />
<u>CoCoNum:</u>&emsp;<b>@context.CoCoNum</b><br />
<u>CoType:</u>&emsp;<b>@context.CoType</b><br />
<u>CoTakenBy:</u>&emsp;<b>@context.CoTakenBy</b><br />
<u>EdiCoCoNum:</u>&emsp;<b>@context.EdiCoCoNum</b><br />
<u>OrdersCount:</u>&emsp;<b>@context.OrdersCount</b><br />
<u>OrderFound:</u>&emsp;<b>@context.OrderFound</b><br />
<u>CreatedDate:</u>&emsp;<b>@context.CreatedDate.ToString("yyyy-MM-dd HH:mm:ss")</b><br />
<u>FoundNumbers:</u>&emsp;<b>@context.FoundNumbers</b><br />
<u>ScheduleOrderId:</u>&emsp;<b>@context.ScheduleOrderId</b><br />
</ItemTemplate>
</SortableList>
<br />
<div class="row">
<h3>Indeksy</h3>
</div>
<div class="row">
<Grid @ref="_ediCustomerOrderLinesGrid"
TItem="EdiCustomerOrderLineDto"
Class="table table-hover table-bordered table-striped"
Data="_ediCustomerOrderLines"
AllowFiltering="true"
Responsive="true"
AllowPaging="true"
PageSize="20"
AllowSelection="true"
AllowRowClick="true"
SelectionMode="GridSelectionMode.Single"
SelectedItemsChanged="SelectedEdiCustomerOrderLineChanged">
<GridColumns>
<GridColumn TItem="EdiCustomerOrderLineDto" HeaderText="CoLine" PropertyName="CoLine">
@context.CustomerOrderLine
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineDto" HeaderText="SalesChannelProductCode" PropertyName="SalesChannelProductCode">
@context.Item
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineDto" HeaderText="ShipperProductCode" PropertyName="ShipperProductCode">
@context.CustomerItemNumber
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineDto" HeaderText="Qty" TextAlignment="Alignment.End" PropertyName="Qty">
@context.BlanketQty
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineDto" HeaderText="Address" PropertyName="Address">
@context.Address
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineDto" HeaderText="BoxType" PropertyName="BoxType">
@context.BoxType
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineDto" HeaderText="FinalDestination" PropertyName="FinalDestination">
@context.FinalDestination
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineDto" HeaderText="QtyPerBox" PropertyName="QtyPerBox">
@context.QtyPerBox
</GridColumn>
</GridColumns>
</Grid>
</div>
@if (_isVisibleEdiCustomerOrderLine)
{
<div class="row">
<h3>Szczegóły</h3>
</div>
<div class="row">
<div class="col">
<SortableList TItem="EdiCustomerOrderLineDto" Data="_selectedEdiCustomerOrderLine">
<ItemTemplate>
<u>CustomerOrderNumber:</u>&emsp;<b>@context.CustomerOrderNumber</b><br />
<u>CustomerOrderLine:</u>&emsp;<b>@context.CustomerOrderLine</b><br />
<u>Item:</u>&emsp;<b>@context.Item</b><br />
<u>CustomerItemNumber:</u>&emsp;<b>@context.CustomerItemNumber</b><br />
<u>BlanketQty:</u>&emsp;<b>@(context.BlanketQty?.ToString("F2") ?? "N/A")</b><br />
<u>EffectiveDate:</u>&emsp;<b>@(context.EffectiveDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "N/A")</b><br />
<u>ExpirationDate:</u>&emsp;<b>@(context.ExpirationDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "N/A")</b><br />
<u>ContPrice:</u>&emsp;<b>@(context.ContPrice?.ToString("F2") ?? "N/A")</b><br />
<u>Status:</u>&emsp;<b>@context.Status</b><br />
<u>Uom:</u>&emsp;<b>@context.Uom</b><br />
</ItemTemplate>
</SortableList>
</div>
<div class="col">
<SortableList TItem="EdiCustomerOrderLineDto" Data="_selectedEdiCustomerOrderLine">
<ItemTemplate>
<u>BlanketQtyReleased:</u>&emsp;<b>@(context.BlanketQtyReleased?.ToString("F2") ?? "N/A")</b><br />
<u>ContPriceReleased:</u>&emsp;<b>@(context.ContPriceReleased?.ToString("F2") ?? "N/A")</b><br />
<u>QtySent:</u>&emsp;<b>@(context.QtySent?.ToString("F2") ?? "N/A")</b><br />
<u>RecordDate:</u>&emsp;<b>@context.RecordDate.ToString("yyyy-MM-dd HH:mm:ss")</b><br />
<u>Description:</u>&emsp;<b>@context.Description</b><br />
<u>CreateDate:</u>&emsp;<b>@context.CreateDate.ToString("yyyy-MM-dd HH:mm:ss")</b><br />
<u>BoxType:</u>&emsp;<b>@context.BoxType</b><br />
<u>Address:</u>&emsp;<b>@context.Address</b><br />
<u>FinalDestination:</u>&emsp;<b>@context.FinalDestination</b><br />
<u>QtyPerBox:</u>&emsp;<b>@(context.QtyPerBox?.ToString() ?? "N/A")</b>
</ItemTemplate>
</SortableList>
</div>
</div>
<br />
<h3>Harmonogramy</h3>
<div class="row">
<Grid @ref="_ediCustomerOrderLineItemsGrid"
TItem="EdiCustomerOrderLineItemDto"
Class="table table-hover table-bordered table-striped"
Data="_ediCustomerOrderLineItems"
AllowFiltering="true"
Responsive="true"
AllowPaging="true"
PageSize="20"
AllowSelection="true"
AllowRowClick="true"
SelectionMode="GridSelectionMode.Single"
SelectedItemsChanged="SelectedEdiCustomerOrderLineItemChanged">
<GridColumns>
<GridColumn TItem="EdiCustomerOrderLineItemDto" HeaderText="Id" PropertyName="Id">
@context.CustomerOrderRelease
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineItemDto" HeaderText="Quantity Ordered" TextAlignment="Alignment.End" PropertyName="Quantity Ordered">
@context.QtyOrdered
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineItemDto" HeaderText="Due Date" PropertyName="Due Date">
@context.DueDate?.ToString("yyyy-MM-dd")
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineItemDto" HeaderText="RoutingCode" PropertyName="RoutingCode">
@context.RoutingCode
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineItemDto" HeaderText="PalletCode" PropertyName="PalletCode">
@context.PalletCode
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineItemDto" HeaderText="UnloadingPoint" PropertyName="UnloadingPoint">
@context.UnloadingPoint
</GridColumn>
<GridColumn TItem="EdiCustomerOrderLineItemDto" HeaderText="DestinationPoint" PropertyName="DestinationPoint">
@context.DestinationPoint
</GridColumn>
</GridColumns>
</Grid>
</div>
}@if (_isVisibleEdiCustomerOrderLineItem)
{
<div class="row">
<h3>Szczegóły</h3>
</div>
<div class="row">
<div class="col">
<SortableList TItem="EdiCustomerOrderLineItemDto" Data="_selectedEdiCustomerOrderLineItem">
<ItemTemplate>
<u>ReceivedDate:</u>&emsp;<b>@(context.ReceivedDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "N/A")</b><br />
<u>CustomerOrderNumber:</u>&emsp;<b>@context.CustomerOrderNumber</b><br />
<u>CustomerOrderLine:</u>&emsp;<b>@context.CustomerOrderLine</b><br />
<u>CustomerOrderRelease:</u>&emsp;<b>@context.CustomerOrderRelease</b><br />
<u>Item:</u>&emsp;<b>@context.Item</b><br />
<u>CustomerItem:</u>&emsp;<b>@context.CustomerItem</b><br />
<u>QtyOrdered:</u>&emsp;<b>@(context.QtyOrdered?.ToString("F2") ?? "N/A")</b><br />
<u>QtyReady:</u>&emsp;<b>@(context.QtyReady?.ToString("F2") ?? "N/A")</b><br />
<u>Cost:</u>&emsp;<b>@(context.Cost?.ToString("F2") ?? "N/A")</b><br />
<u>Price:</u>&emsp;<b>@(context.Price?.ToString("F2") ?? "N/A")</b><br />
<u>DueDate:</u>&emsp;<b>@(context.DueDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "N/A")</b><br />
<u>ReleaseDate:</u>&emsp;<b>@(context.ReleaseDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "N/A")</b><br />
<u>Warehouse:</u>&emsp;<b>@context.Warehouse</b><br />
</ItemTemplate>
</SortableList>
</div>
<div class="col">
<SortableList TItem="EdiCustomerOrderLineItemDto" Data="_selectedEdiCustomerOrderLineItem">
<ItemTemplate>
<u>TaxCodeOne:</u>&emsp;<b>@context.TaxCodeOne</b><br />
<u>Uom:</u>&emsp;<b>@context.Uom</b><br />
<u>QtyOrderedReleased:</u>&emsp;<b>@(context.QtyOrderedReleased?.ToString("F2") ?? "N/A")</b><br />
<u>PriceReleased:</u>&emsp;<b>@(context.PriceReleased?.ToString("F2") ?? "N/A")</b><br />
<u>CustomerOrderCustomerNumber:</u>&emsp;<b>@context.CustomerOrderCustomerNumber</b><br />
<u>Description:</u>&emsp;<b>@context.Description</b><br />
<u>CreateDate:</u>&emsp;<b>@context.CreateDate.ToString("yyyy-MM-dd HH:mm:ss")</b><br />
<u>RoutingCode:</u>&emsp;<b>@context.RoutingCode</b><br />
<u>DeliveryCallNumber:</u>&emsp;<b>@context.DeliveryCallNumber</b><br />
<u>UnloadingPoint:</u>&emsp;<b>@context.UnloadingPoint</b><br />
<u>DestinationPoint:</u>&emsp;<b>@context.DestinationPoint</b><br />
<u>PalletCode:</u>&emsp;<b>@context.PalletCode</b><br />
<u>PalletNumber:</u>&emsp;<b>@context.PalletNumber</b>
</ItemTemplate>
</SortableList>
</div>
</div>
}
@code {
[Parameter]
public string CustomerOrderId { get; set; } = string.Empty;
List<EdiCustomerOrderDto?>? _ediCustomerOrder;
List<EdiCustomerOrderTranslateDto?> _ediCustomerOrderTranslate = new();
List<EdiCustomerOrderLineDto> _ediCustomerOrderLines = new();
List<EdiCustomerOrderLineItemDto> _ediCustomerOrderLineItems = new();
List<EdiCustomerOrderLineDto?> _selectedEdiCustomerOrderLine = new();
List<EdiCustomerOrderLineItemDto?> _selectedEdiCustomerOrderLineItem = new();
Grid<EdiCustomerOrderLineDto>? _ediCustomerOrderLinesGrid;
Grid<EdiCustomerOrderLineItemDto>? _ediCustomerOrderLineItemsGrid;
private bool _isVisibleEdiCustomerOrderLine;
private bool _isVisibleEdiCustomerOrderLineItem;
protected override async Task OnInitializedAsync()
{
EdiCustomerOrderDto? ediCustomerOrder = await EdiCustomerOrderService.GetEdiCustomerOrderAsync(CustomerOrderId);
_ediCustomerOrder = new List<EdiCustomerOrderDto?> { ediCustomerOrder };
_ediCustomerOrderLines = ediCustomerOrder?.EdiCustomerOrderLines.ToList() ?? new List<EdiCustomerOrderLineDto>();
_ediCustomerOrderTranslate = new List<EdiCustomerOrderTranslateDto?> { ediCustomerOrder?.EdiCustomerOrderTranslates.MaxBy(x => x.CreatedDate) };
}
private void SelectedEdiCustomerOrderLineChanged(HashSet<EdiCustomerOrderLineDto> obj)
{
_isVisibleEdiCustomerOrderLine = obj.Any();
_selectedEdiCustomerOrderLine = new List<EdiCustomerOrderLineDto?> { obj.FirstOrDefault() };
_ediCustomerOrderLineItems = obj.FirstOrDefault()?.EdiCustomerOrderLineItems.ToList() ?? new List<EdiCustomerOrderLineItemDto>();
}
private void SelectedEdiCustomerOrderLineItemChanged(HashSet<EdiCustomerOrderLineItemDto> obj)
{
_isVisibleEdiCustomerOrderLineItem = obj.Any();
_selectedEdiCustomerOrderLineItem = new List<EdiCustomerOrderLineItemDto?> { obj.FirstOrDefault() };
}
}

View File

@@ -0,0 +1,161 @@
@page "/edicustomerorders"
@inject EdiCustomerOrderService EdiCustomerOrderService
@inject NavigationManager NavigationManager
@using SytelineSaAppEfDataModel.Dtos
@using FaKrosnoApi.Dtos
@using OrdersManagement.Dtos
@inherits LayoutComponentBase
<div class="row">
<h3>EdiCustomerOrders</h3>
</div>
<br />
<div class="row">
<div class="col-md-12">
<Switch ValueExpression="() => _filter" ValueChanged="FilterChanged" Label="Pokaż tylko niezaksięgowane" />
</div>
</div>
<br />
@if (_isVisible)
{
<div class="row">
<div class="col-md-12">
<Button Color="ButtonColor.Primary" @onclick="SendOrderToSyteLine">Księguj bieżący</Button>
</div>
</div>
}
<br />
<div class="row">
<Grid @ref="_grid"
TItem="EdiCustomerOrderDto"
Class="table table-hover table-bordered table-striped"
DataProvider="EdiCustomerOrdersDataProvider"
AllowFiltering="true"
Responsive="true"
AllowPaging="true"
PageSize="20"
AllowSelection="true"
AllowRowClick="true"
OnRowDoubleClick="OnRowDoubleClick"
SelectedItemsChanged="SelectedItemsChanged">
<GridColumns>
<GridColumn TItem="EdiCustomerOrderDto" HeaderText="CO Number" PropertyName="CoNumber">
@context.CustomerOrderNumber
</GridColumn>
<GridColumn TItem="EdiCustomerOrderDto" HeaderText="Customer Number" PropertyName="CustNum">
@context.CustomerNumber
</GridColumn>
<GridColumn TItem="EdiCustomerOrderDto" HeaderText="Recipient" PropertyName="Recipient">
@context.CustomerSequence
</GridColumn>
<GridColumn TItem="EdiCustomerOrderDto" HeaderText="Last Update Date" PropertyName="LastUpdateDate">
@context.CreateDate
</GridColumn>
<GridColumn TItem="EdiCustomerOrderDto" HeaderText="Gate" PropertyName="Gate">
@context.Gate
</GridColumn>
<GridColumn TItem="EdiCustomerOrderDto" HeaderText="RecipientCode" PropertyName="RecipientCode">
@context.RecipientCode
</GridColumn>
<GridColumn TItem="EdiCustomerOrderDto" HeaderText="SellerCode" PropertyName="SellerCode">
@context.SellerCode
</GridColumn>
<GridColumn TItem="EdiCustomerOrderDto" HeaderText="SenderCode" PropertyName="SenderCode">
@context.SenderCode
</GridColumn>
<GridColumn TItem="EdiCustomerOrderDto" HeaderText="BuyerCode" PropertyName="BuyerCode">
@context.BuyerCode
</GridColumn>
</GridColumns>
</Grid>
</div>
<Modal @ref="_modal" Title="@_modalDto.Title">
<BodyTemplate>
@_modalDto.Body
</BodyTemplate>
<FooterTemplate>
<Button Color="ButtonColor.Primary" @onclick="OnHideModalClick">OK</Button>
</FooterTemplate>
</Modal>
@code {
Grid<EdiCustomerOrderDto>? _grid;
private IEnumerable<EdiCustomerOrderDto>? _ediCustomerOrders;
private EdiCustomerOrderDto? _selectedEdiCustomerOrder;
private Modal _modal = default!;
private ModalDto _modalDto = new(null, null);
private bool _isVisible;
private bool _filter;
// protected override async Task OnInitializedAsync()
// {
// _ediCustomerOrders = await EdiCustomerOrderService.GetEdiCustomerOrdersAsync() ?? new List<EdiCustomerOrderDto>();
// _ediCustomerOrders = _ediCustomerOrders.OrderByDescending(x => x.CreateDate).ToList();
// }
private async Task<GridDataProviderResult<EdiCustomerOrderDto>> EdiCustomerOrdersDataProvider(GridDataProviderRequest<EdiCustomerOrderDto> request)
{
_ediCustomerOrders = await EdiCustomerOrderService.GetEdiCustomerOrdersAsync() ?? new List<EdiCustomerOrderDto>();
_ediCustomerOrders = _ediCustomerOrders.OrderByDescending(x => x.CreateDate).ToList();
if (_filter)
{
_ediCustomerOrders = _ediCustomerOrders.Where(x => x.Posted == 0).ToList();
}
StateHasChanged();
return await Task.FromResult(request.ApplyTo(_ediCustomerOrders));
}
private void OnRowDoubleClick(GridRowEventArgs<EdiCustomerOrderDto> obj)
{
string customerOrderId = obj.Item.CustomerOrderNumber;
NavigationManager.NavigateTo($"/edicustomerorder/{customerOrderId}");
}
private async void SendOrderToSyteLine()
{
if (_selectedEdiCustomerOrder == null) return;
ResponseDto response = await EdiCustomerOrderService.SendOrderToSyteline(_selectedEdiCustomerOrder.CustomerOrderNumber);
if (response.Status == 1)
{
_modalDto = new ModalDto("Wysłano", $"Zamówienie EDI {_selectedEdiCustomerOrder.CustomerOrderNumber} zostało poprawnie zaksięgowane w Zamówieniach klienta pod numerem '{_selectedEdiCustomerOrder.EdiCustomerOrderTranslates.FirstOrDefault()?.CoCoNum}'");
await _modal.ShowAsync();
_grid?.RefreshDataAsync();
}
else
{
_modalDto = new ModalDto("Błąd", $"Zamówienie EDI {_selectedEdiCustomerOrder.CustomerOrderNumber} nie zostało poprawnie zaksięgowane w Zamówieniach klienta.{Environment.NewLine}Lista błędów:{Environment.NewLine}{response.Message}");
await _modal.ShowAsync();
}
}
private void SelectedItemsChanged(HashSet<EdiCustomerOrderDto> obj)
{
_selectedEdiCustomerOrder = obj.FirstOrDefault() ?? null;
_isVisible = _selectedEdiCustomerOrder?.Posted == 0;
}
private async Task OnHideModalClick()
{
await _modal.HideAsync();
}
private void FilterChanged(bool obj)
{
_filter = obj;
_grid?.RefreshDataAsync();
}
}

View File

@@ -0,0 +1,36 @@
@page "/Error"
@using System.Diagnostics
<PageTitle>Error</PageTitle>
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
@code{
[CascadingParameter]
private HttpContext? HttpContext { get; set; }
private string? RequestId { get; set; }
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
protected override void OnInitialized() =>
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
}

View File

@@ -0,0 +1,135 @@
@page "/details/{ScheduleOrderId:int}"
@inject ScheduleOrderDetailsService ScheduleOrderDetailsService
<div class="container-fluid">
<div class="row">
<div class="col-md-4 bg-light" style="min-height: 150vh;">
<h2 style="margin: 5px">Indeksy:</h2>
<Grid @ref="_grid"
TItem="ScheduleOrderDetailDto"
Class="table table-hover table-bordered table-striped"
DataProvider="ScheduleOrderDetailsDataProvider"
AllowFiltering="true"
Responsive="true"
AllowPaging="true"
PageSize="20"
AllowSelection="true"
AllowRowClick="true"
SelectionMode="GridSelectionMode.Single"
SelectedItemsChanged="SelectedItemChanged">
<GridColumns>
<GridColumn TItem="ScheduleOrderDetailDto" HeaderText="Id" PropertyName="Id">
@context.ID
</GridColumn>
<GridColumn TItem="ScheduleOrderDetailDto" HeaderText="SalesChannelProductCode" PropertyName="SalesChannelProductCode">
@context.Sc_productCode
</GridColumn>
<GridColumn TItem="ScheduleOrderDetailDto" HeaderText="ShipperProductCode" PropertyName="ShipperProductCode">
@context.Sh_productCode
</GridColumn>
<GridColumn TItem="ScheduleOrderDetailDto" HeaderText="Price" PropertyName="Price">
@context.Price
</GridColumn>
</GridColumns>
</Grid>
@if (_isVisible)
{
<div id="rightTopContainer" class="col-12 bg-light" style="height: auto;">
<h2 style="margin: 5px">Dodatkowe informacje:</h2>
<SortableList TItem="ScheduleOrderDetailMiscDto" Data="_scheduleOrderDetailMiscs">
<ItemTemplate>
<u>@context.Label:</u>&emsp;<b>@context.Value</b>
</ItemTemplate>
</SortableList>
</div>
}
</div>
<div class="col-md-8">
<div class="row">
@if (_isVisible)
{
<div id="rightBottomContainer" class="col-12 bg-light">
<h2 style="margin: 5px">Harmonogramy:</h2>
<Grid @ref="_detailDetailsGrid"
TItem="ScheduleOrderDetailDetailDto"
Data="_scheduleOrderDetailsDetails"
Class="table table-hover table-bordered table-striped"
AllowFiltering="true"
Responsive="true"
AllowPaging="true"
PageSize="20"
AllowSelection="true"
SelectionMode="GridSelectionMode.Single"
SelectedItemsChanged="SelectedDetailDetailChanged">
<GridColumns>
<GridColumn TItem="ScheduleOrderDetailDetailDto" HeaderText="Id" PropertyName="Id">
@context.ID
</GridColumn>
<GridColumn TItem="ScheduleOrderDetailDetailDto" HeaderText="DateFrom" PropertyName="DateFrom">
@context.DateFrom
</GridColumn>
<GridColumn TItem="ScheduleOrderDetailDetailDto" HeaderText="DateTo" PropertyName="DateTo">
@context.DateTo
</GridColumn>
<GridColumn TItem="ScheduleOrderDetailDetailDto" HeaderText="Qty" PropertyName="Qty">
@context.Qty
</GridColumn>
</GridColumns>
</Grid>
</div>
@if (_isVisibleDetailDetail)
{
<div id="rightTopContainer" class="col-12 bg-light" style="height: auto;">
<h2 style="margin: 5px">Dodatkowe informacje:</h2>
<SortableList TItem="ScheduleOrderDetailDetailMiscDto" Data="_scheduleOrderDetailDetailMiscs">
<ItemTemplate>
<u>@context.Label:</u>&emsp;<b>@context.Value</b>
</ItemTemplate>
</SortableList>
</div>
}
}
</div>
</div>
</div>
</div>
@code {
[Parameter]
public int ScheduleOrderId { get; set; }
private bool _isVisible;
private bool _isVisibleDetailDetail;
Grid<ScheduleOrderDetailDto>? _grid;
Grid<ScheduleOrderDetailDetailDto>? _detailDetailsGrid;
private IEnumerable<ScheduleOrderDetailDto>? _scheduleOrderDetails;
private IEnumerable<ScheduleOrderDetailDetailDto>? _scheduleOrderDetailsDetails;
private List<ScheduleOrderDetailMiscDto>? _scheduleOrderDetailMiscs;
private List<ScheduleOrderDetailDetailMiscDto>? _scheduleOrderDetailDetailMiscs;
private async Task<GridDataProviderResult<ScheduleOrderDetailDto>> ScheduleOrderDetailsDataProvider(GridDataProviderRequest<ScheduleOrderDetailDto> request)
{
_scheduleOrderDetails = await ScheduleOrderDetailsService.GetScheduleOrderDetails(ScheduleOrderId) ?? new List<ScheduleOrderDetailDto>();
StateHasChanged();
return await Task.FromResult(request.ApplyTo(_scheduleOrderDetails));
}
private void SelectedItemChanged(HashSet<ScheduleOrderDetailDto> obj)
{
_isVisible = obj.Any();
_scheduleOrderDetailMiscs = obj.FirstOrDefault()?.ScheduleOrderDetailMiscs.ToList();
_scheduleOrderDetailsDetails = obj.FirstOrDefault()?.ScheduleOrderDetailDetails.ToList();
}
private void SelectedDetailDetailChanged(HashSet<ScheduleOrderDetailDetailDto> obj)
{
_isVisibleDetailDetail = obj.Any();
_scheduleOrderDetailDetailMiscs = obj.FirstOrDefault()?.ScheduleOrderDetailDetailMiscs.ToList();
}
}

View File

@@ -0,0 +1,62 @@
@page "/"
@inject ScheduleOrderService ScheduleOrderService
@inject NavigationManager NavigationManager
@inherits LayoutComponentBase
<h3>ScheduleOrders</h3>
<Grid @ref="_grid"
TItem="ScheduleOrderDto"
Class="table table-hover table-bordered table-striped"
DataProvider="ScheduleOrdersDataProvider"
AllowFiltering="true"
Responsive="true"
AllowPaging="true"
PageSize="20"
AllowSelection="true"
AllowRowClick="true"
OnRowDoubleClick="OnRowDoubleClick">
<GridColumns>
<GridColumn TItem="ScheduleOrderDto" HeaderText="Id" PropertyName="Id">
@context.ID
</GridColumn>
<GridColumn TItem="ScheduleOrderDto" HeaderText="OrderID" PropertyName="OrderID">
@context.OrderID
</GridColumn>
<GridColumn TItem="ScheduleOrderDto" HeaderText="PO Number" PropertyName="PONum">
@context.PONum
</GridColumn>
<GridColumn TItem="ScheduleOrderDto" HeaderText="Recipient" PropertyName="Recipient">
@context.Recipient.RecipientCode
</GridColumn>
<GridColumn TItem="ScheduleOrderDto" HeaderText="Purchaser" Filterable="true" PropertyName="Purchaser">
@context.Recipient.Purchaser.PurchaserCode
</GridColumn>
<GridColumn TItem="ScheduleOrderDto" HeaderText="Last Update Date" PropertyName="LastUpdateDate">
@context.LastUpdateDate
</GridColumn>
</GridColumns>
</Grid>
@code {
Grid<ScheduleOrderDto>? _grid;
private IEnumerable<ScheduleOrderDto>? _scheduleOrders;
private async Task<GridDataProviderResult<ScheduleOrderDto>> ScheduleOrdersDataProvider(GridDataProviderRequest<ScheduleOrderDto> request)
{
_scheduleOrders = await ScheduleOrderService.GetScheduleOrdersAsync() ?? new List<ScheduleOrderDto>();
_scheduleOrders = _scheduleOrders.OrderByDescending(x => x.LastUpdateDate).ToList();
StateHasChanged();
return await Task.FromResult(request.ApplyTo(_scheduleOrders));
}
private void OnRowDoubleClick(GridRowEventArgs<ScheduleOrderDto> obj)
{
int scheduleOrderId = obj.Item.ID;
NavigationManager.NavigateTo($"/details/{scheduleOrderId}");
}
}