This commit is contained in:
mmrbnjd
2025-07-11 20:37:28 +03:30
parent 1924c88e7a
commit ff342a53c0
156 changed files with 13746 additions and 35 deletions

View File

@@ -0,0 +1,27 @@
@using Hushian.Application.Dtos
<div style="display: flex; "
dir="rtl" class="p-1 rounded w-100">
<div class="bg-green-100 border p-2 rounded text-end" dir="rtl">
سلام
</div>
<Icon Style="align-self: self-end;" Name="IconName.CheckLg" Size="IconSize.x5" />
</div>
<div style="display: flex; "
dir="rtl" class="p-1 rounded w-100">
<div class="bg-white border p-3 rounded text-end" dir="rtl">
جهت خرید در سایت در هنگام درج اطلاعات به‌خصوص کد اقتصادی دقت نمائید صورتحساب شما بر همین اساس ارسال خواهد شد در هنگام درج اطلاعات به‌خصوص کد اقتصادی دقت نمائید صورتحساب شما بر همین اساس ارسال خواهد شد ثبت نام نموده و سپس از منو فروشگاه اقدام به انتخاب محصول مورد نظر خود نمائید.<br /><br />
</div>
<Icon Style="align-self: self-end;" Name="IconName.CheckLg" Size="IconSize.x5" />
</div>
@code {
[Parameter] public List<ConversationDto> Conversations { get; set; }
[Parameter] public List<ConversationItemDto> SelectedConversationItems { get; set; }
}

View File

@@ -0,0 +1,53 @@
@inject ConversationService conversationService
@using Hushian.Application.Dtos
@using HushianWebApp.Service
@if (groups.Where(w => w.Available).Count() > 0)
{
@Content
}
@code {
[Parameter]
public List<GroupDto> groups { get; set; }
[Parameter] public EventCallback<int> OnMultipleOfThree { get; set; }
[Parameter] public int CompanyID { get; set; }
async Task onClickSelectedGroup(int ID)
{
await OnMultipleOfThree.InvokeAsync(ID);
}
RenderFragment Content { get; set; }
List<kv> ints = new();
protected override async Task OnParametersSetAsync()
{
foreach (var g in groups.Where(w => w.Available))
{
ints.Add(new()
{
k=g.ID,
v = await conversationService.GetCountQueueCompany(CompanyID, g.ID)
});
}
Content =@<div class="text-end mb-3">
<span class="badge bg-success p-2">گروه های فعال</span><br />
@foreach (var g in groups.Where(w=>w.Available))
{
<button class="btn btn-outline-secondary btn-sm mt-2"
@onclick="async()=>await onClickSelectedGroup(g.ID)" style="margin-left:5px">
@g.Name (@ints.FirstOrDefault(f=>f.k==g.ID)?.v)
</button>
}
</div>
;
await base.OnParametersSetAsync();
}
public class kv
{
public int k { get; set; }
public int v { get; set; }
}
}

View File

@@ -0,0 +1,70 @@
@using HushianWebApp.Service
@inject AuthService AuthService
<div class="text-end mb-3">
<span class="badge bg-info p-2">نیاز برای ارتباط با کارشناسان وارد شود</span>
</div>
<div class=" group w-full">
<Spinner Class="me-3" Type="SpinnerType.Dots" Color="SpinnerColor.Primary" Visible="@visible" />
@if (ID==0)
{
<label for="user-name" class="block mb-2 text-slate-600 font-bold">
شماره همراه / نام کاربری
</label>
<div class="d-flex">
<div class="container-input" style="width:150px;margin-left:5px">
<input disabled="@visible" style="text-align:center;height:30px" type="number" id="user-name" maxlength="64"
@bind-value=Username title="نام کاربری را وارد کنید." class="input-form input_vk_1" required="" data-val="true" data-val-required="شماره همراه / نام کاربری را وارد کنید." name="Username">
</div>
<Button disabled="visible" Color="ButtonColor.Primary" Type="ButtonType.Submit" @onclick="Login" class="btn-primary"
style="text-align:center;height:30px">
ورود
</Button>
</div>
}
else{
<label for="user-name" class="block mb-2 text-slate-600 font-bold">
جهت احراز کد ارسال شده را وارد کنید
</label>
<div class="d-flex">
<div class="container-input" style="width:150px;margin-left:5px">
<input style="text-align:center;height:30px" type="number" id="Code" maxlength="64"
@bind-value=Code title="کد احراز" class="input-form input_vk_1" required="" data-val="true" name="Code">
</div>
<Button Color="ButtonColor.Primary" Type="ButtonType.Submit" class="btn-dark"
style="text-align:center;height:30px" @onclick="ver">
احراز
</Button>
</div>
}
</div>
@code {
private bool visible = false;
[Parameter] public EventCallback OnMultipleOfThree { get; set; }
public string Username { get; set; }
public int ID { get; set; } = 0;
public string Code { get; set; } = string.Empty;
}
@functions{
async Task Login()
{
visible = true;
ID= await AuthService.login(Username);
visible = false;
}
async Task ver()
{
visible = true;
if(await AuthService.Verificationlogin(ID, Code))
await OnMultipleOfThree.InvokeAsync();
visible = false;
}
}

View File

@@ -0,0 +1,243 @@
@using Hushian.Application.Dtos
@using Hushian.Application.Dtos.Company
@using HushianWebApp.Components.UserPanel
@using HushianWebApp.Service
@using HushianWebApp.Services
@inject IJSRuntime JSRuntime
@inject CompanyService companyService
@inject GroupService groupService
@inject ILocalStorageService localStorageService;
@inject AuthService authService;
@inject BaseController baseController;
@inject ConversationService conversationService
@layout UserPanelLayout
@page "/UserPanel/{CompanyID:int}"
@page "/UserPanel/{CompanyID:int}/{ConversationID:int?}"
<div class="card shadow chat-box-expanded">
<div class="card-header bg-success text-white d-flex justify-content-between align-items-center">
<span>
<strong>@CompanyName / @groups.FirstOrDefault(f => f.ID == SelectedGroup)?.Name / @SelectedConversation?.ExperFullName</strong><br />
<Badge Color="BadgeColor.Danger"
Position="Position.Absolute"
Placement="BadgePlacement.TopRight"
IndicatorType="BadgeIndicatorType.RoundedPill"
VisuallyHiddenText="status"></Badge>
<small>پاسخگویی سوالات شما هستیم</small>
</span>
<button class="btn-close btn-close-white" @onclick="CloseChat"></button>
</div>
<div class="card-body" style="max-height: 500px; overflow-y: auto; background-color: #f9f9f9;">
@if (!IsLogin)
{
<LoginComponent OnMultipleOfThree="EventCallback.Factory.Create(this, Login)" />
}
@if (IsLogin)
{
@if (SelectedConversation == null)
{
<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 Conversations="Conversations" SelectedConversationItems="SelectedConversationItems" />
}
}
</div>
@if (IsLogin && (Conversations.Count == 0 && SelectedConversation == null) || (Conversations.Count > 0 && SelectedConversation != null && SelectedConversation.status == Hushian.Enums.ConversationStatus.InProgress))
{
<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" />
<Button Color="ButtonColor.Dark" Outline="true"><Icon Name="IconName.AppIndicator" @onclick="OnClickSendMssage" /> </Button>
</div>
}
</div>
<style>
.chat-box-expanded {
position: fixed;
bottom: 50%;
right: 50%;
transform: translate(50%, 50%);
width: 90vw;
height: 80%;
z-index: 1051;
transition: all 0.3s ease;
}
</style>
@code {
#region Parameter
[Parameter] public int CompanyID { get; set; }
[Parameter] public int? ConversationID { get; set; }
#endregion
#region Fild
public ConversationDto? SelectedConversation { get; set; } = null;
public List<ConversationDto> Conversations { get; set; } = new();
public List<ConversationItemDto>? SelectedConversationItems { get; set; } = null;
public RenderFragment GCContent { get; set; }
public RenderFragment ConversationsContent { get; set; }
List<GroupDto> groups = new List<GroupDto>();
public CompanyDto company { get; set; } = new();
int CountQueueCompany = 0;
public string CompanyName { get; set; } = "هوشیان";
public bool IsLogin { get; set; } = false;
public int? SelectedGroup { get; set; }
public string InputMessage { get; set; }
public bool Sending { get; set; } = false;
#endregion
}
@functions {
protected override async Task OnParametersSetAsync()
{
if (ConversationID.HasValue && ConversationID > 0 && Conversations.Count > 0)
await SelectedConv(ConversationID.Value);
await base.OnParametersSetAsync();
}
protected override async Task OnInitializedAsync()
{
await CheckOnline();
await base.OnInitializedAsync();
}
async Task CheckOnline()
{
var token = await localStorageService.GetItem<string>("key");
if (string.IsNullOrEmpty(token))
{
IsLogin = false;
}
else
{
await baseController.RemoveToken();
await baseController.SetToken(token);
if (!await authService.IsOnline())
{
await baseController.RemoveToken();
IsLogin = false;
}
else
{
IsLogin = true;
await Login();
}
}
}
async Task CallBackSelectedGroup(int ID)
{
SelectedGroup = ID;
StateHasChanged();
}
async Task Login()
{
// اینجا منطق ورود کاربر را پیاده‌سازی کنید
IsLogin = true;
var _company = await companyService.GetCompany(CompanyID);
if (_company == null)
{
// not Founf Company
}
else
{
if (!_company.Available)
{
// not Available Company
}
else
{
CompanyName = _company.Fullname;
company = _company;
var _groups = await groupService.GetGroupsCompany(CompanyID);
if (_groups != null)
{
CountQueueCompany = await conversationService.GetCountQueueCompany(CompanyID);
groups = _groups;
GCContent =@<GCComponent groups="groups"
CompanyID=CompanyID
OnMultipleOfThree="EventCallback.Factory.Create<int>(this, CallBackSelectedGroup)" />
;
Conversations = await conversationService.MyConversationUserSide(CompanyID);
if (Conversations.Count > 0)
ConversationsContent =@<ConversionHistoryComponent Conversations="Conversations"
OnMultipleOfThree="EventCallback.Factory.Create<int>(this, SelectedConv)" />
;
}
else
{
// ex Groups Company
}
}
}
StateHasChanged();
}
async Task SelectedConv(int ID)
{
if (Conversations.Any(f => f.ID == ID))
{
SelectedConversation = Conversations.FirstOrDefault(f => f.ID == ID);
SelectedConversationItems = await conversationService.GetConversationItems(ID);
SelectedGroup = SelectedConversation.GroupID;
StateHasChanged();
}
}
private void CloseChat()
{
// می‌توان اینجا حالت مخفی‌سازی کامپوننت را تنظیم کرد
}
private void GoBack()
{
// برگشت به منوی قبلی یا وضعیت قبلی
}
async Task OnClickSendMssage()
{
Sending = true;
if (SelectedConversation != null)
{
var item = new ADDConversationItemDto()
{
ConversationID = SelectedConversation.ID,
text = InputMessage
};
}
else
{
var Item = new ADDConversationDto()
{
CompanyID = CompanyID,
GroupID = SelectedGroup,
Question = InputMessage
};
}
Sending = false;
}
}