diff --git a/Presentation/HushianWebApp/Components/Base/ChatBubble.razor b/Presentation/HushianWebApp/Components/Base/ChatBubble.razor index 664f635..d97484f 100644 --- a/Presentation/HushianWebApp/Components/Base/ChatBubble.razor +++ b/Presentation/HushianWebApp/Components/Base/ChatBubble.razor @@ -1,5 +1,7 @@ @using Common.Dtos.Conversation +@using HushianWebApp.Service @inject IJSRuntime JSRuntime +@inject ConversationService conversationService;
@@ -12,8 +14,8 @@ @if (!msg.IsRead && msg.Type == Common.Enums.ConversationType.UE) {

ـــــــــــــــــــــــــ

- } - + } +
} @@ -46,29 +48,29 @@ @@ -91,10 +93,12 @@ public async Task MarkAsRead(int id) { var msg = Messages.FirstOrDefault(m => m.ID == id); - if (msg != null && !msg.IsRead && msg.Type==Common.Enums.ConversationType.UE) + if (msg != null && !msg.IsRead && msg.Type == Common.Enums.ConversationType.UE) { msg.IsRead = true; - await EventCallIsRead.InvokeAsync(id); + await conversationService.MarkAsReadConversationItemAsync(id); + + // await EventCallIsRead.InvokeAsync(id); } await Task.CompletedTask; } diff --git a/Presentation/HushianWebApp/Pages/Conversation.razor b/Presentation/HushianWebApp/Pages/Conversation.razor index 14dae74..00e4b78 100644 --- a/Presentation/HushianWebApp/Pages/Conversation.razor +++ b/Presentation/HushianWebApp/Pages/Conversation.razor @@ -174,12 +174,18 @@ public int UserID = 0; async Task OnclickInbox(int ID) { + Inbox1Items = await conversationService.ConversationAwaitingOurResponse(); + Inbox2Items = await conversationService.MyConversationIsInProgress(); + Inbox3Items = await conversationService.MyConversationIsFinished(); + switch (ID) { case 1: isSelectedInbox1 = true; isSelectedInbox2 = false; isSelectedInbox3 = false; + + break; case 2: @@ -219,8 +225,15 @@ } async Task onClickSelectedCon(int InboxID,Read_ConversationDto conversationDto) { - // پر کردن SelectedCon - // مقدار دادن به SelectedChatUserName + if (InboxID == 1 ) + Inbox1Items = await conversationService.ConversationAwaitingOurResponse(); + if (InboxID == 2 ) + Inbox2Items = await conversationService.MyConversationIsInProgress(); + if ( InboxID == 3) + Inbox3Items = await conversationService.MyConversationIsFinished(); + + + chatloading = true; SelectedChatUserName = "در حال گفتگو با "+ conversationDto.UserFullName; SelectedConversation = conversationDto; diff --git a/Presentation/HushianWebApp/Pages/FromUserSide/ChatBoxComponent.razor b/Presentation/HushianWebApp/Pages/FromUserSide/ChatBoxComponent.razor index a0c3e57..3191a55 100644 --- a/Presentation/HushianWebApp/Pages/FromUserSide/ChatBoxComponent.razor +++ b/Presentation/HushianWebApp/Pages/FromUserSide/ChatBoxComponent.razor @@ -7,7 +7,7 @@ if (item.Type == Common.Enums.ConversationType.UE) {
+ dir="rtl" class="p-1 rounded w-100">
@item.text
@@ -17,8 +17,16 @@ } else { +
+ @if (!target&& !item.IsRead) + { + target = true; +

ـــــــــــــــــــــــــ

+ } + +
+ dir="ltr" class="p-1 rounded w-100">
@item.text
@@ -35,6 +43,12 @@ @code { - // [Parameter] public List Conversations { get; set; } + bool target = false; + // [Parameter] public List Conversations { get; set; } [Parameter] public List SelectedConversationItems { get; set; } + protected override Task OnParametersSetAsync() + { + target = false; + return base.OnParametersSetAsync(); + } }