...
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
@using Common.Dtos.Exper
|
||||
@using HushianWebApp.Service
|
||||
@inject GroupService groupService;
|
||||
@inject UserService userService;
|
||||
@inject HushianWebApp.Services.ILocalStorageService localStorageService;
|
||||
@inject ChatService chatService;
|
||||
@inject ToastService toastService
|
||||
@if (!Spinnervisible)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12" style="margin-bottom:15px">
|
||||
<AutoComplete @bind-Value="ExperName"
|
||||
TItem="Read_ExperDto"
|
||||
DataProvider="DataProvider"
|
||||
PropertyName="FullName"
|
||||
Placeholder="جستجو در کاربران..."
|
||||
OnChanged="(Read_ExperDto exper) => OnAutoCompleteChanged(exper)"/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@code {
|
||||
private string? ExperName;
|
||||
private bool Spinnervisible = false;
|
||||
[Parameter] public int chatID { get; set; }
|
||||
[Parameter] public EventCallback OnMultipleOfThree { get; set; }
|
||||
public List<Read_ExperDto> CoExpers { get; set; }
|
||||
= new();
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
}
|
||||
@functions {
|
||||
private async Task<AutoCompleteDataProviderResult<Read_ExperDto>> DataProvider(AutoCompleteDataProviderRequest<Read_ExperDto> request)
|
||||
{
|
||||
CoExpers = await userService.GetExpersCompany();
|
||||
return await Task.FromResult(new AutoCompleteDataProviderResult<Read_ExperDto> { Data = CoExpers.Where(w => w.FullName.Contains(request.Filter.Value)), TotalCount = CoExpers.Count() });
|
||||
}
|
||||
|
||||
private async Task OnAutoCompleteChanged(Read_ExperDto exper)
|
||||
{
|
||||
Spinnervisible = true;
|
||||
if(await chatService.Attachedto(exper.ID, chatID))
|
||||
{
|
||||
await OnMultipleOfThree.InvokeAsync();
|
||||
}
|
||||
else toastService.Notify(new ToastMessage(ToastType.Danger, "خطا در پیوست"));
|
||||
Spinnervisible = false;
|
||||
}
|
||||
}
|
@@ -3,6 +3,7 @@
|
||||
@using Common.Dtos.Conversation
|
||||
@using Common.Dtos.Group
|
||||
@using Common.Enums
|
||||
@using HushianWebApp.Components
|
||||
@using HushianWebApp.Service
|
||||
@inject ChatService chatService
|
||||
@inject GroupService groupService
|
||||
@@ -10,6 +11,7 @@
|
||||
@inject IJSRuntime JS
|
||||
@inject ToastService toastService
|
||||
<ConfirmDialog @ref="dialog" />
|
||||
<Modal @ref="modal" IsVerticallyCentered="true" IsScrollable="true" />
|
||||
<PageTitle>گفتمان</PageTitle>
|
||||
<div class="container-fluid">
|
||||
<div class="row" style="height:85vh">
|
||||
@@ -158,8 +160,9 @@
|
||||
<Icon Name="IconName.Escape" /> اتمام گفتگو
|
||||
</Button>
|
||||
|
||||
<Button Color="ButtonColor.Secondary" Size=ButtonSize.ExtraSmall Outline="true" Class="toexper-btn">
|
||||
<Icon Name="IconName.EnvelopeArrowUp" /> پیوست به...
|
||||
<Button Color="ButtonColor.Secondary" Size=ButtonSize.ExtraSmall Outline="true" Class="toexper-btn" @onclick="onclickAttachedto">
|
||||
<Icon Name="IconName.EnvelopeArrowUp"
|
||||
/> پیوست به...
|
||||
</Button>
|
||||
}
|
||||
else if (ChatCurrent.status == Common.Enums.ConversationStatus.Finished
|
||||
@@ -283,7 +286,7 @@
|
||||
string SelectedChatUserName = "مهدی ربیع نژاد";
|
||||
private bool _shouldObserveVisibility = false;
|
||||
private ConfirmDialog dialog = default!;
|
||||
|
||||
private Modal modal = default!;
|
||||
}
|
||||
@functions {
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -369,6 +372,20 @@
|
||||
// StateHasChanged();
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
async Task onclickAttachedto()
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
parameters.Add("chatID",ChatCurrent.ID);
|
||||
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create(this, CallBackAttachedto));
|
||||
|
||||
await modal.ShowAsync<AttachedtoComponent>("پیوست کارشناس", parameters: parameters);
|
||||
|
||||
}
|
||||
async Task CallBackAttachedto()
|
||||
{
|
||||
await modal.HideAsync();
|
||||
toastService.Notify(new ToastMessage(ToastType.Success, "کارشناس جدید به این گفتگو پیوست"));
|
||||
}
|
||||
async Task OpenChat()
|
||||
{
|
||||
if (CurrentUser.Role == "Company" || CurrentUser.Role == "Exper" && ChatCurrent.ExperID==CurrentUser.ExperID)
|
||||
|
Reference in New Issue
Block a user