more changes
This commit is contained in:
parent
f39fc86a84
commit
9bba24f232
|
|
@ -328,33 +328,43 @@ namespace TIAMMobileApp.Services
|
|||
{
|
||||
_logger.Info("SendForgottenPasswordMail() called");
|
||||
|
||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.SendForgottenPasswordMail}";
|
||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.SendForgottenPasswordMail}";
|
||||
var response = await http.PostAsJsonAsync(url, emailAddress);
|
||||
var success = await response.Content.ReadFromJsonAsync<bool>();
|
||||
|
||||
_logger.Detail($"SendForgottenPasswordMail(): {success.ToString()}");
|
||||
return success;
|
||||
}
|
||||
|
||||
public async Task<string> ValidateForgotPasswordToken(Guid userId, string token)
|
||||
{
|
||||
_logger.Info("SendForgottenPasswordMail() called");
|
||||
string? result = "";
|
||||
_logger.Info("ValidateForgotPasswordToken() called");
|
||||
|
||||
string[] parameters = new string[2];
|
||||
parameters[0] = userId.ToString();
|
||||
parameters[1] = token.ToString();
|
||||
|
||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.SendForgottenPasswordMail}";
|
||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.ValidateForgottenPasswordToken}";
|
||||
var parameters = new[] { userId.ToString(), token };
|
||||
|
||||
var response = await http.PostAsJsonAsync(url, parameters);
|
||||
var success = await response.Content.ReadFromJsonAsync<string>();
|
||||
result = await response.Content.ReadAsStringAsync();
|
||||
|
||||
if (success == "Success")
|
||||
{
|
||||
_logger.Detail($"SendForgottenPasswordMail(): {success}");
|
||||
}
|
||||
_logger.Detail($"ValidateForgotPasswordToken(): {result}");
|
||||
|
||||
return success;
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<bool> SetEmailConfirmed(Guid userId)
|
||||
{
|
||||
bool result = false;
|
||||
_logger.Info("SetEmailConfirmed() called");
|
||||
|
||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.SetEmailConfirmed}";
|
||||
|
||||
var response = await http.PostAsJsonAsync(url, userId);
|
||||
result = await response.Content.ReadFromJsonAsync<bool>();
|
||||
|
||||
_logger.Detail($"ValidateForgotPasswordToken(): {result.ToString()}");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//public Task<Dictionary<int, string>> GetUserRolesAsync(UserModel userModel)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
@page "/mytransfers/{transferId:guid}"
|
||||
@using AyCode.Core.Extensions
|
||||
@using TIAM.Entities.Transfers
|
||||
@using TIAM.Resources
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
|
|
@ -13,6 +14,7 @@
|
|||
@inject NavigationManager navManager
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
@inject ITransferDataService transferDataService
|
||||
@inject IUserDataService UserDataService
|
||||
@inject SumupService SumUpService
|
||||
@inject NavigationManager navigationManager
|
||||
@inject IStringLocalizer<TIAMResources> localizer
|
||||
|
|
@ -260,12 +262,12 @@ else
|
|||
public List<string> IgnoreList =
|
||||
[
|
||||
"ReceiverEmailAddress",
|
||||
"ReceiverFullName",
|
||||
"ReceiverId",
|
||||
"SenderEmailAddress",
|
||||
"SenderFullName",
|
||||
"SenderId",
|
||||
"ContextId",
|
||||
"ReceiverFullName",
|
||||
"ReceiverId",
|
||||
"SenderEmailAddress",
|
||||
"SenderFullName",
|
||||
"SenderId",
|
||||
"ContextId",
|
||||
];
|
||||
|
||||
List<string> StatusTypes = new List<string>();
|
||||
|
|
@ -362,13 +364,18 @@ else
|
|||
|
||||
_logger = new LoggerClient<EditTransfers>(LogWriters.ToArray());
|
||||
_logger.Info($"parameter: {transferId.ToString()}");
|
||||
|
||||
await LoadTransfer();
|
||||
if(transfer.UserId.IsNullOrEmpty())
|
||||
{
|
||||
await UserDataService.SetEmailConfirmed(transfer.UserId);
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
_logger.Info($"on parameter set: {transferId.ToString()}");
|
||||
base.OnParametersSet();
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
|
||||
private void SetEditMode()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
@page "/user/admin"
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using TIAM.Models.Dtos.Users
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAMWebApp.Shared.Application.Interfaces;
|
||||
@using TIAMSharedUI.Shared.Components.BaseComponents
|
||||
|
|
@ -12,34 +13,42 @@
|
|||
<PageTitle>Administration</PageTitle>
|
||||
|
||||
<div class="text-center m-5">
|
||||
<h1>Dashboard</h1>
|
||||
<h1>Control panel</h1>
|
||||
<h2 style="font-size:small">Have a nice day!</h2>
|
||||
</div>
|
||||
|
||||
<!--We need to check if the user is owner of a swerviceprovider-->
|
||||
|
||||
<div class="container">
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
<div class="row py-3">
|
||||
|
||||
|
||||
|
||||
<div class=" col-12 col-xl-12">
|
||||
<div class="p-5 text-center">
|
||||
<h1 class="mb-3">Welcome @myUser.UserDto.EmailAddress</h1>
|
||||
<h4 class="mb-3">Good to see you here :)</h4>
|
||||
<a data-mdb-ripple-init class="btn btn-primary" href="" role="button">Call to action</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" col-12 col-xl-3">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<div class="card">
|
||||
<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">Panel title</span>
|
||||
<p class="text-muted mb-0">Subtitle</p>
|
||||
</div>
|
||||
<div>
|
||||
<h6 class="mb-0"> <a href="#">All details</a> </h6>
|
||||
<span class="fw-bold text-body">Overview</span>
|
||||
<p class="text-muted mb-0">Your transfers and such</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body card-admin-body py-2 px-4">
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<div class="flex-fill">
|
||||
<h5 class="bold">Some info</h5>
|
||||
<p class="text-muted"> Budapest, Dózsa György út 35, 1146</p>
|
||||
<h5 class="bold">Upcoming transfers</h5>
|
||||
<p class="text-muted">You have 0 upcoming transfers</p>
|
||||
</div>
|
||||
<div>
|
||||
<!--img class="align-self-center img-fluid"
|
||||
|
|
@ -47,16 +56,31 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
<ul id="progressbar-1" class="mx-0 mt-0 mb-5 px-0 pt-0 pb-4">
|
||||
<li class="step0 active" id="step1">
|
||||
<span style="margin-left: 22px; margin-top: 12px;">PLACED</span>
|
||||
</li>
|
||||
<li class="step0 active text-center" id="step2"><span>WAITING FOR PICK UP</span></li>
|
||||
<li class="step0 text-muted text-end" id="step3">
|
||||
<span style="margin-right: 22px;">FINISHED</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<div class="flex-fill">
|
||||
<h5 class="bold">Companies</h5>
|
||||
<p class="text-muted">You have 0 companies</p>
|
||||
</div>
|
||||
<div>
|
||||
<!--img class="align-self-center img-fluid"
|
||||
src="https://mdbcdn.b-cdn.net/img/Photos/Horizontal/E-commerce/Products/6.webp" width="250"-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<div class="flex-fill">
|
||||
<h5 class="bold">Hotels</h5>
|
||||
<p class="text-muted">You have 0 hotels</p>
|
||||
</div>
|
||||
<div>
|
||||
<!--img class="align-self-center img-fluid"
|
||||
src="https://mdbcdn.b-cdn.net/img/Photos/Horizontal/E-commerce/Products/6.webp" width="250"-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<h4> Some <span class="small text-muted"> conclusion </span></h4>
|
||||
</div>
|
||||
|
|
@ -72,110 +96,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" col-12 col-xl-3">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<span class="fw-bold text-body">Panel title</span>
|
||||
<p class="text-muted mb-0">Subtitle</p>
|
||||
</div>
|
||||
<div>
|
||||
<h6 class="mb-0"> <a href="#">All details</a> </h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body card-admin-body py-2 px-4">
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<div class="flex-fill">
|
||||
<h5 class="bold">Some info</h5>
|
||||
<p class="text-muted"> Budapest, Dózsa György út 35, 1146</p>
|
||||
</div>
|
||||
<div>
|
||||
<!--img class="align-self-center img-fluid"
|
||||
src="https://mdbcdn.b-cdn.net/img/Photos/Horizontal/E-commerce/Products/6.webp" width="250"-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<ul id="progressbar-1" class="mx-0 mt-0 mb-5 px-0 pt-0 pb-4">
|
||||
<li class="step0 active" id="step1">
|
||||
<span style="margin-left: 22px; margin-top: 12px;">PLACED</span>
|
||||
</li>
|
||||
<li class="step0 active text-center" id="step2"><span>WAITING FOR PICK UP</span></li>
|
||||
<li class="step0 text-muted text-end" id="step3">
|
||||
<span style="margin-right: 22px;">FINISHED</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<h4> Some <span class="small text-muted"> conclusion </span></h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer py-2 px-4">
|
||||
<div class="d-flex justify-content-between">
|
||||
|
||||
<a href="#!">Modify</a>
|
||||
<div class="border-start h-100"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class=" col-12 col-xl-3">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<span class="fw-bold text-body">Panel title</span>
|
||||
<p class="text-muted mb-0">Subtitle</p>
|
||||
</div>
|
||||
<div>
|
||||
<h6 class="mb-0"> <a href="#">All details</a> </h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body card-admin-body py-2 px-4">
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<div class="flex-fill">
|
||||
<h5 class="bold">Some info</h5>
|
||||
<p class="text-muted"> Budapest, Dózsa György út 35, 1146</p>
|
||||
</div>
|
||||
<div>
|
||||
<!--img class="align-self-center img-fluid"
|
||||
src="https://mdbcdn.b-cdn.net/img/Photos/Horizontal/E-commerce/Products/6.webp" width="250"-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<ul id="progressbar-1" class="mx-0 mt-0 mb-5 px-0 pt-0 pb-4">
|
||||
<li class="step0 active" id="step1">
|
||||
<span style="margin-left: 22px; margin-top: 12px;">PLACED</span>
|
||||
</li>
|
||||
<li class="step0 active text-center" id="step2"><span>WAITING FOR PICK UP</span></li>
|
||||
<li class="step0 text-muted text-end" id="step3">
|
||||
<span style="margin-right: 22px;">FINISHED</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<h4> Some <span class="small text-muted"> conclusion </span></h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer py-2 px-4">
|
||||
<div class="d-flex justify-content-between">
|
||||
|
||||
<a href="#!">Modify</a>
|
||||
<div class="border-start h-100"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" col-12 col-xl-3">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
@ -187,13 +109,14 @@
|
|||
|
||||
bool isUserLoggedIn;
|
||||
int userType = 0;
|
||||
|
||||
|
||||
|
||||
private UserModelDtoDetail? myUser;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
if(_sessionService.User != null)
|
||||
{
|
||||
myUser = _sessionService.User.UserModelDto;
|
||||
}
|
||||
await base.OnInitializedAsync();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,40 @@
|
|||
<DetailRowTemplate>
|
||||
@{
|
||||
<DxTabs>
|
||||
<DxTabPage Text="Transfers">
|
||||
<TransferDetailGrid @ref="_gridTransfer"
|
||||
Logger="_logger"
|
||||
GetAllMessageTag="SignalRTags.GetTransfersByUserProductMappingId"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
ContextIds="new object[] {((UserProductMapping)context.DataItem).Id}"
|
||||
ShowGroupPanel="true"
|
||||
CustomGroup="Grid_CustomGroup"
|
||||
CustomizeGroupValueDisplayText="Grid_CustomizeGroupValueDisplayText"
|
||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
AllowSelectRowByClick="false"
|
||||
PageSize="13"
|
||||
ShowFilterRow="true">
|
||||
|
||||
<Columns>
|
||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="Appointment" SortOrder="GridColumnSortOrder.Descending" GroupIndex="0" GroupInterval="GridColumnGroupInterval.Custom" DisplayFormat="g" Width="125" />
|
||||
<DxGridDataColumn FieldName="OrderId" Caption="Order" SortIndex="1" SortOrder="GridColumnSortOrder.Descending" Width="70" />
|
||||
|
||||
<DxGridDataColumn FieldName="FromAddress" />
|
||||
<DxGridDataColumn FieldName="ToAddress" />
|
||||
<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="Price" Caption="Price" Width="70" CaptionAlignment="GridTextAlignment.Center" />
|
||||
<DxGridDataColumn FieldName="Revenue" Caption="Revenue" Width="70" CaptionAlignment="GridTextAlignment.Center" />
|
||||
<DxGridDataColumn FieldName="FullName" />
|
||||
<DxGridDataColumn FieldName="ContactPhone" Width="120" />
|
||||
<DxGridDataColumn FieldName="ContactEmail" Width="120" />
|
||||
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="125" Visible="false" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
||||
</Columns>
|
||||
|
||||
</TransferDetailGrid>
|
||||
</DxTabPage>
|
||||
<DxTabPage Text="Products">
|
||||
<ProductDetailGridComponent GetAllTag="SignalRTags.GetProductsById" ContextId="((UserProductMapping)context.DataItem).ProductId" />
|
||||
</DxTabPage>
|
||||
|
|
@ -151,7 +184,7 @@
|
|||
private ElementReference _errorMessage;
|
||||
private string _errorCss = "display: none;";
|
||||
private List<UserModelDto> FoundUsers { get; set; } = new List<UserModelDto>();
|
||||
|
||||
private TransferGrid _gridTransfer;
|
||||
|
||||
private string Email { get; set; } = "email@email.com";
|
||||
string EmailMask { get; set; } = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}";
|
||||
|
|
@ -164,6 +197,31 @@
|
|||
base.OnInitialized();
|
||||
}
|
||||
|
||||
void Grid_CustomGroup(GridCustomGroupEventArgs e)
|
||||
{
|
||||
if (e.FieldName == "Appointment")
|
||||
{
|
||||
e.SameGroup = Grid_CompareColumnValues(((DateTime)e.Value1).Date, ((DateTime)e.Value2).Date);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
bool Grid_CompareColumnValues(DateTime value1, DateTime value2)
|
||||
{
|
||||
if (value1.Year == value2.Year && value1.Month == value2.Month)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
void Grid_CustomizeGroupValueDisplayText(GridCustomizeGroupValueDisplayTextEventArgs e)
|
||||
{
|
||||
if (e.FieldName == "Appointment")
|
||||
{
|
||||
|
||||
string displayText = ((DateTime)e.Value).Date.ToString();
|
||||
e.DisplayText = displayText;
|
||||
}
|
||||
}
|
||||
|
||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||
{
|
||||
if (!e.IsNew) return;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,451 @@
|
|||
@page "/user/transfers/{userId:guid}"
|
||||
@using BlazorAnimation
|
||||
@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.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
|
||||
@using TIAM.Entities.Emails
|
||||
@using TIAMSharedUI.Shared.Components.BaseComponents
|
||||
@inherits UserBasePageComponent
|
||||
@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="MessageBox"
|
||||
Closing="EmailPopupClosing"
|
||||
Closed="EmailPopupClosed">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
<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="Unpaid">
|
||||
<DxAccordion ExpandMode="ExpandMode"
|
||||
ExpandCollapseAction="ExpandCollapseAction"
|
||||
AnimationType="LayoutAnimationType.Slide">
|
||||
<Items>
|
||||
@foreach (var (transfer, i) in Problems)
|
||||
{
|
||||
|
||||
<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="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>
|
||||
|
||||
<DxTabPage Text="History">
|
||||
<div class="d-flex flex-column mb-4 pb-2">
|
||||
|
||||
<TransferDetailGrid @ref="_gridTransfer"
|
||||
Logger="_logger"
|
||||
GetAllMessageTag="SignalRTags.GetTransfersByUserProductMappingId"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
ContextIds="new object[] {userId}"
|
||||
CustomizeElement="Grid_CustomizeElement"
|
||||
ShowGroupPanel="true"
|
||||
CustomGroup="Grid_CustomGroup"
|
||||
CustomizeGroupValueDisplayText="Grid_CustomizeGroupValueDisplayText"
|
||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
AllowSelectRowByClick="false"
|
||||
PageSize="13"
|
||||
ShowFilterRow="true">
|
||||
|
||||
<Columns>
|
||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="Appointment" SortOrder="GridColumnSortOrder.Descending" GroupIndex="0" GroupInterval="GridColumnGroupInterval.Custom" DisplayFormat="g" Width="125" />
|
||||
<DxGridDataColumn FieldName="OrderId" Caption="Order" SortIndex="1" SortOrder="GridColumnSortOrder.Descending" Width="70" />
|
||||
<DxGridDataColumn FieldName="FromAddress" />
|
||||
<DxGridDataColumn FieldName="ToAddress" />
|
||||
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="125" Visible="false" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
||||
</Columns>
|
||||
|
||||
</TransferDetailGrid>
|
||||
</div>
|
||||
</DxTabPage>
|
||||
|
||||
</DxTabs>
|
||||
|
||||
</div>
|
||||
|
||||
<div class=" col-12 col-xl-6">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter] public Guid UserId { get; set; }
|
||||
private Guid userId;
|
||||
private LoggerClient<UserManageTransfers> _logger;
|
||||
private TransferGrid _gridTransfer;
|
||||
private bool _popupVisible;
|
||||
|
||||
private List<Transfer>? transfers = [];
|
||||
IEnumerable<(Transfer, int)> Upcoming = [];
|
||||
IEnumerable<(Transfer, int)> Problems = [];
|
||||
|
||||
AccordionExpandMode ExpandMode { get; set; } = AccordionExpandMode.SingleOrNone;
|
||||
AccordionExpandCollapseAction ExpandCollapseAction { get; set; } = AccordionExpandCollapseAction.HeaderClick;
|
||||
|
||||
private MessageWizardModel _messageWizardModel = new();
|
||||
|
||||
public List<AppointmentModel> AppointmentModels { get; set; } = null!;
|
||||
|
||||
DateTime StartDate { get; set; } = DateTime.Today;
|
||||
DxSchedulerDataStorage _dataStorage = new();
|
||||
|
||||
|
||||
public List<string> IgnoreList =
|
||||
[
|
||||
"ReceiverEmailAddress",
|
||||
"ReceiverFullName",
|
||||
"ReceiverId",
|
||||
"SenderEmailAddress",
|
||||
"SenderFullName",
|
||||
"SenderId",
|
||||
"ContextId",
|
||||
];
|
||||
|
||||
private static readonly List<TransferStatusModel> Statuses =
|
||||
[
|
||||
new(Convert.ToByte(TransferStatusType.OrderSubmitted), "Order submitted"),
|
||||
new(Convert.ToByte(TransferStatusType.OrderConfirmed), "Order confirmed"),
|
||||
new(Convert.ToByte(TransferStatusType.AssignedToDriver), "Assigned to driver"),
|
||||
new(Convert.ToByte(TransferStatusType.DriverConfirmed), "Driver confirmed"),
|
||||
new(Convert.ToByte(TransferStatusType.DriverEnRoute), "Driver enroute"),
|
||||
new(Convert.ToByte(TransferStatusType.PassengerPickup), "Passenger in car"),
|
||||
new(Convert.ToByte(TransferStatusType.Finished), "Finished"),
|
||||
new(Convert.ToByte(TransferStatusType.UserCanceled), "User cancelled"),
|
||||
new(Convert.ToByte(TransferStatusType.AdminDenied), "Admin cancelled")
|
||||
];
|
||||
|
||||
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_CustomGroup(GridCustomGroupEventArgs e)
|
||||
{
|
||||
if (e.FieldName == "Appointment")
|
||||
{
|
||||
e.SameGroup = Grid_CompareColumnValues(((DateTime)e.Value1).Date, ((DateTime)e.Value2).Date);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
bool Grid_CompareColumnValues(DateTime value1, DateTime value2)
|
||||
{
|
||||
if (value1 == value2)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
void Grid_CustomizeGroupValueDisplayText(GridCustomizeGroupValueDisplayTextEventArgs e)
|
||||
{
|
||||
if (e.FieldName == "Appointment")
|
||||
{
|
||||
|
||||
string displayText = ((DateTime)e.Value).Date.ToString();
|
||||
e.DisplayText = displayText;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void RefreshComponent()
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
userId = UserId;
|
||||
// transfers = await AdminSignalRClient.GetByIdAsync<List<Transfer>>(SignalRTags.GetTransfersByUserProductMappingId, DriverId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void SendMail(Transfer item)
|
||||
{
|
||||
_logger.Info($"Sending mail to {item.ContactEmail}, {item.Id}");
|
||||
|
||||
_messageWizardModel.ReceiverId = item.UserId;
|
||||
_messageWizardModel.ContextId = item.Id;
|
||||
_messageWizardModel.SenderEmailAddress = "info@touriam.com";
|
||||
_messageWizardModel.ReceiverEmailAddress = item.ContactEmail;
|
||||
_messageWizardModel.ReceiverFullName = item.FullName;
|
||||
_popupVisible = true;
|
||||
}
|
||||
|
||||
void CancelCreateClick()
|
||||
{
|
||||
|
||||
_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)!;
|
||||
messageModel.ContextId = _messageWizardModel.ContextId;
|
||||
//messageModel.SenderId = sessionService.User.UserId;
|
||||
|
||||
string FormatEmailContent()
|
||||
{
|
||||
return $@"
|
||||
<html>
|
||||
<body>
|
||||
<p>Dear {messageModel.ReceiverFullName},</p>
|
||||
<p>{messageModel.Content}:</p>
|
||||
<p>Best regards,<br/>Tour I Am team</p>
|
||||
</body>
|
||||
</html>";
|
||||
}
|
||||
|
||||
messageModel.Content = FormatEmailContent();
|
||||
|
||||
_logger.Info(messageModel.Content);
|
||||
var email = await wizardProcessor.ProcessWizardAsync<MessageWizardModel>(result.GetType(), messageModel);
|
||||
|
||||
_logger.Info($"Submitted nested form: {result.GetType().FullName}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
string GetCustomColor(TransferStatusType transferStatusType)
|
||||
{
|
||||
|
||||
var transferStatusByte = (byte)transferStatusType;
|
||||
|
||||
switch (transferStatusByte)
|
||||
{
|
||||
case 5:
|
||||
return "bg-important";
|
||||
|
||||
case > 5 and < 35:
|
||||
return "bg-attention";
|
||||
|
||||
case 35:
|
||||
return "bg-finished";
|
||||
|
||||
case > 35:
|
||||
return "bg-cancel";
|
||||
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_logger = new LoggerClient<UserManageTransfers>(LogWriters.ToArray());
|
||||
if (transfers != null)
|
||||
{
|
||||
var test = UserId.ToString();
|
||||
var result = await AdminSignalRClient.GetByIdAsync<List<Transfer>>(SignalRTags.GetTransfersByUserId, UserId);
|
||||
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.Paid == false).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");
|
||||
|
||||
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" };
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
@inherits LayoutComponentBase
|
||||
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using TIAMSharedUI.Pages
|
||||
@using TIAMSharedUI.Shared.Users
|
||||
@using AyCode.Interfaces.StorageHandlers;
|
||||
@using AyCode.Services.Loggers
|
||||
|
|
@ -17,6 +18,7 @@
|
|||
|
||||
<div class="page">
|
||||
<TiamErrorBoundaryComponent LoggerCategory="AdminLayout" OnError="HandleError">
|
||||
|
||||
<AdminNavMenu />
|
||||
<NavHelperComponent />
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<img height="25" src="_content/TIAMSharedUI/images/logo_wide.png" alt="TourIam Logo" title="TourIAm Logo" />
|
||||
</NavLink>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<button @onclick="ToggleNavMenu" class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="@expandNavMenu" aria-label="Toggle navigation">
|
||||
<img src="_content/TIAMSharedUI/images/navbar-toggler.png" width="40" />
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
|
|
@ -25,11 +25,7 @@
|
|||
</NavLink>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="formulaone">
|
||||
@localizer.GetString("NavMenu.FormulaOne")
|
||||
</NavLink>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@{
|
||||
|
|
@ -40,27 +36,30 @@
|
|||
@localizer.GetString("NavMenu.Transfer")
|
||||
</NavLink>
|
||||
</li>
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (enableEvents)
|
||||
{
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="events">
|
||||
@localizer.GetString("NavMenu.Events")
|
||||
<NavLink class="nav-link" href="formulaone">
|
||||
@localizer.GetString("NavMenu.FormulaOne")
|
||||
</NavLink>
|
||||
</li>
|
||||
|
||||
}
|
||||
if (enableApi)
|
||||
|
||||
if (sessionService.IsSysAdmin)
|
||||
{
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="swagger">
|
||||
API
|
||||
</NavLink>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="chat">
|
||||
Chat
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="events">
|
||||
@localizer.GetString("NavMenu.Events")
|
||||
</NavLink>
|
||||
</li>
|
||||
}
|
||||
|
||||
if(enableLanguage)
|
||||
|
|
@ -79,15 +78,6 @@
|
|||
</li>
|
||||
}
|
||||
|
||||
if(enableChat)
|
||||
{
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="chat">
|
||||
Chat
|
||||
</NavLink>
|
||||
</li>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
<li class="nav-item">
|
||||
|
|
@ -147,13 +137,7 @@
|
|||
</div>
|
||||
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<div class="btn-nav">
|
||||
<Button class="btn btn-primary btn-small navbar-btn" @onclick="ThrowSomeError">
|
||||
x
|
||||
</Button>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -165,6 +149,27 @@
|
|||
</div>
|
||||
</nav>
|
||||
|
||||
<script>
|
||||
function toggleBootstrapNavMenu(isExpanded) {
|
||||
var navMenu = document.getElementById('navbarNav');
|
||||
if (navMenu) {
|
||||
var collapse = new bootstrap.Collapse(navMenu, {
|
||||
toggle: false
|
||||
});
|
||||
if (isExpanded) {
|
||||
collapse.show();
|
||||
console.log("Show");
|
||||
} else {
|
||||
collapse.hide();
|
||||
console.log("Hide");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ using TIAMSharedUI.Pages.Components;
|
|||
using TIAMWebApp.Shared.Application.Models.ClientSide;
|
||||
using Newtonsoft.Json;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.JSInterop;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
|
||||
|
||||
namespace TIAMSharedUI.Shared.Components
|
||||
|
|
@ -43,6 +46,9 @@ namespace TIAMSharedUI.Shared.Components
|
|||
[Inject]
|
||||
private IUserDataService UserDataService { get; set; }
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JsRuntime { get; set; }
|
||||
|
||||
[Inject] AuthenticationStateProvider AuthStateProvider { get; set; }
|
||||
|
||||
private bool enableLogin = true;
|
||||
|
|
@ -52,7 +58,7 @@ namespace TIAMSharedUI.Shared.Components
|
|||
private bool enableApi = true;
|
||||
private bool enableChat = true;
|
||||
|
||||
private bool collapseNavMenu = true;
|
||||
private bool expandNavMenu = true;
|
||||
private bool myUser = false;
|
||||
private bool hasProperty = false;
|
||||
|
||||
|
|
@ -65,6 +71,11 @@ namespace TIAMSharedUI.Shared.Components
|
|||
|
||||
}
|
||||
|
||||
private async Task ExpandNavMenu()
|
||||
{
|
||||
await JsRuntime.InvokeVoidAsync("toggleBootstrapNavMenu");
|
||||
}
|
||||
|
||||
private void RefreshMe()
|
||||
{
|
||||
_logger.Debug($"Navbar refresh called! {DateTime.Now} ");
|
||||
|
|
@ -76,12 +87,9 @@ namespace TIAMSharedUI.Shared.Components
|
|||
|
||||
private void ToggleNavMenu()
|
||||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
}
|
||||
|
||||
private void NavigateBack()
|
||||
{
|
||||
|
||||
expandNavMenu = !expandNavMenu;
|
||||
|
||||
JsRuntime.InvokeVoidAsync("toggleBootstrapNavMenu", expandNavMenu);
|
||||
}
|
||||
|
||||
private async Task SignOut()
|
||||
|
|
@ -102,15 +110,12 @@ namespace TIAMSharedUI.Shared.Components
|
|||
myUser = false;
|
||||
}
|
||||
|
||||
private void ThrowSomeError()
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
|
||||
base.OnInitialized();
|
||||
|
||||
navigationManager.LocationChanged += OnLocationChanged;
|
||||
_logger = new LoggerClient<Navbar>(LogWriters.ToArray());
|
||||
|
||||
|
||||
|
|
@ -119,6 +124,21 @@ namespace TIAMSharedUI.Shared.Components
|
|||
InitUser();
|
||||
}
|
||||
|
||||
private void OnLocationChanged(object sender, LocationChangedEventArgs e)
|
||||
{
|
||||
// Collapse the navbar on navigation
|
||||
|
||||
expandNavMenu = false;
|
||||
JsRuntime.InvokeVoidAsync("toggleBootstrapNavMenu", false);
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Unsubscribe from the event when the component is disposed
|
||||
navigationManager.LocationChanged -= OnLocationChanged;
|
||||
}
|
||||
|
||||
private void InitUser()
|
||||
{
|
||||
if (sessionService.User != null)
|
||||
|
|
|
|||
|
|
@ -19,10 +19,18 @@
|
|||
DisplayMode="DisplayMode">
|
||||
<Items>
|
||||
<DxMenuItem NavigateUrl="/" Text="Home" IconCssClass="menu-icon-home menu-icon" />
|
||||
<DxMenuItem NavigateUrl="user/properties" Text="My companies" IconCssClass="fa-solid fa-building" />
|
||||
<DxMenuItem NavigateUrl="user/createAndManageTransfer" IconCssClass="fa-solid fa-route" Text="Transfer" />
|
||||
<DxMenuItem NavigateUrl="user/media" Text="Media" IconCssClass="menu-icon-home menu-icon" />
|
||||
<DxMenuItem NavigateUrl="user/messages" Text="Messages" IconCssClass="fa-solid fa-envelope" />
|
||||
@{
|
||||
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="user/media" Text="Media" IconCssClass="menu-icon-home menu-icon" /> *@
|
||||
|
||||
|
||||
<DxMenuItem Text="Driver" Visible="@IsDriver" IconCssClass="fa-solid fa-id-card">
|
||||
<Items>
|
||||
|
|
@ -30,8 +38,8 @@
|
|||
|
||||
|
||||
@{
|
||||
string url1 = $"driver/transfers/{SessionService.DriverPersmissionId}";
|
||||
string url2 = $"driver/cars/{SessionService.DriverPersmissionId}";
|
||||
string url1 = $"driver/transfers/{driverPermissionId}";
|
||||
string url2 = $"driver/cars/{driverPermissionId}";
|
||||
<DxMenuItem NavigateUrl="@url1" Text="My transfers" />
|
||||
<DxMenuItem NavigateUrl="@url2" Text="My cars" />
|
||||
}
|
||||
|
|
@ -68,6 +76,8 @@
|
|||
<DxMenuItem NavigateUrl="user/serviceprovider/5453-a87f77787d-khj899" Text="Manage hotel" />
|
||||
</Items>
|
||||
</DxMenuItem-->
|
||||
@* <DxMenuItem NavigateUrl="user/messages" Text="Messages" IconCssClass="fa-solid fa-envelope" /> *@
|
||||
<DxMenuItem NavigateUrl="user/messages" IconCssClass="fa-solid fa-envelope" />
|
||||
<DxMenuItem CssClass="notoggle" Position="ItemPosition.End">
|
||||
<TextTemplate>
|
||||
<div class="fa-solid fa-user" />
|
||||
|
|
@ -81,8 +91,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="user-name-container bm-3 mb-2">
|
||||
<div class="tm-8 text-center">@SessionService.User.Email</div>
|
||||
<div class="text-center">@SessionService.User.UserModelDto.ProfileDto.FullName</div>
|
||||
<div class="tm-8 text-center">@userEmail</div>
|
||||
<div class="text-center">@userFullName</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center log-off-btn">
|
||||
<DxButton Text="Manage" RenderStyle="@ButtonRenderStyle.Secondary" Click="NavToAcc"></DxButton>
|
||||
|
|
@ -106,6 +116,13 @@
|
|||
private bool IsSysAdmin;
|
||||
private bool IsDriver;
|
||||
|
||||
private bool userHasCompany = false;
|
||||
private bool userHasHotels = false;
|
||||
private string? userEmail;
|
||||
private string? userFullName;
|
||||
|
||||
private Guid driverPermissionId;
|
||||
|
||||
private ILogger _logger;
|
||||
|
||||
MenuDisplayMode DisplayMode { get; set; } = MenuDisplayMode.Auto;
|
||||
|
|
@ -127,7 +144,20 @@
|
|||
//_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)
|
||||
{
|
||||
driverPermissionId = SessionService.DriverPersmissionId;
|
||||
userEmail = SessionService.User.Email;
|
||||
if (SessionService.User.UserModelDto.ProfileDto.FullName != null)
|
||||
{
|
||||
userFullName = SessionService.User.UserModelDto.ProfileDto.FullName;
|
||||
}
|
||||
}
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ select {
|
|||
|
||||
|
||||
.card {
|
||||
border-radius: 16px;
|
||||
|
||||
|
||||
overflow: hidden;
|
||||
/*min-height: 300px;*/
|
||||
|
|
|
|||
|
|
@ -18,11 +18,15 @@ namespace TIAMWebApp.Client.Services
|
|||
|
||||
public List<Product> GetHotels()
|
||||
{
|
||||
if(User.UserModelDto.Products.Count > 0)
|
||||
if(User != null)
|
||||
{
|
||||
return User.UserModelDto.Products.Where(x => x.ProductType == TIAM.Core.Enums.ProductType.Hotel).ToList();
|
||||
if(User.UserModelDto.Products.Count > 0)
|
||||
{
|
||||
return User.UserModelDto.Products.Where(x => x.ProductType == TIAM.Core.Enums.ProductType.Hotel).ToList();
|
||||
}
|
||||
else return new List<Product>();
|
||||
}
|
||||
else return new List<Product>();
|
||||
else return new List<Product>();
|
||||
}
|
||||
|
||||
public Guid DriverPersmissionId { get; set; } = Guid.Empty;
|
||||
|
|
|
|||
|
|
@ -359,6 +359,21 @@ namespace TIAMWebApp.Client.Services
|
|||
return result;
|
||||
}
|
||||
|
||||
public async Task<bool> SetEmailConfirmed(Guid userId)
|
||||
{
|
||||
bool result = false;
|
||||
_logger.Info("SetEmailConfirmed() called");
|
||||
|
||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.SetEmailConfirmed}";
|
||||
|
||||
var response = await http.PostAsJsonAsync(url, userId);
|
||||
result = await response.Content.ReadFromJsonAsync<bool>();
|
||||
|
||||
_logger.Detail($"ValidateForgotPasswordToken(): {result.ToString()}");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*public Task<Dictionary<int, string>> GetUserRolesAsync(UserModel userModel)
|
||||
{
|
||||
//TODO: finish this
|
||||
|
|
|
|||
|
|
@ -30,5 +30,7 @@ namespace TIAMWebApp.Shared.Application.Interfaces
|
|||
public Task<bool> SendForgottenPasswordMail(string emailAddress);
|
||||
|
||||
public Task<string> ValidateForgotPasswordToken(Guid userId, string token);
|
||||
|
||||
public Task<bool> SetEmailConfirmed(Guid userId);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue