improvements, fixes, etc...
This commit is contained in:
parent
1acd6a5833
commit
4c5b31f123
|
|
@ -25,6 +25,9 @@
|
||||||
<Reference Include="AyCode.Core">
|
<Reference Include="AyCode.Core">
|
||||||
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll</HintPath>
|
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="AyCode.Interfaces">
|
||||||
|
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="AyCode.Models.Server">
|
<Reference Include="AyCode.Models.Server">
|
||||||
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Models.Server.dll</HintPath>
|
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Models.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using AyCode.Core.Extensions;
|
||||||
|
using AyCode.Interfaces.Entities;
|
||||||
|
|
||||||
|
namespace FruitBank.Common.Databases;
|
||||||
|
|
||||||
|
public abstract class DatabaseLocalBase
|
||||||
|
{
|
||||||
|
//private ObservableCollection<IEntityInt> a = new ObservableCollection<IEntityInt>();
|
||||||
|
private readonly ConcurrentDictionary<Type, object> _database = new();
|
||||||
|
|
||||||
|
protected void AddTable<TEntity>(IList<TEntity> table)where TEntity: class, IEntityInt
|
||||||
|
{
|
||||||
|
if (GetTableObject<TEntity>() == null)
|
||||||
|
{
|
||||||
|
if (!_database.TryAdd(typeof(TEntity), table))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IList<T>? GetTableObject<T>() where T : class, IEntityInt
|
||||||
|
{
|
||||||
|
return _database.GetValueOrDefault(typeof(T)) as IList<T>;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<T>? GetRows<T>() where T : class, IEntityInt
|
||||||
|
{
|
||||||
|
return GetTableObject<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public T? GetRow<T>(int id) where T : class, IEntityInt
|
||||||
|
{
|
||||||
|
return GetTableObject<T>()?.FirstOrDefault(x => x.Id == id) as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T AddRow<T>(T entity) where T : class, IEntityInt
|
||||||
|
=> AddRow(GetTableObject<T>()!, entity);
|
||||||
|
|
||||||
|
protected T AddRow<T>(in IList<T> table, T entity) where T : class, IEntityInt
|
||||||
|
{
|
||||||
|
table.Add(entity);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRows<T>(IEnumerable<T> entities) where T : class, IEntityInt
|
||||||
|
{
|
||||||
|
var table = GetTableObject<T>()!;
|
||||||
|
|
||||||
|
foreach (var entity in entities)
|
||||||
|
{
|
||||||
|
AddRow(table, entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public T? DeleteRow<T>(int id) where T : class, IEntityInt
|
||||||
|
{
|
||||||
|
var table = GetTableObject<T>();
|
||||||
|
if (table == null) return null;
|
||||||
|
|
||||||
|
var index = table.FindIndex(x => x.Id == id);
|
||||||
|
if (index < 0) return null;
|
||||||
|
|
||||||
|
var entity = table[index];
|
||||||
|
table.RemoveAt(index);
|
||||||
|
|
||||||
|
return entity as T;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using FruitBank.Common.Interfaces;
|
using System.Collections.ObjectModel;
|
||||||
|
using FruitBank.Common.Interfaces;
|
||||||
using LinqToDB.Mapping;
|
using LinqToDB.Mapping;
|
||||||
using Mango.Nop.Core.Entities;
|
using Mango.Nop.Core.Entities;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using AyCode.Interfaces.Entities;
|
using AyCode.Interfaces.Entities;
|
||||||
using AyCode.Interfaces.TimeStampInfo;
|
using AyCode.Interfaces.TimeStampInfo;
|
||||||
|
using FruitBank.Common.Entities;
|
||||||
|
|
||||||
namespace FruitBank.Common.Interfaces;
|
namespace FruitBank.Common.Interfaces;
|
||||||
|
|
||||||
|
|
@ -14,4 +15,6 @@ public interface IPartner : IEntityInt, ITimeStampInfo
|
||||||
string County { get; set; }
|
string County { get; set; }
|
||||||
string City { get; set; }
|
string City { get; set; }
|
||||||
string Street { get; set; }
|
string Street { get; set; }
|
||||||
|
|
||||||
|
List<ShippingDocument>? ShippingDocuments { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using AyCode.Interfaces.Entities;
|
using AyCode.Interfaces.Entities;
|
||||||
using AyCode.Interfaces.TimeStampInfo;
|
using AyCode.Interfaces.TimeStampInfo;
|
||||||
using FruitBank.Common.Entities;
|
using FruitBank.Common.Entities;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
namespace FruitBank.Common.Interfaces;
|
namespace FruitBank.Common.Interfaces;
|
||||||
|
|
||||||
|
|
@ -22,6 +23,7 @@ public interface IShippingDocument: IEntityInt, ITimeStampInfo//, IMeasured
|
||||||
public Partner? Partner { get; set; }
|
public Partner? Partner { get; set; }
|
||||||
public Shipping? Shipping{ get; set; }
|
public Shipping? Shipping{ get; set; }
|
||||||
public List<ShippingItem>? ShippingItems { get; set; }
|
public List<ShippingItem>? ShippingItems { get; set; }
|
||||||
|
public List<ShippingDocumentToFiles>? ShippingDocumentToFiles { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
|
<div id="overviewDemoDropZone" class="card custom-drop-zone rounded-3 w-100 m-0">
|
||||||
|
<span class="drop-file-icon mb-3"></span>
|
||||||
|
<span class="drop-file-label" >Drag and Drop File Here</span><span class="m-1">or</span>
|
||||||
|
<DxButton Id="overviewDemoSelectButton"
|
||||||
|
CssClass="m-1"
|
||||||
|
RenderStyle="ButtonRenderStyle.Primary"
|
||||||
|
Text="Select File" />
|
||||||
|
</div>
|
||||||
|
<DxFileInput
|
||||||
|
Visible="@UploadVisible"
|
||||||
|
ExternalSelectButtonCssSelector="#overviewDemoSelectButton"
|
||||||
|
ExternalDropZoneCssSelector="#overviewDemoDropZone"
|
||||||
|
ExternalDropZoneDragOverCssClass="custom-drop-zone-hover"
|
||||||
|
MaxFileSize="15000000"
|
||||||
|
AllowedFileExtensions="_allowedExtensions"
|
||||||
|
AcceptedFileTypes="_acceptedFileTypes"
|
||||||
|
FilesUploading="FilesUploading"
|
||||||
|
SelectedFilesChanged="@SelectedFilesChanged">
|
||||||
|
</DxFileInput>
|
||||||
|
|
||||||
|
<div class="upload-validation-text info-text">
|
||||||
|
Uploads are limited to a single file up to 15 MB.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter] public Func<byte[], Task>? OnFileUploaded { get; set; }
|
||||||
|
|
||||||
|
bool UploadVisible { get; set; } = false;
|
||||||
|
|
||||||
|
readonly List<string> _allowedExtensions = new List<string> { ".jpg", ".jpeg", ".gif", ".png", ".pdf", ".json" };
|
||||||
|
readonly List<string> _acceptedFileTypes = new List<string> { "application/json", "application/pdf", "application/jpeg" };
|
||||||
|
|
||||||
|
byte[] FileBytes { get; set; }
|
||||||
|
|
||||||
|
protected void SelectedFilesChanged(IEnumerable<UploadFileInfo> files)
|
||||||
|
{
|
||||||
|
//InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task FilesUploading(FilesUploadingEventArgs args)
|
||||||
|
{
|
||||||
|
foreach (var file in args.Files)
|
||||||
|
{
|
||||||
|
using var stream = new System.IO.MemoryStream();
|
||||||
|
await file.OpenReadStream(file.Size).CopyToAsync(stream);
|
||||||
|
|
||||||
|
if (OnFileUploaded != null) await OnFileUploaded(stream.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected string GetUploadUrl(string url)
|
||||||
|
{
|
||||||
|
return NavigationManager.ToAbsoluteUri(url).AbsoluteUri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -42,21 +42,6 @@
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
}
|
}
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
@* <ToolbarTemplate>
|
|
||||||
<DxToolbar ItemRenderStyleMode="ToolbarRenderStyleMode.Plain">
|
|
||||||
<Items>
|
|
||||||
<DxToolbarItem BeginGroup="true" Alignment="ToolbarItemAlignment.Left">
|
|
||||||
<Template Context="toolbar_item_context">
|
|
||||||
<div class="d-flex flex-row align-items-center">
|
|
||||||
<DxCheckBox @bind-Checked="AutoCollapseDetailRow">
|
|
||||||
Auto Collapse Detail Rows
|
|
||||||
</DxCheckBox>
|
|
||||||
</div>
|
|
||||||
</Template>
|
|
||||||
</DxToolbarItem>
|
|
||||||
</Items>
|
|
||||||
</DxToolbar>
|
|
||||||
</ToolbarTemplate> *@
|
|
||||||
<GroupSummary>
|
<GroupSummary>
|
||||||
<DxGridSummaryItem SummaryType="GridSummaryItemType.Sum"
|
<DxGridSummaryItem SummaryType="GridSummaryItemType.Sum"
|
||||||
FieldName="Quantity"
|
FieldName="Quantity"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
@using AyCode.Core.Helpers
|
@using AyCode.Core.Helpers
|
||||||
@using DevExpress.Internal.About
|
@using DevExpress.Internal.About
|
||||||
@using FruitBank.Common.Dtos
|
@using FruitBank.Common.Dtos
|
||||||
|
@using FruitBankHybrid.Shared.Databases
|
||||||
@using FruitBankHybrid.Shared.Services.SignalRs
|
@using FruitBankHybrid.Shared.Services.SignalRs
|
||||||
|
|
||||||
@inject FruitBankSignalRClient FruitBankSignalRClient
|
@inject FruitBankSignalRClient FruitBankSignalRClient
|
||||||
|
|
@ -50,6 +51,8 @@
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
[Inject] public required DatabaseClient Database { get; set; }
|
||||||
|
|
||||||
private int _activeTabIndex;
|
private int _activeTabIndex;
|
||||||
|
|
||||||
private List<OrderDto>? _currentOrderDtos;
|
private List<OrderDto>? _currentOrderDtos;
|
||||||
|
|
@ -59,13 +62,15 @@
|
||||||
private readonly Dictionary<int, List<OrderItemDto>> _orderItemDtosByProductId = new();
|
private readonly Dictionary<int, List<OrderItemDto>> _orderItemDtosByProductId = new();
|
||||||
|
|
||||||
[Parameter] public bool IsMasterGrid { get; set; } = false;
|
[Parameter] public bool IsMasterGrid { get; set; } = false;
|
||||||
[Parameter] public List<ProductDto>? ProductDtos { get; set; }
|
[Parameter] public IEnumerable<ProductDto>? ProductDtos { get; set; }
|
||||||
//[Parameter] public List<OrderDto>? OrderDtos { get; set; }
|
//[Parameter] public List<OrderDto>? OrderDtos { get; set; }
|
||||||
//[Parameter] public List<OrderItemDto>? OrderItemDtos { get; set; }
|
//[Parameter] public List<OrderItemDto>? OrderItemDtos { get; set; }
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
ProductDtos ??= await FruitBankSignalRClient.GetProductDtos();
|
ProductDtos ??= await Database.ProductDtoTable.LoadDataAsync(true);
|
||||||
|
|
||||||
|
//ProductDtos ??= await FruitBankSignalRClient.GetProductDtos();
|
||||||
|
|
||||||
// if (ProductDtos is { Count: > 0 })
|
// if (ProductDtos is { Count: > 0 })
|
||||||
// _currentOrderDtos = await GetOrderDtosFromDbAsync(ProductDtos[0].Id);
|
// _currentOrderDtos = await GetOrderDtosFromDbAsync(ProductDtos[0].Id);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,157 @@
|
||||||
|
@using FruitBank.Common.Dtos
|
||||||
|
@using FruitBank.Common.Entities
|
||||||
|
@using FruitBankHybrid.Shared.Services.SignalRs
|
||||||
|
|
||||||
|
@inject FruitBankSignalRClient FruitBankSignalRClient
|
||||||
|
|
||||||
|
<MgGridBase @ref="Grid" Data="Shippings" IsMasterGrid="IsMasterGrid"
|
||||||
|
EditOnKeyPress="true"
|
||||||
|
ValidationEnabled="false"
|
||||||
|
EditModelSaving="Grid_EditModelSaving">
|
||||||
|
<Columns>
|
||||||
|
<DxGridDataColumn FieldName="Id" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" />
|
||||||
|
|
||||||
|
<DxGridDataColumn FieldName="ShippingDate" />
|
||||||
|
<DxGridDataColumn FieldName="LicencePlate" />
|
||||||
|
|
||||||
|
<DxGridDataColumn FieldName="IsAllMeasured" />
|
||||||
|
<DxGridDataColumn FieldName="Created" />
|
||||||
|
<DxGridDataColumn FieldName="Modified" />
|
||||||
|
<DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn>
|
||||||
|
</Columns>
|
||||||
|
<DetailRowTemplate>
|
||||||
|
@if (IsMasterGrid)
|
||||||
|
{
|
||||||
|
var shipping = ((Shipping)context.DataItem);
|
||||||
|
var shippingDocuments = shipping?.ShippingDocuments?.ToList() ?? [];
|
||||||
|
|
||||||
|
<DxTabs ActiveTabIndexChanged="(i) => OnActiveTabChanged(i)">
|
||||||
|
<DxTabPage Text="Szállítólevelek">
|
||||||
|
@{
|
||||||
|
|
||||||
|
<GridShippingDocument IsMasterGrid="false" ShippingDocuments="shippingDocuments"></GridShippingDocument>
|
||||||
|
}
|
||||||
|
</DxTabPage>
|
||||||
|
|
||||||
|
<DxTabPage Text="Szállítmány tételek">
|
||||||
|
<GridShippingItem ShippingItems="shippingDocuments?.SelectMany(sd => sd.ShippingItems ?? [])?.ToList() ?? []" IsMasterGrid="false" />
|
||||||
|
</DxTabPage>
|
||||||
|
</DxTabs>
|
||||||
|
}
|
||||||
|
</DetailRowTemplate>
|
||||||
|
<ToolbarTemplate>
|
||||||
|
<DxToolbar ItemRenderStyleMode="ToolbarRenderStyleMode.Plain">
|
||||||
|
<DxToolbarItem Text="New" Click="NewItem_Click" IconCssClass="grid-toolbar-new" />
|
||||||
|
<DxToolbarItem Text="Edit" Click="EditItem_Click" IconCssClass="grid-toolbar-edit" Enabled="EditItemsEnabled" />
|
||||||
|
<DxToolbarItem Text="Delete" Click="DeleteItem_Click" IconCssClass="grid-toolbar-delete" Enabled="EditItemsEnabled" />
|
||||||
|
<DxToolbarItem Text="Column Chooser" BeginGroup="true" Click="ColumnChooserItem_Click" IconCssClass="grid-toolbar-column-chooser" />
|
||||||
|
<DxToolbarItem Text="Export" IconCssClass="grid-toolbar-export">
|
||||||
|
<Items>
|
||||||
|
<DxToolbarItem Text="To CSV" Click="ExportCsvItem_Click" />
|
||||||
|
<DxToolbarItem Text="To XLSX" Click="ExportXlsxItem_Click" />
|
||||||
|
<DxToolbarItem Text="To XLS" Click="ExportXlsItem_Click" />
|
||||||
|
<DxToolbarItem Text="To PDF" Click="ExportPdfItem_Click" />
|
||||||
|
</Items>
|
||||||
|
</DxToolbarItem>
|
||||||
|
@* <DxToolbarItem BeginGroup="true">
|
||||||
|
<Template Context="toolbar_item_context">
|
||||||
|
<DxSearchBox @bind-Text="GridSearchText"
|
||||||
|
BindValueMode="BindValueMode.OnInput"
|
||||||
|
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"
|
||||||
|
aria-label="Search" />
|
||||||
|
</Template>
|
||||||
|
</DxToolbarItem>
|
||||||
|
*@ </DxToolbar>
|
||||||
|
</ToolbarTemplate>
|
||||||
|
<GroupSummary>
|
||||||
|
<DxGridSummaryItem SummaryType="GridSummaryItemType.Sum"
|
||||||
|
FieldName="Quantity"
|
||||||
|
FooterColumnName="Quantity" />
|
||||||
|
<DxGridSummaryItem SummaryType="GridSummaryItemType.Sum"
|
||||||
|
FieldName="NetWeight"
|
||||||
|
FooterColumnName="NetWeight" />
|
||||||
|
<DxGridSummaryItem SummaryType="GridSummaryItemType.Sum"
|
||||||
|
FieldName="PriceInclTax"
|
||||||
|
FooterColumnName="PriceInclTax" />
|
||||||
|
</GroupSummary>
|
||||||
|
</MgGridBase>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter] public bool IsMasterGrid { get; set; } = false;
|
||||||
|
//[Parameter] public OrderDto? OrderDto { get; set; }
|
||||||
|
[Parameter] public List<Shipping>? Shippings{ get; set; }
|
||||||
|
|
||||||
|
const string ExportFileName = "ExportResult";
|
||||||
|
string GridSearchText = "";
|
||||||
|
bool EditItemsEnabled { get; set; }
|
||||||
|
int FocusedRowVisibleIndex { get; set; }
|
||||||
|
IGrid Grid { get; set; }
|
||||||
|
|
||||||
|
private int _activeTabIndex;
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
Shippings ??= (await FruitBankSignalRClient.GetShippings()) ?? [];
|
||||||
|
// OrderItemDtos = OrderDto.OrderItemDtos;
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e) {
|
||||||
|
// await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
|
||||||
|
// await LoadGridDataAsync();
|
||||||
|
// if(Data.Length == 0)
|
||||||
|
// UpdateEditItemsEnabled(false);
|
||||||
|
}
|
||||||
|
async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e) {
|
||||||
|
// if(e.IsNew) {
|
||||||
|
// await NwindDataService.InsertEmployeeAsync((EditableEmployee)e.EditModel);
|
||||||
|
// UpdateEditItemsEnabled(true);
|
||||||
|
// } else
|
||||||
|
// await NwindDataService.UpdateEmployeeAsync((EditableEmployee)e.DataItem, (EditableEmployee)e.EditModel);
|
||||||
|
// await LoadGridDataAsync();
|
||||||
|
}
|
||||||
|
async Task NewItem_Click() {
|
||||||
|
await Grid.StartEditNewRowAsync();
|
||||||
|
}
|
||||||
|
async Task EditItem_Click() {
|
||||||
|
await Grid.StartEditRowAsync(FocusedRowVisibleIndex);
|
||||||
|
}
|
||||||
|
void DeleteItem_Click() {
|
||||||
|
Grid.ShowRowDeleteConfirmation(FocusedRowVisibleIndex);
|
||||||
|
}
|
||||||
|
void ColumnChooserItem_Click(ToolbarItemClickEventArgs e) {
|
||||||
|
Grid.ShowColumnChooser();
|
||||||
|
}
|
||||||
|
async Task ExportXlsxItem_Click() {
|
||||||
|
await Grid.ExportToXlsxAsync(ExportFileName);
|
||||||
|
}
|
||||||
|
async Task ExportXlsItem_Click() {
|
||||||
|
await Grid.ExportToXlsAsync(ExportFileName);
|
||||||
|
}
|
||||||
|
async Task ExportCsvItem_Click() {
|
||||||
|
await Grid.ExportToCsvAsync(ExportFileName);
|
||||||
|
}
|
||||||
|
async Task ExportPdfItem_Click() {
|
||||||
|
await Grid.ExportToPdfAsync(ExportFileName);
|
||||||
|
}
|
||||||
|
protected async Task OnActiveTabChanged(int activeTabIndex)
|
||||||
|
{
|
||||||
|
_activeTabIndex = activeTabIndex;
|
||||||
|
return;
|
||||||
|
|
||||||
|
// switch (_activeTabIndex)
|
||||||
|
// {
|
||||||
|
// case 0:
|
||||||
|
// if(ProductDtos == null)
|
||||||
|
// ProductDtos = (await FruitBankSignalRClient.GetProductDtos() ?? []); //.Where(o => o.HasMeasuringAccess(LoggedInModel.CustomerDto?.Id, LoggedInModel.IsRevisor)).OrderBy(o => o.DateOfReceipt).ToList();
|
||||||
|
// break;
|
||||||
|
// case 1:
|
||||||
|
// if(OrderDtos == null)
|
||||||
|
// OrderDtos = (await FruitBankSignalRClient.GetAllOrderDtos() ?? []).OrderByDescending(o => o.Id).ToList(); //.Where(o => o.HasMeasuringAccess(LoggedInModel.CustomerDto?.Id, LoggedInModel.IsRevisor)).OrderBy(o => o.DateOfReceipt).ToList();
|
||||||
|
// break;
|
||||||
|
// case 2:
|
||||||
|
// if (OrderItemDtos == null)
|
||||||
|
// OrderItemDtos = (await FruitBankSignalRClient.GetAllOrderItemDtos() ?? []).OrderByDescending(o => o.Id).ToList(); //.Where(o => o.HasMeasuringAccess(LoggedInModel.CustomerDto?.Id, LoggedInModel.IsRevisor)).OrderBy(o => o.DateOfReceipt).ToList();
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
@using FruitBank.Common.Dtos
|
@using FruitBank.Common.Dtos
|
||||||
@using FruitBank.Common.Entities
|
@using FruitBank.Common.Entities
|
||||||
|
@using FruitBankHybrid.Shared.Components.FileUploads
|
||||||
|
@using FruitBankHybrid.Shared.Databases
|
||||||
@using FruitBankHybrid.Shared.Services.SignalRs
|
@using FruitBankHybrid.Shared.Services.SignalRs
|
||||||
|
@using System.Text
|
||||||
|
@using AyCode.Core.Extensions
|
||||||
|
|
||||||
@inject FruitBankSignalRClient FruitBankSignalRClient
|
@inject FruitBankSignalRClient FruitBankSignalRClient
|
||||||
|
|
||||||
|
|
@ -10,8 +14,24 @@
|
||||||
EditModelSaving="Grid_EditModelSaving">
|
EditModelSaving="Grid_EditModelSaving">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridDataColumn FieldName="Id" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" />
|
||||||
<DxGridDataColumn FieldName="PartnerId" Caption="pId" Width="125" />
|
<DxGridDataColumn FieldName="PartnerId" Caption="Partner">
|
||||||
<DxGridDataColumn FieldName="ShippingId" Caption="sId" Width="125" />
|
<EditSettings>
|
||||||
|
<DxComboBoxSettings Data="ProductDtos"
|
||||||
|
ValueFieldName="Id"
|
||||||
|
TextFieldName="Name"
|
||||||
|
SearchFilterCondition="ListSearchFilterCondition.Contains"
|
||||||
|
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" />
|
||||||
|
</EditSettings>
|
||||||
|
</DxGridDataColumn>
|
||||||
|
<DxGridDataColumn FieldName="ShippingId" Caption="Shipping">
|
||||||
|
<EditSettings>
|
||||||
|
<DxComboBoxSettings Data="Shippings"
|
||||||
|
ValueFieldName="Id"
|
||||||
|
TextFieldName="ShippingDate"
|
||||||
|
SearchFilterCondition="ListSearchFilterCondition.Contains"
|
||||||
|
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" />
|
||||||
|
</EditSettings>
|
||||||
|
</DxGridDataColumn>
|
||||||
|
|
||||||
<DxGridDataColumn FieldName="DocumentIdNumber" />
|
<DxGridDataColumn FieldName="DocumentIdNumber" />
|
||||||
<DxGridDataColumn FieldName="ShippingDate" />
|
<DxGridDataColumn FieldName="ShippingDate" />
|
||||||
|
|
@ -30,7 +50,7 @@
|
||||||
var shippingDocument = ((ShippingDocument)context.DataItem);
|
var shippingDocument = ((ShippingDocument)context.DataItem);
|
||||||
|
|
||||||
<DxTabs ActiveTabIndexChanged="(i) => OnActiveTabChanged(i)">
|
<DxTabs ActiveTabIndexChanged="(i) => OnActiveTabChanged(i)">
|
||||||
<DxTabPage Text="Rendelés tételek">
|
<DxTabPage Text="Szállítmány tételek">
|
||||||
<GridShippingItem ShippingItems="shippingDocument.ShippingItems" IsMasterGrid="false" />
|
<GridShippingItem ShippingItems="shippingDocument.ShippingItems" IsMasterGrid="false" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Mérések">
|
<DxTabPage Text="Mérések">
|
||||||
|
|
@ -57,6 +77,17 @@
|
||||||
<DxToolbarItem Text="To PDF" Click="ExportPdfItem_Click" />
|
<DxToolbarItem Text="To PDF" Click="ExportPdfItem_Click" />
|
||||||
</Items>
|
</Items>
|
||||||
</DxToolbarItem>
|
</DxToolbarItem>
|
||||||
|
<DxToolbarItem BeginGroup="true">
|
||||||
|
<Template Context="ctxToolbarItemFileUpload">
|
||||||
|
@* <DxUpload Name="myFile"
|
||||||
|
UploadMode="@UploadMode.Instant"
|
||||||
|
AllowMultiFileUpload="false"
|
||||||
|
ShowSelectButton="true"
|
||||||
|
MaxFileSize="15000000">
|
||||||
|
</DxUpload> *@
|
||||||
|
<FileUpload OnFileUploaded="OnFileUploaded"></FileUpload>
|
||||||
|
</Template>
|
||||||
|
</DxToolbarItem>
|
||||||
@* <DxToolbarItem BeginGroup="true">
|
@* <DxToolbarItem BeginGroup="true">
|
||||||
<Template Context="toolbar_item_context">
|
<Template Context="toolbar_item_context">
|
||||||
<DxSearchBox @bind-Text="GridSearchText"
|
<DxSearchBox @bind-Text="GridSearchText"
|
||||||
|
|
@ -81,59 +112,108 @@
|
||||||
</MgGridBase>
|
</MgGridBase>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
[Inject] public required DatabaseClient Database { get; set; }
|
||||||
|
|
||||||
[Parameter] public bool IsMasterGrid { get; set; } = false;
|
[Parameter] public bool IsMasterGrid { get; set; } = false;
|
||||||
//[Parameter] public OrderDto? OrderDto { get; set; }
|
|
||||||
|
[Parameter] public List<Shipping>? Shippings { get; set; }
|
||||||
|
[Parameter] public IEnumerable<ProductDto>? ProductDtos { get; set; }
|
||||||
[Parameter] public List<ShippingDocument>? ShippingDocuments { get; set; }
|
[Parameter] public List<ShippingDocument>? ShippingDocuments { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public Func<List<Partner>?, Task>? OnUploadedFileParsed { get; set; }
|
||||||
|
|
||||||
const string ExportFileName = "ExportResult";
|
const string ExportFileName = "ExportResult";
|
||||||
string GridSearchText = "";
|
string GridSearchText = "";
|
||||||
bool EditItemsEnabled { get; set; }
|
bool EditItemsEnabled { get; set; } = true;
|
||||||
int FocusedRowVisibleIndex { get; set; }
|
int FocusedRowVisibleIndex { get; set; }
|
||||||
IGrid Grid { get; set; }
|
IGrid Grid { get; set; }
|
||||||
|
|
||||||
private int _activeTabIndex;
|
private int _activeTabIndex;
|
||||||
protected override void OnInitialized()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
ProductDtos ??= await Database.ProductDtoTable.LoadDataAsync(true);
|
||||||
|
|
||||||
|
Shippings ??= await FruitBankSignalRClient.GetShippings() ?? [];
|
||||||
|
//ProductDtos ??= await FruitBankSignalRClient.GetProductDtos() ?? [];
|
||||||
|
ShippingDocuments ??= await FruitBankSignalRClient.GetShippingDocuments() ?? [];
|
||||||
// if (OrderDto != null)
|
// if (OrderDto != null)
|
||||||
// OrderItemDtos = OrderDto.OrderItemDtos;
|
// OrderItemDtos = OrderDto.OrderItemDtos;
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e) {
|
private async Task OnFileUploaded(byte[] arg)
|
||||||
|
{
|
||||||
|
string utfString = Encoding.UTF8.GetString(arg, 0, arg.Length);
|
||||||
|
|
||||||
|
var partners = utfString.JsonTo<List<Partner>>();
|
||||||
|
if (partners != null)
|
||||||
|
{
|
||||||
|
var id = ShippingDocuments.Max(x => x.Id);
|
||||||
|
foreach (var shippingDocument in partners.SelectMany(partner => partner.ShippingDocuments ?? []))
|
||||||
|
{
|
||||||
|
shippingDocument.Id = ++id;
|
||||||
|
|
||||||
|
ShippingDocuments.Add(shippingDocument);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Grid.Reload();
|
||||||
|
|
||||||
|
if (OnUploadedFileParsed != null)
|
||||||
|
await OnUploadedFileParsed(partners);
|
||||||
|
//await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e)
|
||||||
|
{
|
||||||
// await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
|
// await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
|
||||||
// await LoadGridDataAsync();
|
// await LoadGridDataAsync();
|
||||||
// if(Data.Length == 0)
|
// if(Data.Length == 0)
|
||||||
// UpdateEditItemsEnabled(false);
|
// UpdateEditItemsEnabled(false);
|
||||||
}
|
}
|
||||||
async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e) {
|
async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e)
|
||||||
|
{
|
||||||
// if(e.IsNew) {
|
// if(e.IsNew) {
|
||||||
// await NwindDataService.InsertEmployeeAsync((EditableEmployee)e.EditModel);
|
// await NwindDataService.InsertEmployeeAsync((EditableEmployee)e.EditModel);
|
||||||
// UpdateEditItemsEnabled(true);
|
|
||||||
// } else
|
// } else
|
||||||
// await NwindDataService.UpdateEmployeeAsync((EditableEmployee)e.DataItem, (EditableEmployee)e.EditModel);
|
// await NwindDataService.UpdateEmployeeAsync((EditableEmployee)e.DataItem, (EditableEmployee)e.EditModel);
|
||||||
// await LoadGridDataAsync();
|
// await LoadGridDataAsync();
|
||||||
|
EditItemsEnabled = true;
|
||||||
}
|
}
|
||||||
async Task NewItem_Click() {
|
async Task NewItem_Click()
|
||||||
|
{
|
||||||
|
EditItemsEnabled = false;
|
||||||
await Grid.StartEditNewRowAsync();
|
await Grid.StartEditNewRowAsync();
|
||||||
}
|
}
|
||||||
async Task EditItem_Click() {
|
async Task EditItem_Click()
|
||||||
|
{
|
||||||
|
EditItemsEnabled = false;
|
||||||
await Grid.StartEditRowAsync(FocusedRowVisibleIndex);
|
await Grid.StartEditRowAsync(FocusedRowVisibleIndex);
|
||||||
}
|
}
|
||||||
void DeleteItem_Click() {
|
void DeleteItem_Click()
|
||||||
|
{
|
||||||
|
EditItemsEnabled = false;
|
||||||
Grid.ShowRowDeleteConfirmation(FocusedRowVisibleIndex);
|
Grid.ShowRowDeleteConfirmation(FocusedRowVisibleIndex);
|
||||||
}
|
}
|
||||||
void ColumnChooserItem_Click(ToolbarItemClickEventArgs e) {
|
|
||||||
|
void ColumnChooserItem_Click(ToolbarItemClickEventArgs e)
|
||||||
|
{
|
||||||
Grid.ShowColumnChooser();
|
Grid.ShowColumnChooser();
|
||||||
}
|
}
|
||||||
async Task ExportXlsxItem_Click() {
|
async Task ExportXlsxItem_Click()
|
||||||
|
{
|
||||||
await Grid.ExportToXlsxAsync(ExportFileName);
|
await Grid.ExportToXlsxAsync(ExportFileName);
|
||||||
}
|
}
|
||||||
async Task ExportXlsItem_Click() {
|
async Task ExportXlsItem_Click()
|
||||||
|
{
|
||||||
await Grid.ExportToXlsAsync(ExportFileName);
|
await Grid.ExportToXlsAsync(ExportFileName);
|
||||||
}
|
}
|
||||||
async Task ExportCsvItem_Click() {
|
async Task ExportCsvItem_Click()
|
||||||
|
{
|
||||||
await Grid.ExportToCsvAsync(ExportFileName);
|
await Grid.ExportToCsvAsync(ExportFileName);
|
||||||
}
|
}
|
||||||
async Task ExportPdfItem_Click() {
|
async Task ExportPdfItem_Click()
|
||||||
|
{
|
||||||
await Grid.ExportToPdfAsync(ExportFileName);
|
await Grid.ExportToPdfAsync(ExportFileName);
|
||||||
}
|
}
|
||||||
protected async Task OnActiveTabChanged(int activeTabIndex)
|
protected async Task OnActiveTabChanged(int activeTabIndex)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
@using FruitBank.Common.Dtos
|
@using FruitBank.Common.Dtos
|
||||||
@using FruitBank.Common.Entities
|
@using FruitBank.Common.Entities
|
||||||
|
@using FruitBankHybrid.Shared.Databases
|
||||||
@using FruitBankHybrid.Shared.Services.SignalRs
|
@using FruitBankHybrid.Shared.Services.SignalRs
|
||||||
|
|
||||||
@inject FruitBankSignalRClient FruitBankSignalRClient
|
@inject FruitBankSignalRClient FruitBankSignalRClient
|
||||||
|
|
@ -15,9 +16,26 @@
|
||||||
FilterMenuButtonDisplayMode="@(IsMasterGrid ? GridFilterMenuButtonDisplayMode.Never : GridFilterMenuButtonDisplayMode.Always)">
|
FilterMenuButtonDisplayMode="@(IsMasterGrid ? GridFilterMenuButtonDisplayMode.Never : GridFilterMenuButtonDisplayMode.Always)">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridDataColumn FieldName="Id" Caption="oiId" Width="125" />
|
<DxGridDataColumn FieldName="Id" Caption="oiId" Width="125" />
|
||||||
<DxGridDataColumn FieldName="ShippingDocumentId" Caption="oId" Width="125" />
|
<DxGridDataColumn FieldName="ShippingDocumentId" Caption="ShippingDocument">
|
||||||
|
<EditSettings>
|
||||||
|
<DxComboBoxSettings Data="ShippingDocuments"
|
||||||
|
ValueFieldName="Id"
|
||||||
|
TextFieldName="DocumentIdNumber"
|
||||||
|
SearchFilterCondition="ListSearchFilterCondition.Contains"
|
||||||
|
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" />
|
||||||
|
</EditSettings>
|
||||||
|
</DxGridDataColumn>
|
||||||
|
|
||||||
@* <DxGridDataColumn FieldName="PalletId" Caption="pId" Width="125" /> *@
|
@* <DxGridDataColumn FieldName="PalletId" Caption="pId" Width="125" /> *@
|
||||||
<DxGridDataColumn FieldName="ProductId" Caption="pId" Width="125" />
|
<DxGridDataColumn FieldName="ProductId" Caption="Product">
|
||||||
|
<EditSettings>
|
||||||
|
<DxComboBoxSettings Data="ProductDtos"
|
||||||
|
ValueFieldName="Id"
|
||||||
|
TextFieldName="Name"
|
||||||
|
SearchFilterCondition="ListSearchFilterCondition.Contains"
|
||||||
|
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" />
|
||||||
|
</EditSettings>
|
||||||
|
</DxGridDataColumn>
|
||||||
|
|
||||||
<DxGridDataColumn FieldName="Name" MinWidth="120" Caption="Name(OnDoc)" />
|
<DxGridDataColumn FieldName="Name" MinWidth="120" Caption="Name(OnDoc)" />
|
||||||
<DxGridDataColumn FieldName="PalletsOnDocument" Caption="Raklap(OnDoc)" />
|
<DxGridDataColumn FieldName="PalletsOnDocument" Caption="Raklap(OnDoc)" />
|
||||||
|
|
@ -57,13 +75,21 @@
|
||||||
</MgGridBase>
|
</MgGridBase>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
[Inject] public required DatabaseClient Database { get; set; }
|
||||||
|
|
||||||
[Parameter] public bool IsMasterGrid { get; set; } = false;
|
[Parameter] public bool IsMasterGrid { get; set; } = false;
|
||||||
//[Parameter] public OrderDto? OrderDto { get; set; }
|
|
||||||
[Parameter] public List<ShippingItem>? ShippingItems { get; set; }
|
[Parameter] public IEnumerable<ProductDto>? ProductDtos { get; set; }
|
||||||
|
[Parameter] public IEnumerable<ShippingItem>? ShippingItems { get; set; }
|
||||||
|
[Parameter] public IEnumerable<ShippingDocument>? ShippingDocuments { get; set; }
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
ProductDtos ??= await Database.ProductDtoTable.LoadDataAsync(true);
|
||||||
|
|
||||||
|
//ProductDtos ??= await FruitBankSignalRClient.GetProductDtos() ?? [];
|
||||||
ShippingItems ??= await FruitBankSignalRClient.GetShippingItems() ?? [];
|
ShippingItems ??= await FruitBankSignalRClient.GetShippingItems() ?? [];
|
||||||
|
ShippingDocuments ??= await FruitBankSignalRClient.GetShippingDocuments() ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,160 @@
|
||||||
|
using AyCode.Core.Extensions;
|
||||||
|
using AyCode.Interfaces.Entities;
|
||||||
|
using AyCode.Utils.Wrappers;
|
||||||
|
using FruitBank.Common.Dtos;
|
||||||
|
using FruitBankHybrid.Shared.Services.SignalRs;
|
||||||
|
using Nop.Core.Domain.Common;
|
||||||
|
using Nop.Core.Domain.Orders;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using AyCode.Utils.Extensions;
|
||||||
|
|
||||||
|
namespace FruitBankHybrid.Shared.Databases;
|
||||||
|
|
||||||
|
public class ProductDtoTableItem : ProductDto
|
||||||
|
{
|
||||||
|
//[Newtonsoft.Json.JsonProperty]
|
||||||
|
//public new ObservableCollection<GenericAttribute>? GenericAttributes { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OrderDtoTableItem : OrderDto
|
||||||
|
{
|
||||||
|
//[Newtonsoft.Json.JsonProperty]
|
||||||
|
//public new ObservableCollection<GenericAttribute>? GenericAttributes { get; set; }
|
||||||
|
//[Newtonsoft.Json.JsonProperty]
|
||||||
|
//public new ObservableCollection<GenericAttribute>? OrderItemDtos { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ProductDtoTable(FruitBankSignalRClient fruitBankSignalRClient) : ObservableCollection<ProductDtoTableItem>
|
||||||
|
{
|
||||||
|
private readonly SemaphoreSlim _semaphoreSlim = new(1);
|
||||||
|
public async Task<ProductDtoTable> LoadDataAsync(bool onlyIfEmpty = true)
|
||||||
|
{
|
||||||
|
if (onlyIfEmpty && Count != 0) return this;
|
||||||
|
|
||||||
|
using (await _semaphoreSlim.UseWaitAsync())
|
||||||
|
{
|
||||||
|
if (Count != 0) return this;
|
||||||
|
|
||||||
|
var items = (await fruitBankSignalRClient.GetProductDtoTableItems() ?? []);
|
||||||
|
|
||||||
|
Clear();
|
||||||
|
foreach (var productDto in items)
|
||||||
|
{
|
||||||
|
this.Add(productDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class OrderDtoTable(FruitBankSignalRClient fruitBankSignalRClient) : ObservableCollection<OrderDtoTableItem>
|
||||||
|
{
|
||||||
|
private readonly SemaphoreSlim _semaphoreSlim = new(1);
|
||||||
|
|
||||||
|
public async Task<OrderDtoTable> LoadDataAsync(bool onlyIfEmpty = true)
|
||||||
|
{
|
||||||
|
if (onlyIfEmpty && Count != 0) return this;
|
||||||
|
|
||||||
|
using (await _semaphoreSlim.UseWaitAsync())
|
||||||
|
{
|
||||||
|
if (Count != 0) return this;
|
||||||
|
|
||||||
|
var items = (await fruitBankSignalRClient.GetAllOrderDtoTableItems() ?? []);
|
||||||
|
|
||||||
|
Clear();
|
||||||
|
foreach (var orderDto in items)
|
||||||
|
{
|
||||||
|
this.Add(orderDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DatabaseClient : DatabaseClientBase
|
||||||
|
{
|
||||||
|
private FruitBankSignalRClient _fruitBankSignalRClient;
|
||||||
|
|
||||||
|
public DatabaseClient(FruitBankSignalRClient fruitBankSignalRClient)
|
||||||
|
{
|
||||||
|
_fruitBankSignalRClient = fruitBankSignalRClient;
|
||||||
|
|
||||||
|
AddTable(new ProductDtoTable(_fruitBankSignalRClient));
|
||||||
|
AddTable(new OrderDtoTable(_fruitBankSignalRClient));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductDtoTable ProductDtoTable
|
||||||
|
{
|
||||||
|
get => (GetRows<ProductDtoTableItem>()! as ProductDtoTable)!;
|
||||||
|
//set => AddRows(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderDtoTable OrderDtoTable => (GetRows<OrderDtoTableItem>()! as OrderDtoTable)!;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class DatabaseClientBase
|
||||||
|
{
|
||||||
|
//private ObservableCollection<IEntityInt> a = new ObservableCollection<IEntityInt>();
|
||||||
|
private readonly ConcurrentDictionary<Type, object> _database = new();
|
||||||
|
|
||||||
|
protected void AddTable<TEntity>(IList<TEntity> table)where TEntity: class, IEntityInt
|
||||||
|
{
|
||||||
|
if (GetTableObject<TEntity>() == null)
|
||||||
|
{
|
||||||
|
if (!_database.TryAdd(typeof(TEntity), table))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IList<T>? GetTableObject<T>() where T : class, IEntityInt
|
||||||
|
{
|
||||||
|
return _database.GetValueOrDefault(typeof(T)) as IList<T>;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<T>? GetRows<T>() where T : class, IEntityInt
|
||||||
|
{
|
||||||
|
return GetTableObject<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public T? GetRow<T>(int id) where T : class, IEntityInt
|
||||||
|
{
|
||||||
|
return GetTableObject<T>()?.FirstOrDefault(x => x.Id == id) as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T AddRow<T>(T entity) where T : class, IEntityInt
|
||||||
|
=> AddRow(GetTableObject<T>()!, entity);
|
||||||
|
|
||||||
|
protected T AddRow<T>(in IList<T> table, T entity) where T : class, IEntityInt
|
||||||
|
{
|
||||||
|
table.Add(entity);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRows<T>(IEnumerable<T> entities) where T : class, IEntityInt
|
||||||
|
{
|
||||||
|
var table = GetTableObject<T>()!;
|
||||||
|
|
||||||
|
foreach (var entity in entities)
|
||||||
|
{
|
||||||
|
AddRow(table, entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public T? DeleteRow<T>(int id) where T : class, IEntityInt
|
||||||
|
{
|
||||||
|
var table = GetTableObject<T>();
|
||||||
|
if (table == null) return null;
|
||||||
|
|
||||||
|
var index = table.FindIndex(x => x.Id == id);
|
||||||
|
if (index < 0) return null;
|
||||||
|
|
||||||
|
var entity = table[index];
|
||||||
|
table.RemoveAt(index);
|
||||||
|
|
||||||
|
return entity as T;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -18,16 +18,16 @@
|
||||||
@* @bind-ActiveTabIndex="@ActiveTabIndex" *@
|
@* @bind-ActiveTabIndex="@ActiveTabIndex" *@
|
||||||
<DxTabs ActiveTabIndexChanged="(i) => OnActiveTabChanged(i)">
|
<DxTabs ActiveTabIndexChanged="(i) => OnActiveTabChanged(i)">
|
||||||
<DxTabPage Text="Termékek">
|
<DxTabPage Text="Termékek">
|
||||||
<GridProductDtoTemplate ProductDtos="ProductDtos" IsMasterGrid="true"></GridProductDtoTemplate>
|
<GridProductDtoTemplate IsMasterGrid="true"></GridProductDtoTemplate>
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Szállítmányok">
|
<DxTabPage Text="Szállítmányok">
|
||||||
@* <GridDetailOrderDto OrderDtos="Shippings" IsMasterGrid="true"></GridDetailOrderDto> *@
|
<GridShipping Shippings="Shippings" IsMasterGrid="true"></GridShipping>
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Szállítólevelek">
|
<DxTabPage Text="Szállítólevelek">
|
||||||
<GridShippingDocument ShippingDocuments="ShippingDocuments" IsMasterGrid="true"></GridShippingDocument>
|
<GridShippingDocument ShippingDocuments="ShippingDocuments" Shippings="Shippings" IsMasterGrid="true"></GridShippingDocument>
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Szállítólevél tételek">
|
<DxTabPage Text="Szállítólevél tételek">
|
||||||
<GridShippingItem IsMasterGrid="true"></GridShippingItem>
|
<GridShippingItem ShippingItems="ShippingItems" ShippingDocuments="ShippingDocuments" IsMasterGrid="true"></GridShippingItem>
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Mérések">
|
<DxTabPage Text="Mérések">
|
||||||
<GridShippingItemPallets IsMasterGrid="true"></GridShippingItemPallets>
|
<GridShippingItemPallets IsMasterGrid="true"></GridShippingItemPallets>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
using AyCode.Core.Loggers;
|
using AyCode.Core.Loggers;
|
||||||
using DevExpress.Blazor;
|
using DevExpress.Blazor;
|
||||||
|
using DevExpress.ClipboardSource.SpreadsheetML;
|
||||||
using FruitBank.Common.Dtos;
|
using FruitBank.Common.Dtos;
|
||||||
using FruitBank.Common.Entities;
|
using FruitBank.Common.Entities;
|
||||||
using FruitBank.Common.Models;
|
using FruitBank.Common.Models;
|
||||||
|
using FruitBankHybrid.Shared.Databases;
|
||||||
using FruitBankHybrid.Shared.Services.Loggers;
|
using FruitBankHybrid.Shared.Services.Loggers;
|
||||||
using FruitBankHybrid.Shared.Services.SignalRs;
|
using FruitBankHybrid.Shared.Services.SignalRs;
|
||||||
using Mango.Nop.Core.Loggers;
|
using Mango.Nop.Core.Loggers;
|
||||||
|
|
@ -17,9 +19,10 @@ public partial class ShippingsAdmin : ComponentBase
|
||||||
[Inject] public required NavigationManager NavManager { get; set; }
|
[Inject] public required NavigationManager NavManager { get; set; }
|
||||||
[Inject] private IDialogService DialogService { get; set; } = null!;
|
[Inject] private IDialogService DialogService { get; set; } = null!;
|
||||||
[Inject] public required LoggedInModel LoggedInModel { get; set; }
|
[Inject] public required LoggedInModel LoggedInModel { get; set; }
|
||||||
|
[Inject] public required DatabaseClient Database { get; set; }
|
||||||
|
|
||||||
public IGrid gridShipping;
|
public IGrid gridShipping;
|
||||||
private List<ProductDto>? ProductDtos { get; set; } = null!;
|
//private List<ProductDto>? ProductDtos { get; set; } = null!;
|
||||||
private List<Shipping>? Shippings { get; set; } = null!;
|
private List<Shipping>? Shippings { get; set; } = null!;
|
||||||
private List<ShippingDocument>? ShippingDocuments { get; set; } = null!;
|
private List<ShippingDocument>? ShippingDocuments { get; set; } = null!;
|
||||||
private List<ShippingItem>? ShippingItems { get; set; } = null!;
|
private List<ShippingItem>? ShippingItems { get; set; } = null!;
|
||||||
|
|
@ -60,7 +63,7 @@ public partial class ShippingsAdmin : ComponentBase
|
||||||
switch (ActiveTabIndex)
|
switch (ActiveTabIndex)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
ProductDtos ??= (await FruitBankSignalRClient.GetProductDtos() ?? []); //.Where(o => o.HasMeasuringAccess(LoggedInModel.CustomerDto?.Id, LoggedInModel.IsRevisor)).OrderBy(o => o.DateOfReceipt).ToList();
|
await Database.ProductDtoTable.LoadDataAsync(true);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
Shippings ??= (await FruitBankSignalRClient.GetShippings() ?? []).OrderByDescending(o => o.Id).ToList(); //.Where(o => o.HasMeasuringAccess(LoggedInModel.CustomerDto?.Id, LoggedInModel.IsRevisor)).OrderBy(o => o.DateOfReceipt).ToList();
|
Shippings ??= (await FruitBankSignalRClient.GetShippings() ?? []).OrderByDescending(o => o.Id).ToList(); //.Where(o => o.HasMeasuringAccess(LoggedInModel.CustomerDto?.Id, LoggedInModel.IsRevisor)).OrderBy(o => o.DateOfReceipt).ToList();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using AyCode.Core.Extensions;
|
using System.Collections.ObjectModel;
|
||||||
|
using AyCode.Core.Extensions;
|
||||||
using AyCode.Core.Helpers;
|
using AyCode.Core.Helpers;
|
||||||
using AyCode.Core.Loggers;
|
using AyCode.Core.Loggers;
|
||||||
using AyCode.Services.Server.SignalRs;
|
using AyCode.Services.Server.SignalRs;
|
||||||
|
|
@ -9,6 +10,7 @@ using FruitBank.Common.Entities;
|
||||||
using FruitBank.Common.Interfaces;
|
using FruitBank.Common.Interfaces;
|
||||||
using FruitBank.Common.Models;
|
using FruitBank.Common.Models;
|
||||||
using FruitBank.Common.SignalRs;
|
using FruitBank.Common.SignalRs;
|
||||||
|
using FruitBankHybrid.Shared.Databases;
|
||||||
using FruitBankHybrid.Shared.Services.Loggers;
|
using FruitBankHybrid.Shared.Services.Loggers;
|
||||||
using Mango.Nop.Core.Dtos;
|
using Mango.Nop.Core.Dtos;
|
||||||
using Mango.Nop.Core.Models;
|
using Mango.Nop.Core.Models;
|
||||||
|
|
@ -131,6 +133,9 @@ namespace FruitBankHybrid.Shared.Services.SignalRs
|
||||||
|
|
||||||
#region Product
|
#region Product
|
||||||
|
|
||||||
|
public Task<List<ProductDtoTableItem>?> GetProductDtoTableItems()
|
||||||
|
=> GetAllAsync<List<ProductDtoTableItem>>(SignalRTags.GetProductDtos);
|
||||||
|
|
||||||
public Task<List<ProductDto>?> GetProductDtos()
|
public Task<List<ProductDto>?> GetProductDtos()
|
||||||
=> GetAllAsync<List<ProductDto>>(SignalRTags.GetProductDtos);
|
=> GetAllAsync<List<ProductDto>>(SignalRTags.GetProductDtos);
|
||||||
|
|
||||||
|
|
@ -151,6 +156,9 @@ namespace FruitBankHybrid.Shared.Services.SignalRs
|
||||||
#endregion Authenticate
|
#endregion Authenticate
|
||||||
|
|
||||||
#region Orders
|
#region Orders
|
||||||
|
public Task<List<OrderDtoTableItem>?> GetAllOrderDtoTableItems()
|
||||||
|
=> GetAllAsync<List<OrderDtoTableItem>>(SignalRTags.GetAllOrderDtos);
|
||||||
|
|
||||||
public Task<List<OrderDto>?> GetAllOrderDtos()
|
public Task<List<OrderDto>?> GetAllOrderDtos()
|
||||||
=> GetAllAsync<List<OrderDto>>(SignalRTags.GetAllOrderDtos);
|
=> GetAllAsync<List<OrderDto>>(SignalRTags.GetAllOrderDtos);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using FruitBank.Common.Loggers;
|
||||||
using FruitBank.Common.Models;
|
using FruitBank.Common.Models;
|
||||||
using FruitBankHybrid.Services;
|
using FruitBankHybrid.Services;
|
||||||
using FruitBankHybrid.Services.Loggers;
|
using FruitBankHybrid.Services.Loggers;
|
||||||
|
using FruitBankHybrid.Shared.Databases;
|
||||||
using FruitBankHybrid.Shared.Services;
|
using FruitBankHybrid.Shared.Services;
|
||||||
using FruitBankHybrid.Shared.Services.SignalRs;
|
using FruitBankHybrid.Shared.Services.SignalRs;
|
||||||
//using DevExpress.Maui;
|
//using DevExpress.Maui;
|
||||||
|
|
@ -29,8 +30,8 @@ namespace FruitBankHybrid
|
||||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||||
|
|
||||||
builder.Services.AddSingleton<LoggedInModel>();
|
builder.Services.AddSingleton<LoggedInModel>();
|
||||||
//builder.Services.AddScoped<ISignalRService, SignalRService>();
|
|
||||||
builder.Services.AddScoped<FruitBankSignalRClient>();
|
builder.Services.AddScoped<FruitBankSignalRClient>();
|
||||||
|
builder.Services.AddSingleton<DatabaseClient>();
|
||||||
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue