...
This commit is contained in:
@@ -285,20 +285,25 @@ namespace Hushian.Application.Services
|
|||||||
await WriteInHubFromCompany(Response.Value, convModel.UserID.ToString());
|
await WriteInHubFromCompany(Response.Value, convModel.UserID.ToString());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
List<string> users = new();
|
||||||
|
users.Add("C" + convModel.CompanyID.ToString());
|
||||||
|
|
||||||
var modelA = convModel.ConversationResponses.OrderBy(o => o.ID)
|
var modelA = convModel.ConversationResponses.OrderBy(o => o.ID)
|
||||||
.LastOrDefault(l =>/* l.Type == ConversationType.EU || l.Type == ConversationType.CU*/ l.ExperID.HasValue);
|
.LastOrDefault(l =>/* l.Type == ConversationType.EU || l.Type == ConversationType.CU*/ l.ExperID.HasValue);
|
||||||
if (modelA != null)
|
if (modelA != null /*&& (modelA.Type == ConversationType.EU || modelA.Type == ConversationType.UE)*/)
|
||||||
{
|
// {
|
||||||
string user ="";
|
|
||||||
|
|
||||||
if (modelA.Type == ConversationType.EU || modelA.Type == ConversationType.UE) user = modelA.ExperID.Value.ToString();
|
|
||||||
|
|
||||||
else if (modelA.Type == ConversationType.CU) user ="C"+ modelA.conversation.CompanyID.ToString();
|
//if ()
|
||||||
|
users.Add(modelA.ExperID.Value.ToString());
|
||||||
|
|
||||||
await WriteInHubFromUser(Response.Value, user);
|
|
||||||
|
|
||||||
}
|
|
||||||
else await NewChatInHub(convModel.CompanyID);
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
//else await NewChatInHub(convModel.CompanyID);
|
||||||
|
await WriteInHubFromUser(Response.Value, users);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -502,8 +507,9 @@ namespace Hushian.Application.Services
|
|||||||
// // .SendAsync("ReceiveNewConversation", conv.Id, conv.Title);
|
// // .SendAsync("ReceiveNewConversation", conv.Id, conv.Title);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
public async Task WriteInHubFromUser(ChatItemResponseDto item, string ToUser)
|
public async Task WriteInHubFromUser(ChatItemResponseDto item,List< string> ToUserS)
|
||||||
{
|
{
|
||||||
|
foreach (var ToUser in ToUserS)
|
||||||
await _hubContext.Clients.User(ToUser)
|
await _hubContext.Clients.User(ToUser)
|
||||||
.SendAsync("ReceiveNewChatItemFromUser", item);
|
.SendAsync("ReceiveNewChatItemFromUser", item);
|
||||||
}
|
}
|
||||||
|
@@ -118,7 +118,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<Icon Name="IconName.ArrowBarUp" Size="IconSize.x5" Style="height=10px;width=10px" />
|
<Icon Name="IconName.ArrowBarUp" Size="IconSize.x5" Style="height=10px;width=10px" />
|
||||||
}
|
}
|
||||||
|
|
||||||
@item.LastText
|
@item.LastText
|
||||||
@@ -166,9 +166,11 @@
|
|||||||
|
|
||||||
<!-- Main Chat Section (B) -->
|
<!-- Main Chat Section (B) -->
|
||||||
<div class="col-md-9 d-flex flex-column" id="B">
|
<div class="col-md-9 d-flex flex-column" id="B">
|
||||||
|
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@if (ChatCurrent != null)
|
@if (ChatCurrent != null)
|
||||||
{
|
{
|
||||||
|
<small>@ChatCurrent?.ID)</small>
|
||||||
<p type="text" class="form-control fw-bold text-primary" style="border:none;align-self: center;" aria-describedby="basic-addon1">@SelectedChatUserName</p>
|
<p type="text" class="form-control fw-bold text-primary" style="border:none;align-self: center;" aria-describedby="basic-addon1">@SelectedChatUserName</p>
|
||||||
<div class="d-flex gap-2 ms-auto">
|
<div class="d-flex gap-2 ms-auto">
|
||||||
@if (ChatCurrent.status == Common.Enums.ConversationStatus.InProgress)
|
@if (ChatCurrent.status == Common.Enums.ConversationStatus.InProgress)
|
||||||
@@ -386,7 +388,7 @@
|
|||||||
/////////////
|
/////////////
|
||||||
ChatItemDto? ChatCurrent { get; set; } = null;
|
ChatItemDto? ChatCurrent { get; set; } = null;
|
||||||
string MsgInput { get; set; }
|
string MsgInput { get; set; }
|
||||||
IBrowserFile? SelectedImageFile = null;
|
IBrowserFile? SelectedImageFile = null;
|
||||||
byte[]? SelectedImageBytes = null;
|
byte[]? SelectedImageBytes = null;
|
||||||
string? SelectedImagePreview = null;
|
string? SelectedImagePreview = null;
|
||||||
|
|
||||||
@@ -400,7 +402,7 @@
|
|||||||
private DateTime recordingStartTime;
|
private DateTime recordingStartTime;
|
||||||
|
|
||||||
bool chatloading = false;
|
bool chatloading = false;
|
||||||
string SelectedChatUserName = "مهدی ربیع نژاد";
|
string SelectedChatUserName = "";
|
||||||
private bool _shouldObserveVisibility = false;
|
private bool _shouldObserveVisibility = false;
|
||||||
private ConfirmDialog dialog = default!;
|
private ConfirmDialog dialog = default!;
|
||||||
private Modal modal = default!;
|
private Modal modal = default!;
|
||||||
@@ -453,7 +455,7 @@
|
|||||||
//NewChat
|
//NewChat
|
||||||
hubConnection.On<int>("NewChat", async (companyid) =>
|
hubConnection.On<int>("NewChat", async (companyid) =>
|
||||||
{
|
{
|
||||||
if (CurrentUser.CompanyID==companyid)
|
if (CurrentUser.CompanyID==companyid)
|
||||||
{ Inbox1Items = await chatService.ChatAwaitingOurResponse(); StateHasChanged(); }
|
{ Inbox1Items = await chatService.ChatAwaitingOurResponse(); StateHasChanged(); }
|
||||||
});
|
});
|
||||||
await hubConnection.StartAsync();
|
await hubConnection.StartAsync();
|
||||||
@@ -555,7 +557,21 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
chatloading = true;
|
chatloading = true;
|
||||||
SelectedChatUserName = "در حال گفتگو با " + chatItem.UserFullName;
|
|
||||||
|
SelectedChatUserName = "در حال گفتگو با '" + chatItem.UserFullName + "'";
|
||||||
|
|
||||||
|
if (CurrentUser.Role == "Company")
|
||||||
|
{
|
||||||
|
var mo = chatItem.Responses.OrderBy(o => o.ID).Last(l => l.Type != ConversationType.UE);
|
||||||
|
if (mo!=null && mo.Type == Common.Enums.ConversationType.EU)
|
||||||
|
SelectedChatUserName = "گفتگوی '" + mo.ExperName + "' با '" + chatItem.UserFullName+"'";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ChatCurrent = chatItem;
|
ChatCurrent = chatItem;
|
||||||
|
|
||||||
_shouldObserveVisibility = true; // فعال کن تا در OnAfterRenderAsync صدا زده بشه
|
_shouldObserveVisibility = true; // فعال کن تا در OnAfterRenderAsync صدا زده بشه
|
||||||
|
@@ -7,10 +7,13 @@
|
|||||||
@using HushianWebApp.Services
|
@using HushianWebApp.Services
|
||||||
@using Microsoft.AspNetCore.SignalR.Client;
|
@using Microsoft.AspNetCore.SignalR.Client;
|
||||||
@using System.Threading;
|
@using System.Threading;
|
||||||
@if(CompanyInfo!=null)
|
<PageTitle>به هوشیان خوش آمدید</PageTitle>
|
||||||
|
|
||||||
|
@if (CompanyInfo != null && !string.IsNullOrEmpty(CompanyInfo?.FullName))
|
||||||
{
|
{
|
||||||
<PageTitle>گفتگو با @CompanyInfo?.FullName</PageTitle>
|
<PageTitle>گفتگو با @CompanyInfo?.FullName</PageTitle>
|
||||||
}
|
}
|
||||||
|
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject ChatService ChatService
|
@inject ChatService ChatService
|
||||||
@inject ILocalStorageService localStorageService;
|
@inject ILocalStorageService localStorageService;
|
||||||
@@ -240,7 +243,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if (LastOpenChat.status == Common.Enums.ConversationStatus.Finished)
|
||||||
|
{
|
||||||
|
<p style="color: red;text-align: center;font-weight: bold;">این گفتگو به پایان رسیده</p>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user