Driver Tasks, Hotel Dashboard, changepassword

This commit is contained in:
Adam 2024-07-25 08:32:20 +02:00
parent 304ffd68ae
commit 32c705383b
21 changed files with 696 additions and 407 deletions

View File

@ -48,6 +48,7 @@ public class SignalRTags : AcSignalRTags
//public const int RemoveAddress = 34;
public const int GetProfileById = 35;
public const int GetProfileByUserId = 36;
//public const int GetProfiles = 36;
//public const int GetProfileByContextId = 37;

View File

@ -16,7 +16,7 @@
OnInvalidSubmit="@HandleInvalidSubmit"
Context="EditFormContext">
<DataAnnotationsValidator />
<div class="card cw-480">
<div class="card">
<div class="card-header text-center py-3">
<h4>Edit Your Details</h4>
</div>
@ -255,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", "Full name");
editor.AddAttribute(j++, "NullText", "");
editor.AddAttribute(j++, "FirstNameChanged", EventCallback.Factory.Create<string>(this, result =>
{
_logger.DetailConditional($"FirstName changed to {result}");
@ -316,6 +316,7 @@ else
case DataType.MultilineText:
editor.OpenComponent<DxMemo>(j);
editor.AddAttribute(j++, "Text", property.GetValue(Data));
editor.AddAttribute(j++, "CssClass", "form-field");
editor.AddAttribute(j++, "TextExpression", lambda);
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();
@ -323,6 +324,7 @@ else
default:
editor.OpenComponent<DxTextBox>(j++);
editor.AddAttribute(j++, "Text", property.GetValue(Data));
editor.AddAttribute(j++, "CssClass", "form-field");
editor.AddAttribute(j++, "TextExpression", lambda);
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();

View File

@ -0,0 +1,68 @@
@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
@using TIAM.Entities.Drivers
@inject IServiceProviderDataService ServiceProviderDataService
@inject AdminSignalRClient AdminSignalRClient;
<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/defaultcar_60.png" alt="" />
</div>
<div class="e-info flex-grow-1 ms-3">
<div class="e-name">@($"{MyCar.Color}")</div>
<p class="e-title"> @MyCar.Manufacture</p>
<p class="e-title"> @MyCar.CarModel</p>
</div>
</div>
<hr class="hr" />
<div class="row">
<div class="col-12 col-md-6">
@RenderDetailsItem("fa-solid fa-engine", "Engine", Enum.GetName(MyCar.CarMotorType))
</div>
<div class="col-12 col-md-6">
@RenderDetailsItem("fa-solid fa-location-dot", "Year", MyCar.YearOfMake.ToString())
</div>
<hr class="hr" />
<div class="col-12 col-md-4">
@RenderDetailsItem("fa-solid fa-users", "Seats", MyCar.SeatNumber.ToString())
</div>
</div>
</div>
@code {
[Parameter] public Car MyCar { get; set; }
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
}
protected override Task OnParametersSetAsync()
{
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>;
}
}

View File

@ -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;
}

View File

@ -47,7 +47,7 @@
<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">
<div class="col-9 col-md-5">
<DxComboBox Data="@Statuses"
@bind-Value="@CurrentStatusType"
NullText="Select new status"
@ -56,11 +56,17 @@
TextFieldName="@nameof(TransferStatusModel.StatusName)" />
</div>
<div class="col-4 col-md-2">
<div class="col-3 col-md-1">
<DxButton CssClass="btn btn-primary" Click="SaveStatus" Enabled="@isSaveActive"> Save</DxButton>
</div>
@if(!Context.Paid)
{
<hr class="hr" />
<div class="col-3 col-md-1">
<DxButton CssClass="btn btn-primary" Click="PaidByCash">Paid in car</DxButton>
</div>
}
<p>@msg</p>
</div>
</div>
@ -151,7 +157,21 @@
await DataChanged.InvokeAsync(msg);
}
protected async Task PaidByCash()
{
Context.Paid = true;
var result = await AdminSignalRClient.PostDataAsync<Transfer>(SignalRTags.UpdateTransfer, Context);
if (result != null)
{
msg = $"Payment status saved";
StateHasChanged();
}
else
{
msg = "Some error occured during saving, please try again later";
}
await DataChanged.InvokeAsync(msg);
}
protected override async Task OnInitializedAsync()
{

View File

@ -0,0 +1,167 @@
@using BlazorAnimation
@using TIAM.Core.Enums
@using TIAM.Entities.Transfers
@using TIAM.Entities.Users
@using TIAM.Models.Dtos.Users
@using TIAM.Services
@using TIAMSharedUI.Shared.Components.Cards
@using TIAMWebApp.Shared.Application.Interfaces
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI
@using TIAMWebApp.Shared.Application.Models.PageModels
@using TIAMWebApp.Shared.Application.Services
@inject IServiceProviderDataService ServiceProviderDataService
@inject IUserDataService UserDataService;
@inject AdminSignalRClient AdminSignalRClient;
<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.UserDto.Id}")</div>
<p class="e-title"><i class="fa-solid fa-at"></i> @Context.UserDto.EmailAddress</p>
<p class="e-title"><i class="fa-solid fa-phone"></i> @Context.UserDto.PhoneNumber</p>
</div>
</div>
<hr class="hr" />
<div class="row">
<div class="col-12 col-md-6">
@RenderDetailsItem("fa-solid fa-key", "Password", Context.UserDto.Password)
</div>
<div class="col-9 col-md-4">
<DxTextBox
@bind-Text="@NewPassword"
NullText="New password"
BindValueMode="BindValueMode.OnDelayedInput"
InputDelay="300"
CssClass="form-field"
/>
<DxTextBox @bind-Text="@ConfirmNewPassword"
ReadOnly="@PasswordNotSet"
NullText="Confirm new password"
BindValueMode="BindValueMode.OnDelayedInput"
InputDelay="300"
CssClass="form-field" />
</div>
<div class="col-3 col-md-2">
<DxButton CssClass="btn btn-primary" Click="SetPassword" Enabled="@isSaveActive"> Save</DxButton>
</div>
<p>@msg</p>
</div>
</div>
@code {
[Parameter] public UserModelDtoDetail Context { get; set; }
[Parameter] public EventCallback<string> DataChanged { get; set; }
private bool PasswordNotSet = true;
private bool PasswordNotConfirmed = true;
private string _newPassword;
public string NewPassword
{
get => _newPassword;
set
{
if (_newPassword != value)
{
_newPassword = value;
OnPasswordSet(value);
}
}
}
private string? _confirmNewPassword;
public string? ConfirmNewPassword
{
get => _confirmNewPassword;
set
{
if (value != null && _confirmNewPassword != value)
{
_confirmNewPassword = value;
OnPasswordConfirmed(value);
}
}
}
string msg;
private bool isSaveActive = false;
void OnPasswordSet(string password)
{
msg = $"Password to set: {NewPassword}";
PasswordNotSet = false;
StateHasChanged();
}
void OnPasswordConfirmed(string password)
{
if(NewPassword == ConfirmNewPassword)
{
PasswordNotConfirmed = false;
isSaveActive = true;
}
else
{
isSaveActive = false;
msg = "Password and confirmation not matching!";
}
}
protected async Task SetPassword()
{
isSaveActive = false;
User userToUpdate = new User(Context.Id, Context.UserDto.EmailAddress, NewPassword);
var result = await AdminSignalRClient.PostDataAsync<User>(SignalRTags.UpdateUser, userToUpdate);
if (result != null)
{
msg = $"Password saved";
StateHasChanged();
}
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 async Task OnParametersSetAsync()
{
await 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>;
}
}

View File

@ -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;
}

View File

@ -34,8 +34,8 @@
<PageTitle>Transfers</PageTitle>
<div class="text-center m-5">
<h1>Transfer management</h1>
<h2 style="font-size:small">Manage transfers here!</h2>
<h1>Tasks</h1>
<h2 style="font-size:small">Manage your tasks here!</h2>
</div>
@ -46,8 +46,8 @@
CloseOnOutsideClick="false"
ShowCloseButton="false"
HeaderText="MessageBox"
Closing="EulaPopupClosing"
Closed="EulaPopupClosed">
Closing="EmailPopupClosing"
Closed="EmailPopupClosed">
<BodyContentTemplate>
<InputWizard Data=@_messageWizardModel
OnSubmit="SubmitForm"
@ -68,183 +68,68 @@
<div class="container-fluid">
<div class="row">
<div class=" col-12">
<div class="card">
<DxTabs>
<DxTabPage Text="List">
<DxAccordion
ExpandMode="ExpandMode"
ExpandCollapseAction="ExpandCollapseAction"
AnimationType="LayoutAnimationType.Slide">
<Items>
@foreach (var (transfer, i) in Items)
{
<div class="card">
<DxTabs>
<DxTabPage Text="Upcoming">
<DxAccordion ExpandMode="ExpandMode"
ExpandCollapseAction="ExpandCollapseAction"
AnimationType="LayoutAnimationType.Slide">
<Items>
@foreach (var (transfer, i) in Upcoming)
{
<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">
<DxButton Text="Column Chooser"
RenderStyle="ButtonRenderStyle.Secondary"
IconCssClass="btn-column-chooser"
Click="ColumnChooserButton_Click" />
</div>
<ContentTemplate>
<div class="py-3 px-3">
<TransferCardComponent DataChanged="RefreshComponent" Context="@transfer" />
</div>
</ContentTemplate>
</DxAccordionItem>
}
</Items>
</DxAccordion>
</DxTabPage>
<DxTabPage Text="Problems">
<DxAccordion ExpandMode="ExpandMode"
ExpandCollapseAction="ExpandCollapseAction"
AnimationType="LayoutAnimationType.Slide">
<Items>
@foreach (var (transfer, i) in Problems)
{
<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">
<Columns>
<DxGridCommandColumn Visible="false" Width="80" MinWidth="80" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="OrderId" Caption="Order" SortIndex="1" SortOrder="GridColumnSortOrder.Descending" Width="70">
<CellDisplayTemplate>
@{
var idKeyField = ((Transfer)context.DataItem).Id.ToString("N");
var editUri = $"mytransfers/{idKeyField}";
<NavLink href="@editUri">
<text>@context.Value</text>
</NavLink>
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="FromAddress" />
<DxGridDataColumn FieldName="ToAddress" />
<DxGridDataColumn FieldName="Appointment" DisplayFormat="g" Width="125" />
<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">
<CellDisplayTemplate>
@{
var keyField = context.Value;
var keyItem = (Transfer)context.DataItem;
string buttonText = "Contact";
<DxButton Click="() => SendMail(keyItem)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="PaymentId" DisplayFormat="N" Visible="false" />
<DxGridDataColumn Caption="Paid" FieldName="Paid" Width="75" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="TransferStatusType" Caption="Status" SortIndex="0" Width="120" SortOrder="GridColumnSortOrder.Ascending" SortMode="GridColumnSortMode.Value">
<CellDisplayTemplate>
@{
TransferStatusModel keyField = Statuses.FirstOrDefault(x => x.StatusValue == (byte)context.Value)!;
string transferStatusText = keyField.StatusName;
<text>@transferStatusText</text>
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="ReferralId" DisplayFormat="N" Visible="false" />
<DxGridDataColumn FieldName="Comment" Caption="Comment" />
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="125" Visible="false" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
</Columns>
<DetailRowTemplate>
<DxTabs>
@{
var transfer = ((Transfer)context.DataItem);
}
<DxTabPage Text="Messages">
<MessageDetailGridComponent ContextId="transfer.Id" />
</DxTabPage>
<DxTabPage Text="Driver">
<TransferToDriverGridComponent ContextId="transfer.Id" ParentData="transfer" DriverId="driverId" NewButtonVisible="false" DeleteButtonVisible="false" />
</DxTabPage>
</DxTabs>
</DetailRowTemplate>
<EditFormTemplate Context="editFormContext">
@{
var transfer2 = (Transfer)editFormContext.EditModel;
}
<DxFormLayout CssClass="w-100">
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.FirstName) ColSpanMd="6">
@editFormContext.GetEditor("FirstName")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6">
@editFormContext.GetEditor("LastName")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationAddress) ColSpanMd="6">
@editFormContext.GetEditor("ToAddress")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.PickupAddress) ColSpanMd="6">
@editFormContext.GetEditor("FromAddress")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Trip date:" ColSpanMd="6">
<DxDateEdit @bind-Date="@transfer2.Appointment"
TimeSectionVisible="true"
TimeSectionScrollPickerFormat="tt h m">
</DxDateEdit>
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Passengers:" ColSpanMd="6">
@editFormContext.GetEditor("PassengerCount")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Paid:" ColSpanMd="6">
@editFormContext.GetEditor("Payed")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Status:" ColSpanMd="6">
@editFormContext.GetEditor("TransferStatusType")
</DxFormLayoutItem>
</DxFormLayout>
</EditFormTemplate>
<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>
</TransferGrid>
</div>
</DxTabPage>
<DxTabPage Text="Calendar">
<div class="d-flex flex-column mb-4 pb-2">
<DxScheduler @bind-StartDate="@StartDate"
DataStorage="@_dataStorage"
CssClass="w-100">
<DxSchedulerTimelineView Duration="@TimeSpan.FromHours(48)" CellMinWidth="80">
<Scales>
<DxSchedulerTimeScale Unit="@SchedulerTimeScaleUnit.Day" UnitCount="1"></DxSchedulerTimeScale>
<DxSchedulerTimeScale Unit="@SchedulerTimeScaleUnit.Hour" UnitCount="2"></DxSchedulerTimeScale>
</Scales>
</DxSchedulerTimelineView>
<DxSchedulerWeekView ShowWorkTimeOnly="false"></DxSchedulerWeekView>
<DxSchedulerDayView DayCount="1" ShowWorkTimeOnly="false"></DxSchedulerDayView>
</DxScheduler>
</div>
</DxTabPage>
</DxTabs>
</div>
<DxTabPage Text="Calendar">
<div class="d-flex flex-column mb-4 pb-2">
<DxScheduler @bind-StartDate="@StartDate"
DataStorage="@_dataStorage"
CssClass="w-100">
<DxSchedulerTimelineView Duration="@TimeSpan.FromHours(48)" CellMinWidth="80">
<Scales>
<DxSchedulerTimeScale Unit="@SchedulerTimeScaleUnit.Day" UnitCount="1"></DxSchedulerTimeScale>
<DxSchedulerTimeScale Unit="@SchedulerTimeScaleUnit.Hour" UnitCount="2"></DxSchedulerTimeScale>
</Scales>
</DxSchedulerTimelineView>
<DxSchedulerWeekView ShowWorkTimeOnly="false"></DxSchedulerWeekView>
<DxSchedulerDayView DayCount="1" ShowWorkTimeOnly="false"></DxSchedulerDayView>
</DxScheduler>
</div>
</DxTabPage>
</DxTabs>
</div>
</div>
<div class=" col-12 col-xl-6">
@ -260,10 +145,10 @@
private LoggerClient<DriverManageTransfers> _logger;
private bool _popupVisible;
private TransferGrid _gridTransfer;
private List<Transfer>? transfers = [];
IEnumerable<(Transfer, int)> Items = [];
IEnumerable<(Transfer, int)> Upcoming = [];
IEnumerable<(Transfer, int)> Problems = [];
AccordionExpandMode ExpandMode { get; set; } = AccordionExpandMode.SingleOrNone;
AccordionExpandCollapseAction ExpandCollapseAction { get; set; } = AccordionExpandCollapseAction.HeaderClick;
@ -292,15 +177,14 @@
new(Convert.ToByte(TransferStatusType.AdminDenied), "Admin cancelled")
];
private static List<TransferStatusModel> _selectedCategories = Statuses.Where(x => /* x.StatusValue != (byte)TransferStatusType.OrderSubmitted && */ x.StatusValue != (byte)TransferStatusType.Finished && x.StatusValue != (byte)TransferStatusType.UserCanceled && x.StatusValue != (byte)TransferStatusType.AdminDenied).ToList();
private string _filterText = GetFilterText(_selectedCategories.Select(x => (TransferStatusType)x.StatusValue).ToList());
private MessageWizardModel _messageWizardModel = new();
public List<AppointmentModel> AppointmentModels { get; set; } = null!;
DateTime StartDate { get; set; } = DateTime.Today;
DxSchedulerDataStorage _dataStorage = new();
DxSchedulerDataStorage _dataStorage = new();
private void RefreshComponent()
{
@ -333,13 +217,13 @@
_popupVisible = false;
}
void EulaPopupClosed()
void EmailPopupClosed()
{
//cancel clicked
}
void EulaPopupClosing(PopupClosingEventArgs args)
void EmailPopupClosing(PopupClosingEventArgs args)
{
//myModel = new TransferWizardModel();
_messageWizardModel = new MessageWizardModel();
@ -374,145 +258,34 @@
_logger.Info($"Submitted nested form: {result.GetType().FullName}");
}
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
{
try
{
if (e.ElementType == GridElementType.HeaderCell)
{
e.Style = "background-color: rgba(0, 0, 0, 0.08)";
e.CssClass = "header-bold";
}
if (e.ElementType != GridElementType.DataRow) return;
var transferStatus = e.Grid?.GetRowValue(e.VisibleIndex, "TransferStatusType");
if (transferStatus == null) return;
var transferStatusByte = (byte)transferStatus;
switch (transferStatusByte)
{
case 5:
e.CssClass = "bg-important";
break;
case > 5 and < 35:
e.CssClass = "bg-attention";
break;
case 35:
e.CssClass = "bg-finished";
break;
case > 35:
e.CssClass = "bg-cancel";
break;
}
}
catch (Exception ex)
{
_logger.Error($"Grid_CustomizeElement; {ex.Message}", ex);
}
}
string GetCustomColor(TransferStatusType transferStatusType)
{
var transferStatusByte = (byte)transferStatusType;
switch (transferStatusByte)
{
case 5:
return "bg-important";
var transferStatusByte = (byte)transferStatusType;
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;
var transferEditModel = (Transfer)e.EditModel; //TODO not valid cast
transferEditModel.Id = Guid.NewGuid();
transferEditModel.ToAddress = "Where to?";
transferEditModel.FromAddress = "From where?";
transferEditModel.Appointment = DateTime.UtcNow.AddDays(3);
transferEditModel.PassengerCount = 1;
transferEditModel.FirstName = "John";
transferEditModel.LastName = "Doe";
transferEditModel.ContactPhone = "+00000000000";
transferEditModel.ContactEmail = "your@email.address";
}
private static string GetFilterText(ICollection<TransferStatusType> selectedTransferStatuses)
=> selectedTransferStatuses.Count == 0 ? string.Empty : CriteriaOperator.FromLambda<Transfer>(t => selectedTransferStatuses.Contains(t.TransferStatusType)).ToString();
void TagBox_ValuesChanged(IEnumerable<TransferStatusModel> newSelectedCategories)
{
var filterText = string.Empty;
InOperator? filterCriteria = null;
_selectedCategories = newSelectedCategories.ToList();
if (_selectedCategories.Count > 0)
switch (transferStatusByte)
{
filterCriteria = new InOperator("TransferStatusType", _selectedCategories.Select(c => c.StatusValue));
filterText = GetFilterText(_selectedCategories.Select(x => (TransferStatusType)x.StatusValue).ToList());
case 5:
return "bg-important";
case > 5 and < 35:
return "bg-attention";
case 35:
return "bg-finished";
case > 35:
return "bg-cancel";
default:
return "";
}
_filterText = filterText;
_gridTransfer.SetFieldFilterCriteria("TransferStatusType", filterCriteria);
}
private void DataSourceChanged(IList<Transfer> transfers)
{
_logger.Info("DataSourceChanged called");
InitializeAppointments(transfers);
if (_selectedCategories.Count > 0)
TagBox_ValuesChanged(_selectedCategories);
// if(!SelectedCategories.Any())
// SelectedCategories = [Statuses.FirstOrDefault(x => x.StatusValue == (byte)TransferStatusType.Finished)!];
// var filterTransferStatusType = Statuses.FirstOrDefault(x => x.StatusValue == (byte)TransferStatusType.Finished)!;
// if (SelectedCategories.All(x => x.StatusValue != filterTransferStatusType.StatusValue))
// SelectedCategories.Add(filterTransferStatusType);
}
private void DataSourceItemChanging(GridDataItemChangingEventArgs<Transfer> args)
{
_logger.Info("DataSourceItemChanging called");
}
private void DataSourceItemChanged(GridDataItemChangedEventArgs<Transfer> args)
{
_logger.Info("DataSourceItemChanged called");
AppointmentModels.UpdateCollection(CreateAppointmentModel(args.DataItem), args.TrackingState == TrackingState.Remove);
}
private void DataItemSaving(GridEditModelSavingEventArgs e)
{
_logger.Info("DataItemSaving called");
}
private void DataItemDeleting(GridDataItemDeletingEventArgs e)
{
_logger.Info($"DataItemDeleting OnItemDeleting");
}
protected override async Task OnInitializedAsync()
{
@ -520,13 +293,21 @@
if (transfers != null)
{
var test = DriverId.ToString();
transfers = await AdminSignalRClient.GetByIdAsync<List<Transfer>>(SignalRTags.GetTransfersByUserProductMappingId, DriverId);
Items = transfers.Select((item, index) => (item, index));
var result = await AdminSignalRClient.GetByIdAsync<List<Transfer>>(SignalRTags.GetTransfersByUserProductMappingId, DriverId);
transfers = result.Where(t => t.TransferStatusType != TransferStatusType.UserCanceled && t.TransferStatusType != TransferStatusType.AdminDenied).ToList();
Upcoming = transfers.Where(x => x.Appointment >= DateTime.Now).Select((item, index) => (item, index));
Problems = transfers.Where(x => x.Appointment < DateTime.Now && x.TransferStatusType != TransferStatusType.Finished).Select((item, index) => (item, index));
InitializeAppointments(transfers);
}
await base.OnInitializedAsync();
}
private void GroupTransfers(List<Transfer> transferDataList)
{
}
private void InitializeAppointments(ICollection<Transfer> transferDataList)
{
_logger.Info("InitializeAppointments called");
@ -569,17 +350,5 @@
return new AppointmentModel { Id = transfer.Id, StartDate = transfer.Appointment, EndDate = transfer.Appointment.AddMinutes(30), Description = $"{transfer.FullName}, {transfer.ToAddress}", Location = transfer.FromAddress, Caption = "Simple transfer" };
}
void ColumnChooserButton_Click()
{
_gridTransfer.ShowColumnChooser();
}
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
{
//_gridTransfer.ExpandDetailRow(0);
}
}
}

View File

@ -26,22 +26,27 @@
<!--We need to check if the user is owner of a swerviceprovider-->
<div class="container-fluid">
<h3>Selected Hotel:</h3>
<DxComboBox Data="@Hotels"
@bind-Value="@SelectedHotel"
SearchMode="@ListSearchMode.AutoSearch"
SearchFilterCondition="@ListSearchFilterCondition.Contains"
ListRenderMode="ListRenderMode.Virtual"
TextFieldName="Name"></DxComboBox>
<div class="row py-3">
<div class=" col-12 col-xl-3">
<div class="row d-flex justify-content-center">
<div class="col-12 col-md-6">
<h3>Selected Hotel:</h3>
<DxComboBox Data="@Hotels"
@bind-Value="@SelectedHotel"
SearchMode="@ListSearchMode.AutoSearch"
SearchFilterCondition="@ListSearchFilterCondition.Contains"
ListRenderMode="ListRenderMode.Virtual"
TextFieldName="Name"></DxComboBox>
<div class="row py-3">
<DynamicEditForm Data="Data" isEditing="true" IgnoreReflection="TransferIgnorList" OnSubmit="SubmitForm"></DynamicEditForm>
</div>
</div>
<DynamicEditForm Data="Data" isEditing="true" IgnoreReflection="TransferIgnorList" OnSubmit="SubmitForm"></DynamicEditForm>
</div>
</div>

View File

@ -13,7 +13,7 @@
<!--We need to check if the user is owner of a swerviceprovider-->
<div class="container">
<div class="container-fluid">
<HotelComponent Id="@id"></HotelComponent>

View File

@ -174,43 +174,11 @@
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<div class="d-flex flex-column mb-4 pb-2">
<div class="media text-muted pt-3">
<!--img src="https://bootdey.com/img/Content/avatar/avatar7.png" alt="" class="mr-2 rounded" width="32" height="32"-->
<p class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
<strong class="d-block text-gray-dark">username</strong>
Donec id elit non mi porta gravida at eget metus...
</p>
</div>
<div class="media text-muted pt-3">
<p class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
<strong class="d-block text-gray-dark">username</strong>
Donec id elit non mi porta gravida at eget metus...
</p>
</div>
<div class="media text-muted pt-3">
<p class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
<strong class="d-block text-gray-dark">username</strong>
Donec id elit non mi porta gravida at eget metus...
</p>
</div>
<div class="media text-muted pt-3">
<p class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
<strong class="d-block text-gray-dark">username</strong>
Donec id elit non mi porta gravida at eget metus...
</p>
</div>
</div>
@if (Id != null)
{
<MessageDetailGridComponent ContextId="@Id"></MessageDetailGridComponent>
}
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
@ -253,7 +221,7 @@
<Columns>
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="OrderId" Caption="Order" SortIndex="1" SortOrder="GridColumnSortOrder.Descending" Width="70">
<DxGridDataColumn FieldName="OrderId" Caption="Order" SortIndex="1" SortOrder="GridColumnSortOrder.Descending">
<CellDisplayTemplate>
@{
var idKeyField = ((Transfer)context.DataItem).Id.ToString("N");
@ -264,8 +232,8 @@
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn Caption="Paid" FieldName="Paid" Width="75" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="Revenue" Caption="Revenue" Width="70" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn Caption="Paid" FieldName="Paid" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="Revenue" Caption="Revenue" CaptionAlignment="GridTextAlignment.Center" />
</Columns>
</TransferGrid>
</div>

View File

@ -0,0 +1,192 @@
@page "/user/account/{userId:guid}"
@using BlazorAnimation
@using TIAM.Core.Enums
@using TIAM.Entities.Emails
@using TIAM.Entities.Profiles
@using TIAM.Entities.Transfers
@using TIAM.Models.Dtos.Users
@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
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
@using TIAMWebApp.Shared.Application.Models.PageModels
@using TIAMWebApp.Shared.Application.Utility
@using AyCode.Services.Loggers
@using TIAMWebApp.Shared.Application.Services
@using TIAMSharedUI.Shared.Components.Grids
@using AyCode.Core.Enums
@using AyCode.Core.Extensions
@using AyCode.Core.Consts
@using AyCode.Core
@using AyCode.Core.Helpers
@using DevExpress.Data.Filtering
@layout AdminLayout
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
@inject IStringLocalizer<TIAMResources> localizer
@inject IWizardProcessor wizardProcessor
@inject ITransferDataService transferDataService
@inject ISessionService sessionService
@inject AdminSignalRClient AdminSignalRClient;
<PageTitle>Transfers</PageTitle>
<div class="text-center m-5">
<h1>Tasks</h1>
<h2 style="font-size:small">Manage your tasks here!</h2>
</div>
<DxPopup CssClass="popup-demo-events"
@bind-Visible="@_popupVisible"
ShowFooter="true"
CloseOnEscape="true"
CloseOnOutsideClick="false"
ShowCloseButton="false"
HeaderText="Change password"
Closing="PasswordPopupClosing"
Closed="PasswordPopupClosed">
<BodyContentTemplate>
Change your password here
</BodyContentTemplate>
<FooterContentTemplate Context="Context">
<div class="popup-demo-events-footer">
<!--DxCheckBox CssClass="popup-demo-events-checkbox" @bind-Checked="@EulaAccepted">I accept the terms of the EULA</!--DxCheckBox-->
<!--DxButton CssClass="popup-demo-events-button ms-2" RenderStyle="ButtonRenderStyle.Primary" Text="OK" Click="Context.CloseCallback" /-->
<DxButton CssClass="popup-demo-events-button ms-2" RenderStyle="ButtonRenderStyle.Secondary" Text="Cancel" Click="CancelCreateClick" />
</div>
</FooterContentTemplate>
</DxPopup>
<div class="container-fluid">
<div class="row">
<div class=" col-12">
<div class="card">
<DxTabs>
<DxTabPage Text="Account details">
<div class="py-3 px-3">
<div class="d-flex flex-column mb-4 pb-2">
<UserCardComponent Context="@myUser" />
</div>
</div>
</DxTabPage>
<DxTabPage Text="Profiles">
<DxAccordion ExpandMode="ExpandMode"
ExpandCollapseAction="ExpandCollapseAction"
AnimationType="LayoutAnimationType.Slide">
<Items>
@foreach (var (profile, i) in ProfileItems)
{
<DxAccordionItem Text=@($"{profile.Name}") Expanded=@(i == 0)>
<ContentTemplate>
@* <div class="py-3 px-3">
<ProfileCardComponent DataChanged="RefreshComponent" Context="@transfer" />
</div> *@
</ContentTemplate>
</DxAccordionItem>
}
</Items>
</DxAccordion>
</DxTabPage>
</DxTabs>
</div>
</div>
<div class=" col-12 col-xl-6">
</div>
</div>
</div>
@code {
[Parameter] public Guid UserId { get; set; }
private Guid userId;
private LoggerClient<ManageAccount> _logger;
private bool _popupVisible;
private UserModelDtoDetail myUser;
private List<Profile> profiles = [];
IEnumerable<(Profile, int)> ProfileItems = [];
AccordionExpandMode ExpandMode { get; set; } = AccordionExpandMode.SingleOrNone;
AccordionExpandCollapseAction ExpandCollapseAction { get; set; } = AccordionExpandCollapseAction.HeaderClick;
DateTime StartDate { get; set; } = DateTime.Today;
DxSchedulerDataStorage _dataStorage = new();
private void RefreshComponent()
{
StateHasChanged();
}
protected override async Task OnParametersSetAsync()
{
userId = UserId;
// transfers = await AdminSignalRClient.GetByIdAsync<List<Transfer>>(SignalRTags.GetTransfersByUserProductMappingId, DriverId);
}
void CancelCreateClick()
{
_popupVisible = false;
}
void PasswordPopupClosed()
{
//cancel clicked
}
void PasswordPopupClosing(PopupClosingEventArgs args)
{
}
//-----------------------------------------------------------------------------------
public async Task SubmitForm(object result)
{
_logger.Info($"Submitted nested form: {result.GetType().FullName}");
}
protected override async Task OnInitializedAsync()
{
_logger = new LoggerClient<ManageAccount>(LogWriters.ToArray());
if (!UserId.IsNullOrEmpty())
{
var test = UserId.ToString();
if (sessionService.User != null)
{
myUser = sessionService.User.UserModelDto;
}
profiles.Add(myUser.ProfileDto);
ProfileItems = profiles.Select((item, index) => (item, index));
//further profile by userproductmapping
}
await base.OnInitializedAsync();
}
}

View File

@ -0,0 +1,5 @@
<h3>ManageMessages</h3>
@code {
}

View File

@ -15,7 +15,7 @@
<h2 style="font-size:small">Manage transfers here!</h2>
</div>
<div class="container">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<h3>@localizer.GetString("TransferDestination")</h3>

View File

@ -61,29 +61,34 @@
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.Price) FieldName="Price" Width="100" />
<DxGridDataColumn Caption="Options">
<CellDisplayTemplate>
@{
//check if has transferdestination
var AddressId = ((Product)context.DataItem).Profile.AddressId;
var result = CheckDestinations(AddressId);
//if not, display button
if (!result)
{
// <p>Address:</p>
// <p>@(((Product)context.DataItem).Profile.Address.AddressText)</p>
<DxButton Click="() => SaveAsDestination(((Product)context.DataItem).Profile.Address, (Product)context.DataItem)" Text="Save as destination" RenderStyle="ButtonRenderStyle.Primary" />
}
else
{
<p>Address:</p>
<p>@(((Product)context.DataItem).Profile.Address.AddressText)</p>
}
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductDescription) FieldName="Description" />
<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>
@{
//check if has transferdestination
var AddressId = ((Product)context.DataItem).Profile.AddressId;
var result = CheckDestinations(AddressId);
//if not, display button
if(!result)
{ <p>Address:</p>
<p>@(((Product)context.DataItem).Profile.Address.AddressText)</p>
<DxButton Click="() => SaveAsDestination(((Product)context.DataItem).Profile.Address, (Product)context.DataItem)" Text="Save as destination" RenderStyle="ButtonRenderStyle.Primary" />
}
else
{
<p>Address:</p>
<p>@(((Product)context.DataItem).Profile.Address.AddressText)</p>
}
}
<DxTabs>
<DxTabPage Text="Permissions">
<UserProductMappingGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Never" ContextIds="new [] {((Product)context.DataItem).Id}" GetAllTag="SignalRTags.GetUserProductMappingsByProductId">
@ -179,6 +184,7 @@
transferDestination.AddressString = address.AddressText;
var result = await AdminSignalRClient.PostDataAsync<TransferDestination>(SignalRTags.CreateTransferDestination, transferDestination);
_productGrid.Reload();
await InvokeAsync(StateHasChanged);
}
protected override async Task OnParametersSetAsync()

View File

@ -85,7 +85,7 @@
<div class="text-center">@SessionService.User.UserModelDto.ProfileDto.FullName</div>
</div>
<div class="d-flex justify-content-center log-off-btn">
<DxButton Text="Log Off" RenderStyle="@ButtonRenderStyle.Secondary"></DxButton>
<DxButton Text="Manage" RenderStyle="@ButtonRenderStyle.Secondary" Click="NavToAcc"></DxButton>
</div>
</div>
</div>
@ -248,6 +248,12 @@
MenuDisplayMode DisplayMode { get; set; } = MenuDisplayMode.Auto;
Orientation Orientation { get; set; } = Orientation.Horizontal;
private void NavToAcc()
{
var url = $"user/account/{SessionService.User.UserId}";
NavigationManager.NavigateTo(url);
}
protected override void OnInitialized()
{
_logger = new LoggerClient<AdminNavMenu>(LogWriters.ToArray());

View File

@ -434,8 +434,8 @@ select:focus-visible {
.form-field, .card .form-field {
padding-left: 10px;
border-bottom: 1px solid;
margin-bottom: 20px;
/*border-radius: 20px;
/*margin-bottom: 20px;
border-radius: 20px;
box-shadow: inset 3px 3px 3px #cbced1, inset -3px -3px 3px #fff;*/
}
@ -489,6 +489,28 @@ select:focus-visible {
}
}
@media (max-width: 576px) {
.wrapper {
margin: 30px 20px;
padding: 40px 15px 15px 15px;
}
.carousel-item {
height: 30vh;
min-height: 350px;
background: no-repeat center center scroll;
-webkit-background-size: cover;
-moz-background-size: cover;
-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: 2.8 KiB