Compare commits

..

No commits in common. "7c320a939e3f66e8b7bef963fadf5d5a4cb48558" and "8e33abbf7bb190e6173afc20a47bf8d9f9883fdb" have entirely different histories.

7 changed files with 66 additions and 153 deletions

View File

@ -10,7 +10,7 @@
<DxMaskedInput @bind-Value="@LoginModel.Email" <DxMaskedInput @bind-Value="@LoginModel.Email"
Id="Email" Id="Email"
style="width: 100%;"
Mask="@EmailMask" Mask="@EmailMask"
MaskMode="MaskMode.RegEx"> MaskMode="MaskMode.RegEx">
<DxRegExMaskProperties MaskAutoCompleteMode="@((MaskAutoCompleteMode)AutoCompleteMode)" <DxRegExMaskProperties MaskAutoCompleteMode="@((MaskAutoCompleteMode)AutoCompleteMode)"

View File

@ -104,7 +104,7 @@ else if (!string.IsNullOrEmpty(_errorMessage))
else else
{ {
<div class="container mt-4"> <div class="container mt-4">
<DxTabs ActiveTabIndex="@activeTab"> <DxTabs>
<DxTabPage Visible="@displayCard" Text="Details"> <DxTabPage Visible="@displayCard" Text="Details">
@ -167,12 +167,12 @@ else
<div class="card-footer p-4"> <div class="card-footer p-4">
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<DxButton RenderStyle="ButtonRenderStyle.Warning" Click="OpenMessages">Contact driver</DxButton> <h5 class="fw-normal mb-0"><a href="#!" class="text-decoration-none">Contact driver</a></h5>
<div class="vr"></div> <div class="vr"></div>
@{ @{
if (_transfer.TransferStatusType != TransferStatusType.UserCanceled) if (_transfer.TransferStatusType != TransferStatusType.UserCanceled)
{ {
<DxButton RenderStyle="ButtonRenderStyle.Warning" Click="CancelTransfer">Cancel</DxButton> <h5 class="fw-normal mb-0"><DxButton RenderStyle="ButtonRenderStyle.Warning" Click="CancelTransfer">Cancel</DxButton></h5>
} }
} }
@ -186,7 +186,7 @@ else
} }
@*<h5 class="fw-normal mb-0"><a class="btn btn-secondary" @onclick="SetEditMode">Modify</a></h5>*@ @*<h5 class="fw-normal mb-0"><a class="btn btn-secondary" @onclick="SetEditMode">Modify</a></h5>*@
<DxButton RenderStyle="ButtonRenderStyle.Secondary" Click="SetEditMode">Modify</DxButton> <h5 class="fw-normal mb-0"><DxButton RenderStyle="ButtonRenderStyle.Secondary" Click="SetEditMode">Modify</DxButton></h5>
</div> </div>
</div> </div>
</div> </div>
@ -292,7 +292,6 @@ else
<DxTabPage Visible="@displayCard" Text="Messages"> <DxTabPage Visible="@displayCard" Text="Messages">
<div style="margin-top: 10px; margin-bottom: 10px;"> <div style="margin-top: 10px; margin-bottom: 10px;">
<DxButton Click="() => SendMail(_transfer)" Text="Send a message" RenderStyle="ButtonRenderStyle.Primary" /> <DxButton Click="() => SendMail(_transfer)" Text="Send a message" RenderStyle="ButtonRenderStyle.Primary" />
<DxButton RenderStyle="ButtonRenderStyle.Warning" Click="OpenDetails">Back to transfer</DxButton>
</div> </div>
<MessageDetailGridComponent ContextId="_transfer.Id" GetAllMessageTag="SignalRTags.GetMessagesByContextId" IsSenderEmailVisible="false" IsMessageTextVisible="false"></MessageDetailGridComponent> <MessageDetailGridComponent ContextId="_transfer.Id" GetAllMessageTag="SignalRTags.GetMessagesByContextId" IsSenderEmailVisible="false" IsMessageTextVisible="false"></MessageDetailGridComponent>
</DxTabPage> </DxTabPage>
@ -337,8 +336,6 @@ else
private bool _editMode = false; private bool _editMode = false;
private readonly List<string> _statusTypes = []; private readonly List<string> _statusTypes = [];
private int activeTab = 0;
void SendMail(Transfer item) void SendMail(Transfer item)
{ {
_logger.Info($"Preparing mail to {item.ContactEmail}, {item.Id}"); _logger.Info($"Preparing mail to {item.ContactEmail}, {item.Id}");
@ -400,16 +397,6 @@ else
var result = await UpdateTransfer(true); var result = await UpdateTransfer(true);
} }
private void OpenMessages()
{
activeTab = 1;
}
private void OpenDetails()
{
activeTab = 0;
}
private async Task Pay() private async Task Pay()
{ {
if (_transfer != null) if (_transfer != null)

View File

@ -136,12 +136,12 @@
if (!firstDriverName.IsNullOrWhiteSpace()) if (!firstDriverName.IsNullOrWhiteSpace())
{ {
driverBgStyle += $" background-color: #{firstDriverName.GetHashCode():X8} !important"; driverBgStyle += $" background-color: $#{firstDriverName.GetHashCode():X8} !important";
} }
<div> <div>
<div style="@driverBgStyle"></div> <div style="@driverBgStyle"></div>
<div style="position: relative; float: left; width: calc(100% - 28px)">@(string.Join(", ", tranferItem.TransferToDrivers.Select(x => x.UserProductMapping?.User?.Profile?.Name)))</div> <div style="position: relative; float: left;">@(string.Join(", ", tranferItem.TransferToDrivers.Select(x => x.UserProductMapping?.User?.Profile?.Name)))</div>
</div> </div>
} }
</CellDisplayTemplate> </CellDisplayTemplate>

View File

@ -1,13 +1,10 @@
@page "/sysadmin/manage-tours" @page "/sysadmin/manage-tours"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using DevExpress.Blazor.Internal
@using DevExpress.Blazor.Office
@using TIAM.Entities.Transfers @using TIAM.Entities.Transfers
@using TIAMWebApp.Shared.Application.Interfaces @using TIAMWebApp.Shared.Application.Interfaces
@using TIAMWebApp.Shared.Application.Models @using TIAMWebApp.Shared.Application.Models
@using TIAMWebApp.Shared.Application.Services @using TIAMWebApp.Shared.Application.Services
@using TIAMSharedUI.Shared @using TIAMSharedUI.Shared
@using DevExpress.Blazor
@inject ITransferDataService TransferDataService @inject ITransferDataService TransferDataService
@inject TourService TourService @inject TourService TourService
@inject NavigationManager Navigation @inject NavigationManager Navigation
@ -43,25 +40,13 @@
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label>Short Description</label> <label>ShortDescription</label>
<DxHtmlEditor @bind-Markup="@newTour.Bio" <InputTextArea @bind-Value="newTour.Bio" class="form-control" />
Height="200px"
CustomizeToolbar="@OnCustomizeToolbar">
<DxHtmlEditorToolbar>
</DxHtmlEditorToolbar>
</DxHtmlEditor>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label>Description</label> <label>Description</label>
<DxHtmlEditor @bind-Markup="@newTour.Description" <InputTextArea @bind-Value="newTour.Description" class="form-control" />
Height="300px"
CustomizeToolbar="@OnCustomizeToolbar">
<DxHtmlEditorToolbar>
</DxHtmlEditorToolbar>
</DxHtmlEditor>
</div> </div>
<div class="mb-3"> <div class="mb-3">
@ -89,55 +74,23 @@
<h4>Existing Tours</h4> <h4>Existing Tours</h4>
@if (Tours.Any()) @if (Tours.Any())
{ {
<div class="row"> <ul class="list-group">
@foreach (var tour in Tours) @foreach (var tour in Tours)
{ {
var dest = TransferDestinations.FirstOrDefault(d => d.Id == tour.TransferDestinationId); var dest = TransferDestinations.FirstOrDefault(d => d.Id == tour.TransferDestinationId);
<div class="col-lg-6 col-xl-4 mb-4"> <li class="list-group-item d-flex justify-content-between align-items-center">
<div class="card h-100"> <img src="@tour.CoverImageUrl" style="max-height: 100px;"/>
@if (!string.IsNullOrEmpty(tour.CoverImageUrl)) <span>
{ <strong>@tour?.Title</strong> — @tour.FancyDescription
<img src="@tour.CoverImageUrl" class="card-img-top" style="height: 200px; object-fit: cover;" alt="Tour cover image"/> </span>
} <span>
<div class="card-body d-flex flex-column"> @tour.Bio
<h5 class="card-title">@tour?.Title</h5> </span>
<button class="btn btn-sm btn-secondary me-2" @onclick="() => EditTour(tour)">Edit</button>
@if (!string.IsNullOrEmpty(tour.Bio)) <button class="btn btn-sm btn-danger" @onclick="() => DeleteTourAsync(tour.Id)">Delete</button>
{ </li>
<div class="card-text mb-3">
<strong>Short Description:</strong>
<div class="html-content">
@((MarkupString)tour.Bio)
</div>
</div>
}
@if (!string.IsNullOrEmpty(tour.FancyDescription))
{
<div class="card-text mb-3">
<strong>Description:</strong>
<div class="html-content">
@((MarkupString)tour.FancyDescription)
</div>
</div>
}
@if (dest != null)
{
<div class="card-text mb-3">
<strong>Destination:</strong> @dest.Name (@dest.AddressString)
</div>
}
<div class="mt-auto">
<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>
</div>
</div>
</div>
</div>
} }
</div> </ul>
} }
else else
{ {
@ -146,35 +99,6 @@
</div> </div>
</div> </div>
<style>
.html-content {
max-height: 150px;
overflow-y: auto;
border: 1px solid #dee2e6;
border-radius: 0.25rem;
padding: 0.5rem;
background-color: #f8f9fa;
}
.html-content p {
margin-bottom: 0.5rem;
}
.html-content p:last-child {
margin-bottom: 0;
}
.html-content ul, .html-content ol {
margin-bottom: 0.5rem;
padding-left: 1.5rem;
}
.html-content img {
max-width: 100%;
height: auto;
}
</style>
@code { @code {
private List<TransferDestination> TransferDestinations = []; private List<TransferDestination> TransferDestinations = [];
private List<TourInfo> Tours = []; private List<TourInfo> Tours = [];
@ -186,13 +110,6 @@
private bool IsEditing = false; private bool IsEditing = false;
private Guid? EditingTourId = null; private Guid? EditingTourId = null;
void OnCustomizeToolbar(IToolbar toolbar)
{
// Returns the first group
IBarGroup firstGroup = toolbar.Groups[0];
// Returns the "Table" group
IBarGroup tableGroup = toolbar.Groups[HtmlEditorToolbarGroupNames.Table];
}
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
@ -206,8 +123,8 @@
{ {
TransferDestinationId = tour.TransferDestinationId, TransferDestinationId = tour.TransferDestinationId,
Name = tour.Title, Name = tour.Title,
Bio = tour.Bio ?? string.Empty, Bio = tour.Bio,
Description = tour.FancyDescription ?? string.Empty, Description = tour.FancyDescription,
ImageBytes = null, ImageBytes = null,
ImageFileName = tour.CoverImageUrl ImageFileName = tour.CoverImageUrl
}; };
@ -225,7 +142,35 @@
EditingTourId = null; EditingTourId = null;
UploadStatus = string.Empty; UploadStatus = string.Empty;
} }
// private async Task SaveTourAsync()
// {
// if (uploadedFile is not null)
// {
// using var stream = uploadedFile.OpenReadStream(maxAllowedSize: 5 * 1024 * 1024);
// using var ms = new MemoryStream();
// await stream.CopyToAsync(ms);
// newTour.ImageBytes = ms.ToArray();
// newTour.ImageFileName = uploadedFile.Name;
// }
// TourInfo tourToCreate = new TourInfo();
// tourToCreate.TransferDestinationId = newTour.TransferDestinationId;
// tourToCreate.FancyDescription = newTour.Description;
// tourToCreate.Title = newTour.Name;
// tourToCreate.CoverImageUrl = "";
// if (tourToCreate.TransferDestinationId == Guid.Empty)
// {
// throw new InvalidOperationException("Transfer Destination must be selected.");
// }
// await TourService.CreateAsync(tourToCreate, uploadedFile);
// newTour = new();
// uploadedFile = null;
// UploadStatus = string.Empty;
// Tours = (await TourService.GetAllAsync()).ToList();
// }
private async Task HandleSubmit() private async Task HandleSubmit()
{ {
if (uploadedFile is not null) if (uploadedFile is not null)
@ -236,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)
{ {
@ -257,7 +203,6 @@
{ {
TransferDestinationId = newTour.TransferDestinationId, TransferDestinationId = newTour.TransferDestinationId,
Title = newTour.Name, Title = newTour.Name,
Bio = newTour.Bio,
FancyDescription = newTour.Description, FancyDescription = newTour.Description,
CoverImageUrl = newTour.ImageFileName CoverImageUrl = newTour.ImageFileName
}; };
@ -296,10 +241,12 @@
[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; } = string.Empty; public string? Bio { get; set; }
public string Description { get; set; } = string.Empty; public string? Description { get; set; }
public byte[]? ImageBytes { get; set; } public byte[]? ImageBytes { get; set; }
public string? ImageFileName { get; set; } public string? ImageFileName { get; set; }
} }
}
}

View File

@ -18,14 +18,14 @@
{ {
<div class="item" style="background-image: url(@item.CoverImageUrl); height: 600px !important"> <div class="item" style="background-image: url(@item.CoverImageUrl); height: 600px !important">
<div class="added" style="position: absolute; top: 0px; left:0px; text-align:center; padding:10px; width:100%;"> <div class="added" style="position: absolute; top: 100px; left:0px; text-align:center; padding:10px; width:100%">
@((MarkupString)item.Bio) <p>@item.Bio</p>
</div> </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> *@
<div style="margin-top:70px; position: relative; z-index: 10; height:450px; overflow-y: scroll;"> <div style="margin-top:70px; position: relative; z-index: 10; height:450px; overflow-y: scroll;">
@((MarkupString)item.FancyDescription) <p style="">@item.FancyDescription</p>
</div> </div>
@* <p>@item.TransferDestinationId</p> *@ @* <p>@item.TransferDestinationId</p> *@
<div> <div>

View File

@ -171,27 +171,6 @@ select {
background: no-repeat 50% / cover; background: no-repeat 50% / cover;
} }
/* ===== Scrollbar CSS ===== */
/* Firefox */
* {
scrollbar-width: auto;
scrollbar-color: #643172 rgba( 31, 38, 135, 0 );
}
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: 16px;
}
*::-webkit-scrollbar-track {
background: rgba( 31, 38, 135, 0 );
}
*::-webkit-scrollbar-thumb {
background-color: #643172;
border-radius: 10px;
border: 0px solid #ffffff;
}
.inputwizardwrapper { .inputwizardwrapper {
/*max-width: 450px;*/ /*max-width: 450px;*/

File diff suppressed because one or more lines are too long