145 lines
6.4 KiB
Plaintext
145 lines
6.4 KiB
Plaintext
@using TIAM.Entities.Addresses
|
|
@using TIAM.Entities.Transfers
|
|
@using TIAM.Entities.Drivers
|
|
@using TIAM.Models.Dtos.Users
|
|
@using TIAM.Resources
|
|
@using TIAM.Services
|
|
@using TIAMSharedUI.Shared.Components.Grids
|
|
@using TIAMWebApp.Shared.Application.Interfaces
|
|
@using TIAMWebApp.Shared.Application.Utility
|
|
@using TIAM.Core.Loggers
|
|
@using AyCode.Core.Loggers
|
|
@using AyCode.Services.Loggers
|
|
@using TIAMWebApp.Shared.Application.Services
|
|
@using AyCode.Core.Enums
|
|
@using AyCode.Core.Extensions
|
|
@using AyCode.Core
|
|
@inject IUserDataService UserDataService
|
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
|
@inject AdminSignalRClient AdminSignalRClient;
|
|
@inject IStringLocalizer<TIAMResources> localizer
|
|
|
|
<TransferDestinationGrid @ref="_transferToDriversGrid"
|
|
Logger="_logger"
|
|
SignalRClient="AdminSignalRClient"
|
|
PageSize="8"
|
|
GetAllMessageTag="GetAllTag"
|
|
ValidationEnabled="false"
|
|
CustomizeEditModel="CustomizeEditModel"
|
|
EditMode="GridEditMode.EditForm"
|
|
ColumnResizeMode="GridColumnResizeMode.ColumnsContainer"
|
|
ShowFilterRow="true">
|
|
<Columns>
|
|
<DxGridCommandColumn Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
|
|
|
<DxGridDataColumn FieldName="Id" 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="Name" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="20%" />
|
|
<DxGridDataColumn FieldName="Description" MinWidth="80" Width="20%" />
|
|
<DxGridDataColumn FieldName="AddressString" MinWidth="80" Width="20%" />
|
|
<DxGridDataColumn FieldName="Price" MinWidth="80" />
|
|
<DxGridDataColumn FieldName="Price2" MinWidth="80" />
|
|
<DxGridDataColumn FieldName="Price3" MinWidth="80" />
|
|
<DxGridDataColumn FieldName="ProductCommis" MinWidth="80" />
|
|
<DxGridDataColumn FieldName="ExtraPrice" MinWidth="80" />
|
|
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
|
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
|
</Columns>
|
|
<DetailRowTemplate>
|
|
<DxTabs>
|
|
<DxTabPage Text="Prices">
|
|
<TransferDestinationToProductDetailGridComponent IsDestinationIdReadonly="true" GetAllTag="SignalRTags.GetTransferDestinationToProductsByTransferDestinationId" ContextIds="new [] {((TransferDestination)context.DataItem).Id}" />
|
|
</DxTabPage>
|
|
</DxTabs>
|
|
</DetailRowTemplate>
|
|
<EditFormTemplate Context="editFormContext">
|
|
@{
|
|
var transfer = (TransferDestination)editFormContext.EditModel;
|
|
}
|
|
<DxFormLayout CssClass="w-100">
|
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationName) ColSpanXs="12" ColSpanMd="6">
|
|
@editFormContext.GetEditor("Name")
|
|
</DxFormLayoutItem>
|
|
|
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationAddress) ColSpanXs="12" ColSpanMd="6">
|
|
@editFormContext.GetEditor("AddressString")
|
|
</DxFormLayoutItem>
|
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price) ColSpanXs="12" ColSpanMd="3">
|
|
@editFormContext.GetEditor("Price")
|
|
</DxFormLayoutItem>
|
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price2) ColSpanXs="12" ColSpanMd="3">
|
|
@editFormContext.GetEditor("Price2")
|
|
</DxFormLayoutItem>
|
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price3) ColSpanXs="12" ColSpanMd="3">
|
|
@editFormContext.GetEditor("Price3")
|
|
</DxFormLayoutItem>
|
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Commission) ColSpanXs="12" ColSpanMd="3">
|
|
@editFormContext.GetEditor("ProductCommis")
|
|
</DxFormLayoutItem>
|
|
<DxFormLayoutItem Caption="Extra" ColSpanXs="12" ColSpanMd="6">
|
|
@editFormContext.GetEditor("ExtraPrice")
|
|
</DxFormLayoutItem>
|
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationInfo) ColSpanXs="12" ColSpanMd="6">
|
|
@editFormContext.GetEditor("Description")
|
|
</DxFormLayoutItem>
|
|
|
|
</DxFormLayout>
|
|
</EditFormTemplate>
|
|
|
|
</TransferDestinationGrid>
|
|
|
|
@code {
|
|
[Parameter] public Guid? ContextId { get; set; }
|
|
[Parameter] public int GetAllTag { get; set; }
|
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
|
|
|
private TransferDestinationGrid _transferToDriversGrid = null!;
|
|
private LoggerClient<TransferDestinationGridComponent> _logger = null!;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
_logger = new LoggerClient<TransferDestinationGridComponent>(LogWriters.ToArray());
|
|
|
|
}
|
|
|
|
private void DataItemChanged(GridDataItemChangedEventArgs<TransferToDriver> args)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
private void DataItemSaving(GridEditModelSavingEventArgs obj)
|
|
{
|
|
_logger.Debug($"DataItemSaving");
|
|
|
|
}
|
|
|
|
private void DataItemDeleting(GridDataItemDeletingEventArgs obj)
|
|
{
|
|
_logger.Debug($"DataItemDeleting");
|
|
}
|
|
|
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
|
{
|
|
if (!e.IsNew) return;
|
|
|
|
var newDestination = (TransferDestination)e.EditModel;
|
|
newDestination.Id = Guid.NewGuid();
|
|
newDestination.Name = "Destination name";
|
|
newDestination.Description = "Type some description here";
|
|
newDestination.AddressString = "The address of the destination";
|
|
Guid addressId = Guid.NewGuid();
|
|
newDestination.Address = new Address();
|
|
newDestination.Address.Id = addressId;
|
|
newDestination.Address.AddressText = newDestination.AddressString;
|
|
|
|
}
|
|
} |