ltable
This commit is contained in:
37
Back/Controllers/CustomerController.cs
Normal file
37
Back/Controllers/CustomerController.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using Back.Services;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Shared.DTOs;
|
||||||
|
|
||||||
|
namespace Back.Controllers
|
||||||
|
{
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
[Authorize]
|
||||||
|
[ApiController]
|
||||||
|
public class CustomerController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly CheckPermission _checkPermission;
|
||||||
|
private readonly servUser _servUser;
|
||||||
|
private readonly servCustomer _servCus;
|
||||||
|
public CustomerController(CheckPermission checkPermission, servUser servUser, servCustomer servCus)
|
||||||
|
{
|
||||||
|
|
||||||
|
_checkPermission = checkPermission;
|
||||||
|
_servUser = servUser;
|
||||||
|
_servCus = servCus;
|
||||||
|
}
|
||||||
|
[HttpPost("GetAll")]
|
||||||
|
public async Task<ActionResult<PagingDto<RCustomer>>> GetAll(ItemSerchGetCustomer itemSerch)
|
||||||
|
{
|
||||||
|
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||||
|
var UserID = claim.Value;
|
||||||
|
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||||
|
|
||||||
|
if (!await _checkPermission.AllowSYSGetCustomer(Convert.ToInt32(UserID), user.RolUsers.First().CompanyID)) return Forbid( "شما دسترسی به خواندن اطلاعات مشتری را نداربد");
|
||||||
|
|
||||||
|
return Ok(await _servCus.GetCustomers(user.RolUsers.First().CompanyID, itemSerch));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -29,7 +29,7 @@ namespace Back.Features
|
|||||||
{
|
{
|
||||||
servUser _servUser = (servUser)httpContext.RequestServices.GetService(typeof(servUser));
|
servUser _servUser = (servUser)httpContext.RequestServices.GetService(typeof(servUser));
|
||||||
var user = _servUser.GetUserByUserID(UserID).Result;
|
var user = _servUser.GetUserByUserID(UserID).Result;
|
||||||
if (user != null && user.Token==accessToken)
|
if ((user != null && user.Token==accessToken) || httpContext.GetEndpoint().DisplayName.Contains("BaseController"))
|
||||||
await _next(httpContext);
|
await _next(httpContext);
|
||||||
else
|
else
|
||||||
httpContext.Response.StatusCode = StatusCodes.Status401Unauthorized;
|
httpContext.Response.StatusCode = StatusCodes.Status401Unauthorized;
|
||||||
|
@@ -37,6 +37,7 @@ builder.Services.AddScoped<servPermission>();
|
|||||||
builder.Services.AddScoped<servSendMsg>();
|
builder.Services.AddScoped<servSendMsg>();
|
||||||
builder.Services.AddScoped<servUser>();
|
builder.Services.AddScoped<servUser>();
|
||||||
builder.Services.AddScoped<servTaxPayer>();
|
builder.Services.AddScoped<servTaxPayer>();
|
||||||
|
builder.Services.AddScoped<servCustomer>();
|
||||||
builder.Services.AddScoped<CompanyRegistrationValidation>();
|
builder.Services.AddScoped<CompanyRegistrationValidation>();
|
||||||
builder.Services.AddScoped(c => new mpNuget.RestClient("09119660045", "C54S2"));
|
builder.Services.AddScoped(c => new mpNuget.RestClient("09119660045", "C54S2"));
|
||||||
|
|
||||||
|
180
Back/Services/servCustomer.cs
Normal file
180
Back/Services/servCustomer.cs
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
using Back.Common;
|
||||||
|
using Back.Data.Contracts;
|
||||||
|
using Back.Data.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Shared.DTOs;
|
||||||
|
|
||||||
|
namespace Back.Services
|
||||||
|
{
|
||||||
|
public class servCustomer
|
||||||
|
{
|
||||||
|
private readonly IAsyncRepository<Customer> _repoCus;
|
||||||
|
private readonly CheckPermission _checkPermission;
|
||||||
|
public servCustomer(IAsyncRepository<Customer> repoCus, CheckPermission checkPermission)
|
||||||
|
{
|
||||||
|
_repoCus = repoCus;
|
||||||
|
_checkPermission = checkPermission;
|
||||||
|
|
||||||
|
}
|
||||||
|
public async Task<PagingDto<RCustomer>?> GetCustomers(int CompanyID, ItemSerchGetCustomer itemSerch)
|
||||||
|
{
|
||||||
|
#region AdvancedSearch
|
||||||
|
var invok = _repoCus
|
||||||
|
.Get(w => w.CompanyID == CompanyID && !w.IsDeleted);
|
||||||
|
//foreach (InputObj item in inputObjs)
|
||||||
|
// invok = invok.Where(ExMethod.GetFunc<Customer>(item.Param, item.Value));
|
||||||
|
if (!string.IsNullOrEmpty(itemSerch.ZipCode))
|
||||||
|
invok = invok.Where(w=>w.ZipCode.Contains(itemSerch.ZipCode));
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(itemSerch.Phone))
|
||||||
|
invok = invok.Where(w => w.Phone.Contains(itemSerch.Phone));
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(itemSerch.MeliCode))
|
||||||
|
invok = invok.Where(w => w.MeliCode.Contains(itemSerch.MeliCode));
|
||||||
|
|
||||||
|
if (itemSerch.CustomerType.HasValue)
|
||||||
|
invok = invok.Where(w => w.CustomerType==itemSerch.CustomerType);
|
||||||
|
|
||||||
|
if (itemSerch.ID.HasValue)
|
||||||
|
invok = invok.Where(w => w.ID == itemSerch.ID);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(itemSerch.EconomicCode))
|
||||||
|
invok = invok.Where(w => w.EconomicCode.Contains(itemSerch.EconomicCode));
|
||||||
|
#endregion
|
||||||
|
//-----------------------
|
||||||
|
return await invok.Select(s=>new RCustomer()
|
||||||
|
{
|
||||||
|
// Address = s.Address,
|
||||||
|
CustomerType = s.CustomerType.GetEnumDisplayName(),
|
||||||
|
EconomicCode = s.EconomicCode,
|
||||||
|
// Email =s.Email,
|
||||||
|
FullName = s.FullName,
|
||||||
|
ID = s.ID,
|
||||||
|
// Info = s.Info,
|
||||||
|
Phone=s.Phone,
|
||||||
|
// BranchID = s.BranchID,
|
||||||
|
// MeliCode = s.MeliCode,
|
||||||
|
// ZipCode = s.ZipCode ,
|
||||||
|
// PassportNumber=s.PassportNumber,
|
||||||
|
// CompanyID=s.CompanyID
|
||||||
|
})
|
||||||
|
.Paging(itemSerch.PageIndex, itemSerch.PageSize);
|
||||||
|
}
|
||||||
|
//public async Task<Customer> GetCustomerByCustomerID(int CustomerID, int CompanyID)
|
||||||
|
//{
|
||||||
|
// return await _repositores.GET<Customer>()
|
||||||
|
// .Where(w => w.ID == CustomerID && w.CompanyID==CompanyID && !w.IsDeleted).FirstOrDefaultAsync();
|
||||||
|
//}
|
||||||
|
//public async Task<Customer> GetCustomerByCustomerID(int CustomerID)
|
||||||
|
//{
|
||||||
|
// return await _repositores.GET<Customer>()
|
||||||
|
// .Where(w => w.ID == CustomerID && !w.IsDeleted).FirstOrDefaultAsync();
|
||||||
|
//}
|
||||||
|
//public async Task<bool> ExistCustomerByCustomerID(int CustomerID, int CompanyID)
|
||||||
|
//{
|
||||||
|
// return await _repositores.GET<Customer>()
|
||||||
|
// .AnyAsync(w => w.ID == CustomerID && w.CompanyID == CompanyID && !w.IsDeleted);
|
||||||
|
//}
|
||||||
|
//public async Task<CUCustomer> GetCustomerByCustomerIDByDTO(int CustomerID)
|
||||||
|
//{
|
||||||
|
// return await _repositores.GET<Customer>()
|
||||||
|
// .Where(w => w.ID == CustomerID && !w.IsDeleted)
|
||||||
|
// .Select(s => new CUCustomer()
|
||||||
|
// {
|
||||||
|
// Address = s.Address,
|
||||||
|
// CustomerType = s.CustomerType,
|
||||||
|
// EconomicCode = s.EconomicCode,
|
||||||
|
// Email = s.Email,
|
||||||
|
// FullName = s.FullName,
|
||||||
|
// ID = s.ID,
|
||||||
|
// Info = s.Info,
|
||||||
|
// Phone = s.Phone,
|
||||||
|
// BranchID = s.BranchID,
|
||||||
|
// MeliCode = s.MeliCode,
|
||||||
|
// ZipCode = s.ZipCode,
|
||||||
|
// PassportNumber = s.PassportNumber,
|
||||||
|
// //CompanyID = s.CompanyID
|
||||||
|
// })
|
||||||
|
// .FirstOrDefaultAsync();
|
||||||
|
//}
|
||||||
|
//public async Task<Customer?> AddORUpdateCustomer(Customer item)
|
||||||
|
//{
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// SysLog log = new SysLog()
|
||||||
|
// {
|
||||||
|
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
|
||||||
|
// Datetime = DateTime.Now.ConvertMiladiToShamsi(),
|
||||||
|
// Method = $"{_httpContextAccessor.HttpContext.Request.Method}/{this.GetType().FullName}/AddORUpdateCustomer",
|
||||||
|
// Value ="*"+ JsonConvert.SerializeObject(item),
|
||||||
|
// Route = _httpContextAccessor.HttpContext.Request.Path,
|
||||||
|
// Type = "User"
|
||||||
|
// };
|
||||||
|
// _contextMongodb.InsertItem(log);
|
||||||
|
|
||||||
|
// if (item.ID == null || item.ID == 0)
|
||||||
|
// {
|
||||||
|
// var ret = await _repositores.ADD(item);
|
||||||
|
// _checkPermission.ExtensionofAccess(item.CompanyID, 5, "-1");
|
||||||
|
// return item;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// return await _repositores.UPDATE(item);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// SysLog log = new SysLog()
|
||||||
|
// {
|
||||||
|
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
|
||||||
|
// Datetime = DateTime.Now.ConvertMiladiToShamsi(),
|
||||||
|
// Method = $"{_httpContextAccessor.HttpContext.Request.Method}/{this.GetType().FullName}/AddORUpdateCustomer",
|
||||||
|
// Value = ex.Message,
|
||||||
|
// Route = _httpContextAccessor.HttpContext.Request.Path,
|
||||||
|
// Type = "catch"
|
||||||
|
// };
|
||||||
|
// _contextMongodb.InsertItem(log);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
//public async Task<bool> DeleteCustomer(Customer item)
|
||||||
|
//{
|
||||||
|
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// item.IsDeleted = true;
|
||||||
|
// _repositores.UPDATE(item);
|
||||||
|
// SysLog log = new SysLog()
|
||||||
|
// {
|
||||||
|
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
|
||||||
|
// Datetime = DateTime.Now.ConvertMiladiToShamsi(),
|
||||||
|
// Method = $"{_httpContextAccessor.HttpContext.Request.Method}/{this.GetType().FullName}/DeleteCustomer",
|
||||||
|
// Value = JsonConvert.SerializeObject(item.ID),
|
||||||
|
// Route = _httpContextAccessor.HttpContext.Request.Path,
|
||||||
|
// Type = "User"
|
||||||
|
// };
|
||||||
|
// _contextMongodb.InsertItem(log);
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// SysLog log = new SysLog()
|
||||||
|
// {
|
||||||
|
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
|
||||||
|
// Datetime = DateTime.Now.ConvertMiladiToShamsi(),
|
||||||
|
// Method = $"{_httpContextAccessor.HttpContext.Request.Method}/{this.GetType().FullName}/DeleteCustomer",
|
||||||
|
// Value = ex.Message,
|
||||||
|
// Route = _httpContextAccessor.HttpContext.Request.Path,
|
||||||
|
// Type = "catch"
|
||||||
|
// };
|
||||||
|
// _contextMongodb.InsertItem(log);
|
||||||
|
// return false;
|
||||||
|
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Shared.DTOs
|
namespace Shared.DTOs
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -8,7 +9,9 @@ namespace Shared.DTOs
|
|||||||
{
|
{
|
||||||
public class Employee1
|
public class Employee1
|
||||||
{
|
{
|
||||||
|
[Display(Name ="شناسه")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
[Display(Name = "نام")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Designation { get; set; }
|
public string Designation { get; set; }
|
||||||
public DateOnly DOJ { get; set; }
|
public DateOnly DOJ { get; set; }
|
||||||
|
9
Shared/DTOs/Features/ShowNameAttribute.cs
Normal file
9
Shared/DTOs/Features/ShowNameAttribute.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Shared.DTOs
|
||||||
|
{
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class ShowNameAttribute : Attribute
|
||||||
|
{
|
||||||
|
public string Name = "";
|
||||||
|
}
|
||||||
|
}
|
21
Shared/DTOs/ItemSerchGetCustomer.cs
Normal file
21
Shared/DTOs/ItemSerchGetCustomer.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using Shared.DTOs.Serch;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Shared.DTOs
|
||||||
|
{
|
||||||
|
public class ItemSerchGetCustomer : IFildGlobalItemSerch
|
||||||
|
{
|
||||||
|
public int? ID { get; set; }
|
||||||
|
public CustomerType? CustomerType { get; set; }
|
||||||
|
public string? EconomicCode { get; set; }
|
||||||
|
public string? Phone { get; set; }
|
||||||
|
public string? MeliCode { get; set; }
|
||||||
|
public string? ZipCode { get; set; }
|
||||||
|
public int PageIndex { get; set; } = 1;
|
||||||
|
public int PageSize { get; set; } = 5;
|
||||||
|
}
|
||||||
|
}
|
24
Shared/DTOs/RCustomer.cs
Normal file
24
Shared/DTOs/RCustomer.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Shared.DTOs
|
||||||
|
{
|
||||||
|
public class RCustomer
|
||||||
|
{
|
||||||
|
[Display(Name ="شناسه")]
|
||||||
|
public int ID { get; set; }
|
||||||
|
[Display(Name = "نام کامل")]
|
||||||
|
public string FullName { get; set; }
|
||||||
|
[Display(Name = "نوع مشتری")]
|
||||||
|
public string CustomerType { get; set; }
|
||||||
|
[Display(Name = "تلفن")]
|
||||||
|
public string Phone { get; set; }
|
||||||
|
[Display(Name = "کد اقتصادی")]
|
||||||
|
public string? EconomicCode { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
19
Shared/DTOs/TestModel.cs
Normal file
19
Shared/DTOs/TestModel.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Shared.DTOs
|
||||||
|
{
|
||||||
|
public class TestModel
|
||||||
|
{
|
||||||
|
[Display(Name = "شناسه")]
|
||||||
|
public int ID { get; set; }
|
||||||
|
[Display(Name = "نام")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[Display(Name = "آدرس")]
|
||||||
|
public string Address { get; set; }
|
||||||
|
}
|
||||||
|
}
|
66
TaxPayerFull/CUSComponent/LTable.razor
Normal file
66
TaxPayerFull/CUSComponent/LTable.razor
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
@using System.Reflection
|
||||||
|
@using System.ComponentModel.DataAnnotations
|
||||||
|
@using Shared.DTOs
|
||||||
|
@typeparam T
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="mb-4">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="table-responsive text-nowrap">
|
||||||
|
<table class="table">
|
||||||
|
<thead class="table-light">
|
||||||
|
<tr>
|
||||||
|
@{
|
||||||
|
PropertyInfo[] properties = typeof(T).GetProperties();
|
||||||
|
foreach (var item in properties)
|
||||||
|
{
|
||||||
|
if (item.GetCustomAttributes(typeof(DisplayAttribute), false).Length > 0)
|
||||||
|
{
|
||||||
|
<th>
|
||||||
|
@item.CustomAttributes.Where(w => w.AttributeType.Name == "DisplayAttribute").Select(s => s.NamedArguments.Where(w => w.MemberName == "Name").Select(ss => ss.TypedValue.Value).First()).First().ToString()
|
||||||
|
</th>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="table-border-bottom-0">
|
||||||
|
@{
|
||||||
|
foreach (var item in ModelinComponent)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
@{
|
||||||
|
properties = item.GetType().GetProperties();
|
||||||
|
foreach (PropertyInfo property in properties)
|
||||||
|
{
|
||||||
|
if (property.CustomAttributes.Any(w => w.AttributeType.Name == "DisplayAttribute"))
|
||||||
|
{
|
||||||
|
<td>@property.GetValue(item, null)</td>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public List<T> ModelinComponent { get; set; } = new List<T>();
|
||||||
|
|
||||||
|
}
|
@@ -230,6 +230,7 @@
|
|||||||
|
|
||||||
private async Task OnLoginClick()
|
private async Task OnLoginClick()
|
||||||
{
|
{
|
||||||
|
_hc.DefaultRequestHeaders.Clear();
|
||||||
var request = await _hc.PostAsJsonAsync("User/authenticate", Model);
|
var request = await _hc.PostAsJsonAsync("User/authenticate", Model);
|
||||||
if (request.IsSuccessStatusCode)
|
if (request.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
@page "/Customer"
|
@page "/Customer"
|
||||||
|
@using Front.Services
|
||||||
@using Shared.DTOs
|
@using Shared.DTOs
|
||||||
|
@using Front.CUSComponent
|
||||||
|
@using Shared.DTOs.Serch
|
||||||
|
@inject HttpClientController hc;
|
||||||
<PageTitle>مشتری</PageTitle>
|
<PageTitle>مشتری</PageTitle>
|
||||||
@* search *@
|
@* search *@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -58,170 +62,98 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@* data *@
|
@* alert *@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<Alert hidden="@Hidealert" Color="@alertColor" Dismissable="false">
|
||||||
<div class="mb-4">
|
<Icon Name="@alertIconName" class="me-2"></Icon>
|
||||||
<div class="row">
|
@alertMessage
|
||||||
<div class="col-md-12">
|
</Alert>
|
||||||
<div class="card">
|
|
||||||
<div class="table-responsive text-nowrap">
|
|
||||||
<table class="table">
|
|
||||||
<thead class="table-light">
|
|
||||||
<tr>
|
|
||||||
<th>پروژه</th>
|
|
||||||
<th>مشتری</th>
|
|
||||||
<th>کاربران</th>
|
|
||||||
<th>وضعیت</th>
|
|
||||||
<th>عملکردها</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="table-border-bottom-0">
|
|
||||||
<tr>
|
|
||||||
<td><i class="fab fa-angular fa-lg text-danger me-3"></i> <strong>پروژه انگولار</strong></td>
|
|
||||||
<td>آلبرت کوک</td>
|
|
||||||
<td>
|
|
||||||
<ul class="list-unstyled users-list m-0 avatar-group d-flex align-items-center">
|
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top" class="avatar avatar-xs pull-up" title="" data-bs-original-title="لیلان فولر">
|
|
||||||
<img src="assets/img/avatars/5.png" alt="Avatar" class="rounded-circle">
|
|
||||||
</li>
|
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top" class="avatar avatar-xs pull-up" title="" data-bs-original-title="سوفیا ویلکرسون">
|
|
||||||
<img src="assets/img/avatars/6.png" alt="Avatar" class="rounded-circle">
|
|
||||||
</li>
|
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top" class="avatar avatar-xs pull-up" title="" data-bs-original-title="کریستین پارکر">
|
|
||||||
<img src="assets/img/avatars/7.png" alt="Avatar" class="rounded-circle">
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
<td><span class="badge bg-label-primary me-1">فعال</span></td>
|
|
||||||
<td>
|
|
||||||
<div class="dropdown">
|
|
||||||
<button type="button" class="btn p-0 dropdown-toggle hide-arrow" data-bs-toggle="dropdown"><i class="bx bx-dots-vertical-rounded"></i></button>
|
|
||||||
<div class="dropdown-menu new-style-11">
|
|
||||||
<a class="dropdown-item" href="javascript:void(0);"><i class="bx bx-edit-alt me-1"></i>ویرایش</a>
|
|
||||||
<a class="dropdown-item" href="javascript:void(0);"><i class="bx bx-trash me-1"></i> حذف</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><i class="fab fa-react fa-lg text-info me-3"></i> <strong>پروژه ری اکت</strong></td>
|
|
||||||
<td>بری هانتر</td>
|
|
||||||
<td>
|
|
||||||
<ul class="list-unstyled users-list m-0 avatar-group d-flex align-items-center">
|
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top" class="avatar avatar-xs pull-up" title="" data-bs-original-title="لیلان فولر">
|
|
||||||
<img src="assets/img/avatars/5.png" alt="Avatar" class="rounded-circle">
|
|
||||||
</li>
|
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top" class="avatar avatar-xs pull-up" title="" data-bs-original-title="سوفیا ویلکرسون">
|
|
||||||
<img src="assets/img/avatars/6.png" alt="Avatar" class="rounded-circle">
|
|
||||||
</li>
|
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top" class="avatar avatar-xs pull-up" title="" data-bs-original-title="کریستین پارکر">
|
|
||||||
<img src="assets/img/avatars/7.png" alt="Avatar" class="rounded-circle">
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
<td><span class="badge bg-label-success me-1">تکمیل شد</span></td>
|
|
||||||
<td>
|
|
||||||
<div class="dropdown">
|
|
||||||
<button type="button" class="btn p-0 dropdown-toggle hide-arrow" data-bs-toggle="dropdown"><i class="bx bx-dots-vertical-rounded"></i></button>
|
|
||||||
<div class="dropdown-menu new-style-11">
|
|
||||||
<a class="dropdown-item" href="javascript:void(0);"><i class="bx bx-edit-alt me-1"></i>ویرایش</a>
|
|
||||||
<a class="dropdown-item" href="javascript:void(0);"><i class="bx bx-trash me-1"></i> حذف</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><i class="fab fa-vuejs fa-lg text-success me-3"></i> <strong>پروژه وی جی اس</strong></td>
|
|
||||||
<td>ترور بیکر</td>
|
|
||||||
<td>
|
|
||||||
<ul class="list-unstyled users-list m-0 avatar-group d-flex align-items-center">
|
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top" class="avatar avatar-xs pull-up" title="" data-bs-original-title="لیلان فولر">
|
|
||||||
<img src="assets/img/avatars/5.png" alt="Avatar" class="rounded-circle">
|
|
||||||
</li>
|
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top" class="avatar avatar-xs pull-up" title="" data-bs-original-title="سوفیا ویلکرسون">
|
|
||||||
<img src="assets/img/avatars/6.png" alt="Avatar" class="rounded-circle">
|
|
||||||
</li>
|
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top" class="avatar avatar-xs pull-up" title="" data-bs-original-title="کریستین پارکر">
|
|
||||||
<img src="assets/img/avatars/7.png" alt="Avatar" class="rounded-circle">
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
<td><span class="badge bg-label-info me-1">برنامه ریزی شده</span></td>
|
|
||||||
<td>
|
|
||||||
<div class="dropdown">
|
|
||||||
<button type="button" class="btn p-0 dropdown-toggle hide-arrow" data-bs-toggle="dropdown"><i class="bx bx-dots-vertical-rounded"></i></button>
|
|
||||||
<div class="dropdown-menu new-style-12">
|
|
||||||
<a class="dropdown-item" href="javascript:void(0);"><i class="bx bx-edit-alt me-1"></i>ویرایش</a>
|
|
||||||
<a class="dropdown-item" href="javascript:void(0);"><i class="bx bx-trash me-1"></i> حذف</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><i class="fab fa-bootstrap fa-lg text-primary me-3"></i> <strong>پروژه بوت استرپ</strong></td>
|
|
||||||
<td>جری میلتون</td>
|
|
||||||
<td>
|
|
||||||
<ul class="list-unstyled users-list m-0 avatar-group d-flex align-items-center">
|
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top" class="avatar avatar-xs pull-up" title="" data-bs-original-title="لیلان فولر">
|
|
||||||
<img src="assets/img/avatars/5.png" alt="Avatar" class="rounded-circle">
|
|
||||||
</li>
|
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top" class="avatar avatar-xs pull-up" title="" data-bs-original-title="سوفیا ویلکرسون">
|
|
||||||
<img src="assets/img/avatars/6.png" alt="Avatar" class="rounded-circle">
|
|
||||||
</li>
|
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top" class="avatar avatar-xs pull-up" title="" data-bs-original-title="کریستین پارکر">
|
|
||||||
<img src="assets/img/avatars/7.png" alt="Avatar" class="rounded-circle">
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
<td><span class="badge bg-label-warning me-1">درانتظار</span></td>
|
|
||||||
<td>
|
|
||||||
<div class="dropdown">
|
|
||||||
<button type="button" class="btn p-0 dropdown-toggle hide-arrow" data-bs-toggle="dropdown"><i class="bx bx-dots-vertical-rounded"></i></button>
|
|
||||||
<div class="dropdown-menu new-style-12">
|
|
||||||
<a class="dropdown-item" href="javascript:void(0);"><i class="bx bx-edit-alt me-1"></i>ویرایش</a>
|
|
||||||
<a class="dropdown-item" href="javascript:void(0);"><i class="bx bx-trash me-1"></i> حذف</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@* data *@
|
||||||
|
@if (request != null)
|
||||||
|
{
|
||||||
|
<LTable ModelinComponent="request?.list" />
|
||||||
|
|
||||||
|
@* pagination *@
|
||||||
|
<nav aria-label="Page navigation">
|
||||||
|
<br />
|
||||||
|
<ul class="pagination justify-content-center">
|
||||||
|
@for (int page = 1; page <= request?.PageCount; page++)
|
||||||
|
{
|
||||||
|
if (page == PageIndex)
|
||||||
|
{
|
||||||
|
<li class="page-item disabled">
|
||||||
|
<a class="page-link" href="@hc._nav.GetUriWithQueryParameter("PageIndex",page)">@(page)</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="page-link" href="@hc._nav.GetUriWithQueryParameter("PageIndex",page)">@(page)</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@layout PanelLayout
|
@layout PanelLayout
|
||||||
@code {
|
@code {
|
||||||
private IEnumerable<Employee1>? employees;
|
// alert
|
||||||
|
AlertColor alertColor = AlertColor.Primary;
|
||||||
|
IconName alertIconName = IconName.CheckCircleFill;
|
||||||
|
bool Hidealert = true;
|
||||||
|
string alertMessage = "";
|
||||||
|
|
||||||
private async Task<GridDataProviderResult<Employee1>> EmployeesDataProvider(GridDataProviderRequest<Employee1> request)
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
if (employees is null) // pull employees only one time for client-side filtering, sorting, and paging
|
if (PageIndex == null) PageIndex = 1;
|
||||||
employees = GetEmployees(); // call a service or an API to pull the employees
|
await LoadCus(PageIndex.Value);
|
||||||
|
await base.OnParametersSetAsync();
|
||||||
return await Task.FromResult(request.ApplyTo(employees));
|
|
||||||
}
|
}
|
||||||
|
[Parameter, SupplyParameterFromQuery]
|
||||||
|
public int? PageIndex { get; set; }
|
||||||
|
|
||||||
private IEnumerable<Employee1> GetEmployees()
|
public Shared.DTOs.PagingDto<RCustomer>? request { get; set; }
|
||||||
{
|
|
||||||
return new List<Employee1>
|
|
||||||
{
|
|
||||||
new Employee1 { Id = 107, Name = "Alice", Designation = "AI Engineer", DOJ = new DateOnly(1998, 11, 17), IsActive = true },
|
|
||||||
new Employee1 { Id = 103, Name = "Bob", Designation = "Senior DevOps Engineer", DOJ = new DateOnly(1985, 1, 5), IsActive = true },
|
|
||||||
new Employee1 { Id = 106, Name = "John", Designation = "Data Engineer", DOJ = new DateOnly(1995, 4, 17), IsActive = true },
|
|
||||||
new Employee1 { Id = 104, Name = "Pop", Designation = "Associate Architect", DOJ = new DateOnly(1985, 6, 8), IsActive = false },
|
|
||||||
new Employee1 { Id = 105, Name = "Ronald", Designation = "Senior Data Engineer", DOJ = new DateOnly(1991, 8, 23), IsActive = true },
|
|
||||||
new Employee1 { Id = 102, Name = "Line", Designation = "Architect", DOJ = new DateOnly(1977, 1, 12), IsActive = true },
|
|
||||||
new Employee1 { Id = 101, Name = "Daniel", Designation = "Architect", DOJ = new DateOnly(1977, 1, 12), IsActive = true },
|
|
||||||
new Employee1 { Id = 108, Name = "Zayne", Designation = "Data Analyst", DOJ = new DateOnly(1991, 1, 1), IsActive = true },
|
|
||||||
new Employee1 { Id = 109, Name = "Isha", Designation = "App Maker", DOJ = new DateOnly(1996, 7, 1), IsActive = true },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@functions {
|
||||||
|
private void ShowSuccessAlert(string msg)
|
||||||
|
{
|
||||||
|
Hidealert = false;
|
||||||
|
alertColor = AlertColor.Success;
|
||||||
|
alertIconName = IconName.CheckCircleFill;
|
||||||
|
alertMessage = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowDangerAlert(string msg)
|
||||||
|
{
|
||||||
|
Hidealert = false;
|
||||||
|
alertColor = AlertColor.Danger;
|
||||||
|
alertIconName = IconName.ExclamationTriangleFill;
|
||||||
|
alertMessage = msg;
|
||||||
|
}
|
||||||
|
public async Task LoadCus(int pi)
|
||||||
|
{
|
||||||
|
var rsp = await hc.Post<ItemSerchGetCustomer>("Customer/GetAll", new ItemSerchGetCustomer()
|
||||||
|
{
|
||||||
|
PageIndex=pi
|
||||||
|
});
|
||||||
|
if (rsp.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
request = await rsp.Content.ReadFromJsonAsync<PagingDto<RCustomer>>();
|
||||||
|
}
|
||||||
|
else if(rsp.StatusCode==System.Net.HttpStatusCode.Forbidden)
|
||||||
|
{
|
||||||
|
ShowDangerAlert("شما دسترسی به خواندن اطلاعات مشتری را نداربد");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user