This commit is contained in:
mmrbnjd
2025-07-26 22:15:48 +03:30
parent 71f06b8ee8
commit 14c125ddd9
3 changed files with 30 additions and 9 deletions

View File

@@ -129,6 +129,7 @@ namespace Hushian.Application.Services
.Where(w => w.UserID == UserID && w.CompanyID==CompanyID)
.Select(s => new Read_ConversationDto()
{
ID=s.ID,
ExperID = s.ConversationResponses.OrderBy(o => o.ID).Last().ExperID,
ExperFullName = s.ConversationResponses.OrderBy(o => o.ID).Last().Exper.FullName,
GroupID = s.GroupID,

View File

@@ -2,7 +2,10 @@
<div style="display: flex; "
dir="rtl" class="p-1 rounded w-100">
@if (SelectedConversationItems != null)
{
<p>@SelectedConversationItems.Count()</p>
}
<div class="bg-green-100 border p-2 rounded text-end" dir="rtl">
سلام

View File

@@ -26,7 +26,10 @@
VisuallyHiddenText="status"></Badge>
<small>پاسخگویی سوالات شما هستیم</small>
</span>
@if (ConversationID.HasValue)
{
<button class="btn-close btn-close-white" @onclick="CloseChat"></button>
}
</div>
<div class="card-body" style="max-height: 500px; overflow-y: auto; background-color: #f9f9f9;">
@@ -61,7 +64,7 @@
}
</div>
@if (IsLogin && (Conversations.Count == 0 && SelectedConversation == null) || (Conversations.Count > 0 && SelectedConversation != null && SelectedConversation.status == Common.Enums.ConversationStatus.InProgress))
@if (IsLogin && (@* Conversations.Count == 0 && *@ SelectedConversation == null) || (@* Conversations.Count > 0 && *@ SelectedConversation != null && SelectedConversation.status == Common.Enums.ConversationStatus.InProgress))
{
<div class="card-header text-white d-flex justify-content-between align-items-center">
<input type="text" class="form-control" @bind-value="InputMessage" placeholder="پیام خود را بنویسید..." style="margin-left:10px" />
@@ -111,8 +114,8 @@
protected override async Task OnParametersSetAsync()
{
if (ConversationID.HasValue && ConversationID > 0 && Conversations.Count > 0)
await SelectedConv(ConversationID.Value);
// if (ConversationID.HasValue && ConversationID > 0 && Conversations.Count > 0)
// await SelectedConv(ConversationID.Value);
await base.OnParametersSetAsync();
}
@@ -189,8 +192,10 @@
Conversations = await conversationService.MyConversationUserSide(CompanyID);
if (Conversations.Count > 0)
ConversationsContent =@<ConversionHistoryComponent Conversations="Conversations"
OnMultipleOfThree="EventCallback.Factory.Create<int>(this, SelectedConv)" />
;
OnMultipleOfThree="EventCallback.Factory.Create<int>(this, SelectedConv)" />;
if (ConversationID.HasValue && ConversationID > 0 && Conversations.Count > 0)
await SelectedConv(ConversationID.Value);
}
}
@@ -204,6 +209,7 @@
SelectedConversation = Conversations.FirstOrDefault(f => f.ID == ID);
SelectedConversationItems = await conversationService.GetConversationItems(ID);
SelectedGroup = SelectedConversation.GroupID;
ConversationID = ID;
StateHasChanged();
}
@@ -211,6 +217,11 @@
private void CloseChat()
{
// می‌توان اینجا حالت مخفی‌سازی کامپوننت را تنظیم کرد
SelectedConversation = null;
SelectedConversationItems = null;
SelectedGroup = null;
ConversationID = null;
StateHasChanged();
}
private void GoBack()
{
@@ -218,6 +229,12 @@
}
async Task OnClickSendMssage()
{
// SelectedConversationItems.Add(new Read_ConversationResponseDto()
// {
// ConversationID=1,
// });
// return;
Sending = true;
if (SelectedConversation != null)
{