This commit is contained in:
mmrbnjd
2025-07-27 16:04:28 +03:30
parent 14c125ddd9
commit 574a4d3ed6
6 changed files with 174 additions and 71 deletions

View File

@@ -32,39 +32,49 @@
}
</div>
<div class="card-body" style="max-height: 500px; overflow-y: auto; background-color: #f9f9f9;">
@if (!IsLogin)
@if (!IsFisrLoding)
{
<LoginComponent OnMultipleOfThree="EventCallback.Factory.Create(this, Login)" />
}
@if (IsLogin)
{
@if (SelectedConversation == null)
@if (!IsLogin)
{
<button class="btn btn-outline-secondary btn-sm mt-2"
@onclick="()=> {SelectedGroup=0; StateHasChanged();}" style="margin-left:5px;margin-bottom:5px">
شرکت @CompanyName (@CountQueueCompany)
</button>
@GCContent
@if (Conversations.Count > 0)
<LoginComponent OnMultipleOfThree="EventCallback.Factory.Create(this, Login)" />
}
@if (IsLogin)
{
@if (SelectedConversation == null)
{
@ConversationsContent
<button class="btn btn-outline-secondary btn-sm mt-2"
@onclick="()=> {SelectedGroup=0; StateHasChanged();}" style="margin-left:5px;margin-bottom:5px">
شرکت @CompanyName (@CountQueueCompany)
</button>
@GCContent
@if (Conversations.Count > 0)
{
@ConversationsContent
}
}
else
{
<ChatBoxComponent SelectedConversationItems="SelectedConversationItems" />
}
}
else
{
<ChatBoxComponent Conversations="Conversations" SelectedConversationItems="SelectedConversationItems" />
}
}
}
else
{
<div class="d-flex justify-content-center">
<Spinner Class="me-3" Type="SpinnerType.Dots" Color="SpinnerColor.Primary" Visible="@IsFisrLoding" />
</div>
}
</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.Finished)))
{
<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" />
@@ -105,6 +115,7 @@
int CountQueueCompany = 0;
public string CompanyName { get; set; } = "هوشیان";
public bool IsLogin { get; set; } = false;
public bool IsFisrLoding { get; set; } = true;
public int? SelectedGroup { get; set; }
public string InputMessage { get; set; }
public bool Sending { get; set; } = false;
@@ -121,7 +132,9 @@
}
protected override async Task OnInitializedAsync()
{
IsFisrLoding = true;
await CheckOnline();
IsFisrLoding = false;
await base.OnInitializedAsync();
}
async Task CheckOnline()
@@ -192,7 +205,8 @@
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);
@@ -229,12 +243,8 @@
}
async Task OnClickSendMssage()
{
// SelectedConversationItems.Add(new Read_ConversationResponseDto()
// {
// ConversationID=1,
// });
// return;
if (string.IsNullOrEmpty(InputMessage)) return;
Sending = true;
if (SelectedConversation != null)
{
@@ -243,6 +253,9 @@
ConversationID = SelectedConversation.ID,
Text = InputMessage
};
var inputconv= await conversationService.ADDConversationItem(SelectedConversation.ID, InputMessage, Common.Enums.ConversationType.UE);
if (inputconv!=null) SelectedConversationItems.Add(inputconv);
}
else
{
@@ -252,11 +265,11 @@
GroupID = SelectedGroup,
Question = InputMessage
};
var convID= await conversationService.NewConversationFromCurrentUser(Item);
if (convID >0)
var convNEW= await conversationService.NewConversationFromCurrentUser(Item);
if (convNEW !=null)
{
ConversationID = convID;
await SelectedConv(ConversationID.Value);
Conversations.Add(convNEW);
await SelectedConv(convNEW.ID);
}
}