Impelement EmailMessage.IsReaded; improvements, fixes, etc...
This commit is contained in:
parent
49635226c5
commit
2ee5967d67
|
|
@ -57,6 +57,9 @@ public class SignalRTags : AcSignalRTags
|
||||||
|
|
||||||
public const int GetMessagesByContextId = 60;
|
public const int GetMessagesByContextId = 60;
|
||||||
public const int GetAllMessages = 61;
|
public const int GetAllMessages = 61;
|
||||||
|
public const int CreateMessage = 63;
|
||||||
|
public const int UpdateMessage = 64;
|
||||||
|
public const int DeleteMessage = 65;
|
||||||
|
|
||||||
public const int GetProductById = 70;
|
public const int GetProductById = 70;
|
||||||
public const int GetProductsByOwnerId = 71; //for now until we can send multiple parameters
|
public const int GetProductsByOwnerId = 71; //for now until we can send multiple parameters
|
||||||
|
|
|
||||||
|
|
@ -27,81 +27,78 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="w-100 ch-220">
|
<div class="w-100 ch-220">
|
||||||
<CompanyGrid @ref="_gridCompany"
|
<CompanyGrid @ref="_gridCompany"
|
||||||
ContextId="@CompanyId"
|
Logger="_logger"
|
||||||
Logger="_logger"
|
SignalRClient="AdminSignalRClient"
|
||||||
SignalRClient="AdminSignalRClient"
|
|
||||||
|
|
||||||
AutoCollapseDetailRow="false"
|
AutoCollapseDetailRow="false"
|
||||||
KeyboardNavigationEnabled="true"
|
KeyboardNavigationEnabled="true"
|
||||||
CustomizeElement="Grid_CustomizeElement"
|
CustomizeElement="Grid_CustomizeElement"
|
||||||
CustomizeEditModel="Grid_CustomizeEditModel"
|
CustomizeEditModel="Grid_CustomizeEditModel"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
ShowFilterRow="true"
|
ShowFilterRow="true"
|
||||||
KeyFieldName="Id">
|
KeyFieldName="Id">
|
||||||
|
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
<DxGridDataColumn FieldName="Name" />
|
<DxGridDataColumn FieldName="Name" />
|
||||||
|
|
||||||
<DxGridDataColumn FieldName="AffiliateId" DisplayFormat="N" />
|
<DxGridDataColumn FieldName="AffiliateId" DisplayFormat="N" />
|
||||||
<DxGridDataColumn FieldName="CommissionPercent" />
|
<DxGridDataColumn FieldName="CommissionPercent" />
|
||||||
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" />
|
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" />
|
||||||
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" />
|
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" />
|
||||||
@* <DxGridDataColumn FieldName="ContactEmail">
|
@* <DxGridDataColumn FieldName="ContactEmail">
|
||||||
|
|
||||||
</DxGridDataColumn> *@
|
</DxGridDataColumn> *@
|
||||||
|
|
||||||
</Columns>
|
</Columns>
|
||||||
@* <DetailRowTemplate>
|
@* <DetailRowTemplate>
|
||||||
<CompaniesNestedUserProductMapping CurrentCompany="(TIAM.Entities.ServiceProviders.Company)context.DataItem" KeyboardNavigationEnabled="true" />
|
<CompaniesNestedUserProductMapping CurrentCompany="(TIAM.Entities.ServiceProviders.Company)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||||
</DetailRowTemplate> *@
|
</DetailRowTemplate> *@
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
<DxTabs>
|
<DxTabs>
|
||||||
<DxTabPage Text="Profile">
|
<DxTabPage Text="Profile">
|
||||||
<ProfileGridComponent ParentData="((Company)context.DataItem)" KeyboardNavigationEnabled="true" />
|
<ProfileGridComponent ParentData="((Company)context.DataItem)" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Products">
|
<DxTabPage Text="Products">
|
||||||
<ProductDetailGridComponent ContextId="((Company)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
<ProductDetailGridComponent ParentData="((Company)context.DataItem)" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Address">
|
<DxTabPage Text="Address">
|
||||||
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" />
|
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
<EditFormTemplate Context="EditFormContext">
|
<EditFormTemplate Context="EditFormContext">
|
||||||
@{
|
@{
|
||||||
var transfer2 = (Company)EditFormContext.EditModel;
|
var transfer2 = (Company)EditFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
||||||
@EditFormContext.GetEditor("Name")
|
@EditFormContext.GetEditor("Name")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
||||||
@EditFormContext.GetEditor("CommissionPercent")
|
@EditFormContext.GetEditor("CommissionPercent")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
</EditFormTemplate>
|
</EditFormTemplate>
|
||||||
</CompanyGrid>
|
</CompanyGrid>
|
||||||
|
|
||||||
<DxTabs>
|
<DxTabs>
|
||||||
@* <DxTabPage Text="Profile">
|
@* <DxTabPage Text="Profile">
|
||||||
<ProfileComponent></ProfileComponent>
|
<ProfileComponent></ProfileComponent>
|
||||||
</DxTabPage> *@
|
</DxTabPage> *@
|
||||||
@* <DxTabPage Text="Profile 2">
|
@* <DxTabPage Text="Profile 2">
|
||||||
<ProfileGridComponent ProfileId="((Company)context.DataItem).ProfileId" KeyboardNavigationEnabled="true" />
|
<ProfileGridComponent ProfileId="((Company)context.DataItem).ProfileId" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage> *@
|
</DxTabPage> *@
|
||||||
<DxTabPage Text="Products">
|
<DxTabPage Text="Products">
|
||||||
<ProductDetailGridComponent ContextId="@CompanyId" KeyboardNavigationEnabled="true" />
|
<ProductDetailGridComponent ContextId="@CompanyId" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
@* <DxTabPage Text="Address">
|
@* <DxTabPage Text="Address">
|
||||||
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" />
|
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage> *@
|
</DxTabPage> *@
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
|
||||||
|
|
@ -107,35 +107,36 @@
|
||||||
KeyFieldName="Id">
|
KeyFieldName="Id">
|
||||||
|
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="AcDomain.IsDeveloperVersion" Width="70" MinWidth="70" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="AcDomain.IsDeveloperVersion" Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N"/>
|
||||||
<DxGridDataColumn FieldName="OrderId">
|
<DxGridDataColumn FieldName="OrderId">
|
||||||
<CellDisplayTemplate>
|
<CellDisplayTemplate>
|
||||||
@{
|
@{
|
||||||
var idKeyField = ((Transfer)context.DataItem).Id;
|
var idKeyField = ((Transfer)context.DataItem).Id;
|
||||||
var editUri = $"mytransfers/{idKeyField:N}";
|
var editUri = $"mytransfers/{idKeyField:N}";
|
||||||
<NavLink href="@editUri">
|
<NavLink href="@editUri">
|
||||||
<text>@context.Value</text>
|
<text>@context.Value</text>
|
||||||
</NavLink> }
|
</NavLink>
|
||||||
</CellDisplayTemplate>
|
}
|
||||||
|
</CellDisplayTemplate>
|
||||||
</DxGridDataColumn>
|
</DxGridDataColumn>
|
||||||
<DxGridDataColumn FieldName="PaymentId" DisplayFormat="N" />
|
<DxGridDataColumn FieldName="PaymentId" DisplayFormat="N"/>
|
||||||
<DxGridDataColumn FieldName="FromAddress" />
|
<DxGridDataColumn FieldName="FromAddress"/>
|
||||||
<DxGridDataColumn FieldName="ToAddress" />
|
<DxGridDataColumn FieldName="ToAddress"/>
|
||||||
<DxGridDataColumn FieldName="Appointment" DisplayFormat="g" Width="140" />
|
<DxGridDataColumn FieldName="Appointment" DisplayFormat="g" Width="140"/>
|
||||||
<DxGridDataColumn FieldName="FullName" />
|
<DxGridDataColumn FieldName="FullName"/>
|
||||||
<DxGridDataColumn FieldName="ContactPhone" />
|
<DxGridDataColumn FieldName="ContactPhone"/>
|
||||||
<DxGridDataColumn FieldName="ContactEmail">
|
<DxGridDataColumn FieldName="ContactEmail">
|
||||||
<CellDisplayTemplate>
|
<CellDisplayTemplate>
|
||||||
@{
|
@{
|
||||||
var keyField = context.Value;
|
var keyField = context.Value;
|
||||||
var keyItem = (Transfer)context.DataItem;
|
var keyItem = (Transfer)context.DataItem;
|
||||||
string buttonText = "Contact";
|
string buttonText = "Contact";
|
||||||
<DxButton Click="() => SendMail(keyItem)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
|
<DxButton Click="() => SendMail(keyItem)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary"/>
|
||||||
}
|
}
|
||||||
</CellDisplayTemplate>
|
</CellDisplayTemplate>
|
||||||
</DxGridDataColumn>
|
</DxGridDataColumn>
|
||||||
<DxGridDataColumn FieldName="PassengerCount" />
|
<DxGridDataColumn FieldName="PassengerCount"/>
|
||||||
<DxGridDataColumn FieldName="TransferStatusType">
|
<DxGridDataColumn FieldName="TransferStatusType">
|
||||||
<CellDisplayTemplate>
|
<CellDisplayTemplate>
|
||||||
@{
|
@{
|
||||||
|
|
@ -148,17 +149,14 @@
|
||||||
</DxGridDataColumn>
|
</DxGridDataColumn>
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
|
|
||||||
<DxTabs>
|
<DxTabs>
|
||||||
<DxTabPage Text="Driver">
|
|
||||||
<TransferToDriverGridComponent ParentData="(Transfer)context.DataItem" KeyboardNavigationEnabled="true" />
|
|
||||||
</DxTabPage>
|
|
||||||
<DxTabPage Text="Messages">
|
<DxTabPage Text="Messages">
|
||||||
<MessageDetailGridComponent ContextId="((Transfer)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
<MessageDetailGridComponent ContextId="((Transfer)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
|
<DxTabPage Text="Driver">
|
||||||
|
<TransferToDriverGridComponent ParentData="(Transfer)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||||
|
</DxTabPage>
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
|
|
||||||
|
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
<EditFormTemplate Context="EditFormContext">
|
<EditFormTemplate Context="EditFormContext">
|
||||||
@{
|
@{
|
||||||
|
|
@ -329,28 +327,30 @@
|
||||||
|
|
||||||
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.ElementType == GridElementType.DataRow && (byte)e.Grid.GetRowValue(e.VisibleIndex, "TransferStatusType") == 5)
|
|
||||||
{
|
|
||||||
e.CssClass = "bg-important";
|
|
||||||
}
|
|
||||||
else if (e.ElementType == GridElementType.DataRow && (byte)e.Grid.GetRowValue(e.VisibleIndex, "TransferStatusType") > 5 && (byte)e.Grid.GetRowValue(e.VisibleIndex, "TransferStatusType") < 35)
|
|
||||||
{
|
|
||||||
e.CssClass = "bg-attention";
|
|
||||||
}
|
|
||||||
else if (e.ElementType == GridElementType.DataRow && (byte)e.Grid.GetRowValue(e.VisibleIndex, "TransferStatusType") == 35)
|
|
||||||
{
|
|
||||||
e.CssClass = "bg-finished";
|
|
||||||
}
|
|
||||||
else if (e.ElementType == GridElementType.DataRow && (byte)e.Grid.GetRowValue(e.VisibleIndex, "TransferStatusType") > 35)
|
|
||||||
{
|
|
||||||
e.CssClass = "bg-cancel";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.ElementType == GridElementType.HeaderCell)
|
if (e.ElementType == GridElementType.HeaderCell)
|
||||||
{
|
{
|
||||||
e.Style = "background-color: rgba(0, 0, 0, 0.08)";
|
e.Style = "background-color: rgba(0, 0, 0, 0.08)";
|
||||||
e.CssClass = "header-bold";
|
e.CssClass = "header-bold";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.ElementType != GridElementType.DataRow) return;
|
||||||
|
|
||||||
|
var transferStatusType = (byte)e.Grid.GetRowValue(e.VisibleIndex, "TransferStatusType");
|
||||||
|
switch (transferStatusType)
|
||||||
|
{
|
||||||
|
case 5:
|
||||||
|
e.CssClass = "bg-important";
|
||||||
|
break;
|
||||||
|
case > 5 and < 35:
|
||||||
|
e.CssClass = "bg-attention";
|
||||||
|
break;
|
||||||
|
case 35:
|
||||||
|
e.CssClass = "bg-finished";
|
||||||
|
break;
|
||||||
|
case > 35:
|
||||||
|
e.CssClass = "bg-cancel";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
@using AyCode.Core
|
@using AyCode.Core
|
||||||
|
@using AyCode.Core.Helpers
|
||||||
@using TIAM.Entities.Products
|
@using TIAM.Entities.Products
|
||||||
@using TIAM.Entities.ServiceProviders
|
@using TIAM.Entities.ServiceProviders
|
||||||
@using TIAM.Entities.Transfers
|
@using TIAM.Entities.Transfers
|
||||||
|
|
@ -14,9 +15,7 @@
|
||||||
@using TIAMSharedUI.Pages.Components.EditComponents
|
@using TIAMSharedUI.Pages.Components.EditComponents
|
||||||
@using TIAMWebApp.Shared.Application.Services
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
@using AyCode.Interfaces.Addresses
|
@using AyCode.Interfaces.Addresses
|
||||||
@inject IServiceProviderDataService serviceProviderDataService
|
@using TIAM.Entities.Emails
|
||||||
@inject IUserDataService userDataService
|
|
||||||
@inject ITransferDataService transferDataService
|
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
@inject AdminSignalRClient AdminSignalRClient;
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
|
|
@ -24,44 +23,60 @@
|
||||||
<MessageDetailGrid @ref="_messageGrid"
|
<MessageDetailGrid @ref="_messageGrid"
|
||||||
Logger="_logger"
|
Logger="_logger"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
ContextId="ContextId"
|
ContextIds="new[] {ContextId}"
|
||||||
|
CustomizeElement="CustomizeElement"
|
||||||
TextWrapEnabled="false">
|
TextWrapEnabled="false">
|
||||||
|
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridDataColumn FieldName="Id" Width="80px" Visible="false" />
|
<DxGridCommandColumn Width="135" MinWidth="135" DeleteButtonVisible="AcDomain.IsDeveloperVersion" EditButtonVisible="AcDomain.IsDeveloperVersion" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="ContextId" Width="80px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="false" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
|
<DxGridDataColumn FieldName="ContextId" Width="80px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
<DxGridDataColumn FieldName="EmailAddress" Width="100px" Visible="@IsSenderEmailVisible" />
|
<DxGridDataColumn FieldName="EmailAddress" Width="100px" Visible="@IsSenderEmailVisible" />
|
||||||
<DxGridDataColumn FieldName="Subject" Visible=@IsSubjectVisible />
|
<DxGridDataColumn FieldName="Subject" Visible=@IsSubjectVisible />
|
||||||
<DxGridDataColumn FieldName="Text">
|
<DxGridDataColumn FieldName="Text">
|
||||||
<CellDisplayTemplate Context="messageContext">
|
<CellDisplayTemplate Context="displayTextContext">
|
||||||
@{
|
<text>@System.Text.RegularExpressions.Regex.Replace((displayTextContext.Value as string)!, "<(.|\n)*?>", string.Empty)</text>
|
||||||
var keyField = (string)messageContext.Value;
|
|
||||||
}
|
|
||||||
<div>@((MarkupString)keyField)</div>
|
|
||||||
</CellDisplayTemplate>
|
</CellDisplayTemplate>
|
||||||
</DxGridDataColumn>
|
</DxGridDataColumn>
|
||||||
|
<DxGridDataColumn FieldName="IsReaded" Caption="Readed" Width="70" CaptionAlignment="GridTextAlignment.Center" />
|
||||||
<DxGridDataColumn FieldName="Created" Width="100px" />
|
<DxGridDataColumn FieldName="Created" Width="100px" />
|
||||||
</Columns>
|
</Columns>
|
||||||
|
<DetailRowTemplate>
|
||||||
|
@{
|
||||||
|
var emailMessage = ((EmailMessage)context.DataItem);
|
||||||
|
<div>@((MarkupString)(emailMessage.Text ?? string.Empty))</div>
|
||||||
|
|
||||||
|
if (!emailMessage.IsReaded)
|
||||||
|
{
|
||||||
|
emailMessage.IsReaded = true;
|
||||||
|
_messageGrid.UpdateDataItemAsync(emailMessage).Forget();
|
||||||
|
|
||||||
|
InvokeAsync(StateHasChanged).Forget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</DetailRowTemplate>
|
||||||
</MessageDetailGrid>
|
</MessageDetailGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
[Parameter] public Guid? ContextId { get; set; }
|
[Parameter] public Guid ContextId { get; set; }
|
||||||
|
//[Parameter] public IEmailMessageRelation ParentData { get; set; } = null!;
|
||||||
[Parameter] public bool IsSubjectVisible { get; set; } = true;
|
[Parameter] public bool IsSubjectVisible { get; set; } = true;
|
||||||
[Parameter] public bool IsSenderEmailVisible { get; set; } = true;
|
[Parameter] public bool IsSenderEmailVisible { get; set; } = true;
|
||||||
|
|
||||||
|
|
||||||
private Guid? _contextId = null!;
|
|
||||||
private MessageGrid _messageGrid = null!;
|
private MessageGrid _messageGrid = null!;
|
||||||
private LoggerClient<MessageGridComponent> _logger = null!;
|
private LoggerClient<MessageGridComponent> _logger = null!;
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<MessageGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<MessageGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
//DataSource = new List<Address>();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CustomizeElement(GridCustomizeElementEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.ElementType != GridElementType.DataRow) return;
|
||||||
|
|
||||||
|
e.Style = (bool)e.Grid.GetRowValue(e.VisibleIndex, "IsReaded") == false ? "font-weight: bold;" : "font-weight: normal;";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
@using TIAMSharedUI.Pages.Components.EditComponents
|
@using TIAMSharedUI.Pages.Components.EditComponents
|
||||||
@using TIAMWebApp.Shared.Application.Services
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
@using AyCode.Interfaces.Addresses
|
@using AyCode.Interfaces.Addresses
|
||||||
|
@using TIAM.Entities.Emails
|
||||||
@inject IServiceProviderDataService serviceProviderDataService
|
@inject IServiceProviderDataService serviceProviderDataService
|
||||||
@inject IUserDataService userDataService
|
@inject IUserDataService userDataService
|
||||||
@inject ITransferDataService transferDataService
|
@inject ITransferDataService transferDataService
|
||||||
|
|
@ -21,8 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
<MessageGrid @ref="_messageGrid"
|
<MessageGrid @ref="_messageGrid"
|
||||||
ContextId="_contextId"
|
Logger="_logger"
|
||||||
Logger="_logger"
|
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
PageSize="5"
|
PageSize="5"
|
||||||
AutoExpandAllGroupRows="true"
|
AutoExpandAllGroupRows="true"
|
||||||
|
|
@ -43,14 +43,16 @@
|
||||||
<DxGridDataColumn FieldName="Created" Width="40" />
|
<DxGridDataColumn FieldName="Created" Width="40" />
|
||||||
<DxGridDataColumn FieldName="Modified" Width="40" />
|
<DxGridDataColumn FieldName="Modified" Width="40" />
|
||||||
</Columns>
|
</Columns>
|
||||||
|
<DetailRowTemplate>
|
||||||
|
@{
|
||||||
|
<text>@(((EmailMessage)context.DataItem).Text)</text>
|
||||||
|
}
|
||||||
|
</DetailRowTemplate>
|
||||||
</MessageGrid>
|
</MessageGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
|
||||||
|
|
||||||
private Guid? _contextId = null!;
|
|
||||||
private MessageGrid _messageGrid = null!;
|
private MessageGrid _messageGrid = null!;
|
||||||
private LoggerClient<MessageGridComponent> _logger = null!;
|
private LoggerClient<MessageGridComponent> _logger = null!;
|
||||||
|
|
||||||
|
|
@ -59,7 +61,6 @@
|
||||||
_logger = new LoggerClient<MessageGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<MessageGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
//DataSource = new List<Address>();
|
//DataSource = new List<Address>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
@using TIAMSharedUI.Pages.Components.EditComponents
|
@using TIAMSharedUI.Pages.Components.EditComponents
|
||||||
@using TIAMWebApp.Shared.Application.Services
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
@using AyCode.Interfaces.Addresses
|
@using AyCode.Interfaces.Addresses
|
||||||
|
@using AyCode.Core
|
||||||
@inject IStringLocalizer<TIAMResources> Localizer
|
@inject IStringLocalizer<TIAMResources> Localizer
|
||||||
@inject IServiceProviderDataService serviceProviderDataService
|
@inject IServiceProviderDataService serviceProviderDataService
|
||||||
@inject IUserDataService userDataService
|
@inject IUserDataService userDataService
|
||||||
|
|
@ -39,8 +40,9 @@
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn NewButtonVisible="true" Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N"/>
|
||||||
|
|
||||||
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductName) FieldName="Name" />
|
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductName) FieldName="Name" />
|
||||||
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductType) FieldName="ProductType" Width="140" />
|
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductType) FieldName="ProductType" Width="140" />
|
||||||
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.Price) FieldName="Price" Width="40" />
|
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.Price) FieldName="Price" Width="40" />
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
ShowFilterRow="false">
|
ShowFilterRow="false">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="false" Width="70" MinWidth="70" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
<DxGridDataColumn FieldName="Name" />
|
<DxGridDataColumn FieldName="Name" />
|
||||||
<DxGridDataColumn FieldName="FullName" />
|
<DxGridDataColumn FieldName="FullName" />
|
||||||
<DxGridDataColumn FieldName="Created" Width="40%" />
|
<DxGridDataColumn FieldName="Created" Width="40%" />
|
||||||
|
|
@ -39,14 +39,10 @@
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
<DxTabs>
|
<DxTabs>
|
||||||
|
|
||||||
<DxTabPage Text="Address">
|
<DxTabPage Text="Address">
|
||||||
<AddressDetailGridComponent ParentData="((Profile)context.DataItem)" KeyboardNavigationEnabled="true" />
|
<AddressDetailGridComponent ParentData="((Profile)context.DataItem)" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
|
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
|
|
||||||
|
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
|
|
||||||
</ProfileDetailGrid>
|
</ProfileDetailGrid>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
<CompanyDetailGrid Data="_detailGridData"
|
<CompanyDetailGrid Data="_detailGridData"
|
||||||
Logger="_logger"
|
Logger="_logger"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
ContextId="ContextId"
|
ContextIds="new[] {ContextId}"
|
||||||
PageSize="5"
|
PageSize="5"
|
||||||
AutoExpandAllGroupRows="true"
|
AutoExpandAllGroupRows="true"
|
||||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
|
|
@ -36,15 +36,11 @@
|
||||||
<DxGridDataColumn FieldName="CommissionPercent" />
|
<DxGridDataColumn FieldName="CommissionPercent" />
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
|
|
||||||
<DxTabs>
|
<DxTabs>
|
||||||
<DxTabPage Text="Products">
|
<DxTabPage Text="Products">
|
||||||
<ProductDetailGridComponent ContextId="((Company)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
<ProductDetailGridComponent ParentData="((Company)context.DataItem)" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
|
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
|
|
||||||
|
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
<EditFormTemplate Context="EditFormContext">
|
<EditFormTemplate Context="EditFormContext">
|
||||||
@{
|
@{
|
||||||
|
|
@ -69,7 +65,7 @@
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
[Parameter] public UserModelDtoDetail UserModelDtoDetail { get; set; }
|
[Parameter] public UserModelDtoDetail UserModelDtoDetail { get; set; }
|
||||||
[Parameter] public Guid? ContextId { get; set; }
|
[Parameter] public Guid ContextId { get; set; }
|
||||||
|
|
||||||
List<Company> _detailGridData;
|
List<Company> _detailGridData;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ public class MessageGrid : TiamGrid<EmailMessage>
|
||||||
public MessageGrid() : base()
|
public MessageGrid() : base()
|
||||||
{
|
{
|
||||||
GetAllMessageTag = SignalRTags.GetMessagesByContextId;
|
GetAllMessageTag = SignalRTags.GetMessagesByContextId;
|
||||||
//AddMessageTag = SignalRTags.AddAddress;
|
AddMessageTag = SignalRTags.CreateMessage;
|
||||||
//UpdateMessageTag = SignalRTags.UpdateAddress;
|
UpdateMessageTag = SignalRTags.UpdateMessage;
|
||||||
//RemoveMessageTag = SignalRTags.RemoveAddress; - nem törlünk címet - J.
|
//RemoveMessageTag = SignalRTags.RemoveAddress; - nem törlünk címet - J.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ using AyCode.Services.SignalRs;
|
||||||
using TIAM.Services;
|
using TIAM.Services;
|
||||||
using AyCode.Core.Loggers;
|
using AyCode.Core.Loggers;
|
||||||
using AyCode.Core.Extensions;
|
using AyCode.Core.Extensions;
|
||||||
|
using TIAM.Entities.Products;
|
||||||
|
|
||||||
namespace TIAMWebApp.Server.Controllers
|
namespace TIAMWebApp.Server.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -20,15 +21,13 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[Route("api/v1/[controller]")]
|
[Route("api/v1/[controller]")]
|
||||||
public class MessageAPIController : ControllerBase
|
public class MessageAPIController : ControllerBase
|
||||||
{
|
{
|
||||||
private AdminDal _adminDal;
|
private readonly AdminDal _adminDal;
|
||||||
private readonly TIAM.Core.Loggers.ILogger _logger;
|
private readonly TIAM.Core.Loggers.ILogger _logger;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||||
private IMessageSenderService _messageSenderService;
|
private readonly IMessageSenderService _messageSenderService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public MessageAPIController(IEnumerable<IAcLogWriterBase> logWriters, IConfiguration configuration, IWebHostEnvironment webHostEnvironment, IMessageSenderService messageSenderService, AdminDal adminDal)
|
public MessageAPIController(IEnumerable<IAcLogWriterBase> logWriters, IConfiguration configuration, IWebHostEnvironment webHostEnvironment, IMessageSenderService messageSenderService, AdminDal adminDal)
|
||||||
{
|
{
|
||||||
_adminDal = adminDal;
|
_adminDal = adminDal;
|
||||||
|
|
@ -42,38 +41,33 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route(APIUrls.SendEmailRouteName)]
|
[Route(APIUrls.SendEmailRouteName)]
|
||||||
public async Task<IActionResult> SendEmail([FromBody] JsonElement SerializedMessageSenderModel)
|
public async Task<IActionResult> SendEmail([FromBody] JsonElement serializedMessageSenderModel)
|
||||||
{
|
{
|
||||||
Console.WriteLine("SendEmail called!");
|
_logger.Debug($"SendEmail called!");
|
||||||
var message = JObject.Parse(SerializedMessageSenderModel.GetRawText()).ToObject<MessageSenderModel<EmailMessage>>();
|
var message = JObject.Parse(serializedMessageSenderModel.GetRawText()).ToObject<MessageSenderModel<EmailMessage>>();
|
||||||
|
|
||||||
if (message != null)
|
if (message == null) return BadRequest("Invalid request");
|
||||||
|
|
||||||
|
if (message.MessageType == MessageTypesEnum.email)
|
||||||
{
|
{
|
||||||
|
_logger.Debug($"EmailMessage!!!");
|
||||||
|
|
||||||
if (message.MessageType == MessageTypesEnum.email)
|
var messageElement = message.Message;
|
||||||
{
|
_logger.Debug(message.Message.Subject);
|
||||||
|
|
||||||
Console.WriteLine($"EmailMessage!!!");
|
var result = await _messageSenderService.SendMessageAsync(messageElement, (int)message.MessageType);
|
||||||
var messageElement = message.Message;
|
//_adminDal.AddEmailMessageAsync((TIAM.Entities.Emails.EmailMessage)SerializedMessageSenderModel.Message);
|
||||||
Console.WriteLine(message.Message);
|
messageElement.EmailAddress = "noreply@anataworld.com";
|
||||||
var result = await _messageSenderService.SendMessageAsync(messageElement, (int)message.MessageType);
|
|
||||||
//_adminDal.AddEmailMessageAsync((TIAM.Entities.Emails.EmailMessage)SerializedMessageSenderModel.Message);
|
|
||||||
messageElement.EmailAddress = "noreply@anataworld.com";
|
|
||||||
await _adminDal.AddEmailMessageAsync(messageElement);
|
|
||||||
Console.WriteLine("SendEmail result: " + result);
|
|
||||||
return Ok(result);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return BadRequest("Invalid request");
|
|
||||||
// Access BaseClass properties
|
|
||||||
}
|
|
||||||
|
|
||||||
|
await _adminDal.AddEmailMessageAsync(messageElement);
|
||||||
|
_logger.Debug($"SendEmail result: {result}");
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid request");
|
||||||
}
|
}
|
||||||
return BadRequest("Invalid request");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
|
|
@ -84,10 +78,8 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
public async Task<string> GetMessagesByContextId(Guid contextId)
|
public async Task<string> GetMessagesByContextId(Guid contextId)
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetMessagessByContextId called with ownerId: {contextId}");
|
_logger.Info($@"GetMessagessByContextId called with ownerId: {contextId}");
|
||||||
|
|
||||||
|
|
||||||
var messages = await _adminDal.GetEmailMessagesByContextIdAsync(contextId);
|
var messages = await _adminDal.GetEmailMessagesByContextIdAsync(contextId);
|
||||||
//put Company id and name into a dictionary
|
|
||||||
|
|
||||||
return messages.ToJson();
|
return messages.ToJson();
|
||||||
}
|
}
|
||||||
|
|
@ -101,12 +93,19 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetMessages called");
|
_logger.Info($@"GetMessages called");
|
||||||
|
|
||||||
|
|
||||||
var messages = await _adminDal.GetAllEmailMessagesAsync();
|
var messages = await _adminDal.GetAllEmailMessagesAsync();
|
||||||
//put Company id and name into a dictionary
|
|
||||||
|
|
||||||
return messages.ToJson();
|
return messages.ToJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SignalR(SignalRTags.UpdateMessage)]
|
||||||
|
public async Task<EmailMessage?> UpdateMessages([FromBody] EmailMessage message)
|
||||||
|
{
|
||||||
|
_logger.Info($@"UpdateMessages called");
|
||||||
|
|
||||||
|
if (await _adminDal.UpdateEmailMessageAsync(message)) return message;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -357,27 +357,12 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetProductsByServiceProviderId called with serviceProviderId: {serviceProviderId}");
|
_logger.Info($@"GetProductsByServiceProviderId called with serviceProviderId: {serviceProviderId}");
|
||||||
|
|
||||||
if (serviceProviderId != Guid.Empty)
|
if (serviceProviderId == Guid.Empty) return await Task.FromResult(string.Empty);
|
||||||
{
|
|
||||||
var products = adminDal.GetProductsJsonByServiceProviderId(serviceProviderId);
|
|
||||||
if (products != null)
|
|
||||||
{
|
|
||||||
return await Task.FromResult(products);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//some Iactionresult that explains that there were errors
|
|
||||||
return await Task.FromResult(string.Empty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//some Iactionresult that explains that there were errors
|
|
||||||
return await Task.FromResult(string.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
var products = adminDal.GetProductsJsonByServiceProviderId(serviceProviderId);
|
||||||
|
return await Task.FromResult(products);
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route(APIUrls.GetProductsByServiceProviderIdRouteName)]
|
[Route(APIUrls.GetProductsByServiceProviderIdRouteName)]
|
||||||
|
|
@ -391,13 +376,9 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
{
|
{
|
||||||
return await Task.FromResult("Invalid request");
|
return await Task.FromResult("Invalid request");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
var result = await GetProductsByOwnerId(serviceProviderId);
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
var result = await GetProductsByOwnerId(serviceProviderId);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
|
|
@ -417,7 +398,6 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue