bruh
This commit is contained in:
parent
8fe1484279
commit
02eed4a794
|
|
@ -1,23 +1,29 @@
|
||||||
@* Deprecated *@
|
@page "/sysadmin/products"
|
||||||
|
@using BlazorAnimation
|
||||||
@page "/user/products"
|
@using TIAM.Core.Enums
|
||||||
@using TIAM.Resources
|
@using TIAM.Resources
|
||||||
|
@using TIAM.Services
|
||||||
@using TIAMSharedUI.Shared
|
@using TIAMSharedUI.Shared
|
||||||
|
@using TIAMSharedUI.Shared.Components.Grids
|
||||||
|
@using TIAMWebApp.Shared.Application.Interfaces
|
||||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||||
@using AyCode.Services.Loggers
|
@using AyCode.Services.Loggers
|
||||||
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
@layout AdminLayout
|
@layout AdminLayout
|
||||||
@inject IStringLocalizer<TIAMResources> localizer
|
@inject IStringLocalizer<TIAMResources> localizer
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
|
@inject IServiceProviderDataService ServiceProviderDataService
|
||||||
|
|
||||||
<!--div class="text-center m-5">
|
<!--div class="text-center m-5">
|
||||||
<h1>Service management</h1>
|
<h1>Service management</h1>
|
||||||
<h2 style="font-size:small">Manage your services here!</h2>
|
<h2 style="font-size:small">Manage your services here!</h2>
|
||||||
</!--div-->
|
</!--div-->
|
||||||
|
|
||||||
<!--div class="container"-->
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class=" col-12">
|
<div class=" col-12">
|
||||||
|
<Animation Effect="@Effect.FadeInUp" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||||
|
<div class="card">
|
||||||
<div class="d-flex flex-column mb-4 pb-2">
|
<div class="d-flex flex-column mb-4 pb-2">
|
||||||
<div class="align-self-end pl-2 pb-2">
|
<div class="align-self-end pl-2 pb-2">
|
||||||
<DxButton Text="Column Chooser"
|
<DxButton Text="Column Chooser"
|
||||||
|
|
@ -25,76 +31,170 @@
|
||||||
IconCssClass="btn-column-chooser"
|
IconCssClass="btn-column-chooser"
|
||||||
Click="ColumnChooserButton_Click" />
|
Click="ColumnChooserButton_Click" />
|
||||||
</div>
|
</div>
|
||||||
<DxGrid @ref="Grid"
|
<ProductGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" GetAllTag="SignalRTags.GetAllUserProductMappings"></ProductGridComponent>
|
||||||
Data="_productWizardModels"
|
|
||||||
PageSize="8"
|
|
||||||
KeyFieldName="Id"
|
|
||||||
ValidationEnabled="false"
|
|
||||||
CustomizeElement="Grid_CustomizeElement"
|
|
||||||
CustomizeEditModel="Grid_CustomizeEditModel"
|
|
||||||
EditModelSaving="Grid_EditModelSaving"
|
|
||||||
DataItemDeleting="Grid_DataItemDeleting"
|
|
||||||
EditMode="GridEditMode.EditForm"
|
|
||||||
ColumnResizeMode="GridColumnResizeMode.ColumnsContainer"
|
|
||||||
KeyboardNavigationEnabled="true"
|
|
||||||
ShowFilterRow="true">
|
|
||||||
<Columns>
|
|
||||||
<DxGridCommandColumn Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
|
||||||
|
|
||||||
<DxGridDataColumn FieldName="Id" MinWidth="80" Width="20%" Visible="false" />
|
|
||||||
<DxGridDataColumn FieldName="ServiceProviderId" MinWidth="80" Width="20%" Visible="false" />
|
|
||||||
<DxGridDataColumn FieldName="Name" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="20%">
|
|
||||||
<CellDisplayTemplate>
|
|
||||||
@{
|
|
||||||
var keyField = context.Value;
|
|
||||||
<a class="d-block text-left" href="transferdetails">@context.Value</a>
|
|
||||||
}
|
|
||||||
</CellDisplayTemplate>
|
|
||||||
</DxGridDataColumn>
|
|
||||||
<DxGridDataColumn FieldName="Description" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="20%" />
|
|
||||||
<DxGridDataColumn FieldName="Price" MinWidth="80" Width="20%" />
|
|
||||||
<DxGridDataColumn FieldName="JsonDetails" MinWidth="80" Width="20%" />
|
|
||||||
|
|
||||||
|
|
||||||
</Columns>
|
|
||||||
|
|
||||||
<EditFormTemplate Context="EditFormContext">
|
|
||||||
@{
|
|
||||||
var transfer = (TransferDestinationWizardModel)EditFormContext.EditModel;
|
|
||||||
}
|
|
||||||
<DxFormLayout CssClass="w-100">
|
|
||||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationName) ColSpanMd="6">
|
|
||||||
@EditFormContext.GetEditor("Name")
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Destination) ColSpanMd="6">
|
|
||||||
@EditFormContext.GetEditor("Destination")
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationAddress) ColSpanMd="6">
|
|
||||||
@EditFormContext.GetEditor("AddressString")
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price) ColSpanMd="6">
|
|
||||||
@EditFormContext.GetEditor("Price")
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
|
|
||||||
</DxFormLayout>
|
|
||||||
</EditFormTemplate>
|
|
||||||
|
|
||||||
</DxGrid>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</Animation>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class=" col-12 col-xl-6">
|
<div class=" col-12 col-xl-6">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!--/div-->
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
|
private LoggerClient<ManageProducts> _logger;
|
||||||
|
|
||||||
|
IGrid Grid { get; set; }
|
||||||
|
private List<ProductWizardModel> ProductWizardModels { get; set; } = [];
|
||||||
|
|
||||||
|
public void ColumnChooserButton_Click()
|
||||||
|
{
|
||||||
|
Grid.ShowColumnChooser();
|
||||||
|
}
|
||||||
|
|
||||||
|
//public ProductWizardModel productWizardModel = new();
|
||||||
|
|
||||||
|
|
||||||
|
public MessageWizardModel MessageWizardModel = new();
|
||||||
|
|
||||||
|
|
||||||
|
//List<ProductWizardModel> _productArray =
|
||||||
|
//[
|
||||||
|
// new ProductWizardModel(new Company(), ProductType.Hotel, "XY hotel", "XYHotel description is here ", 10.0f, ""),
|
||||||
|
// new ProductWizardModel(new Company(), ProductType.Hotel, "XY hotel", "XYHotel description is here ", 10.0f, ""),
|
||||||
|
// new ProductWizardModel(new Company(), ProductType.Hotel, "XY hotel", "XYHotel description is here ", 10.0f, "")
|
||||||
|
//];
|
||||||
|
|
||||||
|
private readonly List<ProductWizardModel> _productWizardModels = [];
|
||||||
|
|
||||||
|
void CancelCreateClick()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void EulaPopupClosed()
|
||||||
|
{
|
||||||
|
//cancel clicked
|
||||||
|
}
|
||||||
|
|
||||||
|
void EulaPopupClosing(PopupClosingEventArgs args)
|
||||||
|
{
|
||||||
|
//myModel = new TransferWizardModel();
|
||||||
|
MessageWizardModel = new MessageWizardModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
public async Task SubmitForm(object Result)
|
||||||
|
{
|
||||||
|
//await WizardProcessor.ProcessWizardAsync(Result.GetType(), Result);
|
||||||
|
_logger.Info($"Submitted nested form: {Result.GetType().FullName}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
{
|
||||||
|
//if (firstRender)
|
||||||
|
// await Grid.StartEditRowAsync(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
{
|
||||||
|
if (!e.IsNew) return;
|
||||||
|
|
||||||
|
var newProduct = (ProductWizardModel)e.EditModel;
|
||||||
|
newProduct.Id = Guid.NewGuid();
|
||||||
|
newProduct.Name = "ghjgkg hkgh ghjkghgkjgh";
|
||||||
|
newProduct.Description = "ghjgkg hkgh ghjkghgkjgh";
|
||||||
|
newProduct.ProductType = ProductType.NotDefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e)
|
||||||
|
{
|
||||||
|
var productWizardModel = (ProductWizardModel)e.EditModel;
|
||||||
|
|
||||||
|
if (e.IsNew)
|
||||||
|
{
|
||||||
|
//add mymodel to transferData array
|
||||||
|
ProductWizardModels.Add(productWizardModel);
|
||||||
|
|
||||||
|
//add new orderData to orderData array
|
||||||
|
_logger.Info("New orderData added");
|
||||||
|
//await NwindDataService.InsertEmployeeAsync((EditableEmployee)e.EditModel);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Info("orderData updated");
|
||||||
|
//modify transferData where transferData.Id == e.EditModel.Id
|
||||||
|
//get transfer from TransferData by Id
|
||||||
|
|
||||||
|
foreach (var productToModify in ProductWizardModels)
|
||||||
|
{
|
||||||
|
if (productToModify.Id != productWizardModel.Id) continue;
|
||||||
|
|
||||||
|
productToModify.ProductType = productWizardModel.ProductType;
|
||||||
|
productToModify.Name = productWizardModel.Name;
|
||||||
|
productToModify.Description = productWizardModel.Description;
|
||||||
|
productToModify.Price = productWizardModel.Price;
|
||||||
|
productToModify.JsonDetails = productWizardModel.JsonDetails;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//await NwindDataService.UpdateEmployeeAsync((EditableEmployee)e.DataItem, (EditableEmployee)e.EditModel);
|
||||||
|
|
||||||
|
//TODO: ne a teljes grid-et refresh-eljük, elég lenne csak az adott sort! - J.
|
||||||
|
await UpdateDataAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e)
|
||||||
|
{
|
||||||
|
//await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
|
||||||
|
//remove orderData from orderData array
|
||||||
|
_logger.Info("orderData deleted");
|
||||||
|
//await UpdateDataAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task UpdateDataAsync()
|
||||||
|
{
|
||||||
|
//refresh grid
|
||||||
|
await FillGridDataSource();
|
||||||
|
|
||||||
|
_logger.Info("orderData grid refreshed");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
base.OnInitialized();
|
||||||
|
|
||||||
|
_logger = new LoggerClient<ManageProducts>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
await FillGridDataSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task FillGridDataSource()
|
||||||
|
{
|
||||||
|
var productForServiceProcvider = await ServiceProviderDataService.GetProductsForServiceProviderAsync(Guid.Parse("3587F169-683C-4EEE-BCB5-E8D57F8C6DCE"));
|
||||||
|
|
||||||
|
foreach (var item in productForServiceProcvider)
|
||||||
|
{
|
||||||
|
_productWizardModels.Add(new ProductWizardModel(item.ServiceProvider, item.ProductType, item.Name, item.Description, item.Price, item.JsonDetails));
|
||||||
|
|
||||||
|
_logger.DetailConditional($"_productWizardModels add: {item.Name}");
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.Info($"_productWizardModels: {_productWizardModels.Count}");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,164 +0,0 @@
|
||||||
using DevExpress.Blazor;
|
|
||||||
using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
|
||||||
using TIAMWebApp.Shared.Application.Interfaces;
|
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using TIAM.Core.Enums;
|
|
||||||
using TIAMWebApp.Shared.Application.Utility;
|
|
||||||
|
|
||||||
namespace TIAMSharedUI.Pages.User.SysAdmins
|
|
||||||
{
|
|
||||||
public partial class ManageProducts :ComponentBase
|
|
||||||
{
|
|
||||||
private LoggerClient<ManageProducts> _logger;
|
|
||||||
|
|
||||||
IGrid Grid { get; set; }
|
|
||||||
private List<ProductWizardModel> ProductWizardModels { get; set; } = [];
|
|
||||||
|
|
||||||
public void ColumnChooserButton_Click()
|
|
||||||
{
|
|
||||||
Grid.ShowColumnChooser();
|
|
||||||
}
|
|
||||||
|
|
||||||
//public ProductWizardModel productWizardModel = new();
|
|
||||||
|
|
||||||
|
|
||||||
public MessageWizardModel MessageWizardModel = new();
|
|
||||||
|
|
||||||
[Inject]
|
|
||||||
public IServiceProviderDataService ServiceProviderDataService { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
//List<ProductWizardModel> _productArray =
|
|
||||||
//[
|
|
||||||
// new ProductWizardModel(new Company(), ProductType.Hotel, "XY hotel", "XYHotel description is here ", 10.0f, ""),
|
|
||||||
// new ProductWizardModel(new Company(), ProductType.Hotel, "XY hotel", "XYHotel description is here ", 10.0f, ""),
|
|
||||||
// new ProductWizardModel(new Company(), ProductType.Hotel, "XY hotel", "XYHotel description is here ", 10.0f, "")
|
|
||||||
//];
|
|
||||||
|
|
||||||
private readonly List<ProductWizardModel> _productWizardModels = [];
|
|
||||||
|
|
||||||
void CancelCreateClick()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
void EulaPopupClosed()
|
|
||||||
{
|
|
||||||
//cancel clicked
|
|
||||||
}
|
|
||||||
|
|
||||||
void EulaPopupClosing(PopupClosingEventArgs args)
|
|
||||||
{
|
|
||||||
//myModel = new TransferWizardModel();
|
|
||||||
MessageWizardModel = new MessageWizardModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
public async Task SubmitForm(object Result)
|
|
||||||
{
|
|
||||||
//await WizardProcessor.ProcessWizardAsync(Result.GetType(), Result);
|
|
||||||
_logger.Info($"Submitted nested form: {Result.GetType().FullName}");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
||||||
{
|
|
||||||
//if (firstRender)
|
|
||||||
// await Grid.StartEditRowAsync(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
|
||||||
{
|
|
||||||
if (!e.IsNew) return;
|
|
||||||
|
|
||||||
var newProduct = (ProductWizardModel)e.EditModel;
|
|
||||||
newProduct.Id = Guid.NewGuid();
|
|
||||||
newProduct.Name = "ghjgkg hkgh ghjkghgkjgh";
|
|
||||||
newProduct.Description = "ghjgkg hkgh ghjkghgkjgh";
|
|
||||||
newProduct.ProductType = ProductType.NotDefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e)
|
|
||||||
{
|
|
||||||
var productWizardModel = (ProductWizardModel)e.EditModel;
|
|
||||||
|
|
||||||
if (e.IsNew)
|
|
||||||
{
|
|
||||||
//add mymodel to transferData array
|
|
||||||
ProductWizardModels.Add(productWizardModel);
|
|
||||||
|
|
||||||
//add new orderData to orderData array
|
|
||||||
_logger.Info("New orderData added");
|
|
||||||
//await NwindDataService.InsertEmployeeAsync((EditableEmployee)e.EditModel);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.Info("orderData updated");
|
|
||||||
//modify transferData where transferData.Id == e.EditModel.Id
|
|
||||||
//get transfer from TransferData by Id
|
|
||||||
|
|
||||||
foreach (var productToModify in ProductWizardModels)
|
|
||||||
{
|
|
||||||
if (productToModify.Id != productWizardModel.Id) continue;
|
|
||||||
|
|
||||||
productToModify.ProductType = productWizardModel.ProductType;
|
|
||||||
productToModify.Name = productWizardModel.Name;
|
|
||||||
productToModify.Description = productWizardModel.Description;
|
|
||||||
productToModify.Price = productWizardModel.Price;
|
|
||||||
productToModify.JsonDetails = productWizardModel.JsonDetails;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//await NwindDataService.UpdateEmployeeAsync((EditableEmployee)e.DataItem, (EditableEmployee)e.EditModel);
|
|
||||||
|
|
||||||
//TODO: ne a teljes grid-et refresh-eljük, elég lenne csak az adott sort! - J.
|
|
||||||
await UpdateDataAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e)
|
|
||||||
{
|
|
||||||
//await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
|
|
||||||
//remove orderData from orderData array
|
|
||||||
_logger.Info("orderData deleted");
|
|
||||||
//await UpdateDataAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task UpdateDataAsync()
|
|
||||||
{
|
|
||||||
//refresh grid
|
|
||||||
await FillGridDataSource();
|
|
||||||
|
|
||||||
_logger.Info("orderData grid refreshed");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
base.OnInitialized();
|
|
||||||
|
|
||||||
_logger = new LoggerClient<ManageProducts>(LogWriters.ToArray());
|
|
||||||
|
|
||||||
await FillGridDataSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task FillGridDataSource()
|
|
||||||
{
|
|
||||||
var productForServiceProcvider = await ServiceProviderDataService.GetProductsForServiceProviderAsync(Guid.Parse("3587F169-683C-4EEE-BCB5-E8D57F8C6DCE"));
|
|
||||||
|
|
||||||
foreach (var item in productForServiceProcvider)
|
|
||||||
{
|
|
||||||
_productWizardModels.Add(new ProductWizardModel(item.ServiceProvider, item.ProductType, item.Name, item.Description, item.Price, item.JsonDetails));
|
|
||||||
|
|
||||||
_logger.DetailConditional($"_productWizardModels add: {item.Name}");
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.Info($"_productWizardModels: {_productWizardModels.Count}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,179 @@
|
||||||
|
@using TIAM.Entities.Products
|
||||||
|
@using TIAM.Entities.ServiceProviders
|
||||||
|
@using TIAM.Entities.Transfers
|
||||||
|
@using TIAM.Entities.Drivers
|
||||||
|
@using TIAM.Entities.Users
|
||||||
|
@using TIAM.Models.Dtos.Users
|
||||||
|
@using TIAM.Resources
|
||||||
|
@using TIAM.Services
|
||||||
|
@using TIAMWebApp.Shared.Application.Interfaces
|
||||||
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
|
@using AyCode.Services.Loggers
|
||||||
|
@using TIAM.Core.Loggers
|
||||||
|
@using Address = TIAM.Entities.Addresses.Address
|
||||||
|
@using Profile = TIAM.Entities.Profiles.Profile
|
||||||
|
@using TIAMSharedUI.Shared.Components.Grids
|
||||||
|
@using TIAMSharedUI.Pages.Components.EditComponents
|
||||||
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
|
@using AyCode.Interfaces.Addresses
|
||||||
|
@using AyCode.Core
|
||||||
|
@inject IStringLocalizer<TIAMResources> Localizer
|
||||||
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
|
|
||||||
|
<ProductGrid @ref="_productGrid"
|
||||||
|
ContextIds="new[] {ContextId}"
|
||||||
|
DataSource="ParentData?.Products ?? []"
|
||||||
|
GetAllMessageTag="GetAllTag"
|
||||||
|
Logger="_logger"
|
||||||
|
SignalRClient="AdminSignalRClient"
|
||||||
|
OnGridEditModelSaving="DataItemSaving"
|
||||||
|
OnGridItemDeleting="DataItemDeleting"
|
||||||
|
OnGridItemChanged="DataItemChanged"
|
||||||
|
TextWrapEnabled="false"
|
||||||
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
|
KeyFieldName="Id"
|
||||||
|
ValidationEnabled="false"
|
||||||
|
EditMode="GridEditMode.EditForm"
|
||||||
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode">
|
||||||
|
<Columns>
|
||||||
|
<DxGridCommandColumn NewButtonVisible="true" Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
|
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N"/>
|
||||||
|
|
||||||
|
<DxGridDataColumn FieldName="@nameof(Product.ServiceProvider.Name)" Caption="Company name" />
|
||||||
|
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductName) FieldName="Name" SortIndex="0"/>
|
||||||
|
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductType) FieldName="ProductType" Width="130" />
|
||||||
|
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.Price) FieldName="Price" Width="100" />
|
||||||
|
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductDescription) FieldName="Description" />
|
||||||
|
</Columns>
|
||||||
|
<DetailRowTemplate>
|
||||||
|
<DxTabs>
|
||||||
|
<DxTabPage Text="Permissions">
|
||||||
|
<UserProductMappingGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Never" ContextIds="new [] {((Product)context.DataItem).Id}" GetAllTag="SignalRTags.GetUserProductMappingsByProductId">
|
||||||
|
</UserProductMappingGridComponent>
|
||||||
|
</DxTabPage>
|
||||||
|
<DxTabPage Text="Profile">
|
||||||
|
<ProfileGridComponent ParentData="((Product)context.DataItem)" KeyboardNavigationEnabled="true" />
|
||||||
|
</DxTabPage>
|
||||||
|
</DxTabs>
|
||||||
|
</DetailRowTemplate>
|
||||||
|
<EditFormTemplate Context="editFormContext">
|
||||||
|
@{
|
||||||
|
var transfer2 = (Product)editFormContext.EditModel;
|
||||||
|
}
|
||||||
|
<DxFormLayout CssClass="w-100">
|
||||||
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductName) ColSpanMd="4">
|
||||||
|
@editFormContext.GetEditor("Name")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductType) ColSpanMd="4">
|
||||||
|
@editFormContext.GetEditor("ProductType")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.Price) ColSpanMd="4">
|
||||||
|
@editFormContext.GetEditor("Price")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductDescription) ColSpanMd="4">
|
||||||
|
@editFormContext.GetEditor("Description")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
</DxFormLayout>
|
||||||
|
</EditFormTemplate>
|
||||||
|
|
||||||
|
</ProductGrid>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public IProductsRelation? ParentData { get; set; } = null!;
|
||||||
|
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnGridEditModelSaving { get; set; }
|
||||||
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetProductsByContextId;
|
||||||
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
|
|
||||||
|
private ProductDetailGrid _productGrid = null!;
|
||||||
|
private LoggerClient<ProductDetailGridComponent> _logger = null!;
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
_logger = new LoggerClient<ProductDetailGridComponent>(LogWriters.ToArray());
|
||||||
|
//DataSource = new List<Address>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnParametersSetAsync()
|
||||||
|
{
|
||||||
|
// if (ParentData != null)
|
||||||
|
// {
|
||||||
|
// productList.AddRange(ParentData.Products);
|
||||||
|
// }
|
||||||
|
// else if (ContextId != null)
|
||||||
|
// {
|
||||||
|
// //_productGrid.ContextIds = new Guid[1];
|
||||||
|
// //_productGrid.ContextIds[0] = (Guid)ContextId;
|
||||||
|
// var data = await serviceProviderDataService.GetProductByIdAsync((Guid)ContextId);
|
||||||
|
// List<Product> result = new List<Product>();
|
||||||
|
// result.Add(data);
|
||||||
|
// _productGrid.DataSource = result;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
|
||||||
|
await base.OnParametersSetAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataItemChanged(GridDataItemChangedEventArgs<Product> args)
|
||||||
|
{
|
||||||
|
_logger.Debug($"Saving: {args.DataItem.Name}, {args.DataItem.ServiceProviderId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DataItemSaving(GridEditModelSavingEventArgs e)
|
||||||
|
{
|
||||||
|
await OnGridEditModelSaving.InvokeAsync(e);
|
||||||
|
|
||||||
|
if (e.Cancel) return;
|
||||||
|
|
||||||
|
var product = ((Product)e.EditModel);
|
||||||
|
|
||||||
|
if (e.IsNew)
|
||||||
|
{
|
||||||
|
_logger.Debug($"DataItemSaving");
|
||||||
|
|
||||||
|
// var profileId = Guid.NewGuid();
|
||||||
|
// product.Profile = new Profile(profileId, product.Name);
|
||||||
|
// product.ProfileId = profileId;
|
||||||
|
|
||||||
|
// var addressId = Guid.NewGuid();
|
||||||
|
// product.Profile.Address = new Address(addressId);
|
||||||
|
// product.Profile.AddressId = addressId;
|
||||||
|
|
||||||
|
//((Product)e.EditModel).UserProductMappings.Add(new UserProductMapping(Guid.NewGuid, ParentData.));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.Debug($"Saving: {product.Name}, {product.ServiceProviderId}");
|
||||||
|
|
||||||
|
//var result = serviceProviderDataService.CreateProductAsync((Product)e.EditModel);
|
||||||
|
//_logger.Debug($"saved product: {product.ServiceProviderId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataItemDeleting(GridDataItemDeletingEventArgs obj)
|
||||||
|
{
|
||||||
|
_logger.Debug($"DataItemDeleting");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
{
|
||||||
|
if (!e.IsNew) return;
|
||||||
|
|
||||||
|
var newProduct = (Product)e.EditModel;
|
||||||
|
newProduct.Id = Guid.NewGuid();
|
||||||
|
newProduct.Name = "Type a name";
|
||||||
|
newProduct.ServiceProviderId = (Guid)ContextId!;
|
||||||
|
newProduct.Price = 0;
|
||||||
|
newProduct.ProductType = TIAM.Core.Enums.ProductType.Hotel;
|
||||||
|
newProduct.Description = "Type a description";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
<DxMenuItem NavigateUrl="user/sysadmin" Text="Dashboard" />
|
<DxMenuItem NavigateUrl="user/sysadmin" Text="Dashboard" />
|
||||||
<DxMenuItem NavigateUrl="sysadmin/transfers" Text="Transfers" />
|
<DxMenuItem NavigateUrl="sysadmin/transfers" Text="Transfers" />
|
||||||
<DxMenuItem NavigateUrl="sysadmin/companies" Text="Companies" />
|
<DxMenuItem NavigateUrl="sysadmin/companies" Text="Companies" />
|
||||||
|
<DxMenuItem NavigateUrl="sysadmin/products" Text="Services" />
|
||||||
<DxMenuItem NavigateUrl="sysadmin/drivers" Text="Drivers" />
|
<DxMenuItem NavigateUrl="sysadmin/drivers" Text="Drivers" />
|
||||||
<DxMenuItem NavigateUrl="sysadmin/cars" Text="Cars" />
|
<DxMenuItem NavigateUrl="sysadmin/cars" Text="Cars" />
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue