Compare commits
No commits in common. "64d38174bed7e635b5502befc1d4660dde5ac285" and "0819efc59334d2ff796f1ac1980d6baefaf62052" have entirely different histories.
64d38174be
...
0819efc593
|
|
@ -159,7 +159,6 @@ else
|
||||||
<h4>EUR @_transfer.Price <span class="small text-muted"> </span></h4>
|
<h4>EUR @_transfer.Price <span class="small text-muted"> </span></h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-footer p-4">
|
<div class="card-footer p-4">
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
<h5 class="fw-normal mb-0"><a href="#!" class="text-decoration-none">Contact driver</a></h5>
|
<h5 class="fw-normal mb-0"><a href="#!" class="text-decoration-none">Contact driver</a></h5>
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@
|
||||||
HeaderText="MessageBox"
|
HeaderText="MessageBox"
|
||||||
Closing="EmailPopupClosing"
|
Closing="EmailPopupClosing"
|
||||||
Closed="EmailPopupClosed"
|
Closed="EmailPopupClosed"
|
||||||
SizeMode="SizeMode.Large">
|
SizeMode="SizeMode.Large">
|
||||||
<BodyContentTemplate>
|
<BodyContentTemplate>
|
||||||
@{
|
@{
|
||||||
if (showResultMessage)
|
if(showResultMessage)
|
||||||
{
|
{
|
||||||
<h5>@resultMessage</h5>
|
<h5>@resultMessage</h5>
|
||||||
}
|
}
|
||||||
|
|
@ -45,11 +45,11 @@
|
||||||
IgnoreReflection=@IgnoreList></DynamicEditForm>
|
IgnoreReflection=@IgnoreList></DynamicEditForm>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</BodyContentTemplate>
|
</BodyContentTemplate>
|
||||||
<FooterContentTemplate Context="Context">
|
<FooterContentTemplate Context="Context">
|
||||||
@{
|
@{
|
||||||
if (showResultMessage)
|
if(showResultMessage)
|
||||||
{
|
{
|
||||||
<div class="popup-demo-events-footer">
|
<div class="popup-demo-events-footer">
|
||||||
<!--DxCheckBox CssClass="popup-demo-events-checkbox" @bind-Checked="@EulaAccepted">I accept the terms of the EULA</!--DxCheckBox-->
|
<!--DxCheckBox CssClass="popup-demo-events-checkbox" @bind-Checked="@EulaAccepted">I accept the terms of the EULA</!--DxCheckBox-->
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</FooterContentTemplate>
|
</FooterContentTemplate>
|
||||||
</DxPopup>
|
</DxPopup>
|
||||||
|
|
||||||
|
|
@ -129,10 +129,6 @@
|
||||||
<div class="col-3 col-md-1">
|
<div class="col-3 col-md-1">
|
||||||
<DxButton CssClass="btn btn-primary" Click="PaidByCash">Paid in car</DxButton>
|
<DxButton CssClass="btn btn-primary" Click="PaidByCash">Paid in car</DxButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-9 col-md-1">
|
|
||||||
<p>To be paid:</p>
|
|
||||||
<h5 class="text-danger"> €@Context.Price</h5>
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<p>@msg</p>
|
<p>@msg</p>
|
||||||
|
|
@ -161,7 +157,7 @@
|
||||||
private string resultMessage = string.Empty;
|
private string resultMessage = string.Empty;
|
||||||
private List<UserModelDtoDetail> sysAdmins = [];
|
private List<UserModelDtoDetail> sysAdmins = [];
|
||||||
|
|
||||||
|
|
||||||
private MessageWizardModel _messageWizardModel = new();
|
private MessageWizardModel _messageWizardModel = new();
|
||||||
|
|
||||||
private bool displayCard = true;
|
private bool displayCard = true;
|
||||||
|
|
@ -169,8 +165,8 @@
|
||||||
private bool _popupVisible;
|
private bool _popupVisible;
|
||||||
|
|
||||||
public List<string> IgnoreList =
|
public List<string> IgnoreList =
|
||||||
[
|
[
|
||||||
"ReceiverEmailAddress",
|
"ReceiverEmailAddress",
|
||||||
"ReceiverFullName",
|
"ReceiverFullName",
|
||||||
"ReceiverId",
|
"ReceiverId",
|
||||||
"SenderEmailAddress",
|
"SenderEmailAddress",
|
||||||
|
|
@ -178,7 +174,7 @@
|
||||||
"SenderId",
|
"SenderId",
|
||||||
"ContextId",
|
"ContextId",
|
||||||
"ContextType"
|
"ContextType"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h6 class="mb-0"> <a href="/hotel/transfers/@ProductId">All transfers</a> </h6>
|
<h6 class="mb-0"> <a href="/user/transfers/@ProductId">All transfers</a> </h6>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
<CellDisplayTemplate>
|
<CellDisplayTemplate>
|
||||||
@{
|
@{
|
||||||
var idKeyField = ((Transfer)context.DataItem).Id.ToString("N");
|
var idKeyField = ((Transfer)context.DataItem).Id.ToString("N");
|
||||||
var editUri = $"hotel/mytransfers/{idKeyField}";
|
var editUri = $"mytransfers/{idKeyField}";
|
||||||
<NavLink href="@editUri">
|
<NavLink href="@editUri">
|
||||||
<text>@context.Value</text>
|
<text>@context.Value</text>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
|
|
|
||||||
|
|
@ -1,546 +0,0 @@
|
||||||
@page "/hotel/mytransfers/{transferId:guid}"
|
|
||||||
@using AyCode.Core.Enums
|
|
||||||
@using AyCode.Core.Extensions
|
|
||||||
@using TIAM.Core.Consts
|
|
||||||
@using TIAM.Entities.Drivers
|
|
||||||
@using TIAM.Entities.Transfers
|
|
||||||
@using TIAM.Models.Dtos.Users
|
|
||||||
@using TIAM.Resources
|
|
||||||
@using TIAM.Services
|
|
||||||
@using TIAMSharedUI.Pages.Components.EditComponents
|
|
||||||
@using TIAMSharedUI.Shared
|
|
||||||
@using TIAMSharedUI.Shared.Components.BaseComponents
|
|
||||||
@using TIAMWebApp.Shared.Application.Interfaces
|
|
||||||
@using AyCode.Services.Loggers
|
|
||||||
@using TIAM.Core.Enums
|
|
||||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|
||||||
@using TIAMWebApp.Shared.Application.Services
|
|
||||||
@using TIAMWebApp.Shared.Application.Utility
|
|
||||||
@using TIAMSharedUI.Pages.User.SysAdmins
|
|
||||||
@using TIAMSharedUI.Pages.Components
|
|
||||||
@layout AdminLayout
|
|
||||||
@inherits BasePageComponent
|
|
||||||
@inject HttpClient Http
|
|
||||||
@inject NavigationManager navManager
|
|
||||||
@inject ITransferDataService transferDataService
|
|
||||||
@inject IUserDataService UserDataService
|
|
||||||
@inject SumupService SumUpService
|
|
||||||
@inject NavigationManager navigationManager
|
|
||||||
@inject IStringLocalizer<TIAMResources> localizer
|
|
||||||
@inject IWizardProcessor wizardProcessor
|
|
||||||
@inject AdminSignalRClient _adminSignalRClient
|
|
||||||
|
|
||||||
<PageTitle>@localizer.GetString("MyTransfers.Subtitle")</PageTitle>
|
|
||||||
<div class="text-center m-5">
|
|
||||||
<h1>@localizer.GetString("MyTransfers.Title")</h1>
|
|
||||||
<h2 style="font-size:small">@localizer.GetString("MyTransfers.Subtitle")</h2>
|
|
||||||
</div>
|
|
||||||
@*
|
|
||||||
<DxPopup CssClass="popup-demo-events"
|
|
||||||
@bind-Visible="@_popupVisible"
|
|
||||||
ShowFooter="true"
|
|
||||||
CloseOnEscape="true"
|
|
||||||
CloseOnOutsideClick="false"
|
|
||||||
ShowCloseButton="false"
|
|
||||||
HeaderText="MessageBox"
|
|
||||||
Closing="EmailPopupClosing"
|
|
||||||
Closed="EmailPopupClosed"
|
|
||||||
SizeMode="SizeMode.Large">
|
|
||||||
<BodyContentTemplate>
|
|
||||||
@{
|
|
||||||
if(showResultMessage)
|
|
||||||
{
|
|
||||||
<h5>@resultMessage</h5>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<DynamicEditForm Data=@_messageWizardModel
|
|
||||||
OnSubmit="SubmitForm"
|
|
||||||
TitleString="New message"
|
|
||||||
ButtonTextString="Send message"
|
|
||||||
isEditing="true"
|
|
||||||
IgnoreReflection=@IgnoreList></DynamicEditForm>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</BodyContentTemplate>
|
|
||||||
<FooterContentTemplate Context="Context">
|
|
||||||
@{
|
|
||||||
if(showResultMessage)
|
|
||||||
{
|
|
||||||
<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="Ok" Click="CancelCreateClick" />
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<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> *@
|
|
||||||
|
|
||||||
@if (_isLoading)
|
|
||||||
{
|
|
||||||
<div class="text-center m-5">
|
|
||||||
<DxWaitIndicator Visible="true"
|
|
||||||
CssClass="m-auto"
|
|
||||||
AnimationType="WaitIndicatorAnimationType.Spin" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (!string.IsNullOrEmpty(_errorMessage))
|
|
||||||
{
|
|
||||||
<div class="alert alert-danger">@_errorMessage</div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="container mt-4">
|
|
||||||
<DxTabs>
|
|
||||||
<DxTabPage Visible="@displayCard" Text="Details">
|
|
||||||
|
|
||||||
|
|
||||||
@if (!_editMode)
|
|
||||||
{
|
|
||||||
<section>
|
|
||||||
<div class="container py-4">
|
|
||||||
<div class="row d-flex justify-content-center align-items-center h-100">
|
|
||||||
<div class="col-md-10 col-lg-8 col-xl-6">
|
|
||||||
<div class="card" style="border-radius: 16px;">
|
|
||||||
<div class="card-header py-3 px-4">
|
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
|
||||||
<div>
|
|
||||||
<span class="fw-bold text-body">Transfer identifier: #@_transfer.OrderId</span>
|
|
||||||
<p class="text-muted mb-0">@_transfer.ContactPhone</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-4">
|
|
||||||
<div class="mb-4 pb-2">
|
|
||||||
<div class="mb-3">
|
|
||||||
<h4 class="fw-bold">Passenger: @_transfer.FullName</h4>
|
|
||||||
<h5 class="fw-bold">E-mail address: @_transfer.ContactEmail</h5>
|
|
||||||
<p class="text-muted">From: @_transfer.FromAddress</p>
|
|
||||||
<p class="text-muted">To: @_transfer.ToAddress</p>
|
|
||||||
<hr />
|
|
||||||
<h5>@_transfer.Appointment.ToString("MMMM dd, yyyy")</h5>
|
|
||||||
<h5 class="mb-3 text-muted">@_transfer.Appointment.ToString("hh:mm tt")</h5>
|
|
||||||
<p>Passengers: @_transfer.PassengerCount</p>
|
|
||||||
<p>Luggage: @_transfer.LuggageCount</p>
|
|
||||||
<p>Flight number (optional): @_transfer.FlightNumber</p>
|
|
||||||
<hr />
|
|
||||||
@{
|
|
||||||
if(_drivers.Count < 1)
|
|
||||||
{
|
|
||||||
<p>No car information available yet</p>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach (var _car in _cars)
|
|
||||||
{
|
|
||||||
<h4>License plate: @_car.LicencePlate</h4>
|
|
||||||
<p class="text-muted">Car looks: @_car.Color, @_car.Manufacture, @_car.CarModel</p>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
<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>
|
|
||||||
<h5 class="text-muted">@Enum.GetName(typeof(TransferStatusType), _transfer.TransferStatusType)</h5>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
|
||||||
<h4>EUR @_transfer.Price <span class="small text-muted"> </span></h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-footer p-4">
|
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
|
||||||
<h5 class="fw-normal mb-0"><a href="#!" class="text-decoration-none">Contact driver</a></h5>
|
|
||||||
<div class="vr"></div>
|
|
||||||
@{
|
|
||||||
if (_transfer.TransferStatusType != TransferStatusType.UserCanceled)
|
|
||||||
{
|
|
||||||
<h5 class="fw-normal mb-0"><DxButton RenderStyle="ButtonRenderStyle.Warning" Click="CancelTransfer">Cancel</DxButton></h5>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="vr"></div>
|
|
||||||
@* @{
|
|
||||||
if(_transfer.Price != null || _transfer.Price != 0)
|
|
||||||
{
|
|
||||||
<DxButton RenderStyle="ButtonRenderStyle.Primary" Click="Pay">Pay</DxButton>
|
|
||||||
<div class="vr"></div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*@
|
|
||||||
@*<h5 class="fw-normal mb-0"><a class="btn btn-secondary" @onclick="SetEditMode">Modify</a></h5>*@
|
|
||||||
<h5 class="fw-normal mb-0"><DxButton RenderStyle="ButtonRenderStyle.Secondary" Click="SetEditMode">Modify</DxButton></h5>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<div class="container py-1">
|
|
||||||
<div class="row d-flex justify-content-center align-items-center h-100">
|
|
||||||
<div class="col-md-10 col-lg-8 col-xl-6">
|
|
||||||
<DxFormLayout>
|
|
||||||
<div class="card card-admin card-stepper" 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">Transfer identifier: @_transfer.Id</span>
|
|
||||||
<p class="text-muted">
|
|
||||||
<DxFormLayoutItem ColSpanLg="12" CssClass="form-field dxbl-col-12" Caption="Contact Phone">
|
|
||||||
<DxTextBox @bind-Text="_transfer.ContactPhone" />
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h6 class="mb-0"> </h6>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-4">
|
|
||||||
<div class="d-flex flex-row mb-4 pb-2">
|
|
||||||
<div class="flex-fill">
|
|
||||||
|
|
||||||
<DxFormLayoutItem ColSpanLg="6" CssClass="form-field" Caption="First Name">
|
|
||||||
<DxTextBox @bind-Text="_transfer.FirstName" />
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
<DxFormLayoutItem ColSpanLg="6" CssClass="form-field" Caption="Last Name">
|
|
||||||
<DxTextBox @bind-Text="_transfer.LastName" />
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
|
|
||||||
<DxFormLayoutItem ColSpanLg="12" CssClass="form-field" Caption="Contact Email">
|
|
||||||
<DxTextBox @bind-Text="_transfer.ContactEmail" />
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
|
|
||||||
|
|
||||||
<DxFormLayoutItem ColSpanLg="12" CssClass="form-field" Caption="From Address">
|
|
||||||
<DxTextBox @bind-Text="_transfer.FromAddress" />
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
|
|
||||||
<DxFormLayoutItem ColSpanLg="12" CssClass="form-field" Caption="To Address">
|
|
||||||
<DxTextBox @bind-Text="_transfer.ToAddress" />
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<DxFormLayoutItem ColSpanLg="12" CssClass="form-field" Caption="Appointment">
|
|
||||||
<DxDateEdit TimeSectionVisible="true" @bind-Date="_transfer.Appointment" />
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
|
|
||||||
<DxFormLayoutItem ColSpanLg="12" CssClass="form-field" Caption="Passenger Count">
|
|
||||||
<DxSpinEdit @bind-Value="_transfer.PassengerCount" />
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
|
|
||||||
<DxFormLayoutItem ColSpanLg="12" CssClass="form-field" Caption="Luggage Count">
|
|
||||||
<DxSpinEdit @bind-Value="_transfer.LuggageCount" />
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
|
|
||||||
<DxFormLayoutItem ColSpanLg="12" CssClass="form-field" Caption="Flight Number">
|
|
||||||
<DxTextBox @bind-Text="_transfer.FlightNumber" />
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="d-flex flex-row mb-4 pb-2">
|
|
||||||
<DxFormLayoutItem ColSpanLg="12" CssClass="form-field" Caption="Comment">
|
|
||||||
<DxMemo @bind-Text="_transfer.Comment" />
|
|
||||||
</DxFormLayoutItem>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer p-4">
|
|
||||||
<div class="d-flex justify-content-between">
|
|
||||||
<DxButton Click="@((e) => UpdateTransferEventHandler(e, true))">Save Changes</DxButton>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</DxFormLayout>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
}
|
|
||||||
|
|
||||||
</DxTabPage>
|
|
||||||
@* <DxTabPage Visible="@displayCard" Text="Messages">
|
|
||||||
<div style="margin-top: 10px; margin-bottom: 10px;">
|
|
||||||
<DxButton Click="() => SendMail(_transfer)" Text="Send a message" RenderStyle="ButtonRenderStyle.Primary" />
|
|
||||||
</div>
|
|
||||||
<MessageDetailGridComponent ContextId="transferId" IsSenderEmailVisible="false" IsMessageTextVisible="false"></MessageDetailGridComponent>
|
|
||||||
</DxTabPage> *@
|
|
||||||
</DxTabs>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@code {
|
|
||||||
[Parameter] public Guid transferId { get; set; } = Guid.Empty;
|
|
||||||
|
|
||||||
private Transfer _transfer = new Transfer();
|
|
||||||
private List<TransferToDriver> _drivers = new List<TransferToDriver>();
|
|
||||||
private List<Car> _cars = new List<Car>();
|
|
||||||
private bool _isLoading = true;
|
|
||||||
private string _errorMessage = string.Empty;
|
|
||||||
|
|
||||||
private bool showResultMessage = false;
|
|
||||||
private string resultMessage = string.Empty;
|
|
||||||
private List<UserModelDtoDetail> sysAdmins = [];
|
|
||||||
|
|
||||||
private LoggerClient<EditTransfers> _logger = null!;
|
|
||||||
private MessageWizardModel _messageWizardModel = new();
|
|
||||||
|
|
||||||
private bool displayCard = true;
|
|
||||||
|
|
||||||
private bool _popupVisible;
|
|
||||||
|
|
||||||
// public List<string> IgnoreList =
|
|
||||||
// [
|
|
||||||
// "ReceiverEmailAddress",
|
|
||||||
// "ReceiverFullName",
|
|
||||||
// "ReceiverId",
|
|
||||||
// "SenderEmailAddress",
|
|
||||||
// "SenderFullName",
|
|
||||||
// "SenderId",
|
|
||||||
// "ContextId",
|
|
||||||
// "ContextType"
|
|
||||||
// ];
|
|
||||||
|
|
||||||
private bool _editMode = false;
|
|
||||||
private readonly List<string> _statusTypes = [];
|
|
||||||
|
|
||||||
// void SendMail(Transfer item)
|
|
||||||
// {
|
|
||||||
// _logger.Info($"Preparing mail to {item.ContactEmail}, {item.Id}");
|
|
||||||
// _messageWizardModel.Subject = $"[#{item.OrderId}] New message from guest";
|
|
||||||
// _messageWizardModel.ReceiverId = TiamConstClient.SysAccounts["SystemEmailSender"];
|
|
||||||
// //get first sysadmin
|
|
||||||
|
|
||||||
// _messageWizardModel.ReceiverEmailAddress = sysAdmins[0].UserDto.EmailAddress;
|
|
||||||
// _messageWizardModel.ReceiverFullName = "Admin user";
|
|
||||||
|
|
||||||
// _messageWizardModel.SenderId = item.UserId;
|
|
||||||
// _messageWizardModel.SenderEmailAddress = TiamConstClient.SystemEmailAddress;
|
|
||||||
|
|
||||||
// _messageWizardModel.ContextId = item.Id;
|
|
||||||
// _messageWizardModel.ContextType = MessageContextType.Transfer;
|
|
||||||
// _popupVisible = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void CancelCreateClick()
|
|
||||||
// {
|
|
||||||
// showResultMessage = false;
|
|
||||||
// resultMessage = "";
|
|
||||||
// _popupVisible = false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void EmailPopupClosed()
|
|
||||||
// {
|
|
||||||
// //cancel clicked
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void EmailPopupClosing(PopupClosingEventArgs args)
|
|
||||||
// {
|
|
||||||
// //myModel = new TransferWizardModel();
|
|
||||||
// _messageWizardModel = new MessageWizardModel();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public async Task SubmitForm(object result)
|
|
||||||
// {
|
|
||||||
// var messageModel = (result as MessageWizardModel)!;
|
|
||||||
// _logger.Info(messageModel.Content);
|
|
||||||
// var email = await wizardProcessor.ProcessWizardAsync<MessageWizardModel>(result.GetType(), messageModel);
|
|
||||||
// if(email != null)
|
|
||||||
// {
|
|
||||||
// resultMessage = "Message sent";
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// resultMessage = $"Something went wrong, please try again later, or contact us by regular email at {TiamConstClient.SystemEmailAddress}!";
|
|
||||||
// }
|
|
||||||
// showResultMessage = true;
|
|
||||||
// _logger.Info($"Submitted nested form: {result.GetType().FullName}");
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
private async Task CancelTransfer()
|
|
||||||
{
|
|
||||||
_transfer.TransferStatusType = TransferStatusType.UserCanceled;
|
|
||||||
var result = await UpdateTransfer(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// private async Task Pay()
|
|
||||||
// {
|
|
||||||
// if (_transfer != null)
|
|
||||||
// {
|
|
||||||
// var paymentId = "";
|
|
||||||
// if (_transfer.PaymentId != null)
|
|
||||||
// {
|
|
||||||
// //if we have already
|
|
||||||
// paymentId = _transfer.PaymentId;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// //if we have no paymentId yet
|
|
||||||
// paymentId = await SumUpService.CreatePaymentAsync(_transfer);
|
|
||||||
// _transfer.PaymentId = paymentId;
|
|
||||||
// //and save it to Db
|
|
||||||
// var resultTransfer = await UpdateTransfer(false);
|
|
||||||
// if (resultTransfer.PaymentId != null)
|
|
||||||
// {
|
|
||||||
// _logger.Debug("Added paymentId to Db: " + resultTransfer.PaymentId);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var checkoutUrl = "sumuppayment/" + paymentId;
|
|
||||||
// Console.WriteLine($"Payment Link: {paymentId}");
|
|
||||||
// navigationManager.NavigateTo(checkoutUrl);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (var t in Enum.GetValues(typeof(TransferStatusType)).OfType<TransferStatusType>().ToList())
|
|
||||||
_statusTypes.Add(t.ToString());
|
|
||||||
|
|
||||||
_logger = new LoggerClient<EditTransfers>(_logWriters.ToArray());
|
|
||||||
_logger.Info($"parameter: {transferId.ToString()}");
|
|
||||||
|
|
||||||
await LoadTransfer();
|
|
||||||
sysAdmins = await _adminSignalRClient.GetByIdAsync<List<UserModelDtoDetail>>(SignalRTags.GetAllUserModelDtoDetails, TiamConstClient.SysAdmins[0]);
|
|
||||||
var test = _transfer.UserId;
|
|
||||||
if (!_transfer.UserId.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
//get transfer user details
|
|
||||||
var transferUser = await UserDataService.GetUserByEmailAsync(_transfer.ContactEmail);
|
|
||||||
if(transferUser != null)
|
|
||||||
{
|
|
||||||
if(_sessionService.IsAuthenticated)
|
|
||||||
{
|
|
||||||
if (_sessionService.User != null)
|
|
||||||
{
|
|
||||||
if (transferUser.Id == _sessionService.User.UserId)
|
|
||||||
{
|
|
||||||
//I am logged in, and this is my transfer
|
|
||||||
await UserDataService.SetEmailConfirmed(_transfer.UserId);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//this is not my transfer, if I am not sysadmin, I should not see the transfer details
|
|
||||||
if(!_sessionService.IsSysAdmin || !_sessionService.IsDevAdmin)
|
|
||||||
{
|
|
||||||
displayCard = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//does a user exist with this userId?
|
|
||||||
await UserDataService.SetEmailConfirmed(transferUser.Id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
|
||||||
{
|
|
||||||
_logger.Info($"on parameter set: {transferId.ToString()}");
|
|
||||||
await base.OnParametersSetAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetEditMode()
|
|
||||||
{
|
|
||||||
_editMode = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task LoadTransfer()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//var response = await transferDataService.GetTransferByIdAsync(transferId);
|
|
||||||
var response = await _adminSignalRClient.GetTransferById(transferId);
|
|
||||||
|
|
||||||
if (response != null)
|
|
||||||
{
|
|
||||||
_transfer = response;
|
|
||||||
_drivers = await _adminSignalRClient.GetByIdAsync<List<TransferToDriver>>(SignalRTags.GetTransferDriversByTransferId, _transfer.Id);
|
|
||||||
if(_drivers.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (var _transferToDriver in _drivers)
|
|
||||||
{
|
|
||||||
_cars.Add(_transferToDriver.Car);
|
|
||||||
}
|
|
||||||
_logger.DebugConditional($"{_drivers.FirstOrDefault().Id}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_errorMessage = $"Error loading transfer: {_transfer.Id}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_errorMessage = $"Exception: {ex.Message}";
|
|
||||||
}
|
|
||||||
|
|
||||||
_isLoading = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task UpdateTransferEventHandler(MouseEventArgs e, bool shouldRedirect = false)
|
|
||||||
{
|
|
||||||
var result = await UpdateTransfer(shouldRedirect);
|
|
||||||
if (result != null && shouldRedirect)
|
|
||||||
navManager.Refresh(false); // Redirect to a list or another page after successful update
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<Transfer?> UpdateTransfer(bool shouldRedirect = false)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// var responseTransfer = await transferDataService.UpdateTransferAsync(_transfer);
|
|
||||||
var responseTransfer = await _adminSignalRClient.PostDataAsync<Transfer>(SignalRTags.UpdateTransfer, _transfer);
|
|
||||||
if (responseTransfer != null)
|
|
||||||
{
|
|
||||||
return responseTransfer;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_errorMessage = $"Error updating transfer: {_transfer.Id}";
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_errorMessage = $"Exception: {ex.Message}";
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,393 +0,0 @@
|
||||||
@page "/hotel/transfers/{HotelId:guid}"
|
|
||||||
@using BlazorAnimation
|
|
||||||
@using TIAM.Core.Consts
|
|
||||||
@using TIAM.Core.Enums
|
|
||||||
@using TIAM.Entities.Emails
|
|
||||||
@using TIAM.Entities.Transfers
|
|
||||||
@using TIAM.Resources
|
|
||||||
@using TIAM.Services
|
|
||||||
@using TIAMSharedUI.Pages.Components
|
|
||||||
@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 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
|
|
||||||
@using TIAM.Entities.Emails
|
|
||||||
@using TIAMSharedUI.Shared.Components.BaseComponents
|
|
||||||
@inherits UserBasePageComponent
|
|
||||||
@layout AdminLayout
|
|
||||||
@inject IWizardProcessor wizardProcessor
|
|
||||||
@inject ITransferDataService transferDataService
|
|
||||||
@inject AdminSignalRClient AdminSignalRClient;
|
|
||||||
<PageTitle>Transfers</PageTitle>
|
|
||||||
|
|
||||||
<div class="text-center m-5">
|
|
||||||
<h1>Transfer management</h1>
|
|
||||||
<h2 style="font-size:small">Manage transfers here!</h2>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<DxPopup CssClass="popup-demo-events"
|
|
||||||
@bind-Visible="@_popupVisible"
|
|
||||||
ShowFooter="true"
|
|
||||||
CloseOnEscape="true"
|
|
||||||
CloseOnOutsideClick="false"
|
|
||||||
ShowCloseButton="false"
|
|
||||||
HeaderText="MessageBox"
|
|
||||||
Closing="EulaPopupClosing"
|
|
||||||
Closed="EulaPopupClosed">
|
|
||||||
<BodyContentTemplate>
|
|
||||||
<InputWizard Data=@_messageWizardModel
|
|
||||||
OnSubmit="SubmitForm"
|
|
||||||
IgnoreReflection=@IgnoreList
|
|
||||||
TitleResourceString="NewMessage"
|
|
||||||
SubtitleResourceString="NewMessageSubtitle"
|
|
||||||
SubmitButtonText="@_localizer.GetString("ButtonSend")"></InputWizard>
|
|
||||||
</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="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>
|
|
||||||
|
|
||||||
<TransferGrid @ref="_gridTransfer"
|
|
||||||
Logger="_logger"
|
|
||||||
SignalRClient="AdminSignalRClient"
|
|
||||||
ContextIds="@(HotelId.IsNullOrEmpty() ? null : [HotelId])"
|
|
||||||
GetAllMessageTag="@SignalRTags.GetTransfersByOrderingProductId"
|
|
||||||
CustomizeElement="Grid_CustomizeElement"
|
|
||||||
CustomizeEditModel="Grid_CustomizeEditModel"
|
|
||||||
EditMode="GridEditMode.EditRow"
|
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
|
||||||
PageSize="13"
|
|
||||||
ShowFilterRow="true">
|
|
||||||
|
|
||||||
<Columns>
|
|
||||||
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="AcDomain.IsDeveloperVersion" 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 = $"hotel/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" />
|
|
||||||
|
|
||||||
<DxGridDataColumn FieldName="TransferStatusType" Caption="Status" SortIndex="0" Width="120" SortOrder="GridColumnSortOrder.Ascending" SortMode="GridColumnSortMode.Value" />
|
|
||||||
|
|
||||||
<DxGridDataColumn FieldName="Comment" Caption="Comment" />
|
|
||||||
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="125" Visible="false" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
|
||||||
</Columns>
|
|
||||||
</TransferGrid>
|
|
||||||
</div>
|
|
||||||
</DxTabPage>
|
|
||||||
</DxTabs>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class=" col-12 col-xl-6">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
@code {
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public Guid HotelId { get; set; }
|
|
||||||
private LoggerClient<ManageTransfers> _logger;
|
|
||||||
|
|
||||||
private bool _popupVisible;
|
|
||||||
private TransferGrid _gridTransfer;
|
|
||||||
|
|
||||||
private DxTagBox<TransferStatusModel, TransferStatusModel> _filterTag;
|
|
||||||
|
|
||||||
public List<string> IgnoreList =
|
|
||||||
[
|
|
||||||
"ReceiverEmailAddress",
|
|
||||||
"ReceiverFullName",
|
|
||||||
"ReceiverId",
|
|
||||||
"SenderEmailAddress",
|
|
||||||
"SenderFullName",
|
|
||||||
"SenderId",
|
|
||||||
"ContextId",
|
|
||||||
"ContextType"
|
|
||||||
];
|
|
||||||
|
|
||||||
private static List<TransferStatusModel> _selectedCategories = TransferStatusModel.AllStatuses.Values.Where(x => x.StatusValue != TransferStatusType.Finished && x.StatusValue != TransferStatusType.UserCanceled && x.StatusValue != TransferStatusType.AdminDenied).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
private MessageWizardModel _messageWizardModel = new();
|
|
||||||
|
|
||||||
public List<AppointmentModel> AppointmentModels { get; set; } = null!;
|
|
||||||
|
|
||||||
DateTime StartDate { get; set; } = DateTime.Today;
|
|
||||||
DxSchedulerDataStorage _dataStorage = new();
|
|
||||||
|
|
||||||
|
|
||||||
void SendMail(Transfer item)
|
|
||||||
{
|
|
||||||
_logger.Info($"Preparing mail to {item.ContactEmail}, {item.Id}");
|
|
||||||
_messageWizardModel.Subject = $"[#{item.OrderId}] New message regarding your transfer";
|
|
||||||
_messageWizardModel.ReceiverId = item.UserId;
|
|
||||||
_messageWizardModel.ContextId = item.Id;
|
|
||||||
_messageWizardModel.ContextType = MessageContextType.Transfer;
|
|
||||||
_messageWizardModel.SenderId = TiamConstClient.SysAccounts["SystemEmailSender"];
|
|
||||||
_messageWizardModel.SenderEmailAddress = TiamConstClient.SystemEmailAddress;
|
|
||||||
_messageWizardModel.ReceiverEmailAddress = item.ContactEmail;
|
|
||||||
_messageWizardModel.ReceiverFullName = item.FullName;
|
|
||||||
_popupVisible = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CancelCreateClick()
|
|
||||||
{
|
|
||||||
|
|
||||||
_popupVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EulaPopupClosed()
|
|
||||||
{
|
|
||||||
//cancel clicked
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void EulaPopupClosing(PopupClosingEventArgs args)
|
|
||||||
{
|
|
||||||
//myModel = new TransferWizardModel();
|
|
||||||
_messageWizardModel = new MessageWizardModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
public async Task SubmitForm(object result)
|
|
||||||
{
|
|
||||||
var messageModel = (result as MessageWizardModel)!;
|
|
||||||
_logger.Info(messageModel.Content);
|
|
||||||
var email = await wizardProcessor.ProcessWizardAsync<MessageWizardModel>(result.GetType(), messageModel);
|
|
||||||
_logger.Info($"Submitted nested form: {result.GetType().FullName}");
|
|
||||||
CancelCreateClick();
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
filterCriteria = new InOperator("TransferStatusType", _selectedCategories.Select(c => c.StatusValue));
|
|
||||||
filterText = GetFilterText(_selectedCategories.Select(x => (TransferStatusType)x.StatusValue).ToList());
|
|
||||||
}
|
|
||||||
_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 Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
_logger = new LoggerClient<ManageTransfers>(_logWriters.ToArray());
|
|
||||||
|
|
||||||
return base.OnInitializedAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializeAppointments(ICollection<Transfer> transferDataList)
|
|
||||||
{
|
|
||||||
_logger.Info("InitializeAppointments called");
|
|
||||||
|
|
||||||
AppointmentModels = new List<AppointmentModel>(transferDataList.Count);
|
|
||||||
|
|
||||||
foreach (var transfer in transferDataList)
|
|
||||||
{
|
|
||||||
// var bnm = DataStorage.CreateAppointmentItem();
|
|
||||||
// bnm.Start = transfer.Appointment;
|
|
||||||
// bnm.Description = $"{transfer.FullName}, {transfer.ToAddress}";
|
|
||||||
// bnm.Location = transfer.FromAddress;
|
|
||||||
// bnm.Subject = "Simple transfer";
|
|
||||||
|
|
||||||
AppointmentModels.Add(CreateAppointmentModel(transfer));
|
|
||||||
}
|
|
||||||
|
|
||||||
_dataStorage = new DxSchedulerDataStorage
|
|
||||||
{
|
|
||||||
AppointmentMappings = new DxSchedulerAppointmentMappings()
|
|
||||||
{
|
|
||||||
Type = "AppointmentType",
|
|
||||||
Start = "StartDate",
|
|
||||||
End = "EndDate",
|
|
||||||
Subject = "Caption",
|
|
||||||
AllDay = "AllDay",
|
|
||||||
Location = "Location",
|
|
||||||
Description = "Description",
|
|
||||||
LabelId = "Label",
|
|
||||||
StatusId = "Status",
|
|
||||||
RecurrenceInfo = "Recurrence"
|
|
||||||
},
|
|
||||||
|
|
||||||
AppointmentsSource = AppointmentModels
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public AppointmentModel CreateAppointmentModel(Transfer transfer)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -141,10 +141,10 @@
|
||||||
var transfer2 = (Company)EditFormContext.EditModel;
|
var transfer2 = (Company)EditFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption="Company name" ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
<DxFormLayoutItem Caption=@_localizer.GetString(ResourceKeys.LastName) ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
||||||
@EditFormContext.GetEditor("Name")
|
@EditFormContext.GetEditor("Name")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Commission rate (%)" ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
<DxFormLayoutItem Caption=@_localizer.GetString(ResourceKeys.LastName) ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
||||||
@EditFormContext.GetEditor("CommissionPercent")
|
@EditFormContext.GetEditor("CommissionPercent")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
|
|
|
||||||
|
|
@ -147,10 +147,10 @@
|
||||||
|
|
||||||
private ProductDetailGrid _productGrid = null!;
|
private ProductDetailGrid _productGrid = null!;
|
||||||
private LoggerClient<ProductDetailGridComponent> _logger = null!;
|
private LoggerClient<ProductDetailGridComponent> _logger = null!;
|
||||||
|
|
||||||
private async Task CopyUrl(string url)
|
private async Task CopyUrl(string url)
|
||||||
{
|
{
|
||||||
|
|
||||||
await JsRuntime.InvokeVoidAsync("copyToClipboard", url);
|
await JsRuntime.InvokeVoidAsync("copyToClipboard", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,7 +189,6 @@
|
||||||
{
|
{
|
||||||
TransferDestination transferDestination = new TransferDestination();
|
TransferDestination transferDestination = new TransferDestination();
|
||||||
transferDestination.Id = Guid.NewGuid();
|
transferDestination.Id = Guid.NewGuid();
|
||||||
transferDestination.ProductId = product.Id;
|
|
||||||
transferDestination.Name = product.Name;
|
transferDestination.Name = product.Name;
|
||||||
if (!string.IsNullOrEmpty(product.Profile.Description))
|
if (!string.IsNullOrEmpty(product.Profile.Description))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -126,9 +126,9 @@
|
||||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductType) ColSpanMd="4">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductType) ColSpanMd="4">
|
||||||
@editFormContext.GetEditor("ProductType")
|
@editFormContext.GetEditor("ProductType")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
@* <DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.Price) ColSpanMd="4">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.Price) ColSpanMd="4">
|
||||||
@editFormContext.GetEditor("Price")
|
@editFormContext.GetEditor("Price")
|
||||||
</DxFormLayoutItem> *@
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductDescription) ColSpanMd="4">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductDescription) ColSpanMd="4">
|
||||||
@editFormContext.GetEditor("Description")
|
@editFormContext.GetEditor("Description")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
@ -189,7 +189,6 @@
|
||||||
{
|
{
|
||||||
TransferDestination transferDestination = new TransferDestination();
|
TransferDestination transferDestination = new TransferDestination();
|
||||||
transferDestination.Id = Guid.NewGuid();
|
transferDestination.Id = Guid.NewGuid();
|
||||||
transferDestination.ProductId = product.Id;
|
|
||||||
transferDestination.Name = product.Name;
|
transferDestination.Name = product.Name;
|
||||||
if (!string.IsNullOrEmpty(product.Profile.Description))
|
if (!string.IsNullOrEmpty(product.Profile.Description))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,6 @@
|
||||||
<Content Update="Pages\User\Drivers\DriverManageCars.razor">
|
<Content Update="Pages\User\Drivers\DriverManageCars.razor">
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Update="Pages\User\Hotels\HotelEditTransfers.razor">
|
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
|
||||||
</Content>
|
|
||||||
<Content Update="Pages\User\SysAdmins\AddressDetailGridComponent.razor">
|
<Content Update="Pages\User\SysAdmins\AddressDetailGridComponent.razor">
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
|
||||||
|
|
@ -489,30 +489,20 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
var from = await _adminDal.Context.TransferDestinations.FirstOrDefaultAsync(x => x.AddressString == transfer.FromAddress);
|
var from = await _adminDal.Context.TransferDestinations.FirstOrDefaultAsync(x => x.AddressString == transfer.FromAddress);
|
||||||
var to = await _adminDal.Context.TransferDestinations.FirstOrDefaultAsync(x => x.AddressString == transfer.ToAddress);
|
var to = await _adminDal.Context.TransferDestinations.FirstOrDefaultAsync(x => x.AddressString == transfer.ToAddress);
|
||||||
|
|
||||||
//what if one is not transferdestination
|
if (!transfer.ProductId.IsNullOrEmpty())
|
||||||
if (to != null && from != null)
|
|
||||||
{
|
{
|
||||||
if (!transfer.ProductId.IsNullOrEmpty())
|
var product = await _adminDal.GetProductByIdAsync((Guid)transfer.ProductId);
|
||||||
{
|
transfer.Price = _transferBackendService.GetTransferPrice(transfer.ProductId.Value, from, to, transfer.PassengerCount);
|
||||||
var product = await _adminDal.GetProductByIdAsync((Guid)transfer.ProductId);
|
|
||||||
transfer.Price = _transferBackendService.GetTransferPrice(transfer.ProductId.Value, from, to, transfer.PassengerCount);
|
|
||||||
|
|
||||||
if (transfer.Price.HasValue && transfer.Price > 0)
|
if (transfer.Price.HasValue && transfer.Price > 0)
|
||||||
{
|
{
|
||||||
transfer.Revenue = _transferBackendService.GetCommission((Guid)transfer.ProductId, (double)transfer.Price, to);
|
transfer.Revenue = _transferBackendService.GetCommission((Guid)transfer.ProductId, (double)transfer.Price, to);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
transfer.Revenue = 0;
|
transfer.Revenue = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
transfer.Price = 0;
|
|
||||||
transfer.Revenue = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
transfer.TransferStatusType = TransferStatusType.OrderSubmitted;
|
transfer.TransferStatusType = TransferStatusType.OrderSubmitted;
|
||||||
await _adminDal.AddTransferAsync(transfer);
|
await _adminDal.AddTransferAsync(transfer);
|
||||||
|
|
@ -663,28 +653,6 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
{
|
{
|
||||||
_logger.Info($"UpdateTransfer called! transferId: {transfer.Id}");
|
_logger.Info($"UpdateTransfer called! transferId: {transfer.Id}");
|
||||||
|
|
||||||
var to = await _adminDal.Context.TransferDestinations.FirstOrDefaultAsync(x => x.AddressString == transfer.ToAddress);
|
|
||||||
|
|
||||||
//check if revenue should be calculated
|
|
||||||
if (transfer.ProductId.HasValue && transfer.Price > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
//price seems to have changed, update commission
|
|
||||||
if (to == null)
|
|
||||||
{
|
|
||||||
//get general product commission
|
|
||||||
var product = await _adminDal.Context.Products.FirstOrDefaultAsync(x => x.Id == transfer.ProductId);
|
|
||||||
if(product != null)
|
|
||||||
{
|
|
||||||
transfer.Revenue = transfer.Price * product.ServiceProvider.CommissionPercent/100;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
transfer.Revenue = _transferBackendService.GetCommission((Guid)transfer.ProductId, (double)transfer.Price, to);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await _adminDal.UpdateTransferAsync(transfer);
|
return await _adminDal.UpdateTransferAsync(transfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue