This commit is contained in:
mmrbnjd
2025-07-12 21:33:44 +03:30
parent d397f70b9a
commit 8a6ff3da67
32 changed files with 320 additions and 403 deletions

View File

@@ -2,8 +2,8 @@
@page "/"
@inject IJSRuntime JS
@using Hushian.Application.Dtos
@using HushianWebApp.Data.Models
@using Common.Dtos.Conversation
@using HushianWebApp.Models
@using HushianWebApp.Service
@using HushianWebApp.Services
@inject ILocalStorageService localStorageService;
@@ -62,10 +62,10 @@
<div class="flex-grow-1">
<div class="d-flex justify-content-between">
<strong>@item.UserFullName</strong>
<small class="text-muted">@item.Cdate</small>
<small class="text-muted">@item.Ctime</small>
<small class="text-muted">@item.LastMsgdate</small>
<small class="text-muted">@item.LastMsgtime</small>
</div>
<div class="text-muted small text-truncate">@item.Title</div>
<div class="text-muted small text-truncate">@item.LastText</div>
</div>
@if (item.NoReadCount > 0)
{
@@ -89,10 +89,10 @@
<div class="flex-grow-1">
<div class="d-flex justify-content-between">
<strong>@item.UserFullName</strong>
<small class="text-muted">@item.Cdate</small>
<small class="text-muted">@item.Ctime</small>
<small class="text-muted">@item.LastMsgdate</small>
<small class="text-muted">@item.LastMsgtime</small>
</div>
<div class="text-muted small text-truncate">@item.Title</div>
<div class="text-muted small text-truncate">@item.LastText</div>
</div>
@if (item.NoReadCount>0)
{
@@ -115,10 +115,10 @@
<div class="flex-grow-1">
<div class="d-flex justify-content-between">
<strong>@item.UserFullName</strong>
<small class="text-muted">@item.Cdate</small>
<small class="text-muted">@item.Ctime</small>
<small class="text-muted">@item.LastMsgdate</small>
<small class="text-muted">@item.LastMsgtime</small>
</div>
<div class="text-muted small text-truncate">@item.Title</div>
<div class="text-muted small text-truncate">@item.LastText</div>
</div>
</div>
@@ -159,19 +159,19 @@
public int countInbox1 { get { return Inbox1Items.Count(); } }
public int countInbox2 { get { return Inbox2Items.Count(); } }
public List<ConversationDto> Inbox1Items { get; set; }
public List<Read_ConversationDto> Inbox1Items { get; set; }
= new() ;
public List<ConversationDto> Inbox2Items { get; set; }
public List<Read_ConversationDto> Inbox2Items { get; set; }
= new();
public List<ConversationDto> Inbox3Items { get; set; }
public List<Read_ConversationDto> Inbox3Items { get; set; }
= new();
public ConversationDto? SelectedConversation { get; set; } = null;
public List<ConversationItemDto>? SelectedConversationItems { get; set; }
public Read_ConversationDto? SelectedConversation { get; set; } = null;
public List<Read_ConversationResponseDto>? SelectedConversationItems { get; set; }
= null;
public string SelectedChatUserName { get; set; } = "مهدی ربیع نژاد";
public List<string> Roles { get; set; }
public string UserID = "";
public string Role { get; set; }
public int UserID = 0;
async Task OnclickInbox(int ID)
{
switch (ID)
@@ -203,8 +203,8 @@
if (!string.IsNullOrEmpty(MsgInput) && SelectedConversationItems!=null)
{
await conversationService.ADDConversationItemFromCompanySide(SelectedConversationItems[0].ConversationID, MsgInput);
SelectedConversationItems?.Add(new() { text = MsgInput, Type = Hushian.Enums.ConversationType.EU });
SelectedConversation.Title = MsgInput;
SelectedConversationItems?.Add(new() { text = MsgInput, Type = Common.Enums.ConversationType.EU });
SelectedConversation.LastText = MsgInput;
await Task.Yield();
await JS.InvokeVoidAsync("scrollToBottom", "B1");
MsgInput = string.Empty;
@@ -217,7 +217,7 @@
await SendMsg();
}
}
async Task onClickSelectedCon(int InboxID,ConversationDto conversationDto)
async Task onClickSelectedCon(int InboxID,Read_ConversationDto conversationDto)
{
// پر کردن SelectedCon
// مقدار دادن به SelectedChatUserName
@@ -239,11 +239,11 @@
@functions{
protected override async Task OnInitializedAsync()
{
Roles = await localStorageService.GetItem<List<string>>("Role");
Role = await localStorageService.GetItem<string>("Role");
UserID= await localStorageService.GetItem<string>("UserID");
UserID= await localStorageService.GetItem<int>("UserID");
convloading = true;
await LoadSessionB();
Inbox1Items =await conversationService.ConversationAwaitingOurResponse();
@@ -307,14 +307,14 @@
{
<p type="text" class="form-control fw-bold text-primary" style="border:none;align-self: center;" aria-describedby="basic-addon1">@SelectedChatUserName</p>
<span class="input-group-text-chat" id="basic-addon1">
@if ( SelectedConversation.status==Hushian.Enums.ConversationStatus.InProgress)
@if ( SelectedConversation.status==Common.Enums.ConversationStatus.InProgress)
{
<Button Color="ButtonColor.Danger" Size=ButtonSize.ExtraSmall Outline="true"
@onclick="async()=>
{
if(await conversationService.ConversationIsFinish(SelectedConversation.ID))
SelectedConversation.status=Hushian.Enums.ConversationStatus.Finished;
SelectedConversation.status=Common.Enums.ConversationStatus.Finished;
}">
<Icon Name="IconName.Escape" /> اتمام گفتگو
</Button>
@@ -324,14 +324,14 @@
<Icon Name="IconName.EnvelopeArrowUp" /> ارجاع به...
</Button>
}
else if (SelectedConversation.status == Hushian.Enums.ConversationStatus.Finished
&& (Roles.Contains("HushianManagerCompany") || SelectedConversation.ExperID == UserID))
else if (SelectedConversation.status == Common.Enums.ConversationStatus.Finished
&& (Role=="Company" || SelectedConversation.ExperID == UserID))
{
<Button Color="ButtonColor.Success" Size=ButtonSize.ExtraSmall Outline="true"
@onclick="async()=>{
if(await conversationService.ConversationIsStart(SelectedConversation.ID))
SelectedConversation.status=Hushian.Enums.ConversationStatus.InProgress;
SelectedConversation.status=Common.Enums.ConversationStatus.InProgress;
}"
}">
@@ -368,7 +368,7 @@
@if (SelectedConversation != null && SelectedConversation.status!=Hushian.Enums.ConversationStatus.Finished && SelectedConversationItems != null)
@if (SelectedConversation != null && SelectedConversation.status!=Common.Enums.ConversationStatus.Finished && SelectedConversationItems != null)
{
<!-- B2: Message input -->
<div class="border m-2 p-2 rounded d-flex align-items-center" id="B2">