Compare commits

..

No commits in common. "0662bb77a70818c63022cbf4234bbd17f22a73bf" and "28e8b165ae228d73c5a8649d33288134136d10f6" have entirely different histories.

39 changed files with 611 additions and 1143 deletions

View File

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

View File

@ -69,7 +69,6 @@ namespace TIAMMobileApp
builder.Services.AddSingleton<SignalRService>();
builder.Services.AddSingleton<SumupService>();
builder.Services.AddScoped<AuthenticationStateProvider, CustomAuthStateProvider>();
builder.Services.AddScoped<ExchangeRateService>();
builder.Services.AddAuthorizationCore();
builder.Services.Configure<AnimationOptions>(Guid.NewGuid().ToString(), c => { });
return builder.Build();

View File

@ -16,7 +16,7 @@
OnInvalidSubmit="@HandleInvalidSubmit"
Context="EditFormContext">
<DataAnnotationsValidator />
<div class="card">
<div class="card cw-480">
<div class="card-header text-center py-3">
<h4>Edit Your Details</h4>
</div>
@ -31,7 +31,7 @@ else
<div class="card cw-480">
<div class="card-header text-center py-3">
<h4>Details</h4>
@* <DxButton Click="StartEditing" RenderStyle="ButtonRenderStyle.Primary">Create new</DxButton> *@
<DxButton Click="StartEditing" RenderStyle="ButtonRenderStyle.Primary">Edit</DxButton>
</div>
<div class="card-body">
@CreateCardView()
@ -190,8 +190,6 @@ else
editor.AddAttribute(j++, "Date", property.GetValue(Data));
editor.AddAttribute(j++, "DateExpression", lambda);
editor.AddAttribute(j++, "CssClass", "form-field");
editor.AddAttribute(j++, "TimeSectionVisible", true);
editor.AddAttribute(j++, "TimeSectionScrollPickerFormat", "tt h m");
editor.AddAttribute(j++, "DateChanged", EventCallback.Factory.Create<DateTime>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();
break;
@ -257,7 +255,7 @@ else
else if (property.PropertyType == typeof(string) && string.Compare(attrList.CustomDataType, "FullName", true) == 0)
{
editor.OpenComponent<FullNameEditor>(j);
editor.AddAttribute(j++, "NullText", "");
editor.AddAttribute(j++, "NullText", "Full name");
editor.AddAttribute(j++, "FirstNameChanged", EventCallback.Factory.Create<string>(this, result =>
{
_logger.DetailConditional($"FirstName changed to {result}");
@ -318,7 +316,6 @@ else
case DataType.MultilineText:
editor.OpenComponent<DxMemo>(j);
editor.AddAttribute(j++, "Text", property.GetValue(Data));
editor.AddAttribute(j++, "CssClass", "form-field");
editor.AddAttribute(j++, "TextExpression", lambda);
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();
@ -326,7 +323,6 @@ else
default:
editor.OpenComponent<DxTextBox>(j++);
editor.AddAttribute(j++, "Text", property.GetValue(Data));
editor.AddAttribute(j++, "CssClass", "form-field");
editor.AddAttribute(j++, "TextExpression", lambda);
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();

View File

@ -1,68 +0,0 @@
@using BlazorAnimation
@using TIAM.Core.Enums
@using TIAM.Entities.Transfers
@using TIAM.Services
@using TIAMSharedUI.Shared.Components.Cards
@using TIAMWebApp.Shared.Application.Interfaces
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI
@using TIAMWebApp.Shared.Application.Services
@using TIAM.Entities.Drivers
@inject IServiceProviderDataService ServiceProviderDataService
@inject AdminSignalRClient AdminSignalRClient;
<div class="e-card cw-480">
<div class="e-main d-flex align-items-center">
<div class="flex-shrink-0">
<img class="e-photo" src="_content/TIAMSharedUI/images/defaultcar_60.png" alt="" />
</div>
<div class="e-info flex-grow-1 ms-3">
<div class="e-name">@($"{MyCar.Color}")</div>
<p class="e-title"> @MyCar.Manufacture</p>
<p class="e-title"> @MyCar.CarModel</p>
</div>
</div>
<hr class="hr" />
<div class="row">
<div class="col-12 col-md-6">
@RenderDetailsItem("fa-solid fa-engine", "Engine", Enum.GetName(MyCar.CarMotorType))
</div>
<div class="col-12 col-md-6">
@RenderDetailsItem("fa-solid fa-location-dot", "Year", MyCar.YearOfMake.ToString())
</div>
<hr class="hr" />
<div class="col-12 col-md-4">
@RenderDetailsItem("fa-solid fa-users", "Seats", MyCar.SeatNumber.ToString())
</div>
</div>
</div>
@code {
[Parameter] public Car MyCar { get; set; }
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
}
protected override Task OnParametersSetAsync()
{
return base.OnParametersSetAsync();
}
RenderFragment RenderDetailsItem(string iconCssClass, string caption, string value)
{
return @<div class="d-flex m-1 align-items-center">
<div class="icon-container flex-shrink-0">
<span class="dxbl-image m-1 @iconCssClass"></span>
</div>
<div class="text-container m-1 flex-grow-1 ms-2">
<label>@caption:</label>
<div>@value</div>
</div>
</div>;
}
}

View File

@ -1,29 +0,0 @@
.e-name {
margin-bottom: 0.25rem;
font-size: 1.25rem;
font-weight: 500;
line-height: 1.2;
}
.e-email {
font-size: 0.75rem;
text-decoration: underline;
margin-bottom: 0;
}
.e-title {
font-size: 0.875rem;
margin-bottom: 0.5rem;
}
.e-details .text-container label {
font-size: 0.8125rem;
line-height: 1rem;
}
.e-details .text-container {
font-size: 0.875rem;
line-height: 1.125rem;
white-space: nowrap;
}

View File

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

View File

@ -1,167 +0,0 @@
@using BlazorAnimation
@using TIAM.Core.Enums
@using TIAM.Entities.Transfers
@using TIAM.Entities.Users
@using TIAM.Models.Dtos.Users
@using TIAM.Services
@using TIAMSharedUI.Shared.Components.Cards
@using TIAMWebApp.Shared.Application.Interfaces
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI
@using TIAMWebApp.Shared.Application.Models.PageModels
@using TIAMWebApp.Shared.Application.Services
@inject IServiceProviderDataService ServiceProviderDataService
@inject IUserDataService UserDataService;
@inject AdminSignalRClient AdminSignalRClient;
<div class="e-card cw-480">
<div class="e-main d-flex align-items-center">
<div class="flex-shrink-0">
<img class="e-photo" src="_content/TIAMSharedUI/images/defaultavatar_60.png" alt="" />
</div>
<div class="e-info flex-grow-1 ms-3">
<div class="e-name">@($"{Context.UserDto.Id}")</div>
<p class="e-title"><i class="fa-solid fa-at"></i> @Context.UserDto.EmailAddress</p>
<p class="e-title"><i class="fa-solid fa-phone"></i> @Context.UserDto.PhoneNumber</p>
</div>
</div>
<hr class="hr" />
<div class="row">
<div class="col-12 col-md-6">
@RenderDetailsItem("fa-solid fa-key", "Password", Context.UserDto.Password)
</div>
<div class="col-9 col-md-4">
<DxTextBox
@bind-Text="@NewPassword"
NullText="New password"
BindValueMode="BindValueMode.OnDelayedInput"
InputDelay="300"
Password="true"
CssClass="form-field"
/>
<DxTextBox @bind-Text="@ConfirmNewPassword"
ReadOnly="@PasswordNotSet"
NullText="Confirm new password"
BindValueMode="BindValueMode.OnDelayedInput"
InputDelay="300"
Password="true"
CssClass="form-field" />
</div>
<div class="col-3 col-md-2">
<DxButton CssClass="btn btn-primary" Click="SetPassword" Enabled="@isSaveActive"> Save</DxButton>
</div>
<p>@msg</p>
</div>
</div>
@code {
[Parameter] public UserModelDtoDetail Context { get; set; }
[Parameter] public EventCallback<string> DataChanged { get; set; }
private bool PasswordNotSet = true;
private bool PasswordNotConfirmed = true;
private string _newPassword;
public string NewPassword
{
get => _newPassword;
set
{
if (_newPassword != value)
{
_newPassword = value;
OnPasswordSet(value);
}
}
}
private string? _confirmNewPassword;
public string? ConfirmNewPassword
{
get => _confirmNewPassword;
set
{
if (value != null && _confirmNewPassword != value)
{
_confirmNewPassword = value;
OnPasswordConfirmed(value);
}
}
}
string msg;
private bool isSaveActive = false;
void OnPasswordSet(string password)
{
msg = $"Password to set: {NewPassword}";
PasswordNotSet = false;
StateHasChanged();
}
void OnPasswordConfirmed(string password)
{
if(NewPassword == ConfirmNewPassword)
{
PasswordNotConfirmed = false;
isSaveActive = true;
}
else
{
isSaveActive = false;
msg = "Password and confirmation not matching!";
}
}
protected async Task SetPassword()
{
isSaveActive = false;
User userToUpdate = new User(Context.Id, Context.UserDto.EmailAddress, NewPassword);
var result = await AdminSignalRClient.PostDataAsync<User>(SignalRTags.UpdateUser, userToUpdate);
if (result != null)
{
msg = $"Password saved";
StateHasChanged();
}
else
{
msg = "Some error occured during saving, please try again later";
}
await DataChanged.InvokeAsync(msg);
}
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
}
protected override async Task OnParametersSetAsync()
{
await base.OnParametersSetAsync();
}
RenderFragment RenderDetailsItem(string iconCssClass, string caption, string value)
{
return @<div class="d-flex m-1 align-items-center">
<div class="icon-container flex-shrink-0">
<span class="dxbl-image m-1 @iconCssClass"></span>
</div>
<div class="text-container m-1 flex-grow-1 ms-2">
<label>@caption:</label>
<div>@value</div>
</div>
</div>;
}
}

View File

@ -1,29 +0,0 @@
.e-name {
margin-bottom: 0.25rem;
font-size: 1.25rem;
font-weight: 500;
line-height: 1.2;
}
.e-email {
font-size: 0.75rem;
text-decoration: underline;
margin-bottom: 0;
}
.e-title {
font-size: 0.875rem;
margin-bottom: 0.5rem;
}
.e-details .text-container label {
font-size: 0.8125rem;
line-height: 1rem;
}
.e-details .text-container {
font-size: 0.875rem;
line-height: 1.125rem;
white-space: nowrap;
}

View File

@ -34,8 +34,8 @@
<PageTitle>Transfers</PageTitle>
<div class="text-center m-5">
<h1>Tasks</h1>
<h2 style="font-size:small">Manage your tasks here!</h2>
<h1>Transfer management</h1>
<h2 style="font-size:small">Manage transfers here!</h2>
</div>
@ -46,8 +46,8 @@
CloseOnOutsideClick="false"
ShowCloseButton="false"
HeaderText="MessageBox"
Closing="EmailPopupClosing"
Closed="EmailPopupClosed">
Closing="EulaPopupClosing"
Closed="EulaPopupClosed">
<BodyContentTemplate>
<InputWizard Data=@_messageWizardModel
OnSubmit="SubmitForm"
@ -69,99 +69,182 @@
<div class="row">
<div class=" col-12">
<div class="card">
<div class="card">
<DxTabs>
<DxTabPage Text="Upcoming">
<DxAccordion ExpandMode="ExpandMode"
ExpandCollapseAction="ExpandCollapseAction"
AnimationType="LayoutAnimationType.Slide">
<Items>
@foreach (var (transfer, i) in Upcoming)
{
<DxTabs>
<DxTabPage Text="List">
<DxAccordion
ExpandMode="ExpandMode"
ExpandCollapseAction="ExpandCollapseAction"
AnimationType="LayoutAnimationType.Slide">
<Items>
@foreach (var (transfer, i) in Items)
{
<DxAccordionItem CssClass="@GetCustomColor(transfer.TransferStatusType)" Text=@($"{transfer.Appointment} - {transfer.FromAddress}") Expanded=@(i == 0)>
<ContentTemplate>
<div class="py-3 px-3">
<TransferCardComponent DataChanged="RefreshComponent" Context="@transfer" />
</div>
</ContentTemplate>
</DxAccordionItem>
}
</Items>
</DxAccordion>
</DxTabPage>
<DxTabPage Text="Problems">
<DxAccordion ExpandMode="ExpandMode"
ExpandCollapseAction="ExpandCollapseAction"
AnimationType="LayoutAnimationType.Slide">
<Items>
@foreach (var (transfer, i) in Problems)
{
<ContentTemplate>
<div class="py-3 px-3">
<TransferCardComponent DataChanged="RefreshComponent" Context="@transfer" />
</div>
</ContentTemplate>
</DxAccordionItem>
}
</Items>
</DxAccordion>
</DxTabPage>
<DxTabPage Text="DataGrid">
<div class="d-flex flex-column mb-4 pb-2">
<div class="align-self-end pl-2 pb-2">
<DxButton Text="Column Chooser"
RenderStyle="ButtonRenderStyle.Secondary"
IconCssClass="btn-column-chooser"
Click="ColumnChooserButton_Click" />
</div>
<DxAccordionItem CssClass="@GetCustomColor(transfer.TransferStatusType)" Text=@($"{transfer.Appointment} - {transfer.FromAddress}") Expanded=@(i == 0)>
<ContentTemplate>
<div class="py-3 px-3">
<TransferCardComponent DataChanged="RefreshComponent" Context="@transfer" />
</div>
</ContentTemplate>
</DxAccordionItem>
}
</Items>
</DxAccordion>
</DxTabPage>
<TransferGrid @ref="_gridTransfer"
Logger="_logger"
GetAllMessageTag="SignalRTags.GetTransfersByUserProductMappingId"
SignalRClient="AdminSignalRClient"
ContextIds="new object[] {driverId}"
OnDataSourceChanged="DataSourceChanged"
OnGridItemChanging="DataSourceItemChanging"
OnGridItemChanged="DataSourceItemChanged"
OnGridItemDeleting="DataItemDeleting"
OnGridEditModelSaving="DataItemSaving"
CustomizeElement="Grid_CustomizeElement"
CustomizeEditModel="Grid_CustomizeEditModel"
EditMode="GridEditMode.EditForm"
ColumnResizeMode="GridColumnResizeMode.NextColumn"
AllowSelectRowByClick="false"
PageSize="13"
ShowFilterRow="true">
<Columns>
<DxGridCommandColumn Visible="false" Width="80" MinWidth="80" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="OrderId" Caption="Order" SortIndex="1" SortOrder="GridColumnSortOrder.Descending" Width="70">
<CellDisplayTemplate>
@{
var idKeyField = ((Transfer)context.DataItem).Id.ToString("N");
var editUri = $"mytransfers/{idKeyField}";
<NavLink href="@editUri">
<text>@context.Value</text>
</NavLink>
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="FromAddress" />
<DxGridDataColumn FieldName="ToAddress" />
<DxGridDataColumn FieldName="Appointment" DisplayFormat="g" Width="125" />
<DxGridDataColumn FieldName="PassengerCount" Caption="Passengers" Width="90" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="LuggageCount" Caption="Luggages" Width="80" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="FlightNumber" Caption="FlightNum" Width="95" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="FullName" />
<DxGridDataColumn FieldName="ContactPhone" Width="120" />
<DxGridDataColumn FieldName="ContactEmail" Width="120">
<CellDisplayTemplate>
@{
var keyField = context.Value;
var keyItem = (Transfer)context.DataItem;
string buttonText = "Contact";
<DxButton Click="() => SendMail(keyItem)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="PaymentId" DisplayFormat="N" Visible="false" />
<DxGridDataColumn Caption="Paid" FieldName="Paid" Width="75" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="TransferStatusType" Caption="Status" SortIndex="0" Width="120" SortOrder="GridColumnSortOrder.Ascending" SortMode="GridColumnSortMode.Value">
<CellDisplayTemplate>
@{
TransferStatusModel keyField = Statuses.FirstOrDefault(x => x.StatusValue == (byte)context.Value)!;
string transferStatusText = keyField.StatusName;
<text>@transferStatusText</text>
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="ReferralId" DisplayFormat="N" Visible="false" />
<DxGridDataColumn FieldName="Comment" Caption="Comment" />
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="125" Visible="false" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
</Columns>
<DetailRowTemplate>
<DxTabs>
@{
var transfer = ((Transfer)context.DataItem);
}
<DxTabPage Text="Messages">
<MessageDetailGridComponent ContextId="transfer.Id" />
</DxTabPage>
<DxTabPage Text="Driver">
<TransferToDriverGridComponent ContextId="transfer.Id" ParentData="transfer" DriverId="driverId" NewButtonVisible="false" DeleteButtonVisible="false" />
</DxTabPage>
</DxTabs>
</DetailRowTemplate>
<EditFormTemplate Context="editFormContext">
@{
var transfer2 = (Transfer)editFormContext.EditModel;
}
<DxFormLayout CssClass="w-100">
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.FirstName) ColSpanMd="6">
@editFormContext.GetEditor("FirstName")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6">
@editFormContext.GetEditor("LastName")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationAddress) ColSpanMd="6">
@editFormContext.GetEditor("ToAddress")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.PickupAddress) ColSpanMd="6">
@editFormContext.GetEditor("FromAddress")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Trip date:" ColSpanMd="6">
<DxDateEdit @bind-Date="@transfer2.Appointment"
TimeSectionVisible="true"
TimeSectionScrollPickerFormat="tt h m">
</DxDateEdit>
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Passengers:" ColSpanMd="6">
@editFormContext.GetEditor("PassengerCount")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Paid:" ColSpanMd="6">
@editFormContext.GetEditor("Payed")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Status:" ColSpanMd="6">
@editFormContext.GetEditor("TransferStatusType")
</DxFormLayoutItem>
</DxFormLayout>
</EditFormTemplate>
<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>
</TransferGrid>
</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[] {driverId}"
CustomizeElement="Grid_CustomizeElement"
ShowGroupPanel="true"
CustomGroup="Grid_CustomGroup"
CustomizeGroupValueDisplayText="Grid_CustomizeGroupValueDisplayText"
EditMode="GridEditMode.EditForm"
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>
<DxTabPage Text="Calendar">
<div class="d-flex flex-column mb-4 pb-2">
<DxScheduler @bind-StartDate="@StartDate"
DataStorage="@_dataStorage"
CssClass="w-100">
<DxSchedulerTimelineView Duration="@TimeSpan.FromHours(48)" CellMinWidth="80">
<Scales>
<DxSchedulerTimeScale Unit="@SchedulerTimeScaleUnit.Day" UnitCount="1"></DxSchedulerTimeScale>
<DxSchedulerTimeScale Unit="@SchedulerTimeScaleUnit.Hour" UnitCount="2"></DxSchedulerTimeScale>
</Scales>
</DxSchedulerTimelineView>
<DxSchedulerWeekView ShowWorkTimeOnly="false"></DxSchedulerWeekView>
<DxSchedulerDayView DayCount="1" ShowWorkTimeOnly="false"></DxSchedulerDayView>
</DxScheduler>
</div>
</DxTabPage>
</DxTabs>
</div>
</div>
<div class=" col-12 col-xl-6">
@ -175,24 +258,16 @@
[Parameter] public Guid DriverId { get; set; }
private Guid driverId;
private LoggerClient<DriverManageTransfers> _logger;
private TransferGrid _gridTransfer;
private bool _popupVisible;
private TransferGrid _gridTransfer;
private List<Transfer>? transfers = [];
IEnumerable<(Transfer, int)> Upcoming = [];
IEnumerable<(Transfer, int)> Problems = [];
IEnumerable<(Transfer, int)> Items = [];
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",
@ -217,6 +292,88 @@
new(Convert.ToByte(TransferStatusType.AdminDenied), "Admin cancelled")
];
private static List<TransferStatusModel> _selectedCategories = Statuses.Where(x => /* x.StatusValue != (byte)TransferStatusType.OrderSubmitted && */ x.StatusValue != (byte)TransferStatusType.Finished && x.StatusValue != (byte)TransferStatusType.UserCanceled && x.StatusValue != (byte)TransferStatusType.AdminDenied).ToList();
private string _filterText = GetFilterText(_selectedCategories.Select(x => (TransferStatusType)x.StatusValue).ToList());
private MessageWizardModel _messageWizardModel = new();
public List<AppointmentModel> AppointmentModels { get; set; } = null!;
DateTime StartDate { get; set; } = DateTime.Today;
DxSchedulerDataStorage _dataStorage = new();
private void RefreshComponent()
{
StateHasChanged();
}
protected override async Task OnParametersSetAsync()
{
driverId = DriverId;
// 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 EulaPopupClosed()
{
//cancel clicked
}
void EulaPopupClosing(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}");
}
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
{
try
@ -256,132 +413,106 @@
}
}
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()
{
driverId = DriverId;
// 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;
var transferStatusByte = (byte)transferStatusType;
switch (transferStatusByte)
{
case 5:
return "bg-important";
switch (transferStatusByte)
{
case 5:
return "bg-important";
case > 5 and < 35:
return "bg-attention";
case > 5 and < 35:
return "bg-attention";
case 35:
return "bg-finished";
case 35:
return "bg-finished";
case > 35:
return "bg-cancel";
case > 35:
return "bg-cancel";
default:
return "";
}
default:
return "";
}
}
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
{
if (!e.IsNew) return;
var transferEditModel = (Transfer)e.EditModel; //TODO not valid cast
transferEditModel.Id = Guid.NewGuid();
transferEditModel.ToAddress = "Where to?";
transferEditModel.FromAddress = "From where?";
transferEditModel.Appointment = DateTime.UtcNow.AddDays(3);
transferEditModel.PassengerCount = 1;
transferEditModel.FirstName = "John";
transferEditModel.LastName = "Doe";
transferEditModel.ContactPhone = "+00000000000";
transferEditModel.ContactEmail = "your@email.address";
}
private static string GetFilterText(ICollection<TransferStatusType> selectedTransferStatuses)
=> selectedTransferStatuses.Count == 0 ? string.Empty : CriteriaOperator.FromLambda<Transfer>(t => selectedTransferStatuses.Contains(t.TransferStatusType)).ToString();
void TagBox_ValuesChanged(IEnumerable<TransferStatusModel> newSelectedCategories)
{
var filterText = string.Empty;
InOperator? filterCriteria = null;
_selectedCategories = newSelectedCategories.ToList();
if (_selectedCategories.Count > 0)
{
filterCriteria = new InOperator("TransferStatusType", _selectedCategories.Select(c => c.StatusValue));
filterText = GetFilterText(_selectedCategories.Select(x => (TransferStatusType)x.StatusValue).ToList());
}
_filterText = filterText;
_gridTransfer.SetFieldFilterCriteria("TransferStatusType", filterCriteria);
}
private void DataSourceChanged(IList<Transfer> transfers)
{
_logger.Info("DataSourceChanged called");
InitializeAppointments(transfers);
if (_selectedCategories.Count > 0)
TagBox_ValuesChanged(_selectedCategories);
// if(!SelectedCategories.Any())
// SelectedCategories = [Statuses.FirstOrDefault(x => x.StatusValue == (byte)TransferStatusType.Finished)!];
// var filterTransferStatusType = Statuses.FirstOrDefault(x => x.StatusValue == (byte)TransferStatusType.Finished)!;
// if (SelectedCategories.All(x => x.StatusValue != filterTransferStatusType.StatusValue))
// SelectedCategories.Add(filterTransferStatusType);
}
private void DataSourceItemChanging(GridDataItemChangingEventArgs<Transfer> args)
{
_logger.Info("DataSourceItemChanging called");
}
private void DataSourceItemChanged(GridDataItemChangedEventArgs<Transfer> args)
{
_logger.Info("DataSourceItemChanged called");
AppointmentModels.UpdateCollection(CreateAppointmentModel(args.DataItem), args.TrackingState == TrackingState.Remove);
}
private void DataItemSaving(GridEditModelSavingEventArgs e)
{
_logger.Info("DataItemSaving called");
}
private void DataItemDeleting(GridDataItemDeletingEventArgs e)
{
_logger.Info($"DataItemDeleting OnItemDeleting");
}
protected override async Task OnInitializedAsync()
{
@ -389,21 +520,13 @@
if (transfers != null)
{
var test = DriverId.ToString();
var result = await AdminSignalRClient.GetByIdAsync<List<Transfer>>(SignalRTags.GetTransfersByUserProductMappingId, DriverId);
transfers = result.Where(t => t.TransferStatusType != TransferStatusType.UserCanceled && t.TransferStatusType != TransferStatusType.AdminDenied).ToList();
Upcoming = transfers.Where(x => x.Appointment >= DateTime.Now).Select((item, index) => (item, index));
Problems = transfers.Where(x => x.Appointment < DateTime.Now && x.TransferStatusType != TransferStatusType.Finished).Select((item, index) => (item, index));
InitializeAppointments(transfers);
transfers = await AdminSignalRClient.GetByIdAsync<List<Transfer>>(SignalRTags.GetTransfersByUserProductMappingId, DriverId);
Items = transfers.Select((item, index) => (item, index));
}
await base.OnInitializedAsync();
}
private void GroupTransfers(List<Transfer> transferDataList)
{
}
private void InitializeAppointments(ICollection<Transfer> transferDataList)
{
_logger.Info("InitializeAppointments called");
@ -446,5 +569,17 @@
return new AppointmentModel { Id = transfer.Id, StartDate = transfer.Appointment, EndDate = transfer.Appointment.AddMinutes(30), Description = $"{transfer.FullName}, {transfer.ToAddress}", Location = transfer.FromAddress, Caption = "Simple transfer" };
}
void ColumnChooserButton_Click()
{
_gridTransfer.ShowColumnChooser();
}
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
{
//_gridTransfer.ExpandDetailRow(0);
}
}
}

View File

@ -1,8 +1,5 @@
@page "/user/createAndManageTransfer"
@using AyCode.Core.Consts
@using AyCode.Core.Helpers
@using TIAM.Entities.Products
@using TIAM.Entities.ServiceProviders
@using TIAM.Entities.Transfers
@using TIAM.Services
@using TIAMSharedUI.Pages.Components.EditComponents
@ -10,7 +7,6 @@
@using AyCode.Services.Loggers
@using TIAMWebApp.Shared.Application.Interfaces;
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
@using TIAMWebApp.Shared.Application.Models.PageModels
@using TIAMWebApp.Shared.Application.Services
@using TIAMWebApp.Shared.Application.Utility
@layout AdminLayout
@ -19,7 +15,6 @@
@inject IUserDataService UserDataService
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
@inject AdminSignalRClient _adminSignalRClient
@inject NavigationManager navManager
<PageTitle>Create transfer</PageTitle>
@ -31,38 +26,28 @@
<!--We need to check if the user is owner of a swerviceprovider-->
<div class="container-fluid">
<h3>Selected Hotel:</h3>
<DxComboBox Data="@Hotels"
@bind-Value="@SelectedHotel"
SearchMode="@ListSearchMode.AutoSearch"
SearchFilterCondition="@ListSearchFilterCondition.Contains"
ListRenderMode="ListRenderMode.Virtual"
TextFieldName="Name"></DxComboBox>
<div class="row d-flex justify-content-center">
<div class="col-12 col-md-6">
<h3>Selected Hotel:</h3>
<DxComboBox Data="@Hotels"
@bind-Value="@SelectedHotel"
SearchMode="@ListSearchMode.AutoSearch"
SearchFilterCondition="@ListSearchFilterCondition.Contains"
ListRenderMode="ListRenderMode.Virtual"
TextFieldName="Name"></DxComboBox>
<div class="row py-3">
<DynamicEditForm Data="Data" isEditing="true" IgnoreReflection="TransferIgnorList" OnSubmit="SubmitForm"></DynamicEditForm>
</div>
<div class="row py-3">
<DxButton RenderStyle="ButtonRenderStyle.Primary" Click="@Reload" Visible="@isReloadVisible">Reload</DxButton>
</div>
<div class="row py-3">
<div class=" col-12 col-xl-3">
</div>
<DynamicEditForm Data="Data" isEditing="true" IgnoreReflection="TransferIgnorList" OnSubmit="SubmitForm"></DynamicEditForm>
</div>
</div>
@code {
private LoggerClient<CreateAndManageTransfer> _logger;
private TransferWizardModel Data = new();
private TransferWizardModel Data;
private List<Product> Hotels = new List<Product>();
private Product SelectedHotel;
public List<string> TransferIgnorList = new List<string>
@ -77,7 +62,7 @@
nameof(TransferWizardModel.ReferralId),
nameof(TransferWizardModel.Price)
};
private bool isReloadVisible = false;
protected override void OnInitialized()
{
@ -102,60 +87,11 @@
var valami = ((TransferWizardModel)result).CopyToTransfer();
valami.Id = Guid.NewGuid();
valami.ProductId = SelectedHotel.Id;
var user = await UserDataService.GetUserByEmailAsync(valami.ContactEmail);
if (user != null && user.Id != Guid.Empty)
{
//user exists already
var userDetail = await UserDataService.GetUserDetailByIdAsync(user.Id);
valami.ReferralId = userDetail.UserDto.RefferalId;
valami.UserId = userDetail.Id;
}
else
{
//create a guest user and set referralId
var registration = new RegistrationModel();
//TODO: Refractor to userDataService
// var random = new Random();
// const string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
// var password = new string(Enumerable.Repeat(chars, 10)
// .Select(s => s[random.Next(s.Length)]).ToArray());
var password = AcCharsGenerator.NewPassword(AcConst.MinPasswordLength, 16);
registration.Email = valami.ContactEmail;
registration.PhoneNumber = valami.ContactPhone;
registration.Password = password;
//get list with one member!
var productOwner = await _adminSignalRClient.GetByIdAsync<List<Company>>(SignalRTags.GetCompaniesById, SelectedHotel.ServiceProviderId);
registration.ReferralId = productOwner[0].AffiliateId;
var createResult = await UserDataService.CreateGuestUser(registration);
if(createResult.isSuccess)
{
if (createResult.user != null)
{
valami.UserId = createResult.user.Id;
}
}
_logger.Info("New user created added");
}
//valami.ProductId = SessionService.User.UserId; //TODO ProductID!
// await WizardProcessor.ProcessWizardAsync<TransferDestinationWizardModel>(result.GetType(), result);
var saveResult = await _adminSignalRClient.PostDataAsync<Transfer>(SignalRTags.AddTransfer, valami);
_logger.Info($"Submitted form: {result.GetType().FullName}, {valami.ToAddress}, {valami.FromAddress}, {valami.ProductId}");
isReloadVisible = true;
_logger.Info($"Submitted nested form: {result.GetType().FullName}, {valami.ToAddress}, {valami.FromAddress}, {valami.ProductId}");
}
public void Reload()
{
Data = new TransferWizardModel();
isReloadVisible = false;
StateHasChanged();
}
}

View File

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

View File

@ -103,13 +103,25 @@
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="Revenue" Caption="Revenue" Width="70" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="FullName" />
<DxGridDataColumn FieldName="ContactPhone" Width="120" />
<DxGridDataColumn FieldName="ContactEmail" Width="120">
</DxGridDataColumn>
<DxGridDataColumn FieldName="PaymentId" DisplayFormat="N" Visible="false" />
<DxGridDataColumn Caption="Paid" FieldName="Paid" Width="75" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="TransferStatusType" Caption="Status" SortIndex="0" Width="120" SortOrder="GridColumnSortOrder.Ascending" SortMode="GridColumnSortMode.Value">
<CellDisplayTemplate>
@{
<DxGridDataColumn FieldName="ReferralId" DisplayFormat="N" Visible="true" />
TransferStatusModel keyField = Statuses.FirstOrDefault(x => x.StatusValue == (byte)context.Value)!;
string transferStatusText = keyField.StatusName;
<text>@transferStatusText</text>
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="ReferralId" DisplayFormat="N" Visible="false" />
<DxGridDataColumn FieldName="Comment" Caption="Comment" />
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="125" Visible="false" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
</Columns>
@ -131,7 +143,9 @@
</div>
<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">
@ -160,11 +174,43 @@
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
@if (Id != null)
{
<MessageDetailGridComponent ContextId="@Id"></MessageDetailGridComponent>
}
<div class="d-flex flex-column mb-4 pb-2">
<div class="media text-muted pt-3">
<!--img src="https://bootdey.com/img/Content/avatar/avatar7.png" alt="" class="mr-2 rounded" width="32" height="32"-->
<p class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
<strong class="d-block text-gray-dark">username</strong>
Donec id elit non mi porta gravida at eget metus...
</p>
</div>
<div class="media text-muted pt-3">
<p class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
<strong class="d-block text-gray-dark">username</strong>
Donec id elit non mi porta gravida at eget metus...
</p>
</div>
<div class="media text-muted pt-3">
<p class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
<strong class="d-block text-gray-dark">username</strong>
Donec id elit non mi porta gravida at eget metus...
</p>
</div>
<div class="media text-muted pt-3">
<p class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
<strong class="d-block text-gray-dark">username</strong>
Donec id elit non mi porta gravida at eget metus...
</p>
</div>
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
@ -207,7 +253,7 @@
<Columns>
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="OrderId" Caption="Order" SortIndex="1" SortOrder="GridColumnSortOrder.Descending">
<DxGridDataColumn FieldName="OrderId" Caption="Order" SortIndex="1" SortOrder="GridColumnSortOrder.Descending" Width="70">
<CellDisplayTemplate>
@{
var idKeyField = ((Transfer)context.DataItem).Id.ToString("N");
@ -218,8 +264,8 @@
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn Caption="Paid" FieldName="Paid" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="Revenue" Caption="Revenue" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn Caption="Paid" FieldName="Paid" Width="75" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="Revenue" Caption="Revenue" Width="70" CaptionAlignment="GridTextAlignment.Center" />
</Columns>
</TransferGrid>
</div>

View File

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

View File

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

View File

@ -32,12 +32,14 @@
<Animation Effect="@Effect.FadeIn" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
<div class="card">
<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>
<CarGridComponent
@ref="@Grid"
DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto"
GetAllTag="SignalRTags.GetAllCars">
</CarGridComponent>
<CarGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" GetAllTag="SignalRTags.GetAllCars"></CarGridComponent>
</div>
@ -55,9 +57,123 @@
private LoggerClient<ManageUserProductMappings> _logger;
//public UserModelDtoDetail UserModelDtoDetail = new();
CarGridComponent Grid { get; set; }
bool PopupVisible { get; set; }
IGrid Grid { get; set; }
//object? MasterGridData { get; set; }
public List<string> IgnoreList =
[
"ReceiverEmailAddress",
"ReceiverId",
"SenderEmailAddress",
"SenderId",
"ContextId"
];
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
{
if (e.ElementType == GridElementType.DataRow && e.VisibleIndex % 2 == 1)
{
e.CssClass = "bg-alt";
}
else if (e.ElementType == GridElementType.HeaderCell)
{
e.Style = "background-color: rgba(0, 0, 0, 0.08); font-style=bold";
}
}
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
{
if (!e.IsNew) return;
var userEditModel = (UserModelDtoDetail)e.EditModel; //TODO not valid cast
userEditModel.Id = Guid.NewGuid();
userEditModel.UserDto = new UserDtoDetail
{
AffiliateId = Guid.NewGuid(),
EmailAddress = "",
PhoneNumber = ""
};
userEditModel.ProfileDto = new TIAM.Entities.Profiles.Profile
{
Name = "New user"
};
userEditModel.Products = [];
userEditModel.ServiceProviders = [];
userEditModel.UserProductMappings = [];
}
async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e)
{
var userModelDtoDetail = ((UserModelDtoDetail)e.EditModel);
if (e.IsNew)
{
//add new orderData to orderData array
var registration = new RegistrationModel();
//TODO: Refractor to userDataService
// var random = new Random();
// const string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
// var password = new string(Enumerable.Repeat(chars, 10)
// .Select(s => s[random.Next(s.Length)]).ToArray());
var password = AcCharsGenerator.NewPassword(AcConst.MinPasswordLength, 16);
registration.Email = userModelDtoDetail.UserDto.EmailAddress;
registration.PhoneNumber = userModelDtoDetail.UserDto.PhoneNumber;
registration.Password = password;
registration.ReferralId = null;
await UserDataService.CreateGuestUser(registration);
_logger.Info("New user created added");
}
else
{
_logger.Info("orderData updated at id " + userModelDtoDetail.Id);
//await transferDataService.UpdateTransferAsync((TransferWizardModel)e.EditModel);
//modify transferData where transferData.Id == e.EditModel.Id
}
//get transfer from TransferData by Id
// foreach (var transferToModify in (List<Transfer>)TransferData)
// {
// myModel = (Transfer)e.EditModel;
// if (transferToModify.Id == myModel.Id)
// {
// //transferToModify.Driver = myModel.Driver;
// }
// }
//TODO: ne a teljes grid-et refresh-eljük, elég lenne csak az adott sort! - J.
await UpdateDataAsync();
}
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e)
{
//await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
//remove orderData from orderData array
_logger.Info("orderData deleted");
//await UpdateDataAsync();
}
async Task UpdateDataAsync()
{
//refresh grid
_logger.Info("orderData grid refreshed");
}
protected override async Task OnInitializedAsync()
{
_logger = new LoggerClient<ManageUserProductMappings>(LogWriters.ToArray());
@ -65,6 +181,9 @@
base.OnInitialized();
}
void ColumnChooserButton_Click()
{
Grid.ShowColumnChooser();
}
}

View File

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

View File

@ -68,7 +68,7 @@
<Animation Effect="@Effect.FadeIn" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
<div class="card">
<DxTabs>
<DxTabs>+-
<DxTabPage Text="DataGrid">
<div class="d-flex flex-column mb-4 pb-2">

View File

@ -61,33 +61,28 @@
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.Price) FieldName="Price" Width="100" />
<DxGridDataColumn Caption="Options">
<CellDisplayTemplate>
@{
//check if has transferdestination
var AddressId = ((Product)context.DataItem).Profile.AddressId;
var result = CheckDestinations(AddressId);
//if not, display button
if (!result)
{
// <p>Address:</p>
// <p>@(((Product)context.DataItem).Profile.Address.AddressText)</p>
<DxButton Click="() => SaveAsDestination(((Product)context.DataItem).Profile.Address, (Product)context.DataItem)" Text="Save as destination" RenderStyle="ButtonRenderStyle.Primary" />
}
else
{
<p>Address:</p>
<p>@(((Product)context.DataItem).Profile.Address.AddressText)</p>
}
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductDescription) FieldName="Description" />
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
</Columns>
<DetailRowTemplate>
@{
//check if has transferdestination
var AddressId = ((Product)context.DataItem).Profile.AddressId;
var result = CheckDestinations(AddressId);
//if not, display button
if(!result)
{ <p>Address:</p>
<p>@(((Product)context.DataItem).Profile.Address.AddressText)</p>
<DxButton Click="() => SaveAsDestination(((Product)context.DataItem).Profile.Address, (Product)context.DataItem)" Text="Save as destination" RenderStyle="ButtonRenderStyle.Primary" />
}
else
{
<p>Address:</p>
<p>@(((Product)context.DataItem).Profile.Address.AddressText)</p>
}
}
<DxTabs>
<DxTabPage Text="Permissions">
@ -184,7 +179,6 @@
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

@ -58,14 +58,7 @@
<NavLink href="@($"mytransfers/{Guid.Parse("108E5A63-AA9E-47BE-ACFA-00306FFC5215")}")">
My transfers
</NavLink>
</li>
<li>
<NavLink href="exchange-rate">
Exchange Rate
My trasnfers
</NavLink>
</li>
<li></li>

View File

@ -1,32 +0,0 @@
<!-- Pages/ExchangeRate.razor -->
@page "/exchange-rate"
@using TIAMWebApp.Shared.Application.Models
@using TIAMWebApp.Shared.Application.Services
@inject ExchangeRateService ExchangeRateService
<h3>Exchange Rate</h3>
@if (exchangeRate == null)
{
<p><em>Loading...</em></p>
}
else
{
<p>Current EUR to HUF exchange rate: @exchangeRate.EURtoHUF</p>
<input type="number" @bind="exchangeRate.EURtoHUF" step="0.01" />
<button @onclick="SaveExchangeRate">Save</button>
}
@code {
private ExchangeRate exchangeRate;
protected override async Task OnInitializedAsync()
{
exchangeRate = await ExchangeRateService.GetExchangeRateAsync();
}
private async Task SaveExchangeRate()
{
await ExchangeRateService.SetExchangeRateAsync(exchangeRate);
}
}

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -46,7 +46,6 @@ builder.Services.AddSingleton<SignalRService>();
builder.Services.AddSingleton<SumupService>();
builder.Services.AddScoped<AuthenticationStateProvider, CustomAuthStateProvider>();
builder.Services.AddAuthorizationCore();
builder.Services.AddScoped<ExchangeRateService>();
//builder.Services.AddScoped<BrowserConsoleLogWriter>();
//WebSpecific end

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1,56 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using QRCoder;
using System.Drawing;
using System.Drawing.Imaging;
using AyCode.Core.Enums;
using AyCode.Core.Extensions;
using TIAM.Database.DataLayers.Admins;
using TIAM.Entities.ServiceProviders;
using TIAM.Entities.Users;
using TIAMWebApp.Shared.Application.Models;
using Product = TIAM.Entities.Products.Product;
using TIAM.Entities.Addresses;
using TIAM.Entities.Profiles;
using AyCode.Core.Loggers;
using AyCode.Entities;
using AyCode.Services.SignalRs;
using AyCode.Utils.Extensions;
using TIAM.Entities.Drivers;
using TIAM.Services;
using TIAMWebApp.Server.Services;
using GoogleApi.Entities.Search.Video.Common;
namespace TIAMWebApp.Server.Controllers
{
[ApiController]
[Route("api/v1/[controller]")]
public class ExchangeRateAPIController(ExchangeRateService _service,IEnumerable<IAcLogWriterBase> logWriters) : ControllerBase
{
private readonly TIAM.Core.Loggers.Logger<ExchangeRateAPIController> _logger = new(logWriters.ToArray());
[AllowAnonymous]
[HttpGet]
[Route(APIUrls.GetExchangeRateRouteName)]
//[SignalR(SignalRTags.GetProfileById)]
public async Task<IActionResult> GetExchangeRate()
{
_logger.Info($@"GetExchangeRate called");
var rate = await _service.GetExchangeRateAsync();
return Ok(rate);
}
[AllowAnonymous]
[HttpPost]
[Route(APIUrls.UpdateExchangeRateRouteName)]
//[SignalR(SignalRTags.GetProfileById)]
public async Task<IActionResult> Set([FromBody] ExchangeRate rate)
{
_logger.Info($@"GetServiceProviderById called with rate: {rate.EURtoHUF}");
await _service.SetExchangeRateAsync(rate);
return Ok();
}
}
}

View File

@ -13,9 +13,6 @@ using TIAM.Services;
using AyCode.Core.Loggers;
using AyCode.Core.Extensions;
using TIAM.Entities.Products;
using AyCode.Core.Consts;
using AyCode.Core;
using TIAM.Core.Consts;
namespace TIAMWebApp.Server.Controllers
{
@ -57,12 +54,12 @@ namespace TIAMWebApp.Server.Controllers
var messageElement = message.Message;
_logger.Debug(message.Message.Subject);
messageElement.EmailAddress = TiamConstClient.SystemEmailAddress;
await _adminDal.AddEmailMessageAsync(messageElement);
messageElement.EmailAddress = "noreply@anataworld.com";
var result = await _messageSenderService.SendMessageAsync(messageElement, (int)message.MessageType);
//_adminDal.AddEmailMessageAsync((TIAM.Entities.Emails.EmailMessage)SerializedMessageSenderModel.Message);
await _adminDal.AddEmailMessageAsync(messageElement);
_logger.Debug($"SendEmail result: {result}");
return Ok(result);

View File

@ -27,7 +27,7 @@ namespace TIAMWebApp.Server.Controllers
[Authorize]
[ApiController]
[Route("api/v1/[controller]")]
public class ServiceProviderAPIController(AdminDal adminDal, IWebHostEnvironment env, IEnumerable<IAcLogWriterBase> logWriters) : ControllerBase
public class ServiceProviderAPIController(AdminDal adminDal, IEnumerable<IAcLogWriterBase> logWriters) : ControllerBase
{
private readonly TIAM.Core.Loggers.Logger<ServiceProviderAPIController> _logger = new(logWriters.ToArray());
@ -510,8 +510,7 @@ namespace TIAMWebApp.Server.Controllers
var qrCodeData = qrGenerator.CreateQrCode($"https://touriam.com/{productId}", QRCodeGenerator.ECCLevel.Q);
var qrCode = new QRCode(qrCodeData);
//Bitmap qrCodeImage = qrCode.GetGraphic(20);
//var rootpath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "assets");
var rootpath = System.IO.Path.Combine(env.WebRootPath, "assets");
var rootpath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "assets");
var qrCodeImage = qrCode.GetGraphic(20, Color.DarkMagenta, Color.White, (Bitmap)Bitmap.FromFile(rootpath + "/myimage.png"));
_logger.Info($@"qrCodeLogo: {rootpath}/myimage.png");
var ms = new MemoryStream();

View File

@ -68,7 +68,6 @@ namespace TIAMWebApp.Server.Controllers
//[Authorize]
//[HttpGet]
//[Route(APIUrls.GetTransferDriversByTransferIdRouteName)]
[NonAction]
[SignalR(SignalRTags.GetTransferDestinationById)]
public async Task<TransferDestination?> GetTransferDestinationById(Guid transferDestinationId)
{
@ -140,7 +139,6 @@ namespace TIAMWebApp.Server.Controllers
//[Authorize]
//[HttpGet]
//[Route(APIUrls.GetTransferDriversByTransferIdRouteName)]
[NonAction]
[SignalR(SignalRTags.RemoveTransferDestination)]
public async Task<TransferDestination?> RemoveTransferDestination([FromBody] TransferDestination transferDestination)
{
@ -398,36 +396,17 @@ namespace TIAMWebApp.Server.Controllers
var from = destList.FirstOrDefault(x => x.AddressString == transfer.FromAddress);
var to = destList.FirstOrDefault(x => x.AddressString == transfer.ToAddress);
////TODO
//if (!transfer.ProductId.IsNullOrEmpty())
// transfer.Price = _transferBackendService.GetTransferPrice(transfer.ProductId.Value, from, to, transfer.PassengerCount);
//TODO
if (!transfer.ProductId.IsNullOrEmpty())
transfer.Price = _transferBackendService.GetTransferPrice(transfer.ProductId.Value, from, to, transfer.PassengerCount);
Product? product = null;
//TODO
if (!transfer.ProductId.IsNullOrEmpty())
{
product = await _adminDal.GetProductByIdAsync((Guid)transfer.ProductId);
transfer.Price = _transferBackendService.GetTransferPrice(transfer.ProductId.Value, from, to, transfer.PassengerCount);
}
transfer.TransferStatusType = TransferStatusType.OrderSubmitted;
transfer.TransferStatusType = TransferStatusType.OrderSubmitted;
if (transfer.Price != null && transfer.Price > 0 && product != null)
{
if (product.ServiceProvider.CommissionPercent != null)
{
transfer.Revenue = transfer.Price * product.ServiceProvider.CommissionPercent / 100;
}
else
{
transfer.Revenue = 0;
}
}
await _adminDal.AddTransferAsync(transfer);
await _adminDal.AddTransferAsync(transfer);
_logger.Info($"Created transfer, send emailMessage!!!");
var message = new MessageSenderModel<EmailMessage>();
message.Message = new EmailMessage();
message.Message.Id = Guid.NewGuid();
message.Message.Subject = "[Tour I Am] New transfer in Budapest";
message.Message.ContextId = transfer.Id;
@ -519,7 +498,7 @@ namespace TIAMWebApp.Server.Controllers
{
if(product.ServiceProvider.CommissionPercent!=null)
{
transfer.Revenue = transfer.Price * product.ServiceProvider.CommissionPercent / 100;
transfer.Revenue = transfer.Price * product.ServiceProvider.CommissionPercent;
}
else
{
@ -771,7 +750,6 @@ namespace TIAMWebApp.Server.Controllers
return result;
}
[NonAction]
//[Authorize]
//[HttpGet]
//[Route(APIUrls.GetTransferDriverRouteName)]

View File

@ -47,7 +47,6 @@ builder.Services.AddScoped<TransferDataAPIController>();
builder.Services.AddScoped<MessageAPIController>();
builder.Services.AddScoped<ProfileAPIController>();
builder.Services.AddScoped<LoggerApiController>();
builder.Services.AddSingleton<ExchangeRateService>();
builder.Services.AddSignalR(options => options.MaximumReceiveMessageSize = 102400 * 1024);//.AddMessagePackProtocol(options => options.SerializerOptions = MessagePackSerializerOptions.Standard.WithSecurity(MessagePackSecurity.UntrustedData));

View File

@ -1,34 +0,0 @@
using System.IO;
using System.Threading.Tasks;
using System.Xml.Serialization;
using Microsoft.AspNetCore.Hosting;
using TIAMWebApp.Shared.Application.Models;
namespace TIAMWebApp.Server.Services
{
public class ExchangeRateService
{
private readonly IWebHostEnvironment _env;
private readonly string _filePath;
public ExchangeRateService(IWebHostEnvironment env)
{
_env = env;
_filePath = Path.Combine(_env.WebRootPath, "ExchangeRate.xml");
}
public async Task<ExchangeRate> GetExchangeRateAsync()
{
using var stream = new FileStream(_filePath, FileMode.Open);
var serializer = new XmlSerializer(typeof(ExchangeRate));
return (ExchangeRate)serializer.Deserialize(stream);
}
public async Task SetExchangeRateAsync(ExchangeRate rate)
{
using var stream = new FileStream(_filePath, FileMode.Create);
var serializer = new XmlSerializer(typeof(ExchangeRate));
serializer.Serialize(stream, rate);
}
}
}

View File

@ -8,9 +8,6 @@
<PropertyGroup>
<WasmEnableSIMD>false</WasmEnableSIMD>
</PropertyGroup>
<ItemGroup>
<None Include="wwwroot\Assets\myimage.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" />

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ExchangeRate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<EURtoHUF>380</EURtoHUF>
</ExchangeRate>

View File

@ -19,7 +19,6 @@ namespace TIAMWebApp.Shared.Application.Models
public const string FileAPI = BaseUrlWithSlashAndVersion + "FileAPI/";
public const string MessageAPI = BaseUrlWithSlashAndVersion + "MessageAPI/";
public const string PaymentAPI = BaseUrlWithSlashAndVersion + "PaymentAPI/";
public const string ExchangeRateAPI = BaseUrlWithSlashAndVersion + "ExchangeRateAPI/";
public const string AddLogItemRouteName = "AddLogItem";
public const string AddLogItem = LoggerApi + AddLogItemRouteName;
@ -133,7 +132,7 @@ namespace TIAMWebApp.Shared.Application.Models
public const string GetTransferDriverRouteName = "GetTransfersByDriverId";
public const string GetTransferDriver = TransferDataAPI + GetTransferDriverRouteName;
public const string GetTransferDriversByTransferIdRouteName = "GetTransferDriversByTransferId";
public const string GetTransferDriversByTransferIdRouteName = "GetTransfersByDriverId";
public const string GetTransferDriversByTransferId = TransferDataAPI + GetTransferDriversByTransferIdRouteName;
//serviceprovider
@ -269,10 +268,5 @@ namespace TIAMWebApp.Shared.Application.Models
public const string GetPaymentRouteName = "GetPaymentById";
public const string GetPaymentById = PaymentAPI + GetPaymentRouteName;
public const string UpdateExchangeRateRouteName = "UpdateExchangeRate";
public const string UpdateExchangeRate = ExchangeRateAPI + UpdateExchangeRateRouteName;
public const string GetExchangeRateRouteName = "GetExchangeRate";
public const string GetExchangeRate = ExchangeRateAPI + GetExchangeRateRouteName;
}
}

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TIAMWebApp.Shared.Application.Models
{
public class ExchangeRate
{
public decimal EURtoHUF { get; set; }
}
}

View File

@ -1,35 +0,0 @@
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
using TIAMWebApp.Shared.Application.Models;
using TIAMWebApp.Shared.Application.Models.ClientSide;
namespace TIAMWebApp.Shared.Application.Services
{
public class ExchangeRateService
{
private readonly HttpClient _httpClient;
public ExchangeRateService(HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<ExchangeRate> GetExchangeRateAsync()
{
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetExchangeRate}";
return await _httpClient.GetFromJsonAsync<ExchangeRate>(url);
}
public async Task SetExchangeRateAsync(ExchangeRate rate)
{
var url = $"{Setting.ApiBaseUrl}/{APIUrls.UpdateExchangeRate}";
await _httpClient.PostAsJsonAsync(url, rate);
}
}
}