WIP
This commit is contained in:
parent
651f764384
commit
304ffd68ae
|
|
@ -9,8 +9,6 @@
|
|||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
|
||||
<h2>Edit Form</h2>
|
||||
|
||||
@if (isEditing)
|
||||
{
|
||||
<EditForm Model="@Data"
|
||||
|
|
@ -257,7 +255,7 @@ else
|
|||
else if (property.PropertyType == typeof(string) && string.Compare(attrList.CustomDataType, "FullName", true) == 0)
|
||||
{
|
||||
editor.OpenComponent<FullNameEditor>(j);
|
||||
editor.AddAttribute(j++, "NullText", "Please tell us your name.");
|
||||
editor.AddAttribute(j++, "NullText", "Full name");
|
||||
editor.AddAttribute(j++, "FirstNameChanged", EventCallback.Factory.Create<string>(this, result =>
|
||||
{
|
||||
_logger.DetailConditional($"FirstName changed to {result}");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
@using AyCode.Blazor.Components.Components
|
||||
<h3>
|
||||
<h4>
|
||||
@NullText
|
||||
</h3>
|
||||
</h4>
|
||||
|
||||
<AcTextBox @ref="firstNameTextField"
|
||||
TextChanged="@((newValue) => OnFirstNameChanged(newValue))"
|
||||
|
|
|
|||
|
|
@ -1,44 +1,179 @@
|
|||
@using BlazorAnimation
|
||||
@using TIAM.Core.Enums
|
||||
@using TIAM.Entities.Transfers
|
||||
@using TIAM.Services
|
||||
@using TIAMSharedUI.Shared.Components.Cards
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI
|
||||
@using TIAMWebApp.Shared.Application.Services
|
||||
@inject IServiceProviderDataService ServiceProviderDataService
|
||||
@inject AdminSignalRClient AdminSignalRClient;
|
||||
|
||||
<div class=" col-12 col-xl-3">
|
||||
<Animation Effect="@Effect.FadeIn" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<span class="fw-bold text-body">Transfers</span>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<!--h6 class="mb-0"> <a href="#">All settings</a> </h6-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body card-admin-body py-2 px-4">
|
||||
|
||||
</div>
|
||||
<div class="card-footer py-2 px-4">
|
||||
<div class="d-flex justify-content-between">
|
||||
|
||||
<a href="#!">Modify</a>
|
||||
<div class="border-start h-100"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Animation>
|
||||
<div class="e-card cw-480">
|
||||
<div class="e-main d-flex align-items-center">
|
||||
<div class="flex-shrink-0">
|
||||
<img class="e-photo" src="_content/TIAMSharedUI/images/defaultavatar_60.png" alt="" />
|
||||
</div>
|
||||
<div class="e-info flex-grow-1 ms-3">
|
||||
<div class="e-name">@($"{Context.FullName}")</div>
|
||||
<p class="e-title"><i class="fa-solid fa-at"></i> @Context.ContactEmail</p>
|
||||
<p class="e-title"><i class="fa-solid fa-phone"></i> @Context.ContactPhone</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="hr" />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
@RenderDetailsItem("fa-solid fa-location-dot", "From", Context.FromAddress)
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
@RenderDetailsItem("fa-solid fa-location-dot", "To", Context.ToAddress)
|
||||
</div>
|
||||
<hr class="hr" />
|
||||
<div class="col-12 col-md-4">
|
||||
@RenderDetailsItem("fa-solid fa-users", "Passengers", Context.PassengerCount.ToString())
|
||||
</div>
|
||||
<div class="col-12 col-md-4">
|
||||
@RenderDetailsItem("fa-solid fa-suitcase-rolling", "Luggage", Context.LuggageCount.ToString())
|
||||
</div>
|
||||
<div class="col-12 col-md-4">
|
||||
@RenderDetailsItem("fa-solid fa-hashtag", "Flight number", Context.FlightNumber)
|
||||
</div>
|
||||
<hr class="hr" />
|
||||
<div class="col-12">
|
||||
@RenderDetailsItem("fa-solid fa-hashtag", "Comment", Context.Comment)
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
@RenderDetailsItem("fa-solid fa-list-check", "Status", AllStatuses.FirstOrDefault(x => x.StatusValue == (byte)Context.TransferStatusType).StatusName)
|
||||
</div>
|
||||
<div class="col-8 col-md-4">
|
||||
<DxComboBox Data="@Statuses"
|
||||
@bind-Value="@CurrentStatusType"
|
||||
NullText="Select new status"
|
||||
CssClass="form-field"
|
||||
ValueFieldName="@nameof(TransferStatusModel.StatusValue)"
|
||||
TextFieldName="@nameof(TransferStatusModel.StatusName)" />
|
||||
|
||||
</div>
|
||||
<div class="col-4 col-md-2">
|
||||
<DxButton CssClass="btn btn-primary" Click="SaveStatus" Enabled="@isSaveActive"> Save</DxButton>
|
||||
</div>
|
||||
|
||||
|
||||
<p>@msg</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public Guid ContextID { get; set; }
|
||||
[Parameter] public Transfer Context { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> DataChanged { get; set; }
|
||||
|
||||
private static readonly IEnumerable<TransferStatusModel> Statuses = new[]
|
||||
{
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.DriverConfirmed), "Driver confirmed"),
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.DriverEnRoute), "Driver enroute"),
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.PassengerPickup), "Passenger in car"),
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.Finished), "Finished"),
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.UserCanceled), "User cancelled"),
|
||||
};
|
||||
|
||||
private static readonly List<TransferStatusModel> AllStatuses = new()
|
||||
{
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.OrderSubmitted), "Order submitted"),
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.OrderConfirmed), "Order confirmed"),
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.AssignedToDriver), "Assigned to driver"),
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.DriverConfirmed), "Driver confirmed"),
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.DriverEnRoute), "Driver enroute"),
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.PassengerPickup), "Passenger in car"),
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.Finished), "Finished"),
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.UserCanceled), "User cancelled"),
|
||||
new TransferStatusModel(Convert.ToByte(TransferStatusType.AdminDenied), "Admin cancelled")
|
||||
};
|
||||
|
||||
private TransferStatusModel _currentStatusType;
|
||||
public TransferStatusModel CurrentStatusType
|
||||
{
|
||||
get => _currentStatusType;
|
||||
set
|
||||
{
|
||||
if (_currentStatusType != value)
|
||||
{
|
||||
_currentStatusType = value;
|
||||
OnSelectedStatusChanged(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string msg;
|
||||
private bool isSaveActive = false;
|
||||
|
||||
void OnSelectedStatusChanged(TransferStatusModel status)
|
||||
{
|
||||
|
||||
if (status == null)
|
||||
{
|
||||
isSaveActive = false;
|
||||
msg = "Status is null";
|
||||
}
|
||||
else
|
||||
{
|
||||
isSaveActive = true;
|
||||
Context.TransferStatusType = (TransferStatusType)(Convert.ToInt16(status.StatusValue));
|
||||
msg = $"Status changed: {status.StatusName} - {Context.TransferStatusType} !";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected async Task SaveStatus()
|
||||
{
|
||||
|
||||
isSaveActive = false;
|
||||
var result = await AdminSignalRClient.PostDataAsync<Transfer>(SignalRTags.UpdateTransfer, Context);
|
||||
if (result != null)
|
||||
{
|
||||
if (AllStatuses.FirstOrDefault(x => x.StatusValue == (byte)result.TransferStatusType) == CurrentStatusType)
|
||||
{
|
||||
msg = $"Stataus saved";
|
||||
StateHasChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "Some error occured, please try again later";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "Some error occured during saving, please try again later";
|
||||
}
|
||||
await DataChanged.InvokeAsync(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
protected override Task OnParametersSetAsync()
|
||||
{
|
||||
CurrentStatusType = AllStatuses.FirstOrDefault(x => x.StatusValue == (byte)Context.TransferStatusType);
|
||||
return base.OnParametersSetAsync();
|
||||
}
|
||||
|
||||
RenderFragment RenderDetailsItem(string iconCssClass, string caption, string value)
|
||||
{
|
||||
return @<div class="d-flex m-1 align-items-center">
|
||||
<div class="icon-container flex-shrink-0">
|
||||
<span class="dxbl-image m-1 @iconCssClass"></span>
|
||||
</div>
|
||||
<div class="text-container m-1 flex-grow-1 ms-2">
|
||||
<label>@caption:</label>
|
||||
<div>@value</div>
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
.e-name {
|
||||
margin-bottom: 0.25rem;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.e-email {
|
||||
font-size: 0.75rem;
|
||||
text-decoration: underline;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.e-title {
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.e-details .text-container label {
|
||||
font-size: 0.8125rem;
|
||||
line-height: 1rem;
|
||||
}
|
||||
|
||||
.e-details .text-container {
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.125rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
@using TIAM.Resources
|
||||
@using TIAM.Services
|
||||
@using TIAMSharedUI.Pages.Components
|
||||
@using TIAMSharedUI.Pages.User.CardComponents
|
||||
@using TIAMSharedUI.Pages.User.SysAdmins
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
|
|
@ -67,11 +68,30 @@
|
|||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class=" col-12">
|
||||
<Animation Effect="@Effect.FadeIn" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
|
||||
<div class="card">
|
||||
|
||||
<DxTabs>
|
||||
|
||||
<DxTabPage Text="List">
|
||||
<DxAccordion
|
||||
ExpandMode="ExpandMode"
|
||||
ExpandCollapseAction="ExpandCollapseAction"
|
||||
AnimationType="LayoutAnimationType.Slide">
|
||||
<Items>
|
||||
@foreach (var (transfer, i) in Items)
|
||||
{
|
||||
|
||||
<DxAccordionItem CssClass="@GetCustomColor(transfer.TransferStatusType)" Text=@($"{transfer.Appointment} - {transfer.FromAddress}") Expanded=@(i == 0)>
|
||||
<ContentTemplate>
|
||||
<div class="py-3 px-3">
|
||||
<TransferCardComponent DataChanged="RefreshComponent" Context="@transfer" />
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</DxAccordionItem>
|
||||
}
|
||||
</Items>
|
||||
</DxAccordion>
|
||||
</DxTabPage>
|
||||
<DxTabPage Text="DataGrid">
|
||||
<div class="d-flex flex-column mb-4 pb-2">
|
||||
<div class="align-self-end pl-2 pb-2">
|
||||
|
|
@ -82,22 +102,22 @@
|
|||
</div>
|
||||
|
||||
<TransferGrid @ref="_gridTransfer"
|
||||
Logger="_logger"
|
||||
GetAllMessageTag="SignalRTags.GetTransfersByUserProductMappingId"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
ContextIds="new object[] {driverId}"
|
||||
OnDataSourceChanged="DataSourceChanged"
|
||||
OnGridItemChanging="DataSourceItemChanging"
|
||||
OnGridItemChanged="DataSourceItemChanged"
|
||||
OnGridItemDeleting="DataItemDeleting"
|
||||
OnGridEditModelSaving="DataItemSaving"
|
||||
CustomizeElement="Grid_CustomizeElement"
|
||||
CustomizeEditModel="Grid_CustomizeEditModel"
|
||||
EditMode="GridEditMode.EditForm"
|
||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
AllowSelectRowByClick="false"
|
||||
PageSize="13"
|
||||
ShowFilterRow="true">
|
||||
Logger="_logger"
|
||||
GetAllMessageTag="SignalRTags.GetTransfersByUserProductMappingId"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
ContextIds="new object[] {driverId}"
|
||||
OnDataSourceChanged="DataSourceChanged"
|
||||
OnGridItemChanging="DataSourceItemChanging"
|
||||
OnGridItemChanged="DataSourceItemChanged"
|
||||
OnGridItemDeleting="DataItemDeleting"
|
||||
OnGridEditModelSaving="DataItemSaving"
|
||||
CustomizeElement="Grid_CustomizeElement"
|
||||
CustomizeEditModel="Grid_CustomizeEditModel"
|
||||
EditMode="GridEditMode.EditForm"
|
||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
AllowSelectRowByClick="false"
|
||||
PageSize="13"
|
||||
ShowFilterRow="true">
|
||||
|
||||
<Columns>
|
||||
<DxGridCommandColumn Visible="false" Width="80" MinWidth="80" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
|
|
@ -119,7 +139,7 @@
|
|||
<DxGridDataColumn FieldName="PassengerCount" Caption="Passengers" Width="90" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
|
||||
<DxGridDataColumn FieldName="LuggageCount" Caption="Luggages" Width="80" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
|
||||
<DxGridDataColumn FieldName="FlightNumber" Caption="FlightNum" Width="95" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
|
||||
|
||||
|
||||
<DxGridDataColumn FieldName="FullName" />
|
||||
<DxGridDataColumn FieldName="ContactPhone" Width="120" />
|
||||
<DxGridDataColumn FieldName="ContactEmail" Width="120">
|
||||
|
|
@ -202,7 +222,7 @@
|
|||
</DxFormLayout>
|
||||
</EditFormTemplate>
|
||||
|
||||
|
||||
|
||||
</TransferGrid>
|
||||
</div>
|
||||
</DxTabPage>
|
||||
|
|
@ -224,8 +244,7 @@
|
|||
</div>
|
||||
</DxTabPage>
|
||||
</DxTabs>
|
||||
</div>
|
||||
</Animation>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class=" col-12 col-xl-6">
|
||||
|
|
@ -243,6 +262,12 @@
|
|||
private bool _popupVisible;
|
||||
private TransferGrid _gridTransfer;
|
||||
|
||||
private List<Transfer>? transfers = [];
|
||||
IEnumerable<(Transfer, int)> Items = [];
|
||||
|
||||
AccordionExpandMode ExpandMode { get; set; } = AccordionExpandMode.SingleOrNone;
|
||||
AccordionExpandCollapseAction ExpandCollapseAction { get; set; } = AccordionExpandCollapseAction.HeaderClick;
|
||||
|
||||
public List<string> IgnoreList =
|
||||
[
|
||||
"ReceiverEmailAddress",
|
||||
|
|
@ -277,10 +302,17 @@
|
|||
DateTime StartDate { get; set; } = DateTime.Today;
|
||||
DxSchedulerDataStorage _dataStorage = new();
|
||||
|
||||
protected override Task OnParametersSetAsync()
|
||||
private void RefreshComponent()
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
driverId = DriverId;
|
||||
return base.OnParametersSetAsync();
|
||||
// transfers = await AdminSignalRClient.GetByIdAsync<List<Transfer>>(SignalRTags.GetTransfersByUserProductMappingId, DriverId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void SendMail(Transfer item)
|
||||
|
|
@ -381,6 +413,31 @@
|
|||
}
|
||||
}
|
||||
|
||||
string GetCustomColor(TransferStatusType transferStatusType)
|
||||
{
|
||||
|
||||
var transferStatusByte = (byte)transferStatusType;
|
||||
|
||||
switch (transferStatusByte)
|
||||
{
|
||||
case 5:
|
||||
return "bg-important";
|
||||
|
||||
case > 5 and < 35:
|
||||
return "bg-attention";
|
||||
|
||||
case 35:
|
||||
return "bg-finished";
|
||||
|
||||
case > 35:
|
||||
return "bg-cancel";
|
||||
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||
{
|
||||
if (!e.IsNew) return;
|
||||
|
|
@ -457,11 +514,17 @@
|
|||
_logger.Info($"DataItemDeleting OnItemDeleting");
|
||||
}
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_logger = new LoggerClient<DriverManageTransfers>(LogWriters.ToArray());
|
||||
|
||||
return base.OnInitializedAsync();
|
||||
if (transfers != null)
|
||||
{
|
||||
var test = DriverId.ToString();
|
||||
transfers = await AdminSignalRClient.GetByIdAsync<List<Transfer>>(SignalRTags.GetTransfersByUserProductMappingId, DriverId);
|
||||
Items = transfers.Select((item, index) => (item, index));
|
||||
}
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
private void InitializeAppointments(ICollection<Transfer> transferDataList)
|
||||
|
|
|
|||
|
|
@ -483,6 +483,10 @@ select:focus-visible {
|
|||
-o-background-size: cover;
|
||||
background-size: cover;
|
||||
}
|
||||
.container-fluid {
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
/*forms end*/
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Loading…
Reference in New Issue