fixes, improvements, etc...

This commit is contained in:
Loretta 2024-08-20 14:17:29 +02:00
parent a3a2106be9
commit d0a11d62bb
3 changed files with 68 additions and 45 deletions

View File

@ -82,7 +82,7 @@
<Items> <Items>
@foreach (var transfer in PageModel.Upcomings) @foreach (var transfer in PageModel.Upcomings)
{ {
<DxAccordionItem CssClass="@GetCustomColor(transfer.TransferStatusType)" Text=@($"{transfer.Appointment} - {transfer.FromAddress} [#{transfer.OrderId}]")> <DxAccordionItem CssClass="@GetCustomColor(transfer.TransferStatusType)" Text=@($"[#{transfer.OrderId}] {transfer.Appointment} - {transfer.FromAddress}")>
<ContentTemplate> <ContentTemplate>
<div class="py-3 px-3"> <div class="py-3 px-3">
<TransferCardComponent DataChanged="RefreshComponent" Context="@transfer" /> <TransferCardComponent DataChanged="RefreshComponent" Context="@transfer" />
@ -108,7 +108,7 @@
@foreach (var transfer in PageModel.Problems) @foreach (var transfer in PageModel.Problems)
{ {
<DxAccordionItem CssClass="@GetCustomColor(transfer.TransferStatusType)" Text=@($"{transfer.Appointment} - {transfer.FromAddress} [#{transfer.OrderId}]")> <DxAccordionItem CssClass="@GetCustomColor(transfer.TransferStatusType)" Text=@($"[#{transfer.OrderId}] {transfer.Appointment} - {transfer.FromAddress}")>
<ContentTemplate> <ContentTemplate>
<div class="py-3 px-3"> <div class="py-3 px-3">
<TransferCardComponent DataChanged="RefreshComponent" Context="@transfer" /> <TransferCardComponent DataChanged="RefreshComponent" Context="@transfer" />
@ -147,8 +147,6 @@
ContextIds="new object[] {driverId}" ContextIds="new object[] {driverId}"
CustomizeElement="Grid_CustomizeElement" CustomizeElement="Grid_CustomizeElement"
ShowGroupPanel="true" ShowGroupPanel="true"
CustomGroup="Grid_CustomGroup"
CustomizeGroupValueDisplayText="Grid_CustomizeGroupValueDisplayText"
ColumnResizeMode="GridColumnResizeMode.NextColumn" ColumnResizeMode="GridColumnResizeMode.NextColumn"
AllowSelectRowByClick="false" AllowSelectRowByClick="false"
PageSize="13" PageSize="13"
@ -156,8 +154,16 @@
<Columns> <Columns>
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" /> <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="OrderId" Caption="Order" SortIndex="1" SortOrder="GridColumnSortOrder.Descending" Width="70" />
<DxGridDataColumn FieldName="Appointment" Caption="Appointment" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" SortOrder="GridColumnSortOrder.Descending" GroupIndex="0" GroupInterval="GridColumnGroupInterval.Date" DisplayFormat="d" Width="95" />
<DxGridDataColumn Caption="Time" Width="50" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center">
<CellDisplayTemplate>
@{
var appointment = (Transfer)context.DataItem;
<text>@appointment.Appointment.ToString("t")</text>
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="FromAddress" /> <DxGridDataColumn FieldName="FromAddress" />
<DxGridDataColumn FieldName="ToAddress" /> <DxGridDataColumn FieldName="ToAddress" />
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="125" Visible="false" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" /> <DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="125" Visible="false" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
@ -259,14 +265,14 @@
} }
} }
void Grid_CustomGroup(GridCustomGroupEventArgs e) // void Grid_CustomGroup(GridCustomGroupEventArgs e)
{ // {
if (e.FieldName == "Appointment") // if (e.FieldName == "Appointment")
{ // {
e.SameGroup = Grid_CompareColumnValues(((DateTime)e.Value1).Date, ((DateTime)e.Value2).Date); // e.SameGroup = Grid_CompareColumnValues(((DateTime)e.Value1).Date, ((DateTime)e.Value2).Date);
e.Handled = true; // e.Handled = true;
} // }
} // }
bool Grid_CompareColumnValues(DateTime value1, DateTime value2) bool Grid_CompareColumnValues(DateTime value1, DateTime value2)
{ {
if (value1 == value2) if (value1 == value2)
@ -274,15 +280,14 @@
else else
return false; return false;
} }
void Grid_CustomizeGroupValueDisplayText(GridCustomizeGroupValueDisplayTextEventArgs e) // void Grid_CustomizeGroupValueDisplayText(GridCustomizeGroupValueDisplayTextEventArgs e)
{ // {
if (e.FieldName == "Appointment") // if (e.FieldName == "Appointment")
{ // {
// string displayText = ((DateTime)e.Value).Date.ToString();
string displayText = ((DateTime)e.Value).Date.ToString(); // e.DisplayText = displayText;
e.DisplayText = displayText; // }
} // }
}
private void RefreshComponent() private void RefreshComponent()

View File

@ -16,7 +16,7 @@
<div class="container-fluid"> <div class="container-fluid">
<MessageDetailGridComponent ContextId="UserId" GetAllMessageTag="SignalRTags.GetMessagesByUserId" IsSenderEmailVisible="false" IsMessageTextVisible="!_isMobile"></MessageDetailGridComponent> <MessageDetailGridComponent ContextId="UserId" GetAllMessageTag="SignalRTags.GetMessagesByUserId" IsSenderEmailVisible="false" IsMessageTextVisible="!_isMobile" ShowFilterRow="true"/>
</div> </div>
@ -38,7 +38,15 @@
// var upmId = sessionService.User.UserModelDto.UserProductMappings.Select(x => x.Id).FirstOrDefault(); // var upmId = sessionService.User.UserModelDto.UserProductMappings.Select(x => x.Id).FirstOrDefault();
// if(!upmId.IsNullOrEmpty()) _contextParams.Add(upmId); // if(!upmId.IsNullOrEmpty()) _contextParams.Add(upmId);
_isMobile = await jsRuntime.InvokeAsync<bool>("isDevice"); try
{
_isMobile = await jsRuntime.InvokeAsync<bool>("isDevice");
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
await base.OnInitializedAsync(); await base.OnInitializedAsync();
} }
} }

View File

@ -31,25 +31,14 @@
SignalRClient="AdminSignalRClient" SignalRClient="AdminSignalRClient"
GetAllMessageTag="GetAllMessageTag" GetAllMessageTag="GetAllMessageTag"
ContextIds="@(ContextId.IsNullOrEmpty() ? throw new InvalidDataException($"ContextId.IsNullOrEmpty(); ContextId: {ContextId}") : [ContextId.Value])" ContextIds="@(ContextId.IsNullOrEmpty() ? throw new InvalidDataException($"ContextId.IsNullOrEmpty(); ContextId: {ContextId}") : [ContextId.Value])"
CustomizeElement="CustomizeElement"> CustomizeElement="CustomizeElement"
ShowFilterRow="ShowFilterRow">
<Columns> <Columns>
<DxGridCommandColumn Width="135" MinWidth="135" Visible="AcDomain.IsDeveloperVersion" DeleteButtonVisible="AcDomain.IsDeveloperVersion" EditButtonVisible="AcDomain.IsDeveloperVersion" FixedPosition="GridColumnFixedPosition.Left" /> <DxGridCommandColumn Width="135" MinWidth="135" Visible="AcDomain.IsDeveloperVersion" DeleteButtonVisible="AcDomain.IsDeveloperVersion" EditButtonVisible="AcDomain.IsDeveloperVersion" FixedPosition="GridColumnFixedPosition.Left"/>
<DxGridDataColumn FieldName="Id" Width="150" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="ContextId" Width="150px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="Created" Caption="Received" DisplayFormat="g" Width="80" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center">
<CellDisplayTemplate>
@{
var Date = ((EmailMessage)context.DataItem).Created.Date;
var Time = ((EmailMessage)context.DataItem).Created;
<p style="padding:3px; margin: 0 auto;">@Date.ToString("yy.MM.dd")</p>
<p style="padding:3px; margin: 0 auto;">@Time.ToString("HH:mm")</p>
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="SenderId" Caption="/" Width="30px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" DisplayFormat="N"> <DxGridDataColumn FieldName="SenderId" Caption="/" Width="30px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" DisplayFormat="N">
<CellDisplayTemplate> <CellDisplayTemplate>
@{ @{
bool isOutgoing = ((EmailMessage)context.DataItem).SenderId == myUserId; var isOutgoing = ((EmailMessage)context.DataItem).SenderId == myUserId;
if (isOutgoing) if (isOutgoing)
{ {
<i class="fa-solid fa-right-from-bracket text-info"></i> <i class="fa-solid fa-right-from-bracket text-info"></i>
@ -61,8 +50,8 @@
} }
<span> | </span> <span> | </span>
@{ @{
MessageContextType a = ((EmailMessage)context.DataItem).ContextType; var contextType = ((EmailMessage)context.DataItem).ContextType;
switch (a) switch (contextType)
{ {
case MessageContextType.Transfer: case MessageContextType.Transfer:
{ {
@ -94,12 +83,32 @@
} }
</CellDisplayTemplate> </CellDisplayTemplate>
</DxGridDataColumn> </DxGridDataColumn>
<DxGridDataColumn FieldName="EmailAddress" Caption="Sender" Width="200px" Visible="IsSenderEmailVisible || AcDomain.IsDeveloperVersion" /> <DxGridDataColumn FieldName="Id" Width="150" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N"/>
<DxGridDataColumn FieldName="ContextId" Width="150px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N"/>
<DxGridDataColumn FieldName="Created" Caption="Received" DisplayFormat="g" Width="@(IsMessageTextVisible ? 140.ToString() : 80.ToString())" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center">
<CellDisplayTemplate>
@{
var created = ((EmailMessage)context.DataItem).Created;
if (!IsMessageTextVisible)
{
<p style="padding: 3px; margin: 0 auto;">@created.ToString("yy.MM.dd")</p>
<p style="padding: 3px; margin: 0 auto;">@created.ToString("HH:mm")</p>
}
else
{
<text>@created.ToString("g")</text>
}
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="EmailAddress" Caption="Sender" Width="200px" Visible="IsSenderEmailVisible || AcDomain.IsDeveloperVersion"/>
<DxGridDataColumn FieldName="Subject"> <DxGridDataColumn FieldName="Subject">
<CellDisplayTemplate> <CellDisplayTemplate>
@{ @{
string subjectString = ((EmailMessage)context.DataItem).Subject; var subjectString = ((EmailMessage)context.DataItem).Subject;
<p style="word-break: normal; white-space: normal; padding:0; margin: 0 auto;">@subjectString</p> <p style="word-break: normal; white-space: normal; padding: 0; margin: 0 auto;">@subjectString</p>
} }
</CellDisplayTemplate> </CellDisplayTemplate>
</DxGridDataColumn> </DxGridDataColumn>
@ -108,7 +117,7 @@
<text>@System.Text.RegularExpressions.Regex.Replace((displayTextContext.Value as string)!, "<(.|\n)*?>", string.Empty)</text> <text>@System.Text.RegularExpressions.Regex.Replace((displayTextContext.Value as string)!, "<(.|\n)*?>", string.Empty)</text>
</CellDisplayTemplate> </CellDisplayTemplate>
</DxGridDataColumn> </DxGridDataColumn>
<DxGridDataColumn FieldName="IsReaded" Caption="Readed" Visible="@IsMessageTextVisible" Width="70" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" /> <DxGridDataColumn FieldName="IsReaded" Caption="Readed" Visible="@IsMessageTextVisible" Width="70" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center"/>
</Columns> </Columns>
<DetailRowTemplate> <DetailRowTemplate>
@ -134,6 +143,7 @@
[Parameter] public bool IsSenderEmailVisible { get; set; } = true; [Parameter] public bool IsSenderEmailVisible { get; set; } = true;
[Parameter] public int GetAllMessageTag { get; set; } = SignalRTags.GetMessagesByContextId; [Parameter] public int GetAllMessageTag { get; set; } = SignalRTags.GetMessagesByContextId;
[Parameter] public bool ShowFilterRow { get; set; } = false;
private MessageGrid _messageGrid = null!; private MessageGrid _messageGrid = null!;
private LoggerClient<MessageDetailGridComponent> _logger = null!; private LoggerClient<MessageDetailGridComponent> _logger = null!;