small fixes, help

This commit is contained in:
Adam 2024-08-29 15:13:49 +02:00
parent 7b19b32fba
commit f5bc46bcbd
7 changed files with 329 additions and 81 deletions

View File

@ -40,6 +40,15 @@
return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/i.test(navigator.userAgent);
}
</script>
<script>
function copyToClipboard(text) {
navigator.clipboard.writeText(text).then(function () {
console.log('Copied to clipboard successfully!');
}, function (err) {
alert('Could not copy text: ' + err);
});
}
</script>
</head>
<body>

View File

@ -24,8 +24,150 @@
<HeroSlider SliderItems="sliders" Height="30vh"></HeroSlider>
<div class="container-fluid" style="position: relative; z-index: 2;">
<div class="row d-flex justify-content-center">
<div class="col-12 col-lg-6">
@{
if (displayHelp)
{
<div class="col-md-6 col-12 px-5">
<!-- Step 1 -->
<div class="card mb-3 shadow-sm">
<div class="card-body">
<p>
Step 1: Choose Your Transfer Direction
</p>
<p class="text-muted">At the top of the form, select whether you need a transfer <strong>"To the Airport"</strong> or <strong>"From the Airport"</strong> by clicking on the corresponding tab.</p>
</div>
</div>
<!-- Step 2 -->
<div class="card mb-3 shadow-sm">
<div class="card-body">
<p>
Step 2: Enter the Destination (or Pickup) Address
</p>
<p class="text-muted">In the <strong>PickupAddress</strong> section, select your address:</p>
<ul>
<li><strong>Preset addresses:</strong> Click on the dropdown menu under “Preset addresses” and choose an address from the list. For example, you may see options like "Széchenyi fürdő."</li>
<li><strong>Custom address:</strong> If your address is not listed, click on the "Custom address" tab to manually enter your address.</li>
</ul>
</div>
</div>
<!-- Step 3 -->
<div class="card mb-3 shadow-sm">
<div class="card-body">
<p>
Step 3: Confirm the Destination
</p>
<p class="text-muted">Once you select or enter the address, the form will display it as the "Selected address." Make sure this is correct before proceeding.</p>
</div>
</div>
<!-- Step 4 -->
<div class="card mb-3 shadow-sm">
<div class="card-body">
<p>
Step 4: Enter Flight Information (Optional)
</p>
<p class="text-muted">If applicable, fill in your <strong>FlightNumber</strong>. This is optional, so you can leave it blank if you don't have or dont want to provide it.</p>
</div>
</div>
<!-- Step 5 -->
<div class="card mb-3 shadow-sm">
<div class="card-body">
<p>
Step 5: Specify the Number of Passengers
</p>
<p>In the <strong>NumberOfPassengers</strong> field, enter the number of people who will be traveling. The default is set to 1, but you can change it as needed.</p>
</div>
</div>
<!-- Step 6 -->
<div class="card mb-3 shadow-sm">
<div class="card-body">
<p>
Step 6: Indicate the Amount of Luggage
</p>
<p class="text-muted">In the <strong>NumberOfLuggage</strong> field, enter the total number of luggage items you will be bringing.</p>
</div>
</div>
<!-- Step 7 -->
<div class="card mb-3 shadow-sm">
<div class="card-body">
<p>
Step 7: Fill in Your Personal Information
</p>
<p class="text-muted">Under <strong>FullName</strong>, enter your first and last name in the respective fields. Provide your <strong>PhoneNumber</strong> in the designated field. The phone number appears to be pre-filled with a sample number ("+11234567890"), so be sure to update it with your actual contact number. Enter your <strong>EmailAddress</strong> to receive confirmation and any further communication regarding your transfer.</p>
</div>
</div>
<!-- Step 8 -->
<div class="card mb-3 shadow-sm">
<div class="card-body">
<p>
Step 8: Add Additional Comments (Optional)
</p>
<p class="text-muted">If you have any special requests or additional information youd like to provide, use the <strong>Comment</strong> section to do so.</p>
</div>
</div>
<!-- Step 9 -->
<div class="card mb-3 shadow-sm">
<div class="card-body">
<p>
Step 9: Submit Your Request
</p>
<p>Once all fields are filled in correctly, click the <strong>Submit</strong> button at the bottom of the form to place your transfer order.</p>
</div>
</div>
<!-- Step 10 -->
<div class="card mb-3 shadow-sm">
<div class="card-body">
<p>
Step 10: Confirmation
</p>
<p>After submitting, you should receive a confirmation email or message. Ensure all the details are correct, and youre all set!</p>
</div>
</div>
</div>
}
}
<div class="col-12 col-md-6">
<DxToolbar ItemRenderStyleMode="ToolbarRenderStyleMode.Contained">
<Items>
<DxToolbarItem Alignment="ToolbarItemAlignment.Right" Text="Help" RenderStyle="ButtonRenderStyle.Secondary" IconCssClass="grid-icon-column-chooser" Click="ShowHelp_Click" />
</Items>
</DxToolbar>
<DxTabs>
<DxTabPage TabIconCssClass="fa-solid fa-plane-departure" Click="ToAirport" Text="To the Airport">
<DynamicEditForm Data="myModel" TitleString="@($"To: {myModel.Destination}")" isEditing="true" IgnoreReflection="TransferIgnorList1" OnSubmit="SubmitForm"></DynamicEditForm>
@ -37,19 +179,21 @@
</DxTabPage>
</DxTabs>
@* <InputWizard Data=@myModel
OnSubmit="SubmitForm"
IgnoreReflection="@TransferIgnorList"
SubmitButtonText="ButtonSend"
TitleResourceString="TransferTitle"
@* <InputWizard Data=@myModel
OnSubmit="SubmitForm"
IgnoreReflection="@TransferIgnorList"
SubmitButtonText="ButtonSend"
TitleResourceString="TransferTitle"
SubtitleResourceString="TransferSubtitle"></InputWizard> *@
</div>
</div>
</div>
</div>
<div class="container mt-5">
@ -66,7 +210,7 @@
<li><strong>Comfortable Vehicles:</strong> Clean, modern, and well-maintained cars.</li>
</ul>
</div>
<div class="col-12 col-sm-6 p-5">
<img class="img-fluid" src="_content/TIAMSharedUI/images/about1.jpg" />
@ -74,15 +218,15 @@
<div class="col-12 col-sm-6 p-5">
<img class="img-fluid" src="_content/TIAMSharedUI/images/about2.jpg" />
</div>
<div class="col-12 col-sm-6 p-5">
<div class="col-12 col-sm-6 p-5">
<h2>How to Book</h2>
<p>Booking your airport transfer is easy! Simply visit our <a href="/transfer">booking page</a>, enter your details, and confirm your reservation. You can also contact us at <a href="mailto:info@touriam.com">info@touriam.com</a> or call us at (123) 456-7890 for assistance.</p>
<p>Experience the convenience and reliability of Tour I Am. Book your airport transfer today and travel with peace of mind!</p>
</div>
</div>
</div>
</div>
@ -115,7 +259,7 @@ new HeroSliderItem
{
"Id",
"Destination",
"UserId",
"UserId",
"ProductId",
"PaymentId",
"TripDate",
@ -125,7 +269,7 @@ new HeroSliderItem
"UserProductToCarId",
"ReferralId",
"Price"
};
};
public List<string> TransferIgnorList2 = new List<string>
{
@ -150,6 +294,8 @@ new HeroSliderItem
private bool toAirport = true;
private bool displayHelp = false;
public void ToAirport()
{
toAirport = true;
@ -172,14 +318,14 @@ new HeroSliderItem
resModel.UserId = user.Id;
//user exists already
if(_sessionService.User != null)
if (_sessionService.User != null)
{
if(_sessionService.User.UserId == user.Id)
if (_sessionService.User.UserId == user.Id)
{
//I have ordered for myself
resModel.ReferralId = null;
}
}
else
{
//if I am logged in and different user I become referrer (if no referrer already)
@ -196,9 +342,9 @@ new HeroSliderItem
//user has no referrer so I am the referrer
resModel.ReferralId = userDetail.UserDto.RefferalId;
}
}
}
}
}
}
else
{
@ -210,7 +356,7 @@ new HeroSliderItem
registration.Email = resModel.EmailAddress;
registration.PhoneNumber = resModel.PhoneNumber;
registration.Password = password;
//get list with one member!
//get list with one member!
var createResult = await UserDataService.CreateGuestUser(registration);
if (createResult.isSuccess)
@ -218,24 +364,24 @@ new HeroSliderItem
if (createResult.user != null)
{
if (_sessionService.User != null)
{
{
//if I am logged in user I become referrer
var userDetail = await UserDataService.GetUserDetailByIdAsync(_sessionService.User.UserId);
var createdUserDetail = await UserDataService.GetUserDetailByIdAsync(createResult.user.Id);
if(createdUserDetail != null)
if (createdUserDetail != null)
{
createdUserDetail.UserDto.RefferalId = userDetail.UserDto.RefferalId;
var updatedNewUser = await _adminSignalRClient.PostDataAsync<UserModelDtoDetail>(SignalRTags.UpdateUserModelDtoDetail, userDetail);
if (updatedNewUser != null)
{
//referral set
}
}
else
{
//something wrong
}
}
resModel.ReferralId = userDetail.UserDto.RefferalId;
resModel.ReferralId = userDetail.UserDto.RefferalId;
}
resModel.UserId = createResult.user.Id;
@ -245,7 +391,7 @@ new HeroSliderItem
{
//some error handling
}
}
}
}
var transfer = await WizardProcessor.ProcessWizardAsync<TransferWizardModel>(Result.GetType(), Result);
BrowserConsoleLogWriter.Info($"Submitted nested form: {Result.GetType().FullName}");
@ -258,5 +404,10 @@ new HeroSliderItem
return base.OnInitializedAsync();
}
private void ShowHelp_Click()
{
displayHelp = !displayHelp;
}
}

View File

@ -134,15 +134,6 @@
</ProductDetailGrid>
<script>
function copyToClipboard(text) {
navigator.clipboard.writeText(text).then(function () {
console.log('Copied to clipboard successfully!');
}, function (err) {
alert('Could not copy text: '+ err);
});
}
</script>
@code {
[Parameter] public Guid? ContextId { get; set; }

View File

@ -1,4 +1,5 @@
@using TIAM.Entities.Products
@using AyCode.Core.Helpers
@using TIAM.Entities.Products
@using TIAM.Entities.ServiceProviders
@using TIAM.Entities.Transfers
@using TIAM.Entities.Drivers
@ -20,6 +21,7 @@
@inject IStringLocalizer<TIAMResources> Localizer
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
@inject AdminSignalRClient AdminSignalRClient;
@inject IJSRuntime JsRuntime;
<ProductGrid @ref="_productGrid"
@ -55,12 +57,52 @@
</DxGridDataColumn>
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductType) FieldName="ProductType" Width="130" />
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.Price) FieldName="Price" Width="100" />
<DxGridDataColumn Caption="Options" TextAlignment="GridTextAlignment.Center">
<CellDisplayTemplate>
@{
//check if has transferdestination
var AddressId = ((Product)context.DataItem).Profile.AddressId;
var result = CheckDestinations(AddressId);
//if not, display button
Product product = (Product)context.DataItem;
var _url = $"{Setting.BaseUrl}/public/transfer/{product.ServiceProvider.AffiliateId}/{product.Id}";
<DxButton Context="ButtonContext" CssClass="btn-primary" Click="() => CopyUrl(_url)">Copy referral url</DxButton>
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: @(((Product)context.DataItem).Profile.Address.AddressText)</p>
// }
if (product.ProductType == TIAM.Core.Enums.ProductType.Hotel)
{
<a class="btn-primary" href="user/hoteladmin/@product.Id"><i class="fa-solid fa-pen-to-square"></i></a>
}
else if (product.ProductType == TIAM.Core.Enums.ProductType.Transfer)
{
<a class="btn btn-primary" href="user/transferadmin/@product.Id"><i class="fa-solid fa-pen-to-square"></i></a>
}
}
</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>
<DxTabs>
<DxTabPage Text="Address">
<AddressDetailGridComponent ParentData="((Product)context.DataItem).Profile" />
</DxTabPage>
<DxTabPage Text="Prices">
<TransferDestinationToProductDetailGridComponent IsProductIdReadonly="true" GetAllTag="SignalRTags.GetTransferDestinationToProductsByProductId" ContextIds="new [] {((Product)context.DataItem).Id}" />
</DxTabPage>
@ -95,16 +137,71 @@
</ProductGrid>
@code {
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnGridEditModelSaving { get; set; }
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
private List<TransferDestination> destinations = [];
private ProductGrid _productGrid = null!;
private LoggerClient<ProductGridComponent> _logger = null!;
private async Task CopyUrl(string url)
{
await JsRuntime.InvokeVoidAsync("copyToClipboard", url);
}
protected override void OnInitialized()
{
_logger = new LoggerClient<ProductGridComponent>(LogWriters.ToArray());
AdminSignalRClient.GetAllIntoAsync<TransferDestination>(destinations, SignalRTags.GetAllTransferDestinations).Forget();
}
private bool CheckDestinations(Guid addressId)
{
if (destinations != null)
{
if (destinations.Any(d => d.AddressId == addressId))
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
private async Task SaveAsDestination(Address address, Product product)
{
TransferDestination transferDestination = new TransferDestination();
transferDestination.Id = Guid.NewGuid();
transferDestination.Name = product.Name;
if (!string.IsNullOrEmpty(product.Profile.Description))
{
transferDestination.Description = product.Profile.Description;
}
else
{
transferDestination.Description = "No description available";
}
transferDestination.AddressId = address.Id;
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

@ -64,30 +64,31 @@
var transfer = (TransferDestination)editFormContext.EditModel;
}
<DxFormLayout CssClass="w-100">
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationName) ColSpanMd="6">
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationName) ColSpanXs="12" ColSpanMd="6">
@editFormContext.GetEditor("Name")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationInfo) ColSpanMd="6">
@editFormContext.GetEditor("Description")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationAddress) ColSpanMd="6">
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationAddress) ColSpanXs="12" ColSpanMd="6">
@editFormContext.GetEditor("AddressString")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price) ColSpanMd="6">
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price) ColSpanXs="12" ColSpanMd="3">
@editFormContext.GetEditor("Price")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price2) ColSpanMd="6">
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price2) ColSpanXs="12" ColSpanMd="3">
@editFormContext.GetEditor("Price2")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price3) ColSpanMd="6">
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price3) ColSpanXs="12" ColSpanMd="3">
@editFormContext.GetEditor("Price3")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Commission) ColSpanMd="6">
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Commission) ColSpanXs="12" ColSpanMd="3">
@editFormContext.GetEditor("ProductCommis")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price) ColSpanMd="6">
<DxFormLayoutItem Caption="Extra" ColSpanXs="12" ColSpanMd="6">
@editFormContext.GetEditor("ExtraPrice")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationInfo) ColSpanXs="12" ColSpanMd="6">
@editFormContext.GetEditor("Description")
</DxFormLayoutItem>
</DxFormLayout>
</EditFormTemplate>

View File

@ -15,7 +15,7 @@
<div class="w-100" style="height:40px; position:fixed; z-index: 10000;">
<DxMenu CssClass="my-menu" SizeMode="SizeMode.Medium" Title="Tour I Am" ItemsPosition="ItemPosition.End" CollapseItemsToHamburgerMenu="true"
<DxMenu CssClass="my-menu" SizeMode="SizeMode.Medium" Title="Tour I Am" ItemsPosition="ItemPosition.End" CollapseItemsToHamburgerMenu="true"
Orientation="Orientation"
DisplayMode="DisplayMode"
HamburgerButtonPosition="MenuHamburgerButtonPosition.Right">
@ -28,12 +28,7 @@
string url3 = $"user/messages/{userId}";
<DxToolbar SizeMode="SizeMode.Medium">
<Items>
@*<DxToolbarItem Name="Item1" Text="Item1" Tooltip="Item1" />
<DxToolbarItem Name="Item2" Text="Item2" Tooltip="Item2" />
<DxToolbarItem Name="Left" BeginGroup="true" IconCssClass="tb-icon tb-icon-align-left"
Tooltip="Align Left" />
<DxToolbarItem Name="Center" IconCssClass="tb-icon tb-icon-align-center"
Tooltip="Align Center" />*@
@if (IsSysAdmin)
{
<DxToolbarItem Name="Transfers"
@ -66,20 +61,14 @@
}
</TitleTemplate>
<Items>
<DxMenuItem NavigateUrl="/" Text="Home" IconCssClass="menu-icon-home menu-icon" />
@{
if (userHasCompany)
{
<DxMenuItem NavigateUrl="user/properties" Text="My companies" IconCssClass="fa-solid fa-building" />
}
if (userHasHotels)
{
<DxMenuItem NavigateUrl="user/createAndManageTransfer" IconCssClass="fa-solid fa-route" Text="Transfer" />
}
}
<DxMenuItem NavigateUrl="/" Text="Home" IconCssClass="fa-solid fa-home" />
<DxMenuItem Visible="userHasCompany" NavigateUrl="user/properties" Text="My companies" IconCssClass="fa-solid fa-building" />
<DxMenuItem Visible="userHasHotels" NavigateUrl="user/createAndManageTransfer" IconCssClass="fa-solid fa-route" Text="Transfer" />
@* <DxMenuItem NavigateUrl="user/media" Text="Media" IconCssClass="menu-icon-home menu-icon" /> *@
<DxMenuItem Text="Driver" Visible="@IsDriver" IconCssClass="fa-solid fa-id-card">
<Items>
<DxMenuItem NavigateUrl="driver/dashboard" Text="Dashboard" />
@ -164,12 +153,12 @@
private bool expandHotelAdminNav = false;
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
private bool userHasCompany;
private bool userHasHotels;
private bool IsDriver;
private bool IsDevAdmin;
private bool IsSysAdmin;
private bool IsDriver;
private bool userHasCompany = false;
private bool userHasHotels = false;
private string? userEmail;
private string? userFullName;
private Guid? userId;
@ -193,18 +182,6 @@
{
_isMobile = await jsRuntime.InvokeAsync<bool>("isDevice");
_logger = new LoggerClient<AdminNavMenu>(LogWriters.ToArray());
//_logger.Debug($"UserId: {SessionService.User.UserModelDto.Id}"); //errorokat dobott
IsDevAdmin = SessionService.IsDevAdmin;
//_logger.Debug($"UserId: {SessionService.IsDevAdmin}");
IsSysAdmin = SessionService.IsSysAdmin;
//_logger.Debug($"UserId: {SessionService.IsSysAdmin}");
IsDriver = SessionService.IsDriver;
//_logger.Debug($"UserId: {SessionService.IsDriver}");
userHasCompany = SessionService.HasCompany;
if (SessionService.GetHotels().Count() > 0)
{
userHasHotels = true;
}
if (SessionService.User != null)
{
@ -216,6 +193,19 @@
userFullName = SessionService.User.UserModelDto.ProfileDto.FullName;
}
}
//_logger.Debug($"UserId: {SessionService.User.UserModelDto.Id}"); //errorokat dobott
userHasCompany = SessionService.HasCompany;
if (SessionService.GetHotels().Count() > 0)
{
userHasHotels = true;
}
IsDriver = SessionService.IsDriver;
//_logger.Debug($"UserId: {SessionService.IsDriver}");
IsDevAdmin = SessionService.IsDevAdmin;
//_logger.Debug($"UserId: {SessionService.IsDevAdmin}");
IsSysAdmin = SessionService.IsSysAdmin;
//_logger.Debug($"UserId: {SessionService.IsSysAdmin}");
await base.OnInitializedAsync();
}

View File

@ -41,6 +41,15 @@
return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/i.test(navigator.userAgent);
}
</script>
<script>
function copyToClipboard(text) {
navigator.clipboard.writeText(text).then(function () {
console.log('Copied to clipboard successfully!');
}, function (err) {
alert('Could not copy text: ' + err);
});
}
</script>
</head>
<body>