...
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
@page "/Login"
|
||||
@using Common.Enums
|
||||
@using Common.Models.Identity
|
||||
@using Common.Models.Auth.CompanySide
|
||||
@using HushianWebApp.Components
|
||||
@using HushianWebApp.Service
|
||||
@layout BeforeLayout
|
||||
@@ -11,7 +11,7 @@
|
||||
<ConfirmDialog @ref="dialog" />
|
||||
|
||||
<div class="header-form">
|
||||
<img src="/before/assets/images/Hushian-logo.svg" width="133" alt="Hushian" class="lg:hidden mb-3">
|
||||
<img src="/before/assets/images/Hushian-logo.svg" width="133" alt="Hushian" class="lg:hidden mb-3">
|
||||
|
||||
<span>ورود</span>
|
||||
<span>به هوشیان</span>
|
||||
@@ -59,7 +59,7 @@
|
||||
</div>
|
||||
<div class=" space-y-5 flex flex-col items-center">
|
||||
<NavLink class="btn btn-outline w-full mb-4 lg:mb-0" href="Register">
|
||||
ثبت نام
|
||||
ثبت نام
|
||||
</NavLink>
|
||||
|
||||
</div>
|
||||
@@ -77,27 +77,32 @@
|
||||
@functions {
|
||||
|
||||
|
||||
|
||||
|
||||
async Task onClick()
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(Password)) return;
|
||||
Loading = true;
|
||||
var msg = await auth.login(new AuthRequest(username, Password));
|
||||
if (msg == "PhoneNumberNotConfirmed")
|
||||
{
|
||||
var confirmation = await dialog.ShowAsync(
|
||||
title: "احراز کاربری",
|
||||
message1: "کاربری/ موبایل شما فعال نشده برای ورود باید احراز کنید",
|
||||
message2: "انجام بدیم؟");
|
||||
if (!confirmation)
|
||||
var msg = await auth.login(new AuthRequestFromCompanySide()
|
||||
{
|
||||
Loading = false;
|
||||
return;
|
||||
}
|
||||
await verification();
|
||||
}
|
||||
else if (msg == "ok")
|
||||
Username = username,
|
||||
Password = Password
|
||||
});
|
||||
// if (msg == "PhoneNumberNotConfirmed")
|
||||
// {
|
||||
// var confirmation = await dialog.ShowAsync(
|
||||
// title: "احراز کاربری",
|
||||
// message1: "کاربری/ موبایل شما فعال نشده برای ورود باید احراز کنید",
|
||||
// message2: "انجام بدیم؟");
|
||||
// if (!confirmation)
|
||||
// {
|
||||
// Loading = false;
|
||||
// return;
|
||||
// }
|
||||
// await verification();
|
||||
// }
|
||||
// else
|
||||
if (msg == "ok")
|
||||
{
|
||||
navigationManager.NavigateTo("/");
|
||||
}
|
||||
@@ -106,19 +111,19 @@
|
||||
|
||||
Loading = false;
|
||||
}
|
||||
async Task verification()
|
||||
{
|
||||
var parameters = new Dictionary<string, object>();
|
||||
parameters.Add("type", VerificationCodeType.PhoneNumberConfirmed);
|
||||
parameters.Add("sendValue", username);
|
||||
parameters.Add("ID", 0);
|
||||
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create<VerificationCodeType>(this, CallBackVer));
|
||||
parameters.Add("Title", "کاربری/ موبایل شما فعال نشده برای ورود باید احراز کنید");
|
||||
await modal.ShowAsync<Verification>(title: "احراز", parameters: parameters);
|
||||
}
|
||||
|
||||
async Task CallBackVer(VerificationCodeType type)
|
||||
{
|
||||
await modal.HideAsync();
|
||||
}
|
||||
// async Task verification()
|
||||
// {
|
||||
// var parameters = new Dictionary<string, object>();
|
||||
// parameters.Add("type", VerificationCodeType.PhoneNumberConfirmed);
|
||||
// parameters.Add("sendValue", username);
|
||||
// parameters.Add("ID", 0);
|
||||
// parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create<VerificationCodeType>(this, CallBackVer));
|
||||
// parameters.Add("Title", "کاربری/ موبایل شما فعال نشده برای ورود باید احراز کنید");
|
||||
// await modal.ShowAsync<Verification>(title: "احراز", parameters: parameters);
|
||||
// }
|
||||
|
||||
// async Task CallBackVer(VerificationCodeType type)
|
||||
// {
|
||||
// await modal.HideAsync();
|
||||
// }
|
||||
}
|
||||
|
@@ -159,22 +159,11 @@
|
||||
}
|
||||
//-------------------
|
||||
Loading = true;
|
||||
var ID = await companyService.RegisterCompany(new Hushian.Application.Dtos.RegistrationDto()
|
||||
var ID = await companyService.RegisterCompany(new Common.Dtos.Company.RegisterCompanyDto()
|
||||
{
|
||||
Company = new()
|
||||
{
|
||||
Fullname = FullName,
|
||||
Info = "" ,
|
||||
WebSite = WebSite
|
||||
},
|
||||
User = new()
|
||||
{
|
||||
Email = Email,
|
||||
FullName = FullName,
|
||||
PhoneNumber = PhoneNumber,
|
||||
UserName = PhoneNumber,
|
||||
PassWord = Password
|
||||
}
|
||||
FullName = FullName,
|
||||
Mobile = PhoneNumber,
|
||||
Password = Password
|
||||
});
|
||||
Loading = false;
|
||||
if (ID > 0)
|
||||
|
@@ -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">
|
||||
|
@@ -1,4 +1,4 @@
|
||||
@using Hushian.Application.Dtos
|
||||
@using Common.Dtos.Conversation
|
||||
|
||||
<div style="display: flex; "
|
||||
dir="rtl" class="p-1 rounded w-100">
|
||||
@@ -22,6 +22,6 @@
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter] public List<ConversationDto> Conversations { get; set; }
|
||||
[Parameter] public List<ConversationItemDto> SelectedConversationItems { get; set; }
|
||||
[Parameter] public List<Read_ConversationDto> Conversations { get; set; }
|
||||
[Parameter] public List<Read_ConversationResponseDto> SelectedConversationItems { get; set; }
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
@inject ConversationService conversationService
|
||||
@using Hushian.Application.Dtos
|
||||
@using Common.Dtos.Group
|
||||
@using HushianWebApp.Service
|
||||
@if (groups.Where(w => w.Available).Count() > 0)
|
||||
{
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public List<GroupDto> groups { get; set; }
|
||||
public List<Read_GroupDto> groups { get; set; }
|
||||
[Parameter] public EventCallback<int> OnMultipleOfThree { get; set; }
|
||||
[Parameter] public int CompanyID { get; set; }
|
||||
async Task onClickSelectedGroup(int ID)
|
||||
|
@@ -57,7 +57,10 @@
|
||||
async Task Login()
|
||||
{
|
||||
visible = true;
|
||||
ID= await AuthService.login(Username);
|
||||
ID= await AuthService.login(new Common.Models.Auth.UserSide.AuthRequestFromUserSide()
|
||||
{
|
||||
Mobile=Username
|
||||
});
|
||||
visible = false;
|
||||
}
|
||||
async Task ver()
|
||||
|
@@ -1,5 +1,6 @@
|
||||
@using Hushian.Application.Dtos
|
||||
@using Hushian.Application.Dtos.Company
|
||||
@using Common.Dtos.Company
|
||||
@using Common.Dtos.Conversation
|
||||
@using Common.Dtos.Group
|
||||
@using HushianWebApp.Components.UserPanel
|
||||
@using HushianWebApp.Service
|
||||
@using HushianWebApp.Services
|
||||
@@ -60,7 +61,7 @@
|
||||
}
|
||||
|
||||
</div>
|
||||
@if (IsLogin && (Conversations.Count == 0 && SelectedConversation == null) || (Conversations.Count > 0 && SelectedConversation != null && SelectedConversation.status == Hushian.Enums.ConversationStatus.InProgress))
|
||||
@if (IsLogin && (Conversations.Count == 0 && SelectedConversation == null) || (Conversations.Count > 0 && SelectedConversation != null && SelectedConversation.status == Common.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" />
|
||||
@@ -91,13 +92,13 @@
|
||||
[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 Read_ConversationDto? SelectedConversation { get; set; } = null;
|
||||
public List<Read_ConversationDto> Conversations { get; set; } = new();
|
||||
public List<Read_ConversationResponseDto>? 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();
|
||||
List<Read_GroupDto> groups = new List<Read_GroupDto>();
|
||||
public ReadANDUpdate_CompanyDto company { get; set; } = new();
|
||||
int CountQueueCompany = 0;
|
||||
public string CompanyName { get; set; } = "هوشیان";
|
||||
public bool IsLogin { get; set; } = false;
|
||||
@@ -167,7 +168,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
CompanyName = _company.Fullname;
|
||||
CompanyName = _company.FullName;
|
||||
company = _company;
|
||||
|
||||
var _groups = await groupService.GetGroupsCompany(CompanyID);
|
||||
@@ -220,15 +221,15 @@
|
||||
Sending = true;
|
||||
if (SelectedConversation != null)
|
||||
{
|
||||
var item = new ADDConversationItemDto()
|
||||
var item = new ADD_ConversationResponseDto()
|
||||
{
|
||||
ConversationID = SelectedConversation.ID,
|
||||
text = InputMessage
|
||||
Text = InputMessage
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
var Item = new ADDConversationDto()
|
||||
var Item = new ADD_ConversationDto()
|
||||
{
|
||||
CompanyID = CompanyID,
|
||||
GroupID = SelectedGroup,
|
||||
|
@@ -1,7 +1,7 @@
|
||||
@page "/GroupManagement"
|
||||
<Modal @ref="modal" />
|
||||
<ConfirmDialog @ref="dialog" />
|
||||
@using Hushian.Application.Dtos
|
||||
@using Common.Dtos.Group
|
||||
@using HushianWebApp.Components
|
||||
@using HushianWebApp.Service
|
||||
@using HushianWebApp.Services
|
||||
@@ -15,7 +15,7 @@
|
||||
گروه جدید
|
||||
</Button>
|
||||
|
||||
<Grid @ref="grid" TItem="GroupDto"
|
||||
<Grid @ref="grid" TItem="Read_GroupDto"
|
||||
AllowSorting="true"
|
||||
Class="table table-hover"
|
||||
DataProvider="DataProvider"
|
||||
@@ -26,7 +26,7 @@ OnRowDoubleClick="OnRowClick"
|
||||
AllowRowClick=true>
|
||||
|
||||
<GridColumns>
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="GroupDto" HeaderText="تصویر گروه" >
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="Read_GroupDto" HeaderText="تصویر گروه">
|
||||
@if (context.img?.Length!=0)
|
||||
{
|
||||
<Image Class="rounded-circle mx-auto d-block" src="@GetImageSource(context.img)" height="25" width="25" alt="Uploaded Image" />
|
||||
@@ -36,23 +36,23 @@ AllowRowClick=true>
|
||||
<Icon Name="IconName.People" Size="IconSize.x5" />
|
||||
}
|
||||
</GridColumn>
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="GroupDto" HeaderText="شناسه گروه" SortKeySelector="item => item.ID">
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="Read_GroupDto" HeaderText="شناسه گروه" SortKeySelector="item => item.ID">
|
||||
@context.ID
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="GroupDto" HeaderText="نام گروه" SortKeySelector="item => item.Name">
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="Read_GroupDto" HeaderText="نام گروه" SortKeySelector="item => item.Name">
|
||||
@context.Name
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="GroupDto" HeaderText="توضیحات" >
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="Read_GroupDto" HeaderText="توضیحات">
|
||||
@context.Info
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="GroupDto" HeaderText="وضعیت">
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="Read_GroupDto" HeaderText="وضعیت">
|
||||
<Switch Value="@context.Available" ValueExpression="() => context.Available" ValueChanged="async(v)=>await SwitchChanged(context,v)" />
|
||||
|
||||
</GridColumn>
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="GroupDto" HeaderText="عملیات">
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="Read_GroupDto" HeaderText="عملیات">
|
||||
<Button Color="ButtonColor.Danger" Size="ButtonSize.ExtraSmall" @onclick="async()=>await DeleteGroup(context.ID,context.Name)"> حذف </Button>
|
||||
<Button Color="ButtonColor.Warning" Size="ButtonSize.ExtraSmall" @onclick="async()=>await showGroupsComponent(context.ID,context.Name)"> کاربران </Button>
|
||||
|
||||
@@ -65,11 +65,11 @@ AllowRowClick=true>
|
||||
private ConfirmDialog dialog = default!;
|
||||
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Grid<GroupDto> grid = default!;
|
||||
Grid<Read_GroupDto> grid = default!;
|
||||
private Modal modal = default!;
|
||||
string title = "گروه جدید";
|
||||
public List<GroupDto> list = new();
|
||||
private async Task<GridDataProviderResult<GroupDto>> DataProvider(GridDataProviderRequest<GroupDto> request)
|
||||
public List<Read_GroupDto> list = new();
|
||||
private async Task<GridDataProviderResult<Read_GroupDto>> DataProvider(GridDataProviderRequest<Read_GroupDto> request)
|
||||
{
|
||||
if(list.Count <= 0)
|
||||
list = await groupService.GetGroupsCompany();
|
||||
@@ -86,7 +86,7 @@ AllowRowClick=true>
|
||||
navigationManager.NavigateTo("/NotFound");
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
private async Task OnRowClick(GridRowEventArgs<GroupDto> args)
|
||||
private async Task OnRowClick(GridRowEventArgs<Read_GroupDto> args)
|
||||
{
|
||||
Dictionary<string, object> eparameters = new Dictionary<string, object>();
|
||||
eparameters.Add("model", args.Item);
|
||||
@@ -97,7 +97,7 @@ AllowRowClick=true>
|
||||
|
||||
|
||||
}
|
||||
private async Task SwitchChanged(GroupDto model, bool value)
|
||||
private async Task SwitchChanged(Read_GroupDto model, bool value)
|
||||
{
|
||||
if (model.Available != value)
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
@page "/Settings"
|
||||
@using Hushian.Application.Dtos.Company
|
||||
@using Common.Dtos.Company
|
||||
@using HushianWebApp.Components
|
||||
@using HushianWebApp.Service
|
||||
@using HushianWebApp.Services
|
||||
@@ -71,7 +71,10 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-12" style="margin-top:15px">
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.Fullname" type="text" placeholder="نام کامل" />
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.FullName" type="text" placeholder="نام شرکت" />
|
||||
</div>
|
||||
<div class="col-md-12" style="margin-top:15px">
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.FullNameManager" type="text" placeholder="نام مدیر" />
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.Email" type="text" placeholder="پست الکترونیک" />
|
||||
@@ -79,22 +82,17 @@
|
||||
<div class="col-md-12">
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.WebSite" type="text" placeholder="وب سایت" />
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.Phone" type="text" placeholder="تلفن" />
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.Info" type="text" placeholder="توضیحات" />
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 d-flex align-items-center mb-2">
|
||||
<InputFile type="file" OnChange="OnFileChange" accept=".png" />
|
||||
@if (dto.img != null && dto.img.Length > 0)
|
||||
@if (dto.logo != null && dto.logo.Length > 0)
|
||||
{
|
||||
<Image src="@GetImageSource()" class="rounded mx-2" height="25" width="25" alt="Uploaded Image" />
|
||||
}
|
||||
</div>
|
||||
<div class="d-grid gap-2">
|
||||
<Button Loading=loading LoadingText="در حال ذخیره اطلاعات..." Color="ButtonColor.Warning"
|
||||
@onclick="updateItem">
|
||||
@onclick="updateItem">
|
||||
ویرایش
|
||||
</Button>
|
||||
</div>
|
||||
@@ -127,18 +125,20 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Inject] protected ToastService ToastService { get; set; } = default!;
|
||||
[Inject] protected ToastService ToastService { get; set; } = default!;
|
||||
|
||||
bool ALLOWcompanyinfo = true;
|
||||
bool ALLOWcompanyinfo = true;
|
||||
public bool loading { get; set; } = false;
|
||||
public CompanyDto dto { get; set; }
|
||||
public ReadANDUpdate_CompanyDto dto { get; set; }
|
||||
= new();
|
||||
int CompanyID = 0;
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (!(await localStorageService.GetItem<List<string>>("Role")).Any(a => a == "HushianManagerCompany"))
|
||||
if (await localStorageService.GetItem<string>("Role") != "Company")
|
||||
navigationManager.NavigateTo("/NotFound");
|
||||
CompanyID= await localStorageService.GetItem<int>("C/CompanyId");
|
||||
|
||||
dto=await companyService.GetCompany();
|
||||
dto = await companyService.GetCompany(CompanyID);
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
private async Task OnFileChange(InputFileChangeEventArgs e)
|
||||
@@ -147,14 +147,14 @@
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
await file.OpenReadStream().CopyToAsync(memoryStream);
|
||||
dto.img = memoryStream.ToArray();
|
||||
dto.logo = memoryStream.ToArray();
|
||||
}
|
||||
}
|
||||
private string GetImageSource()
|
||||
{
|
||||
if (dto.img != null)
|
||||
if (dto.logo != null)
|
||||
{
|
||||
return $"data:image/jpeg;base64,{Convert.ToBase64String(dto.img)}";
|
||||
return $"data:image/jpeg;base64,{Convert.ToBase64String(dto.logo)}";
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
@page "/UserManagement"
|
||||
<ConfirmDialog @ref="dialog" />
|
||||
@using Common.Dtos.User
|
||||
@using Hushian.Application.Dtos
|
||||
@using Common.Dtos.Exper
|
||||
@using HushianWebApp.Components
|
||||
@using HushianWebApp.Service
|
||||
@using HushianWebApp.Services
|
||||
@@ -17,7 +16,7 @@
|
||||
کارشناس جدید
|
||||
</Button>
|
||||
|
||||
<Grid @ref="grid" TItem="HushianUserDto"
|
||||
<Grid @ref="grid" TItem="Read_ExperDto"
|
||||
AllowSorting="true"
|
||||
Class="table table-hover"
|
||||
DataProvider="DataProvider"
|
||||
@@ -28,39 +27,23 @@ OnRowDoubleClick="OnRowClick"
|
||||
AllowRowClick=true>
|
||||
|
||||
<GridColumns>
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="HushianUserDto" HeaderText="تصویر کاربر" >
|
||||
@if (context.img?.Length != 0)
|
||||
{
|
||||
<Image Class="rounded-circle mx-auto d-block" src="@GetImageSource(context.img)" height="25" width="25" alt="Uploaded Image" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<Icon Name="IconName.Person" Size="IconSize.x5" />
|
||||
}
|
||||
</GridColumn>
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="HushianUserDto" HeaderText="نام کاریری" SortKeySelector="item => item.UserName">
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="Read_ExperDto" HeaderText="نام کاریری" SortKeySelector="item => item.UserName">
|
||||
@context.UserName
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="HushianUserDto" HeaderText="نام کامل" SortKeySelector="item => item.FullName">
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="Read_ExperDto" HeaderText="نام کامل" SortKeySelector="item => item.FullName">
|
||||
@context.FullName
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="HushianUserDto" HeaderText="پست اکترونیک" SortKeySelector="item => item.Email">
|
||||
@context.Email
|
||||
</GridColumn>
|
||||
|
||||
|
||||
@* <GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="HushianUserDto" HeaderText="موبابل" SortKeySelector="item => item.PhoneNumber">
|
||||
@context.PhoneNumber
|
||||
</GridColumn> *@
|
||||
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="HushianUserDto" HeaderText="وضعیت">
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="Read_ExperDto" HeaderText="وضعیت">
|
||||
<Switch Value="@context.Available" ValueExpression="() => context.Available" ValueChanged="async(v)=>await SwitchChanged(context,v)" />
|
||||
|
||||
</GridColumn>
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="HushianUserDto" HeaderText="عملیات">
|
||||
<Button Color="ButtonColor.Danger" Size="ButtonSize.ExtraSmall" @onclick="async()=>await DeleteExper(context.UserID,context.FullName)"> حذف </Button>
|
||||
<Button Color="ButtonColor.Warning" Size="ButtonSize.ExtraSmall" @onclick="async()=>await showGroupsComponent(context.UserID,context.FullName)"> گروه ها </Button>
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="Read_ExperDto" HeaderText="عملیات">
|
||||
<Button Color="ButtonColor.Danger" Size="ButtonSize.ExtraSmall" @onclick="async()=>await DeleteExper(context.ID,context.FullName)"> حذف </Button>
|
||||
<Button Color="ButtonColor.Warning" Size="ButtonSize.ExtraSmall" @onclick="async()=>await showGroupsComponent(context.ID,context.FullName)"> گروه ها </Button>
|
||||
|
||||
</GridColumn>
|
||||
</GridColumns>
|
||||
@@ -71,35 +54,32 @@ AllowRowClick=true>
|
||||
private ConfirmDialog dialog = default!;
|
||||
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Grid<HushianUserDto> grid = default!;
|
||||
Grid<Read_ExperDto> grid = default!;
|
||||
private Modal modal = default!;
|
||||
string title = "کارشناس جدید";
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create(this, CallBack));
|
||||
|
||||
if (!(await localStorageService.GetItem<List<string>>("Role")).Any(a =>a== "HushianManagerCompany") )
|
||||
if (await localStorageService.GetItem<string>("Role")!= "Company" )
|
||||
navigationManager.NavigateTo("/NotFound");
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
private async Task<GridDataProviderResult<HushianUserDto>> DataProvider(GridDataProviderRequest<HushianUserDto> request)
|
||||
private async Task<GridDataProviderResult<Read_ExperDto>> DataProvider(GridDataProviderRequest<Read_ExperDto> request)
|
||||
{
|
||||
var employees = await userService.GetExpersCompany(0, request.PageNumber, request.PageSize);
|
||||
return await Task.FromResult(request.ApplyTo(employees != null ? employees.list : new()));
|
||||
return await Task.FromResult(request.ApplyTo(employees != null ? employees : new()));
|
||||
}
|
||||
async Task CallBack()
|
||||
{
|
||||
await modal.HideAsync();
|
||||
await grid.RefreshDataAsync();
|
||||
}
|
||||
private async Task OnRowClick(GridRowEventArgs<HushianUserDto> args)
|
||||
private async Task OnRowClick(GridRowEventArgs<Read_ExperDto> args)
|
||||
{
|
||||
var editmodel = new EditUserFromUserDto()
|
||||
var editmodel = new Update_ExperDto()
|
||||
{
|
||||
Email = args.Item.Email,
|
||||
FullName = args.Item.FullName,
|
||||
UserName = args.Item.UserName,
|
||||
img = args.Item.img
|
||||
FullName = args.Item.FullName
|
||||
};
|
||||
Dictionary<string, object> eparameters = new Dictionary<string, object>();
|
||||
eparameters.Add("model", editmodel);
|
||||
@@ -108,17 +88,17 @@ AllowRowClick=true>
|
||||
await modal.ShowAsync<UpdateExperComponent>($"ویرایش کارشناس {args.Item.FullName}", parameters: eparameters);
|
||||
|
||||
}
|
||||
private async Task SwitchChanged(HushianUserDto model,bool value)
|
||||
private async Task SwitchChanged(Read_ExperDto model, bool value)
|
||||
{
|
||||
if (model.Available != value)
|
||||
{
|
||||
if (await userService.ChangeAvailableExperFromManager(model.UserID, value))
|
||||
if (await userService.ChangeAvailableExperFromManager(model.ID, value))
|
||||
model.Available = value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private async Task DeleteExper(string ExperID,string name)
|
||||
private async Task DeleteExper(int ExperID,string name)
|
||||
{
|
||||
var confirmation = await dialog.ShowAsync(
|
||||
title: $"مطمئنی میخوای {name} حذف کنی؟",
|
||||
@@ -144,7 +124,7 @@ AllowRowClick=true>
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
async Task showGroupsComponent(string ExperID, string name)
|
||||
async Task showGroupsComponent(int ExperID, string name)
|
||||
{
|
||||
Dictionary<string, object> eparameters = new Dictionary<string, object>();
|
||||
eparameters.Add("ExperID", ExperID);
|
||||
|
Reference in New Issue
Block a user