...
This commit is contained in:
@@ -58,10 +58,17 @@
|
||||
|
||||
<div class="item-content">
|
||||
<div class="item-header">
|
||||
<strong class="item-name">@item.UserFullName</strong>
|
||||
<strong class="item-name">@item.UserFullName </strong>
|
||||
@if(!string.IsNullOrEmpty(item.GroupName)){
|
||||
<div class="mb-3">
|
||||
<Badge Color="BadgeColor.Info" VisuallyHiddenText="Visually hidden text for Info">@item.GroupName</Badge>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="item-time">
|
||||
<small class="time-text">@item.LastMsgdate</small>
|
||||
<small class="time-text">@item.LastMsgtime</small>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-message">@item.LastText</div>
|
||||
@@ -82,6 +89,12 @@
|
||||
<div class="item-content">
|
||||
<div class="item-header">
|
||||
<strong class="item-name">@item.UserFullName</strong>
|
||||
@if (!string.IsNullOrEmpty(item.GroupName))
|
||||
{
|
||||
<div class="mb-3">
|
||||
<Badge Color="BadgeColor.Info" VisuallyHiddenText="Visually hidden text for Info">@item.GroupName</Badge>
|
||||
</div>
|
||||
}
|
||||
<div class="item-time">
|
||||
<small class="time-text">@item.LastMsgdate</small>
|
||||
<small class="time-text">@item.LastMsgtime</small>
|
||||
@@ -108,6 +121,12 @@
|
||||
<div class="item-content">
|
||||
<div class="item-header">
|
||||
<strong class="item-name">@item.UserFullName</strong>
|
||||
@if (!string.IsNullOrEmpty(item.GroupName))
|
||||
{
|
||||
<div class="mb-3">
|
||||
<Badge Color="BadgeColor.Info" VisuallyHiddenText="Visually hidden text for Info">@item.GroupName</Badge>
|
||||
</div>
|
||||
}
|
||||
<div class="item-time">
|
||||
<small class="time-text">@item.LastMsgdate</small>
|
||||
<small class="time-text">@item.LastMsgtime</small>
|
||||
|
@@ -1,4 +1,5 @@
|
||||
@page "/UserCP/{CompanyID:int}"
|
||||
@page "/UserCP/{CompanyID:int}/{ChatID:int?}"
|
||||
@using Common.Dtos.Company
|
||||
@using Common.Dtos.Conversation
|
||||
@using Common.Dtos.Group
|
||||
@@ -89,7 +90,7 @@
|
||||
<p style="margin-top: 15px; font-size: 1.5rem; color: #0d6efd; font-weight: bold; text-shadow: 1px 1px 2px rgba(0,0,0,0.2);">
|
||||
هوشیان
|
||||
</p>
|
||||
|
||||
|
||||
@if (CompanyGroups != null && CompanyGroups.Any())
|
||||
{
|
||||
<div class="groups-container mt-4">
|
||||
@@ -97,10 +98,18 @@
|
||||
<div class="groups-grid">
|
||||
@foreach (var group in CompanyGroups)
|
||||
{
|
||||
<div class="group-card @(GroupID == group.ID ? "selected" : "")"
|
||||
<div class="group-card @(GroupID == group.ID ? "selected" : "")"
|
||||
@onclick="() => SelectGroup(group.ID)">
|
||||
<div class="group-card-content">
|
||||
<Icon Name="IconName.People" Class="group-icon" />
|
||||
@if (group.img == null || group.img.Length == 0)
|
||||
{
|
||||
<Icon Name="IconName.People" Class="group-icon" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<Image src="@GetImageSource(group.img)" class="rounded mx-2" height="50" width="50" alt="Uploaded Image" />
|
||||
|
||||
}
|
||||
<span class="group-name">@group.Name</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -154,6 +163,8 @@
|
||||
</div>
|
||||
@code {
|
||||
[Parameter] public int CompanyID { get; set; }
|
||||
[Parameter] public int? ChatID { get; set; }
|
||||
|
||||
private bool _shouldObserveVisibility = false;
|
||||
int? GroupID = null;
|
||||
ReadANDUpdate_CompanyDto? CompanyInfo = new();
|
||||
@@ -170,7 +181,12 @@
|
||||
{
|
||||
if (CompanyInfo == null) return string.Empty;
|
||||
string value = $"{CompanyInfo.FullName}";
|
||||
if (LastOpenChat != null)
|
||||
if (GroupID.HasValue)
|
||||
{
|
||||
value += "/" + CompanyGroups.FirstOrDefault(f => f.ID == GroupID.GetValueOrDefault()).Name;
|
||||
|
||||
}
|
||||
if (LastOpenChat != null && !string.IsNullOrEmpty(LastOpenChat.ExperFullName))
|
||||
{
|
||||
value += "/" + LastOpenChat.ExperFullName;
|
||||
}
|
||||
@@ -201,9 +217,13 @@
|
||||
Question = MsgInput,
|
||||
UserID = 0
|
||||
});
|
||||
if (model != null) LastOpenChat = model;
|
||||
else toastService.Notify(new ToastMessage(ToastType.Danger, "خطا در گفتگو جدید"));
|
||||
|
||||
if (model != null)
|
||||
{
|
||||
LastOpenChat = model;
|
||||
}
|
||||
else toastService.Notify(new ToastMessage(ToastType.Danger, "خطا در گفتگو جدید"));
|
||||
|
||||
|
||||
}
|
||||
await Task.Yield();
|
||||
// Scroll to bottom for user's own messages
|
||||
@@ -269,8 +289,9 @@
|
||||
{
|
||||
if (CompanyInfo != null)
|
||||
{
|
||||
// LastOpenChat = await ChatService.GetLastOpenChatInCompany(CompanyID);
|
||||
LastOpenChat = null;
|
||||
if (ChatID.HasValue) LastOpenChat = await ChatService.Getchat(ChatID.GetValueOrDefault());
|
||||
else LastOpenChat = LastOpenChat = await ChatService.GetLastOpenChatInCompany(CompanyID);
|
||||
|
||||
if (LastOpenChat != null)
|
||||
{
|
||||
|
||||
@@ -318,12 +339,16 @@
|
||||
IsLogin = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
async Task SelectGroup(int groupId)
|
||||
{
|
||||
GroupID = groupId;
|
||||
StateHasChanged();
|
||||
}
|
||||
private string GetImageSource(byte[] bytes)
|
||||
=> $"data:image/jpeg;base64,{Convert.ToBase64String(bytes)}";
|
||||
|
||||
|
||||
}
|
||||
<style>
|
||||
.chat-bubble {
|
||||
@@ -891,9 +916,9 @@
|
||||
color: white;
|
||||
}
|
||||
|
||||
.group-card.selected:hover .group-icon {
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
.group-card.selected:hover .group-icon {
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.group-name {
|
||||
font-weight: 600;
|
||||
@@ -910,9 +935,9 @@
|
||||
color: white;
|
||||
}
|
||||
|
||||
.group-card.selected:hover .group-name {
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
.group-card.selected:hover .group-name {
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
/* Responsive design for group cards */
|
||||
@@media (max-width: 768px) {
|
||||
@@ -945,11 +970,11 @@
|
||||
.group-card {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
|
||||
.group-icon {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
|
||||
.group-name {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
Reference in New Issue
Block a user