email fix on login, override comission fix, transferorder page changed, wizard changes, custom address fix and changes

This commit is contained in:
Adam 2025-09-25 14:26:19 +02:00
parent 8b4586909f
commit d1ba700c01
21 changed files with 231 additions and 98 deletions

View File

@ -8,12 +8,14 @@ public static class TiamConstClient
public static string DefaultLocale = "en-US"; public static string DefaultLocale = "en-US";
public static Guid TransferProductId = Guid.Parse("814b5495-c2e9-4f1d-a73f-37cd5d353078"); public static Guid TransferProductId = Guid.Parse("814b5495-c2e9-4f1d-a73f-37cd5d353078");
public static Guid[] DevAdminIds = new Guid[2] { Guid.Parse("dcf451d2-cc4c-4ac2-8c1f-da00041be1fd"), Guid.Parse("4cbaed43-2465-4d99-84f1-c8bc6b7025f7") }; public static Guid[] DevAdminIds = new Guid[2] { Guid.Parse("dcf451d2-cc4c-4ac2-8c1f-da00041be1fd"), Guid.Parse("4cbaed43-2465-4d99-84f1-c8bc6b7025f7") };
public static Guid[] SysAdmins = new Guid[3] public static Guid[] SysAdmins = new Guid[4]
{ {
Guid.Parse("dcf451d2-cc4c-4ac2-8c1f-da00041be1fd"), Guid.Parse("dcf451d2-cc4c-4ac2-8c1f-da00041be1fd"),
Guid.Parse("4cbaed43-2465-4d99-84f1-c8bc6b7025f7"), Guid.Parse("4cbaed43-2465-4d99-84f1-c8bc6b7025f7"),
Guid.Parse("540271f6-c604-4c16-8160-d5a7cafedf00") Guid.Parse("540271f6-c604-4c16-8160-d5a7cafedf00"),
Guid.Parse("18858d54-02fd-4002-98af-542b81fd3c3b")
}; };
public static Dictionary<string, Guid> SysAccounts = new Dictionary<string, Guid> public static Dictionary<string, Guid> SysAccounts = new Dictionary<string, Guid>
{ {
{ "SystemEmailSender", Guid.Parse("5e13e051-4fd6-4a30-a371-75cc785cfb84")}, { "SystemEmailSender", Guid.Parse("5e13e051-4fd6-4a30-a371-75cc785cfb84")},
@ -21,7 +23,7 @@ public static class TiamConstClient
public static string WelcomeEmailTemplateName = "WelcomeEmailTemplate"; public static string WelcomeEmailTemplateName = "WelcomeEmailTemplate";
public static string NewTransferEmailTemplateName = "NewTransferEmailTemplate"; public static string NewTransferEmailTemplateName = "NewTransferEmailTemplate";
public static string TransferModifiedEmailTemplateName = "TramsferModifiedEmailTemplate"; public static string TransferModifiedEmailTemplateName = "TransferModifiedEmailTemplate";
public static string ForgotPasswordEmailTemplateName = "ForgotPasswordEmailTemplate"; public static string ForgotPasswordEmailTemplateName = "ForgotPasswordEmailTemplate";
public static string GeneralEmailTemplateName = "GeneralEmailTemplate"; public static string GeneralEmailTemplateName = "GeneralEmailTemplate";

View File

@ -309,15 +309,21 @@ namespace TIAM.Services.Server
smtpClient.EnableSsl = true; // Try false for port 587 smtpClient.EnableSsl = true; // Try false for port 587
smtpClient.TargetName = $"SMTPS/{smtpHost}"; smtpClient.TargetName = $"SMTPS/{smtpHost}";
string filePath = @"C:\path\to\your\file.pdf";
var attachment = new System.Net.Mail.Attachment(filePath);
var fromAddress = new MailAddress(smtpUser, "Your Mail Service"); var fromAddress = new MailAddress(smtpUser, "Your Mail Service");
var toAddress = new MailAddress(recipient.EmailAddress); var toAddress = new MailAddress(recipient.EmailAddress);
var mailMessage = new MailMessage(fromAddress, toAddress) var mailMessage = new MailMessage(fromAddress, toAddress)
{ {
Subject = message.Subject, Subject = message.Subject,
Body = message.Text, Body = message.Text,
IsBodyHtml = true IsBodyHtml = true,
}; };
mailMessage.Attachments.Insert(0, attachment);
await smtpClient.SendMailAsync(mailMessage); await smtpClient.SendMailAsync(mailMessage);
} }
} }

View File

@ -35,7 +35,7 @@ else
private string Address { get; set; } private string Address { get; set; }
private List<PredictionItem> Predictions { get; set; } = new(); private List<PredictionItem> Predictions { get; set; } = new();
private PredictionItem selectedPrediction { get; set; } private PredictionItem selectedPrediction { get; set; } = new();
public PredictionItem SelectedPrediction public PredictionItem SelectedPrediction
{ {
get => selectedPrediction; get => selectedPrediction;
@ -58,7 +58,11 @@ else
{ {
var predictions = await GooglePlacesService.GetPlacePredictionsAsync(input); var predictions = await GooglePlacesService.GetPlacePredictionsAsync(input);
Predictions = predictions.ConvertAll(p => new PredictionItem { Description = p }); Predictions = predictions.ConvertAll(p => new PredictionItem { Description = p });
SelectedPrediction = Predictions[0]; if (Predictions.Count > 0)
{
SelectedPrediction = Predictions[0];
}
else { SelectedPrediction = new(); }
} }
else else
{ {

View File

@ -9,7 +9,8 @@
OnInvalidSubmit="@HandleInvalidSubmit" OnInvalidSubmit="@HandleInvalidSubmit"
Context="EditFormContext"> Context="EditFormContext">
<div class="text-center"> <div class="text-center">
<h4>@localizer.GetString(TitleResourceString)</h4> @* <h4>@localizer.GetString(TitleResourceString)</h4> *@
<h4>@TitleString</h4>
<p class="tm-8 mb-0 fw-normal fs-825"> <p class="tm-8 mb-0 fw-normal fs-825">
@localizer.GetString(SubtitleResourceString) @localizer.GetString(SubtitleResourceString)
</p> </p>

View File

@ -1,20 +1,21 @@
using DevExpress.Blazor; using AyCode.Core.Consts;
using AyCode.Services.Loggers;
using DevExpress.Blazor;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.Web;
using Microsoft.Extensions.Localization;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq.Expressions; using System.Linq.Expressions;
using TIAMWebApp.Shared.Application.Utility;
using Microsoft.Extensions.Localization;
using TIAM.Resources;
using TIAMWebApp.Shared.Application.Interfaces;
using System.Reflection; using System.Reflection;
using TIAMWebApp.Shared.Application.Models;
using TIAMSharedUI.Shared;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using AyCode.Core.Consts;
using TIAM.Core.Loggers; using TIAM.Core.Loggers;
using AyCode.Services.Loggers; using TIAM.Entities.Products;
using TIAM.Resources;
using TIAMSharedUI.Shared;
using TIAMWebApp.Shared.Application.Interfaces;
using TIAMWebApp.Shared.Application.Models;
using TIAMWebApp.Shared.Application.Utility;
namespace TIAMSharedUI.Pages.Components namespace TIAMSharedUI.Pages.Components
@ -38,6 +39,9 @@ namespace TIAMSharedUI.Pages.Components
[Parameter] [Parameter]
public string TitleResourceString { get; set; } = "Wizard"; public string TitleResourceString { get; set; } = "Wizard";
[Parameter]
public string TitleString { get; set; } = "Wizard";
[Parameter] [Parameter]
public string SubtitleResourceString { get; set; } = "Let's fill in this form"; public string SubtitleResourceString { get; set; } = "Let's fill in this form";
@ -56,9 +60,9 @@ namespace TIAMSharedUI.Pages.Components
[Parameter] [Parameter]
public string CssClass { get; set; } = ""; public string CssClass { get; set; } = "";
[Parameter] public Product? CurrentProduct { get; set; } = null;
private LoggerClient<InputWizard> _logger; private LoggerClient<InputWizard> _logger;
string _formSubmitResult = ""; string _formSubmitResult = "";
private string _spinnerClass = ""; private string _spinnerClass = "";
@ -353,34 +357,57 @@ namespace TIAMSharedUI.Pages.Components
//string.Compare(metadata.CustomDataType, "BoldRed", true) == 0 //string.Compare(metadata.CustomDataType, "BoldRed", true) == 0
//else if (property.PropertyType == typeof(string) && property.Name == "Destination") //else if (property.PropertyType == typeof(string) && property.Name == "Destination")
//else if (property.PropertyType == typeof(string) && string.Compare(attrList.CustomDataType, "TransferDestination", true) == 0)
//{
// editor.OpenComponent<SliderItemSelector>(j);
// editor.AddAttribute(j++, "OwlId", "owlSelector" + stepId);
// editor.AddAttribute(j++, "TextValue", property.GetValue(Data));
// //editor.AddAttribute(j++, "TExpression", lambda);
// editor.AddAttribute(j++, "OnSliderChanged", EventCallback.Factory.Create<string>(this, result =>
// {
// _logger.DetailConditional($"Slider changed to {result}");
// property.SetValue(Data, result);
// _logger.DetailConditional($"bleh: {property.Name} = {property.GetValue(Data)}");
// //StateHasChanged(); // Add this line to refresh the UI
// }));
// editor.CloseComponent();
// editor.OpenComponent<DxTextBox>(j++);
// /*editor.AddAttribute(j++, "CssClass", "form-field");*/
// editor.AddAttribute(j++, "NullText", "Slide or type");
// editor.AddAttribute(j++, "Enabled", false);
// editor.AddAttribute(j++, "Text", property.GetValue(Data));
// editor.AddAttribute(j++, "TextExpression", lambda);
// editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str =>
// {
// property.SetValue(Data, str);
// _logger.DetailConditional($"bleh: {property.Name} = {property.GetValue(Data)}");
// }));
// editor.CloseComponent();
//}
else if (property.PropertyType == typeof(string) && string.Compare(attrList.CustomDataType, "TransferDestination", true) == 0) else if (property.PropertyType == typeof(string) && string.Compare(attrList.CustomDataType, "TransferDestination", true) == 0)
{ {
editor.OpenComponent<SliderItemSelector>(j); editor.OpenComponent<ComboboxItemSelector>(j);
editor.AddAttribute(j++, "OwlId", "owlSelector" + stepId);
editor.AddAttribute(j++, "TextValue", property.GetValue(Data)); editor.AddAttribute(j++, "TextValue", property.GetValue(Data));
//editor.AddAttribute(j++, "TExpression", lambda); editor.AddAttribute(j++, "CssClass", "form-field");
if (CurrentProduct != null)
{
editor.AddAttribute(j++, "ProductId", CurrentProduct.Id);
}
// editor.AddAttribute(j++, "ValExpression", lambda);
editor.AddAttribute(j++, "OnSliderChanged", EventCallback.Factory.Create<string>(this, result => editor.AddAttribute(j++, "OnSliderChanged", EventCallback.Factory.Create<string>(this, result =>
{ {
_logger.DetailConditional($"Slider changed to {result}"); _logger.Debug($"Slider changed to {result}");
property.SetValue(Data, result); property.SetValue(Data, result);
_logger.DetailConditional($"bleh: {property.Name} = {property.GetValue(Data)}"); _logger.DetailConditional($"bleh: {property.Name} = {property.GetValue(Data)}");
//StateHasChanged(); // Add this line to refresh the UI
})); }));
editor.CloseComponent(); editor.CloseComponent();
editor.OpenComponent<DxTextBox>(j++);
/*editor.AddAttribute(j++, "CssClass", "form-field");*/
editor.AddAttribute(j++, "NullText", "Slide or type");
editor.AddAttribute(j++, "Enabled", false);
editor.AddAttribute(j++, "Text", property.GetValue(Data));
editor.AddAttribute(j++, "TextExpression", lambda);
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str =>
{
property.SetValue(Data, str);
_logger.DetailConditional($"bleh: {property.Name} = {property.GetValue(Data)}");
}));
editor.CloseComponent();
} }

View File

@ -10,7 +10,7 @@
<DxMaskedInput @bind-Value="@LoginModel.Email" <DxMaskedInput @bind-Value="@LoginModel.Email"
Id="Email" Id="Email"
CssClass="cw-320"
Mask="@EmailMask" Mask="@EmailMask"
MaskMode="MaskMode.RegEx"> MaskMode="MaskMode.RegEx">
<DxRegExMaskProperties MaskAutoCompleteMode="@((MaskAutoCompleteMode)AutoCompleteMode)" <DxRegExMaskProperties MaskAutoCompleteMode="@((MaskAutoCompleteMode)AutoCompleteMode)"

View File

@ -164,25 +164,30 @@
} }
} }
<div class="col-12 col-md-6"> <div class="col-12 col-md-4">
<DxToolbar ItemRenderStyleMode="ToolbarRenderStyleMode.Contained"> <div class="card">
<Items> <DxToolbar ItemRenderStyleMode="ToolbarRenderStyleMode.Contained">
<DxToolbarItem Alignment="ToolbarItemAlignment.Right" Text="Help" RenderStyle="ButtonRenderStyle.Secondary" IconCssClass="grid-icon-column-chooser" Click="ShowHelp_Click" /> <Items>
</Items> <DxToolbarItem Alignment="ToolbarItemAlignment.Right" Text="Help" RenderStyle="ButtonRenderStyle.Secondary" IconCssClass="grid-icon-column-chooser" Click="ShowHelp_Click" />
</DxToolbar> </Items>
<div style="max-height: 300px; overflow-y: hidden"> </DxToolbar>
<img class="img-fluid" src="@tourInfo.CoverImageUrl" alt="@tourInfo.Title"/> <div style="max-height: 300px; overflow-y: hidden">
<img class="img-fluid" src="@tourInfo.CoverImageUrl" alt="@tourInfo.Title" />
</div>
@*<DynamicEditForm Data="_myModel"
TitleString="@($"To: {tourInfo.Title}, Price: {_myModel.Price} EUR")"
isEditing="true" IgnoreReflection="_transferIgnorList1" OnSubmit="SubmitForm">
</DynamicEditForm>*@
<InputWizard Data=@_myModel
TitleString="@($"To: {tourInfo.Title}, Price: {_myModel.Price} EUR")"
OnSubmit="SubmitForm"
IgnoreReflection="@_transferIgnorList1"
SubmitButtonText="ButtonSend"
TitleResourceString="TransferTitle"
SubtitleResourceString="TransferSubtitle"></InputWizard>
</div> </div>
<DynamicEditForm Data="_myModel" TitleString="@($"To: {tourInfo.Title}, Price: {_myModel.Price} EUR")" isEditing="true" IgnoreReflection="_transferIgnorList1" OnSubmit="SubmitForm"></DynamicEditForm>
<InputWizard Data=@_myModel
OnSubmit="SubmitForm"
IgnoreReflection="@_transferIgnorList1"
SubmitButtonText="ButtonSend"
TitleResourceString="TransferTitle"
SubtitleResourceString="TransferSubtitle"></InputWizard>
</div> </div>
@ -273,9 +278,10 @@
"Destination", "Destination",
"UserId", "UserId",
"ProductId", "ProductId",
"PaymentId", "PaymentId",
"FirstName", "FirstName",
"LastName", "LastName",
"FlightNumber",
"UserProductMappingId", "UserProductMappingId",
"UserProductToCarId", "UserProductToCarId",
"ReferralId", "ReferralId",

View File

@ -214,7 +214,9 @@
<DxFormLayoutItem Caption="Revenue:" ColSpanMd="3"> <DxFormLayoutItem Caption="Revenue:" ColSpanMd="3">
@editFormContext.GetEditor("Revenue") @editFormContext.GetEditor("Revenue")
</DxFormLayoutItem> </DxFormLayoutItem>
<DxFormLayoutItem Caption="Comment:" ColSpanMd="3">
@editFormContext.GetEditor("Comment")
</DxFormLayoutItem>
</DxFormLayout> </DxFormLayout>
</EditFormTemplate> </EditFormTemplate>

View File

@ -39,6 +39,11 @@
<InputTextArea @bind-Value="newTour.Name" class="form-control" /> <InputTextArea @bind-Value="newTour.Name" class="form-control" />
</div> </div>
<div class="mb-3">
<label>ShortDescription</label>
<InputTextArea @bind-Value="newTour.Bio" class="form-control" />
</div>
<div class="mb-3"> <div class="mb-3">
<label>Description</label> <label>Description</label>
<InputTextArea @bind-Value="newTour.Description" class="form-control" /> <InputTextArea @bind-Value="newTour.Description" class="form-control" />
@ -78,6 +83,9 @@
<span> <span>
<strong>@tour?.Title</strong> — @tour.FancyDescription <strong>@tour?.Title</strong> — @tour.FancyDescription
</span> </span>
<span>
@tour.Bio
</span>
<button class="btn btn-sm btn-secondary me-2" @onclick="() => EditTour(tour)">Edit</button> <button class="btn btn-sm btn-secondary me-2" @onclick="() => EditTour(tour)">Edit</button>
<button class="btn btn-sm btn-danger" @onclick="() => DeleteTourAsync(tour.Id)">Delete</button> <button class="btn btn-sm btn-danger" @onclick="() => DeleteTourAsync(tour.Id)">Delete</button>
</li> </li>
@ -115,9 +123,10 @@
{ {
TransferDestinationId = tour.TransferDestinationId, TransferDestinationId = tour.TransferDestinationId,
Name = tour.Title, Name = tour.Title,
Bio = tour.Bio,
Description = tour.FancyDescription, Description = tour.FancyDescription,
ImageBytes = null, ImageBytes = null,
ImageFileName = null ImageFileName = tour.CoverImageUrl
}; };
IsEditing = true; IsEditing = true;
@ -172,6 +181,7 @@
newTour.ImageBytes = ms.ToArray(); newTour.ImageBytes = ms.ToArray();
newTour.ImageFileName = uploadedFile.Name; newTour.ImageFileName = uploadedFile.Name;
} }
if (IsEditing && EditingTourId.HasValue) if (IsEditing && EditingTourId.HasValue)
{ {
@ -180,8 +190,9 @@
Id = EditingTourId.Value, Id = EditingTourId.Value,
TransferDestinationId = newTour.TransferDestinationId, TransferDestinationId = newTour.TransferDestinationId,
Title = newTour.Name, Title = newTour.Name,
Bio = newTour.Bio,
FancyDescription = newTour.Description, FancyDescription = newTour.Description,
CoverImageUrl = "" // assume your service handles image URL logic CoverImageUrl = newTour.ImageFileName // assume your service handles image URL logic
}; };
await TourService.UpdateAsync(updatedTour, uploadedFile); await TourService.UpdateAsync(updatedTour, uploadedFile);
@ -230,6 +241,7 @@
[StringLength(100, ErrorMessage = "Tour name cannot exceed 100 characters.")] [StringLength(100, ErrorMessage = "Tour name cannot exceed 100 characters.")]
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public string? Bio { get; set; }
public string? Description { get; set; } public string? Description { get; set; }
public byte[]? ImageBytes { get; set; } public byte[]? ImageBytes { get; set; }

View File

@ -22,7 +22,7 @@
<DxTabs SizeMode="SizeMode.Small" CssClass="bg-light"> <DxTabs SizeMode="SizeMode.Small" CssClass="bg-light">
<DxTabPage Text="Preset addresses"> @* <DxTabPage Text="Preset addresses">
<DxComboBox Data="@_destinations" <DxComboBox Data="@_destinations"
@ -37,7 +37,7 @@
SizeMode="SizeMode.Small" /> SizeMode="SizeMode.Small" />
</DxTabPage> </DxTabPage> *@
<DxTabPage Text="Custom address"> <DxTabPage Text="Custom address">
<AddressSearchAndSelectComponent AddressChanged="@OnSelectedAddressChanged" CssClass="@CssClass"> <AddressSearchAndSelectComponent AddressChanged="@OnSelectedAddressChanged" CssClass="@CssClass">
@ -56,7 +56,17 @@
</DxTabPage> </DxTabPage>
</DxTabs> </DxTabs>
<p>Selected address: @_address</p> @{
if (string.IsNullOrEmpty(_address))
{
<p class="text-muted mt-2">No address selected</p>
}
else
{
<p class="text-success mt-2">Selected address: @_address</p>
}
}
@* <p class="demo-text cw-480 mt-3"> @* <p class="demo-text cw-480 mt-3">

View File

@ -16,16 +16,24 @@
{ {
foreach (var item in Tours) foreach (var item in Tours)
{ {
<div class="item" style="background-image: url(@item.CoverImageUrl);"> <div class="item" style="background-image: url(@item.CoverImageUrl); height: 600px !important">
<div class="added" style="position: absolute; top: 100px; left:0px; text-align:center; padding:10px; width:100%">
<p>@item.Bio</p>
</div>
<div class="item-desc" style="height: 100%; background-color: rgba(0,0,0,0.3);"> <div class="item-desc" style="height: 100%; background-color: rgba(0,0,0,0.3);">
<p style="padding-top:70px">@item.Created</p> @* <p style="padding-top:70px">@item.Created</p> *@
<p>@item.FancyDescription</p> <div style="margin-top:70px; position: relative; z-index: 10; height:450px; overflow-y: scroll;">
<p style="">@item.FancyDescription</p>
</div>
@* <p>@item.TransferDestinationId</p> *@ @* <p>@item.TransferDestinationId</p> *@
<div> <div>
<button class="btn btn-primary mt-auto" @onclick="@( ()=> Book(item.TransferDestinationId, 1))">1-3 passengers</button> <button class="btn btn-primary mt-auto" @onclick="@( ()=> Book(item.TransferDestinationId, 1))"><i class="fa-solid fa-users"></i> 1-3</button>
<button class="btn btn-primary mt-auto" @onclick="@( ()=> Book(item.TransferDestinationId, 2))">4-6 passengers</button> <button class="btn btn-primary mt-auto" @onclick="@( ()=> Book(item.TransferDestinationId, 2))"><i class="fa-solid fa-users"></i> 4-6</button>
<button class="btn btn-primary mt-auto" @onclick="@( ()=> Book(item.TransferDestinationId, 3))">7-8 passengers</button> <button class="btn btn-primary mt-auto" @onclick="@( ()=> Book(item.TransferDestinationId, 3))"><i class="fa-solid fa-users"></i> 7-8</button>
</div> </div>
<div class="glass" style="position: absolute; top:0px; left:0px; padding:10px; width:100%"> <div class="glass" style="position: absolute; top:0px; left:0px; padding:10px; width:100%">
<h4>@item.Title</h4> <h4>@item.Title</h4>
</div> </div>

View File

@ -89,12 +89,15 @@ button {
background: #e73700; background: #e73700;
} }
/******* Middle section CSS Start ******/ /******* Middle section CSS Start ******/
/* -------- Landing page ------- */ /* -------- Landing page ------- */
.game-section { .game-section {
/*padding: 5px 50px;*/ /*padding: 5px 50px;*/
} }
.game-section .owl-stage { .game-section .owl-stage {
margin: 15px 0; margin: 15px 0;
display: flex; display: flex;
@ -136,6 +139,15 @@ button {
background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 1)); background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 1));
} }
.game-section .added {
opacity: 1;
/*font-size: x-large;*/
}
.game-section .item.active .added {
opacity: 0;
}
.game-section .item-desc { .game-section .item-desc {
padding: 0 24px 12px; padding: 0 24px 12px;
color: #fff; color: #fff;
@ -187,10 +199,12 @@ button {
line-height: 32px; line-height: 32px;
} }
/* -------- Landing page ------- */
.game-section {
/*padding: 50px 5px;*/ /* -------- Landing page ------- */
} .game-section {
/*padding: 50px 5px;*/
}
.game-section .item { .game-section .item {
margin: 0 12px 60px; margin: 0 12px 60px;

View File

@ -117,4 +117,10 @@
<UpToDateCheckInput Remove="Shared\Users\NavigationHelperComponent.razor" /> <UpToDateCheckInput Remove="Shared\Users\NavigationHelperComponent.razor" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="Shared\Components\ToursComponent.razor.css">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> </Project>

View File

@ -500,7 +500,7 @@ namespace TIAMWebApp.Server.Controllers
var to = await _adminDal.Context.TransferDestinations.FirstOrDefaultAsync(x => x.AddressString == transfer.ToAddress); var to = await _adminDal.Context.TransferDestinations.FirstOrDefaultAsync(x => x.AddressString == transfer.ToAddress);
//what if one is not transferdestination //what if one is not transferdestination
if (to != null && from != null) if (to != null && from != null)
{ {
if (!transfer.ProductId.IsNullOrEmpty()) if (!transfer.ProductId.IsNullOrEmpty())
{ {
@ -644,7 +644,7 @@ namespace TIAMWebApp.Server.Controllers
/// </summary> /// </summary>
/// <param name="driverId">UserProductMappingId</param> /// <param name="driverId">UserProductMappingId</param>
/// <returns></returns> /// <returns></returns>
[NonAction] [NonAction]
[SignalR(SignalRTags.GetDriverManageTransfersPageModelByDriverId)] [SignalR(SignalRTags.GetDriverManageTransfersPageModelByDriverId)]
public async Task<DriverManageTransfersPageModel> GetDriverManageTransfersPageModelByDriverId(Guid driverId) public async Task<DriverManageTransfersPageModel> GetDriverManageTransfersPageModelByDriverId(Guid driverId)
{ {
@ -678,22 +678,41 @@ namespace TIAMWebApp.Server.Controllers
//check if revenue should be calculated //check if revenue should be calculated
if (transfer.ProductId.HasValue && transfer.Price > 0) if (transfer.ProductId.HasValue && transfer.Price > 0)
{ {
//price seems to have changed, update commission //price seems to have changed, update commission
if (to == null) if (to == null)
{
//get general product commission
var product = await _adminDal.Context.Products.FirstOrDefaultAsync(x => x.Id == transfer.ProductId);
if (product != null)
{ {
//get general product commission if (transfer.Revenue.HasValue && transfer.Revenue.Value > 0)
var product = await _adminDal.Context.Products.FirstOrDefaultAsync(x => x.Id == transfer.ProductId);
if(product != null)
{ {
transfer.Revenue = transfer.Price * product.ServiceProvider.CommissionPercent/100; //revenue intentional override, do nothing
}
else if (!transfer.Revenue.HasValue || transfer.Revenue.Value == 0)
{
//revenue not set, calculate it
transfer.Revenue = transfer.Price * product.ServiceProvider.CommissionPercent / 100;
} }
} }
else
}
else
{
if (transfer.Revenue.HasValue && transfer.Revenue.Value > 0)
{ {
//revenue intentional override, do nothing
}
else if (!transfer.Revenue.HasValue || transfer.Revenue.Value == 0)
{
//revenue not set, calculate it
transfer.Revenue = _transferBackendService.GetCommission((Guid)transfer.ProductId, (double)transfer.Price, to); transfer.Revenue = _transferBackendService.GetCommission((Guid)transfer.ProductId, (double)transfer.Price, to);
} }
}
} }
return await _adminDal.UpdateTransferAsync(transfer); return await _adminDal.UpdateTransferAsync(transfer);
} }

View File

@ -12,8 +12,8 @@ namespace TIAMWebApp.Server.Services
{ {
private readonly HttpClient _httpClient; private readonly HttpClient _httpClient;
private readonly TIAM.Core.Loggers.ILogger _logger; private readonly TIAM.Core.Loggers.ILogger _logger;
private readonly string _clientId; private readonly string _clientId = "sup_pk_RrAkDKKDU8jFSdlCq1dmw19WuBU42LJkD";
private readonly string _clientSecret; private readonly string _clientSecret = "sup_sk_smy6IL1ww3I66adCSPzv5GkSKBFP4TNMs";
public SumupService(HttpClient httpClient, string clientId, string clientSecret, IEnumerable<IAcLogWriterBase> logWriters) public SumupService(HttpClient httpClient, string clientId, string clientSecret, IEnumerable<IAcLogWriterBase> logWriters)
{ {
@ -24,7 +24,8 @@ namespace TIAMWebApp.Server.Services
} }
public async Task<string> GetAccessTokenAsync() public async Task<string> GetAccessTokenAsync()
{ {
var authToken = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{_clientId}:{_clientSecret}")); var authToken = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{_clientId}:{_clientSecret}"));
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authToken); _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authToken);
@ -43,7 +44,8 @@ namespace TIAMWebApp.Server.Services
{ {
var accessToken = await GetAccessTokenAsync(); var accessToken = await GetAccessTokenAsync();
//_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); //_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "sup_sk_0rt9IFrMpE9qA6328vqMwCtiCntRXZxGR"); //_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "sup_sk_0rt9IFrMpE9qA6328vqMwCtiCntRXZxGR");
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "sup_sk_smy6IL1ww3I66adCSPzv5GkSKBFP4TNMs");
var requestContent = new StringContent(JsonSerializer.Serialize(paymentRequest), Encoding.UTF8, "application/json"); var requestContent = new StringContent(JsonSerializer.Serialize(paymentRequest), Encoding.UTF8, "application/json");
@ -65,11 +67,12 @@ namespace TIAMWebApp.Server.Services
}; };
var checkoutRequest = new HttpRequestMessage(HttpMethod.Post, "https://api.sumup.com/v0.1/checkouts"); var checkoutRequest = new HttpRequestMessage(HttpMethod.Post, "https://api.sumup.com/v0.1/checkouts");
checkoutRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "sup_sk_0rt9IFrMpE9qA6328vqMwCtiCntRXZxGR"); //checkoutRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "sup_sk_0rt9IFrMpE9qA6328vqMwCtiCntRXZxGR");
checkoutRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "sup_sk_smy6IL1ww3I66adCSPzv5GkSKBFP4TNMs");
var kvaanyad = JsonSerializer.Serialize(request, options); var kvaanyad = JsonSerializer.Serialize(request, options);
_logger.Detail($"Request json: {kvaanyad}"); _logger.Detail($"Request json: {kvaanyad}");
checkoutRequest.Content = new StringContent(kvaanyad, Encoding.UTF8, "application/json"); checkoutRequest.Content = new StringContent(kvaanyad, Encoding.UTF8, "application/json");
_logger.Detail($"Request content: { await checkoutRequest.Content.ReadAsStringAsync()}"); _logger.Detail($"Request content: {await checkoutRequest.Content.ReadAsStringAsync()}");
var response = await _httpClient.SendAsync(checkoutRequest); var response = await _httpClient.SendAsync(checkoutRequest);
_logger.Detail(await response.Content.ReadAsStringAsync()); _logger.Detail(await response.Content.ReadAsStringAsync());
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
@ -89,7 +92,8 @@ namespace TIAMWebApp.Server.Services
string url = $"https://api.sumup.com/v0.1/checkouts/{checkoutId}"; string url = $"https://api.sumup.com/v0.1/checkouts/{checkoutId}";
// Replace with your actual access token // Replace with your actual access token
string accessToken = "sup_sk_0rt9IFrMpE9qA6328vqMwCtiCntRXZxGR"; //string accessToken = "sup_sk_0rt9IFrMpE9qA6328vqMwCtiCntRXZxGR";
string accessToken = "sup_sk_smy6IL1ww3I66adCSPzv5GkSKBFP4TNMs";
var request = new HttpRequestMessage(HttpMethod.Get, url); var request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", accessToken); request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", accessToken);
@ -100,7 +104,7 @@ namespace TIAMWebApp.Server.Services
{ {
return "error"; return "error";
} }
else else
{ {
var jsonResponse = await response.Content.ReadAsStringAsync(); var jsonResponse = await response.Content.ReadAsStringAsync();
var checkoutResponse = JsonSerializer.Deserialize<GetPaymentResponse>(jsonResponse); var checkoutResponse = JsonSerializer.Deserialize<GetPaymentResponse>(jsonResponse);
@ -110,7 +114,7 @@ namespace TIAMWebApp.Server.Services
{ {
case "pending": case "pending":
//update in DB? //update in DB?
break; break;
case "failed": case "failed":
//update in DB? //update in DB?
break; break;
@ -119,7 +123,7 @@ namespace TIAMWebApp.Server.Services
break; break;
} }
return jsonResponse; return jsonResponse;
} }
} }
@ -135,14 +139,14 @@ namespace TIAMWebApp.Server.Services
// SumUpService.cs (continued) // SumUpService.cs (continued)
public class PaymentResponse public class PaymentResponse
{ {
[JsonPropertyName("amount")] [JsonPropertyName("amount")]
public int Amount { get; set; } public int Amount { get; set; }
[JsonPropertyName("checkout_reference")] [JsonPropertyName("checkout_reference")]
public string CheckoutReference { get; set; } public string CheckoutReference { get; set; }
[JsonPropertyName("checkout_type")] [JsonPropertyName("checkout_type")]

File diff suppressed because one or more lines are too long

View File

@ -2,8 +2,9 @@
"Id": "00000000-0000-0000-0000-000000000000", "Id": "00000000-0000-0000-0000-000000000000",
"TransferDestinationId": "72a29052-0d99-49ec-a103-3b5ca86b5b4c", "TransferDestinationId": "72a29052-0d99-49ec-a103-3b5ca86b5b4c",
"Title": "Rept\u00E9ri t\u00FAra", "Title": "Rept\u00E9ri t\u00FAra",
"Bio": "boooob jhkl hjk hjfdsklh sjklfh sjkfh sjklfhdsjlfh djkf hdjklf hjk fldshjkf hdsjkf hdjk fhdsjkf",
"FancyDescription": "jhkl hjk hjfdsklh sjklfh sjkfh sjklfhdsjlfh djkf hdjklf hjk fldshjkf hdsjkf hdjk fhdsjkf hdsjklfhdjklf dhjkf hdsjklfdhjkldsfh jklsdfhjkfslhfjkslh fdsklh fjklhfdsjklhdsjkfdshjkfdhjksdlhjksdh skl", "FancyDescription": "jhkl hjk hjfdsklh sjklfh sjkfh sjklfhdsjlfh djkf hdjklf hjk fldshjkf hdsjkf hdjk fhdsjkf hdsjklfhdjklf dhjkf hdsjklfdhjkldsfh jklsdfhjkfslhfjkslh fdsklh fjklhfdsjklhdsjkfdshjkfdhjksdlhjksdh skl",
"CoverImageUrl": "/uploads/tourcovers/72a29052-0d99-49ec-a103-3b5ca86b5b4c.jpeg", "CoverImageUrl": "/uploads/tourcovers/72a29052-0d99-49ec-a103-3b5ca86b5b4c.jpeg",
"Created": "2025-07-27T18:05:27.5184619Z", "Created": "0001-01-01T00:00:00",
"Modified": "2025-07-27T18:05:27.5184622Z" "Modified": "2025-09-18T12:03:42.0805437Z"
} }

View File

@ -0,0 +1,9 @@
{
"Id": "00000000-0000-0000-0000-000000000000",
"TransferDestinationId": "d9bd0565-fea5-4668-9f86-e468a515d5ea",
"Title": "Candlelight tour in the city of Vienna",
"FancyDescription": "kfh dghdfjdjklgh djklgh fjklgdfjklh sjklfh jklshh sjkgh sfjkh slgdf kjhsgjklhg skjl skl",
"CoverImageUrl": "/uploads/tourcovers/d9bd0565-fea5-4668-9f86-e468a515d5ea.jpeg",
"Created": "2025-09-04T10:20:08.4277228Z",
"Modified": "2025-09-04T10:20:08.4277235Z"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

View File

@ -11,6 +11,7 @@ namespace TIAMWebApp.Shared.Application.Models
public Guid Id { get; set; } public Guid Id { get; set; }
public Guid TransferDestinationId { get; set; } public Guid TransferDestinationId { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string Bio { get; set; }
public string? FancyDescription { get; set; } public string? FancyDescription { get; set; }
public string? CoverImageUrl { get; set; } public string? CoverImageUrl { get; set; }
public DateTime Created { get; set; } public DateTime Created { get; set; }