Compare commits
9 Commits
c63a02fd4f
...
1e3690f7e8
| Author | SHA1 | Date |
|---|---|---|
|
|
1e3690f7e8 | |
|
|
4cf5a50a41 | |
|
|
9412a02d82 | |
|
|
0b042063af | |
|
|
422a1c0bab | |
|
|
02eed4a794 | |
|
|
8fe1484279 | |
|
|
a843236736 | |
|
|
354a22d31d |
|
|
@ -75,4 +75,18 @@ public class SignalRTags : AcSignalRTags
|
||||||
public const int AddProduct = 74;
|
public const int AddProduct = 74;
|
||||||
public const int RemoveProduct = 75;
|
public const int RemoveProduct = 75;
|
||||||
public const int GetProductsById = 76;
|
public const int GetProductsById = 76;
|
||||||
|
public const int GetAllProducts = 77;
|
||||||
|
|
||||||
|
public const int CreateTransferDestination = 80;
|
||||||
|
public const int UpdateTransferDestination = 81;
|
||||||
|
public const int DeleteTransferDestination = 82; //set permissions to 0
|
||||||
|
public const int GetAllTransferDestinations = 83;
|
||||||
|
|
||||||
|
public const int CreateTransferDestinationToProduct = 90;
|
||||||
|
public const int UpdateTransferDestinationToProduct = 91;
|
||||||
|
public const int DeleteTransferDestinationToProduct = 92; //set permissions to 0
|
||||||
|
public const int GetAllTransferDestinationToProducts = 93;
|
||||||
|
public const int GetTransferDestinationToProductByProductId = 94;
|
||||||
|
public const int GetTransferDestinationToProductByTransferDestinationId = 95;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,100 +1,193 @@
|
||||||
@* 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="d-flex flex-column mb-4 pb-2">
|
<div class="card">
|
||||||
<div class="align-self-end pl-2 pb-2">
|
<div class="d-flex flex-column mb-4 pb-2">
|
||||||
<DxButton Text="Column Chooser"
|
<div class="align-self-end pl-2 pb-2">
|
||||||
RenderStyle="ButtonRenderStyle.Secondary"
|
<DxButton Text="Column Chooser"
|
||||||
IconCssClass="btn-column-chooser"
|
RenderStyle="ButtonRenderStyle.Secondary"
|
||||||
Click="ColumnChooserButton_Click" />
|
IconCssClass="btn-column-chooser"
|
||||||
|
Click="ColumnChooserButton_Click" />
|
||||||
|
</div>
|
||||||
|
<ProductGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" GetAllTag="SignalRTags.GetAllProducts"></ProductGridComponent>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<DxGrid @ref="Grid"
|
</Animation>
|
||||||
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 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();
|
||||||
|
|
||||||
|
|
||||||
|
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}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -234,6 +234,7 @@
|
||||||
{
|
{
|
||||||
_companyToSetOwner.OwnerId = userModelDto.Id;
|
_companyToSetOwner.OwnerId = userModelDto.Id;
|
||||||
var result = await serviceProviderDataService.UpdateServiceProviderAsync(_companyToSetOwner);
|
var result = await serviceProviderDataService.UpdateServiceProviderAsync(_companyToSetOwner);
|
||||||
|
_setOwnerPopupVisible = false;
|
||||||
_companyToSetOwner = null;
|
_companyToSetOwner = null;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -318,7 +319,7 @@
|
||||||
_logger.Detail($"OnProductGridItemSaving");
|
_logger.Detail($"OnProductGridItemSaving");
|
||||||
|
|
||||||
var company = _productDetailGridComponent!.ParentData as Company;
|
var company = _productDetailGridComponent!.ParentData as Company;
|
||||||
if (company == null || company.OwnerId.IsNullOrEmpty())
|
if (company == null || company.OwnerId.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
_logger.Error($"OnProductGridItemSaving; company == null || company.OwnerId.IsNullOrEmpty(); company.OwnerId: {company?.OwnerId}");
|
_logger.Error($"OnProductGridItemSaving; company == null || company.OwnerId.IsNullOrEmpty(); company.OwnerId: {company?.OwnerId}");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,168 @@
|
||||||
|
@page "/sysadmin/prices"
|
||||||
|
@using BlazorAnimation
|
||||||
|
@using TIAM.Models.Dtos.Users
|
||||||
|
@using TIAM.Resources
|
||||||
|
@using TIAM.Services
|
||||||
|
@using TIAMSharedUI.Pages.Components
|
||||||
|
@using TIAMSharedUI.Shared
|
||||||
|
@using TIAMWebApp.Shared.Application.Interfaces
|
||||||
|
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||||
|
@using TIAMWebApp.Shared.Application.Models.PageModels
|
||||||
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
|
@using AyCode.Services.Loggers
|
||||||
|
@layout AdminLayout
|
||||||
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
|
@inject IStringLocalizer<TIAMResources> Localizer
|
||||||
|
@inject ISessionService SessionService
|
||||||
|
@inject IWizardProcessor WizardProcessor
|
||||||
|
@inject IUserDataService UserDataService
|
||||||
|
<PageTitle>User permissions</PageTitle>
|
||||||
|
|
||||||
|
<div class="text-center m-5">
|
||||||
|
<h1>User permissions</h1>
|
||||||
|
<h2 style="font-size:small">Manage transfers here!</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<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="align-self-end pl-2 pb-2">
|
||||||
|
<DxButton Text="Column Chooser"
|
||||||
|
RenderStyle="ButtonRenderStyle.Secondary"
|
||||||
|
IconCssClass="btn-column-chooser"
|
||||||
|
Click="ColumnChooserButton_Click" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<TransferDestinationToProductGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" GetAllTag="SignalRTags.GetAllTransferDestinationToProducts"></TransferDestinationToProductGridComponent>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Animation>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class=" col-12 col-xl-6">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private LoggerClient<ManageUserProductMappings> _logger;
|
||||||
|
//public UserModelDtoDetail UserModelDtoDetail = new();
|
||||||
|
|
||||||
|
|
||||||
|
bool PopupVisible { get; set; }
|
||||||
|
|
||||||
|
IGrid Grid { get; set; }
|
||||||
|
//object? MasterGridData { get; set; }
|
||||||
|
bool AutoCollapseDetailRow { get; set; }
|
||||||
|
|
||||||
|
public List<string> IgnoreList =
|
||||||
|
[
|
||||||
|
"ReceiverEmailAddress",
|
||||||
|
"ReceiverId",
|
||||||
|
"SenderEmailAddress",
|
||||||
|
"SenderId",
|
||||||
|
"ContextId"
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.ElementType == GridElementType.DataRow && e.VisibleIndex % 2 == 1)
|
||||||
|
{
|
||||||
|
e.CssClass = "bg-alt";
|
||||||
|
}
|
||||||
|
else if (e.ElementType == GridElementType.HeaderCell)
|
||||||
|
{
|
||||||
|
e.Style = "background-color: rgba(0, 0, 0, 0.08); font-style=bold";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
{
|
||||||
|
if (!e.IsNew) return;
|
||||||
|
|
||||||
|
var userEditModel = (UserModelDtoDetail)e.EditModel; //TODO not valid cast
|
||||||
|
userEditModel.Id = Guid.NewGuid();
|
||||||
|
|
||||||
|
userEditModel.UserDto = new UserDtoDetail
|
||||||
|
{
|
||||||
|
AffiliateId = Guid.NewGuid(),
|
||||||
|
EmailAddress = "",
|
||||||
|
PhoneNumber = ""
|
||||||
|
};
|
||||||
|
|
||||||
|
userEditModel.ProfileDto = new TIAM.Entities.Profiles.Profile
|
||||||
|
{
|
||||||
|
Name = "New user"
|
||||||
|
};
|
||||||
|
|
||||||
|
userEditModel.Products = [];
|
||||||
|
userEditModel.ServiceProviders = [];
|
||||||
|
userEditModel.UserProductMappings = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e)
|
||||||
|
{
|
||||||
|
var userModelDtoDetail = ((UserModelDtoDetail)e.EditModel);
|
||||||
|
|
||||||
|
if (e.IsNew)
|
||||||
|
{
|
||||||
|
//add new orderData to orderData array
|
||||||
|
var registration = new RegistrationModel();
|
||||||
|
//TODO: Refractor to userDataService
|
||||||
|
|
||||||
|
var random = new Random();
|
||||||
|
const string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
||||||
|
var password = new string(Enumerable.Repeat(chars, 10)
|
||||||
|
.Select(s => s[random.Next(s.Length)]).ToArray());
|
||||||
|
|
||||||
|
registration.Email = userModelDtoDetail.UserDto.EmailAddress;
|
||||||
|
registration.PhoneNumber = userModelDtoDetail.UserDto.PhoneNumber;
|
||||||
|
registration.Password = password;
|
||||||
|
registration.ReferralId = null;
|
||||||
|
|
||||||
|
await UserDataService.CreateGuestUser(registration);
|
||||||
|
_logger.Info("New user created added");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Info("orderData updated at id " + userModelDtoDetail.Id);
|
||||||
|
|
||||||
|
//await transferDataService.UpdateTransferAsync((TransferWizardModel)e.EditModel);
|
||||||
|
//modify transferData where transferData.Id == e.EditModel.Id
|
||||||
|
}
|
||||||
|
//get transfer from TransferData by Id
|
||||||
|
|
||||||
|
// foreach (var transferToModify in (List<Transfer>)TransferData)
|
||||||
|
// {
|
||||||
|
// myModel = (Transfer)e.EditModel;
|
||||||
|
|
||||||
|
// if (transferToModify.Id == myModel.Id)
|
||||||
|
// {
|
||||||
|
// //transferToModify.Driver = myModel.Driver;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
_logger = new LoggerClient<ManageUserProductMappings>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
base.OnInitialized();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ColumnChooserButton_Click()
|
||||||
|
{
|
||||||
|
Grid.ShowColumnChooser();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||||
@using AyCode.Services.Loggers
|
@using AyCode.Services.Loggers
|
||||||
@layout AdminLayout
|
@layout AdminLayout
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
|
||||||
|
|
||||||
@inject IStringLocalizer<TIAMResources> localizer
|
@inject IStringLocalizer<TIAMResources> localizer
|
||||||
<PageTitle>Transfers</PageTitle>
|
<PageTitle>Transfers</PageTitle>
|
||||||
|
|
@ -3,10 +3,11 @@ using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
||||||
using TIAMWebApp.Shared.Application.Interfaces;
|
using TIAMWebApp.Shared.Application.Interfaces;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using TIAMWebApp.Shared.Application.Utility;
|
using TIAMWebApp.Shared.Application.Utility;
|
||||||
|
using AyCode.Services.Loggers;
|
||||||
|
|
||||||
namespace TIAMSharedUI.Pages.User.SysAdmins
|
namespace TIAMSharedUI.Pages.User.SysAdmins
|
||||||
{
|
{
|
||||||
public partial class TransferDestinations
|
public partial class ManageTransferDestinations : ComponentBase
|
||||||
{
|
{
|
||||||
|
|
||||||
IGrid Grid { get; set; }
|
IGrid Grid { get; set; }
|
||||||
|
|
@ -22,6 +23,8 @@ namespace TIAMSharedUI.Pages.User.SysAdmins
|
||||||
[Inject]
|
[Inject]
|
||||||
public ITransferDataService TransferDataService { get; set; }
|
public ITransferDataService TransferDataService { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
public IEnumerable<IAcLogWriterClientBase> LogWriters { get; set; }
|
||||||
|
|
||||||
/*object? TransferData = new TransferDestinationWizardModel[]
|
/*object? TransferData = new TransferDestinationWizardModel[]
|
||||||
{
|
{
|
||||||
|
|
@ -34,9 +37,9 @@ namespace TIAMSharedUI.Pages.User.SysAdmins
|
||||||
new TransferDestinationWizardModel(Guid.NewGuid(), "Margaret Island", "Historical site in the heart of Budapest", "1138 Budapest, Margitsziget" ),
|
new TransferDestinationWizardModel(Guid.NewGuid(), "Margaret Island", "Historical site in the heart of Budapest", "1138 Budapest, Margitsziget" ),
|
||||||
};*/
|
};*/
|
||||||
|
|
||||||
private LoggerClient<TransferDestinations> _logger;
|
private LoggerClient<ManageTransferDestinations> _logger;
|
||||||
|
|
||||||
private readonly List<TransferDestinationWizardModel> _transferDestinationWizardModels = [];
|
public readonly List<TransferDestinationWizardModel> _transferDestinationWizardModels = [];
|
||||||
|
|
||||||
void CancelCreateClick()
|
void CancelCreateClick()
|
||||||
{
|
{
|
||||||
|
|
@ -64,11 +67,12 @@ namespace TIAMSharedUI.Pages.User.SysAdmins
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
//protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
//{
|
||||||
//if (firstRender)
|
// //if (firstRender)
|
||||||
// await Grid.StartEditRowAsync(0);
|
// // await Grid.StartEditRowAsync(0);
|
||||||
}
|
// throw new NotImplementedException();
|
||||||
|
//}
|
||||||
|
|
||||||
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
@ -158,7 +162,7 @@ namespace TIAMSharedUI.Pages.User.SysAdmins
|
||||||
{
|
{
|
||||||
base.OnInitialized();
|
base.OnInitialized();
|
||||||
|
|
||||||
_logger = new LoggerClient<TransferDestinations>(LogWriters.ToArray());
|
_logger = new LoggerClient<ManageTransferDestinations>(LogWriters.ToArray());
|
||||||
|
|
||||||
await FillGridDataSource();
|
await FillGridDataSource();
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,178 @@
|
||||||
|
@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"
|
||||||
|
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 ProductGrid _productGrid = null!;
|
||||||
|
private LoggerClient<ProductGridComponent> _logger = null!;
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
_logger = new LoggerClient<ProductGridComponent>(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.NewGuid();
|
||||||
|
newProduct.Price = 0;
|
||||||
|
newProduct.ProductType = TIAM.Core.Enums.ProductType.Hotel;
|
||||||
|
newProduct.Description = "Type a description";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,143 @@
|
||||||
|
@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 TIAMWebApp.Shared.Application.Interfaces
|
||||||
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
|
@using AyCode.Services.Loggers
|
||||||
|
@using TIAM.Core.Loggers
|
||||||
|
@using AyCode.Core
|
||||||
|
@using TIAMSharedUI.Shared.Components.Grids
|
||||||
|
@inject IServiceProviderDataService ServiceProviderDataService
|
||||||
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
|
<TransferDestinationToProductGrid
|
||||||
|
Logger="_logger"
|
||||||
|
SignalRClient="AdminSignalRClient"
|
||||||
|
ContextIds="ContextIds"
|
||||||
|
PageSize="5"
|
||||||
|
AutoExpandAllGroupRows="true"
|
||||||
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
|
KeyFieldName="Id"
|
||||||
|
ValidationEnabled="false"
|
||||||
|
EditMode="GridEditMode.EditForm"
|
||||||
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
ShowFilterRow="true">
|
||||||
|
<Columns>
|
||||||
|
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
|
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||||
|
<DxGridDataColumn FieldName="ProductId" />
|
||||||
|
<DxGridDataColumn FieldName="TransferDestinationId"/>
|
||||||
|
<DxGridDataColumn FieldName="Price" />
|
||||||
|
<DxGridDataColumn FieldName="Price2" />
|
||||||
|
<DxGridDataColumn FieldName="Price3" />
|
||||||
|
<DxGridDataColumn FieldName="ProductCommis" />
|
||||||
|
</Columns>
|
||||||
|
<DetailRowTemplate>
|
||||||
|
|
||||||
|
<DxTabs>
|
||||||
|
<DxTabPage Text="Partner">
|
||||||
|
|
||||||
|
</DxTabPage>
|
||||||
|
|
||||||
|
</DxTabs>
|
||||||
|
|
||||||
|
|
||||||
|
</DetailRowTemplate>
|
||||||
|
<EditFormTemplate Context="EditFormContext">
|
||||||
|
@{
|
||||||
|
var serviceProvider = (Company)EditFormContext.EditModel;
|
||||||
|
}
|
||||||
|
<DxFormLayout CssClass="w-100">
|
||||||
|
<DxFormLayoutItem Caption="Price" ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("Price")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption="Price2" ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("Price2")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption="Price3" ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("Price3")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
<DxFormLayoutItem Caption="Commission rate" ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("ProductCommis")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</DxFormLayout>
|
||||||
|
</EditFormTemplate>
|
||||||
|
|
||||||
|
</TransferDestinationToProductGrid>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public Guid? ContextId { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public int GetAllTag { get; set; }
|
||||||
|
|
||||||
|
public Guid[]? ContextIds = new Guid[1];
|
||||||
|
|
||||||
|
private LoggerClient<TransferDestinationToProductGridComponent> _logger = null!;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
_logger = new LoggerClient<TransferDestinationToProductGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
// ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract
|
||||||
|
//_detailGridData = UserModelDtoDetail.ServiceProviders ?? [];
|
||||||
|
//_availableServices = await ServiceProviderDataService.GetServiceProvidersAsync();
|
||||||
|
|
||||||
|
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnParametersSet()
|
||||||
|
{
|
||||||
|
ContextIds[0] = (Guid)ContextId!;
|
||||||
|
base.OnParametersSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
// void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
// {
|
||||||
|
// if (!e.IsNew) return;
|
||||||
|
|
||||||
|
// var newProductMapping = new UserProductMapping
|
||||||
|
// {
|
||||||
|
// ProductId = Guid.NewGuid(),
|
||||||
|
// UserId = UserModelDtoDetail.Id,
|
||||||
|
// Permissions = 1
|
||||||
|
// };
|
||||||
|
|
||||||
|
// e.EditModel = newProductMapping;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
||||||
|
// {
|
||||||
|
// if (e.IsNew)
|
||||||
|
// //add new orderData to orderData array
|
||||||
|
// _logger.Info("New orderData added");
|
||||||
|
// else
|
||||||
|
// _logger.Info("orderData updated");
|
||||||
|
|
||||||
|
// await UpdateDataAsync();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
|
||||||
|
// {
|
||||||
|
// //remove orderData from orderData array
|
||||||
|
// _logger.Info("orderData deleted");
|
||||||
|
// //await UpdateDataAsync();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// async Task UpdateDataAsync()
|
||||||
|
// {
|
||||||
|
// //refresh grid
|
||||||
|
// _logger.Info("orderData grid refreshed");
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using TIAM.Entities.Products;
|
||||||
|
using TIAM.Entities.Transfers;
|
||||||
|
using TIAM.Services;
|
||||||
|
|
||||||
|
namespace TIAMSharedUI.Shared.Components.Grids;
|
||||||
|
|
||||||
|
public class TransferDestinationToProductGrid : TiamGrid<TransferDestinationToProduct>
|
||||||
|
{
|
||||||
|
public TransferDestinationToProductGrid() : base()
|
||||||
|
{
|
||||||
|
GetAllMessageTag = SignalRTags.GetProductsByContextId;
|
||||||
|
AddMessageTag = SignalRTags.AddProduct;
|
||||||
|
UpdateMessageTag = SignalRTags.UpdateProduct;
|
||||||
|
RemoveMessageTag = SignalRTags.RemoveProduct;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||||
|
{
|
||||||
|
if (!IsFirstInitializeParameters)
|
||||||
|
{
|
||||||
|
//ShowFilterRow = true;
|
||||||
|
//ShowGroupPanel = true;
|
||||||
|
//AllowSort = false;
|
||||||
|
|
||||||
|
//etc...
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.SetParametersAsyncCore(parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,12 +11,15 @@
|
||||||
<DxMenuItem NavigateUrl="/" Text="Home" IconCssClass="menu-icon-home menu-icon" />
|
<DxMenuItem NavigateUrl="/" Text="Home" IconCssClass="menu-icon-home menu-icon" />
|
||||||
<DxMenuItem NavigateUrl="user/properties" Text="My companies" IconCssClass="menu-icon-home menu-icon" />
|
<DxMenuItem NavigateUrl="user/properties" Text="My companies" IconCssClass="menu-icon-home menu-icon" />
|
||||||
<DxMenuItem NavigateUrl="user/media" Text="Media" IconCssClass="menu-icon-home menu-icon" />
|
<DxMenuItem NavigateUrl="user/media" Text="Media" IconCssClass="menu-icon-home menu-icon" />
|
||||||
|
<DxMenuItem NavigateUrl="user/messages" Text="Media" IconCssClass="menu-icon-home menu-icon" />
|
||||||
|
|
||||||
<DxMenuItem Text="SysAdmin" IconCssClass="menu-icon-products menu-icon">
|
<DxMenuItem Text="SysAdmin" IconCssClass="menu-icon-products menu-icon">
|
||||||
<Items>
|
<Items>
|
||||||
<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/prices" Text="Partner prices" />
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -438,12 +438,13 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route(APIUrls.GetAllProductsRouteName)]
|
[Route(APIUrls.GetAllProductsRouteName)]
|
||||||
[Tags("In-Progress", "Product")]
|
[Tags("In-Progress", "Product")]
|
||||||
public Task<string> GetAllProducts()
|
[SignalR(SignalRTags.GetAllProducts)]
|
||||||
|
public async Task<string> GetAllProducts()
|
||||||
{
|
{
|
||||||
_logger.Info("GetAllProducts called");
|
_logger.Info("GetAllProducts called");
|
||||||
|
|
||||||
var products = adminDal.GetProductsJson();
|
var products = adminDal.GetProductsJson();
|
||||||
return Task.FromResult(products);
|
return products;
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue