...
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
@inject GroupService groupService
|
@inject GroupService groupService
|
||||||
@inject ChatService chatService
|
@inject ChatService chatService
|
||||||
@inject IJSRuntime JS
|
@inject IJSRuntime JS
|
||||||
|
@inject ToastService toastService
|
||||||
@layout UserPanelLayout
|
@layout UserPanelLayout
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row" style="height:85vh">
|
<div class="row" style="height:85vh">
|
||||||
@@ -138,7 +139,7 @@
|
|||||||
@code {
|
@code {
|
||||||
[Parameter] public int CompanyID { get; set; }
|
[Parameter] public int CompanyID { get; set; }
|
||||||
private bool _shouldObserveVisibility = false;
|
private bool _shouldObserveVisibility = false;
|
||||||
|
int? GroupID = null;
|
||||||
ReadANDUpdate_CompanyDto? CompanyInfo = new();
|
ReadANDUpdate_CompanyDto? CompanyInfo = new();
|
||||||
Common.Dtos.CurrentUserInfo CurrentUser = new();
|
Common.Dtos.CurrentUserInfo CurrentUser = new();
|
||||||
List<Read_GroupDto> CompanyGroups = new();
|
List<Read_GroupDto> CompanyGroups = new();
|
||||||
@@ -172,15 +173,26 @@
|
|||||||
var model = await chatService.ADDChatResponse(LastOpenChat.ID, MsgInput, type);
|
var model = await chatService.ADDChatResponse(LastOpenChat.ID, MsgInput, type);
|
||||||
LastOpenChat?.Responses.Add(model);
|
LastOpenChat?.Responses.Add(model);
|
||||||
LastOpenChat.LastText = MsgInput;
|
LastOpenChat.LastText = MsgInput;
|
||||||
await Task.Yield();
|
|
||||||
// Scroll to bottom for user's own messages
|
|
||||||
await JS.InvokeVoidAsync("scrollToBottom", "B1");
|
|
||||||
MsgInput = string.Empty;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//TODO New Chat
|
//TODO New Chat
|
||||||
|
var model = await chatService.NewChatFromCurrentUser(new ADD_ConversationDto()
|
||||||
|
{
|
||||||
|
CompanyID = CompanyID,
|
||||||
|
GroupID = GroupID,
|
||||||
|
Question = MsgInput,
|
||||||
|
UserID = 0
|
||||||
|
});
|
||||||
|
if (model != null) LastOpenChat = model;
|
||||||
|
else toastService.Notify(new ToastMessage(ToastType.Danger, "خطا در گفتگو جدید"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
await Task.Yield();
|
||||||
|
// Scroll to bottom for user's own messages
|
||||||
|
await JS.InvokeVoidAsync("scrollToBottom", "B1");
|
||||||
|
MsgInput = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -266,7 +278,7 @@
|
|||||||
{
|
{
|
||||||
msg.IsRead = true;
|
msg.IsRead = true;
|
||||||
await chatService.MarkAsReadChatItemAsync(id);
|
await chatService.MarkAsReadChatItemAsync(id);
|
||||||
// StateHasChanged();
|
// StateHasChanged();
|
||||||
}
|
}
|
||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user