@page "/Chant" @using Common.Dtos.Conversation @using Common.Dtos.Group @using HushianWebApp.Service @inject ChatService chatService @inject GroupService groupService @inject UserService userService @inject IJSRuntime JS @code { public Common.Dtos.CurrentUserInfo CurrentUser { get; set; } List _Group = new List(); //------------------------------------- bool isSelectedInbox1 = false; public List Inbox1Items { get; set; } = new(); bool isSelectedInbox2 = true; public List Inbox2Items { get; set; } = new(); bool isSelectedInbox3 = false; public List Inbox3Items { get; set; } = new(); ///////////// public ChatItemDto? ChatCurrent { get; set; } = null; public string MsgInput { get; set; } } @functions { protected override async Task OnInitializedAsync() { CurrentUser =await userService.GetCurrentUserInfo(); _Group = await groupService.GetGroups(); Inbox1Items = await chatService.ChatAwaitingOurResponse(); Inbox2Items = await chatService.MyChatsIsInProgress(); Inbox3Items = await chatService.MyChatsIsFinished(); await base.OnInitializedAsync(); } async Task OnclickInbox(int ID) { switch (ID) { case 1: isSelectedInbox1 = true; isSelectedInbox2 = false; isSelectedInbox3 = false; break; case 2: isSelectedInbox2 = true; isSelectedInbox1 = false; isSelectedInbox3 = false; break; case 3: isSelectedInbox3 = true; isSelectedInbox2 = false; isSelectedInbox1 = false; break; } ChatCurrent = null; } async Task SendMsg() { if (!string.IsNullOrEmpty(MsgInput) && ChatCurrent != null) { Common.Enums.ConversationType type = CurrentUser.Role == "Company" ? Common.Enums.ConversationType.CU : Common.Enums.ConversationType.EU; await chatService.ADDChatResponse(ChatCurrent.ID, MsgInput, type); ChatCurrent?.Responses.Add(new() { text = MsgInput, Type = type }); ChatCurrent.LastText = MsgInput; await Task.Yield(); await JS.InvokeVoidAsync("scrollToBottom", "B1"); MsgInput = string.Empty; } } async Task onClickSelectedCon(int InboxID, Read_ConversationDto conversationDto) { } }