SMall fixes, driver name in transfer grid
This commit is contained in:
parent
1a2dc36df3
commit
956abfcc03
|
|
@ -0,0 +1,49 @@
|
||||||
|
@using System.Text
|
||||||
|
@using TIAM.Entities.Transfers
|
||||||
|
@using TIAM.Services
|
||||||
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
|
@inject AdminSignalRClient _adminSignalRClient;
|
||||||
|
|
||||||
|
<p>@DriverName</p>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter] public Guid TransferId { get; set; }
|
||||||
|
private string DriverName = "";
|
||||||
|
|
||||||
|
protected override async Task OnParametersSetAsync()
|
||||||
|
{
|
||||||
|
|
||||||
|
var keyItemTransferToDriver = await _adminSignalRClient.GetByIdAsync<List<TransferToDriver>>(SignalRTags.GetTransferDriversByTransferId, TransferId);
|
||||||
|
if(keyItemTransferToDriver != null && keyItemTransferToDriver.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var driver in keyItemTransferToDriver)
|
||||||
|
{
|
||||||
|
if (driver.UserProductMapping != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(driver.UserProductMapping.User != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (driver.UserProductMapping.User.Profile != null)
|
||||||
|
{
|
||||||
|
if(!string.IsNullOrEmpty(driver.UserProductMapping.User.Profile.Name))
|
||||||
|
{
|
||||||
|
DriverName = driver.UserProductMapping.User.Profile.Name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DriverName = driver.LicencePlate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DriverName = "No driver assigned yet";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -155,7 +155,7 @@ else
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<p class="text-muted">Status on: <span class="text-body">@DateTime.Now.ToString("hh:mm tt"), @DateTime.Today.ToString("MMMM dd, yyyy")</span></p>
|
<p class="text-muted">Status on: <span class="text-body">@DateTime.Now.ToString("hh:mm tt"), @DateTime.Today.ToString("MMMM dd, yyyy")</span></p>
|
||||||
<h5 class="text-muted">@TransferStatusModel.GetStatusModel(_transfer.TransferStatusType);</h5>
|
<h5 class="text-muted">@TransferStatusModel.GetStatusModel(_transfer.TransferStatusType).StatusName;</h5>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -524,8 +524,9 @@ else
|
||||||
private async Task UpdateTransferEventHandler(MouseEventArgs e, bool shouldRedirect = false)
|
private async Task UpdateTransferEventHandler(MouseEventArgs e, bool shouldRedirect = false)
|
||||||
{
|
{
|
||||||
var result = await UpdateTransfer(shouldRedirect);
|
var result = await UpdateTransfer(shouldRedirect);
|
||||||
|
_editMode = false;
|
||||||
if (result != null && shouldRedirect)
|
if (result != null && shouldRedirect)
|
||||||
navManager.NavigateTo("/mytransfers"); // Redirect to a list or another page after successful update
|
navManager.NavigateTo($"/mytransfers/{_transfer.Id}"); // Redirect to a list or another page after successful update
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CancelTransferEventHandler(MouseEventArgs e, bool shouldRedirect = false)
|
private async Task CancelTransferEventHandler(MouseEventArgs e, bool shouldRedirect = false)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
@using TIAM.Core.Enums
|
@using TIAM.Core.Enums
|
||||||
@using TIAM.Entities.Emails
|
@using TIAM.Entities.Emails
|
||||||
@using TIAM.Entities.Transfers
|
@using TIAM.Entities.Transfers
|
||||||
|
@using TIAM.Entities.Users
|
||||||
@using TIAM.Resources
|
@using TIAM.Resources
|
||||||
@using TIAMSharedUI.Pages.Components
|
@using TIAMSharedUI.Pages.Components
|
||||||
@using TIAMSharedUI.Shared
|
@using TIAMSharedUI.Shared
|
||||||
|
|
@ -22,6 +23,7 @@
|
||||||
@using DevExpress.Data.Filtering
|
@using DevExpress.Data.Filtering
|
||||||
@using TIAM.Entities.Emails
|
@using TIAM.Entities.Emails
|
||||||
@using TIAMSharedUI.Shared.Components.BaseComponents
|
@using TIAMSharedUI.Shared.Components.BaseComponents
|
||||||
|
@using TIAM.Services
|
||||||
@inherits UserBasePageComponent
|
@inherits UserBasePageComponent
|
||||||
@layout AdminLayout
|
@layout AdminLayout
|
||||||
@inject IWizardProcessor wizardProcessor
|
@inject IWizardProcessor wizardProcessor
|
||||||
|
|
@ -36,21 +38,21 @@
|
||||||
|
|
||||||
|
|
||||||
<DxPopup CssClass="popup-demo-events"
|
<DxPopup CssClass="popup-demo-events"
|
||||||
@bind-Visible="@_popupVisible"
|
@bind-Visible="@_popupVisible"
|
||||||
ShowFooter="true"
|
ShowFooter="true"
|
||||||
CloseOnEscape="true"
|
CloseOnEscape="true"
|
||||||
CloseOnOutsideClick="false"
|
CloseOnOutsideClick="false"
|
||||||
ShowCloseButton="false"
|
ShowCloseButton="false"
|
||||||
HeaderText="MessageBox"
|
HeaderText="MessageBox"
|
||||||
Closing="EulaPopupClosing"
|
Closing="EulaPopupClosing"
|
||||||
Closed="EulaPopupClosed">
|
Closed="EulaPopupClosed">
|
||||||
<BodyContentTemplate>
|
<BodyContentTemplate>
|
||||||
<InputWizard Data=@_messageWizardModel
|
<InputWizard Data=@_messageWizardModel
|
||||||
OnSubmit="SubmitForm"
|
OnSubmit="SubmitForm"
|
||||||
IgnoreReflection=@IgnoreList
|
IgnoreReflection=@IgnoreList
|
||||||
TitleResourceString="NewMessage"
|
TitleResourceString="NewMessage"
|
||||||
SubtitleResourceString="NewMessageSubtitle"
|
SubtitleResourceString="NewMessageSubtitle"
|
||||||
SubmitButtonText="@_localizer.GetString("ButtonSend")"></InputWizard>
|
SubmitButtonText="@_localizer.GetString("ButtonSend")"></InputWizard>
|
||||||
</BodyContentTemplate>
|
</BodyContentTemplate>
|
||||||
<FooterContentTemplate Context="Context">
|
<FooterContentTemplate Context="Context">
|
||||||
<div class="popup-demo-events-footer">
|
<div class="popup-demo-events-footer">
|
||||||
|
|
@ -73,26 +75,26 @@
|
||||||
<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"
|
||||||
RenderStyle="ButtonRenderStyle.Secondary"
|
RenderStyle="ButtonRenderStyle.Secondary"
|
||||||
IconCssClass="btn-column-chooser"
|
IconCssClass="btn-column-chooser"
|
||||||
Click="ColumnChooserButton_Click" />
|
Click="ColumnChooserButton_Click" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<TransferGrid @ref="_gridTransfer"
|
<TransferGrid @ref="_gridTransfer"
|
||||||
Logger="_logger"
|
Logger="_logger"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
FilterText="@_filterText"
|
FilterText="@_filterText"
|
||||||
OnDataSourceChanged="DataSourceChanged"
|
OnDataSourceChanged="DataSourceChanged"
|
||||||
OnGridItemChanging="DataSourceItemChanging"
|
OnGridItemChanging="DataSourceItemChanging"
|
||||||
OnGridItemChanged="DataSourceItemChanged"
|
OnGridItemChanged="DataSourceItemChanged"
|
||||||
OnGridItemDeleting="DataItemDeleting"
|
OnGridItemDeleting="DataItemDeleting"
|
||||||
OnGridEditModelSaving="DataItemSaving"
|
OnGridEditModelSaving="DataItemSaving"
|
||||||
CustomizeElement="Grid_CustomizeElement"
|
CustomizeElement="Grid_CustomizeElement"
|
||||||
CustomizeEditModel="Grid_CustomizeEditModel"
|
CustomizeEditModel="Grid_CustomizeEditModel"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
PageSize="13"
|
PageSize="13"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="true">
|
||||||
|
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="AcDomain.IsDeveloperVersion" Width="80" MinWidth="80" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="AcDomain.IsDeveloperVersion" Width="80" MinWidth="80" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
|
|
@ -117,8 +119,19 @@
|
||||||
<DxGridDataColumn FieldName="Price" Caption="Price" Width="70" CaptionAlignment="GridTextAlignment.Center" />
|
<DxGridDataColumn FieldName="Price" Caption="Price" Width="70" CaptionAlignment="GridTextAlignment.Center" />
|
||||||
<DxGridDataColumn FieldName="Revenue" Caption="Revenue" Width="70" CaptionAlignment="GridTextAlignment.Center" />
|
<DxGridDataColumn FieldName="Revenue" Caption="Revenue" Width="70" CaptionAlignment="GridTextAlignment.Center" />
|
||||||
<DxGridDataColumn FieldName="FullName" />
|
<DxGridDataColumn FieldName="FullName" />
|
||||||
|
<DxGridDataColumn Caption="Driver" Width="120">
|
||||||
|
<CellDisplayTemplate>
|
||||||
|
@{
|
||||||
|
var keyField = context.Value;
|
||||||
|
var keyItem = (Transfer)context.DataItem;
|
||||||
|
<DriverDisplayNameComponent TransferId="@keyItem.Id"></DriverDisplayNameComponent>
|
||||||
|
}
|
||||||
|
</CellDisplayTemplate>
|
||||||
|
|
||||||
|
</DxGridDataColumn>
|
||||||
<DxGridDataColumn FieldName="ContactPhone" Width="120" />
|
<DxGridDataColumn FieldName="ContactPhone" Width="120" />
|
||||||
<DxGridDataColumn FieldName="ContactEmail" Width="120" />
|
<DxGridDataColumn FieldName="ContactEmail" Width="120" />
|
||||||
|
|
||||||
<DxGridDataColumn FieldName="ContactEmail" Width="120">
|
<DxGridDataColumn FieldName="ContactEmail" Width="120">
|
||||||
<CellDisplayTemplate>
|
<CellDisplayTemplate>
|
||||||
@{
|
@{
|
||||||
|
|
@ -178,8 +191,8 @@
|
||||||
<DxFormLayoutItem Caption="Trip date:" ColSpanMd="3">
|
<DxFormLayoutItem Caption="Trip date:" ColSpanMd="3">
|
||||||
|
|
||||||
<DxDateEdit @bind-Date="@transfer2.Appointment"
|
<DxDateEdit @bind-Date="@transfer2.Appointment"
|
||||||
TimeSectionVisible="true"
|
TimeSectionVisible="true"
|
||||||
TimeSectionScrollPickerFormat="tt h m">
|
TimeSectionScrollPickerFormat="tt h m">
|
||||||
</DxDateEdit>
|
</DxDateEdit>
|
||||||
|
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
@ -198,6 +211,9 @@
|
||||||
<DxFormLayoutItem Caption="Price:" ColSpanMd="3">
|
<DxFormLayoutItem Caption="Price:" ColSpanMd="3">
|
||||||
@editFormContext.GetEditor("Price")
|
@editFormContext.GetEditor("Price")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption="Revenue:" ColSpanMd="3">
|
||||||
|
@editFormContext.GetEditor("Revenue")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
</EditFormTemplate>
|
</EditFormTemplate>
|
||||||
|
|
@ -205,9 +221,9 @@
|
||||||
<ToolbarTemplate>
|
<ToolbarTemplate>
|
||||||
<div>
|
<div>
|
||||||
<DxTagBox Data="@TransferStatusModel.AllStatuses.Values" Values="@_selectedCategories" @ref="_filterTag"
|
<DxTagBox Data="@TransferStatusModel.AllStatuses.Values" Values="@_selectedCategories" @ref="_filterTag"
|
||||||
ValuesChanged="(IEnumerable<TransferStatusModel> values) => TagBox_ValuesChanged(values)"
|
ValuesChanged="(IEnumerable<TransferStatusModel> values) => TagBox_ValuesChanged(values)"
|
||||||
ValueFieldName="StatusValue" TextFieldName="StatusName" NullText="Select status type..."
|
ValueFieldName="StatusValue" TextFieldName="StatusName" NullText="Select status type..."
|
||||||
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" aria-label="Select status type" />
|
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" aria-label="Select status type" />
|
||||||
</div>
|
</div>
|
||||||
</ToolbarTemplate>
|
</ToolbarTemplate>
|
||||||
</TransferGrid>
|
</TransferGrid>
|
||||||
|
|
@ -217,8 +233,8 @@
|
||||||
<DxTabPage Text="Calendar">
|
<DxTabPage Text="Calendar">
|
||||||
<div class="d-flex flex-column mb-4 pb-2">
|
<div class="d-flex flex-column mb-4 pb-2">
|
||||||
<DxScheduler @bind-StartDate="@StartDate"
|
<DxScheduler @bind-StartDate="@StartDate"
|
||||||
DataStorage="@_dataStorage"
|
DataStorage="@_dataStorage"
|
||||||
CssClass="w-100">
|
CssClass="w-100">
|
||||||
<DxSchedulerTimelineView Duration="@TimeSpan.FromHours(48)" CellMinWidth="80">
|
<DxSchedulerTimelineView Duration="@TimeSpan.FromHours(48)" CellMinWidth="80">
|
||||||
<Scales>
|
<Scales>
|
||||||
<DxSchedulerTimeScale Unit="@SchedulerTimeScaleUnit.Day" UnitCount="1"></DxSchedulerTimeScale>
|
<DxSchedulerTimeScale Unit="@SchedulerTimeScaleUnit.Day" UnitCount="1"></DxSchedulerTimeScale>
|
||||||
|
|
@ -273,6 +289,7 @@
|
||||||
DxSchedulerDataStorage _dataStorage = new();
|
DxSchedulerDataStorage _dataStorage = new();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SendMail(Transfer item)
|
void SendMail(Transfer item)
|
||||||
{
|
{
|
||||||
_logger.Info($"Preparing mail to {item.ContactEmail}, {item.Id}");
|
_logger.Info($"Preparing mail to {item.ContactEmail}, {item.Id}");
|
||||||
|
|
@ -317,7 +334,7 @@
|
||||||
CancelCreateClick();
|
CancelCreateClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
async void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -327,6 +344,8 @@
|
||||||
e.CssClass = "header-bold";
|
e.CssClass = "header-bold";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (e.ElementType != GridElementType.DataRow) return;
|
if (e.ElementType != GridElementType.DataRow) return;
|
||||||
|
|
||||||
var transferStatus = e.Grid?.GetRowValue(e.VisibleIndex, "TransferStatusType");
|
var transferStatus = e.Grid?.GetRowValue(e.VisibleIndex, "TransferStatusType");
|
||||||
|
|
@ -349,11 +368,16 @@
|
||||||
e.CssClass = "bg-cancel";
|
e.CssClass = "bg-cancel";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error($"Grid_CustomizeElement; {ex.Message}", ex);
|
_logger.Error($"Grid_CustomizeElement; {ex.Message}", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
|
@ -435,7 +459,7 @@
|
||||||
protected override Task OnInitializedAsync()
|
protected override Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<ManageTransfers>(_logWriters.ToArray());
|
_logger = new LoggerClient<ManageTransfers>(_logWriters.ToArray());
|
||||||
|
|
||||||
return base.OnInitializedAsync();
|
return base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -766,7 +766,11 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
_logger.Debug($"GetTransferDrivers called; transferId: {transferId}");
|
_logger.Debug($"GetTransferDrivers called; transferId: {transferId}");
|
||||||
|
|
||||||
var result = await _adminDal.GetTransferToDriversByTransferIdAsync(transferId);
|
var result = await _adminDal.GetTransferToDriversByTransferIdAsync(transferId);
|
||||||
return result;
|
if(result == null)
|
||||||
|
{
|
||||||
|
_logger.Warning("Null result", "GetTransferDrivers");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Authorize]
|
//[Authorize]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue