View COD
This commit is contained in:
@@ -6,13 +6,6 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Remove="Common\DTOs\**" />
|
|
||||||
<Content Remove="Common\DTOs\**" />
|
|
||||||
<EmbeddedResource Remove="Common\DTOs\**" />
|
|
||||||
<None Remove="Common\DTOs\**" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Melipayamak.RestClient" Version="1.0.0" />
|
<PackageReference Include="Melipayamak.RestClient" Version="1.0.0" />
|
||||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
|
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
|
||||||
@@ -31,13 +24,17 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Common\DTOs\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
<ProjectReference Include="..\Shared\Shared.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Service">
|
<Reference Include="Service">
|
||||||
<HintPath>..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll</HintPath>
|
<HintPath>..\..\Dlls\Service.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Shared.DTOs.Serch;
|
using Shared.DTOs.Serch;
|
||||||
using Shared.DTOs;
|
using Shared.DTOs;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using Back.Common;
|
||||||
|
|
||||||
namespace Back.Controllers
|
namespace Back.Controllers
|
||||||
{
|
{
|
||||||
@@ -28,9 +29,92 @@ namespace Back.Controllers
|
|||||||
return Ok(await _servCOD.GetCODs(user.RolUsers.First().CompanyID, itemSerch));
|
return Ok(await _servCOD.GetCODs(user.RolUsers.First().CompanyID, itemSerch));
|
||||||
}
|
}
|
||||||
[HttpGet("GetUnits")]
|
[HttpGet("GetUnits")]
|
||||||
public async Task<ActionResult<IdName<int>>> GetUnits()
|
public async Task<ActionResult<List<IdName<int>>>> GetUnits()
|
||||||
{
|
{
|
||||||
return Ok(await _servCOD.GetUnits());
|
return Ok(await _servCOD.GetUnits());
|
||||||
}
|
}
|
||||||
|
[HttpPost("Add")]
|
||||||
|
public async Task<ActionResult<bool>> Add(RCOD item)
|
||||||
|
{
|
||||||
|
return Ok();
|
||||||
|
//var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||||
|
//var UserID = claim.Value;
|
||||||
|
//var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||||
|
|
||||||
|
//var resultValidationmodel = await _addorupdateCustomerValidation.ValidateAsync(Tuple.Create(user.RolUsers.First().CompanyID, item, eActionValidation.add));
|
||||||
|
//if (!resultValidationmodel.IsValid)
|
||||||
|
// return BadRequest(resultValidationmodel.Errors.Select(s => s.ErrorMessage).ToList());
|
||||||
|
|
||||||
|
//return Ok(await _servCus.AddOrUpdateCustomer(new Data.Models.Customer
|
||||||
|
//{
|
||||||
|
// Address = item.Address,
|
||||||
|
// BranchID = item.BranchID,
|
||||||
|
// CompanyID = user.RolUsers.First().CompanyID,
|
||||||
|
// CustomerType = item.CustomerType,
|
||||||
|
// EconomicCode = item.EconomicCode,
|
||||||
|
// Email = item.Email,
|
||||||
|
// FullName = item.FullName,
|
||||||
|
// Info = item.Info,
|
||||||
|
// MeliCode = item.MeliCode,
|
||||||
|
// PassportNumber = item.PassportNumber,
|
||||||
|
// Phone = item.Phone,
|
||||||
|
// ZipCode = item.ZipCode,
|
||||||
|
// IsDeleted = false
|
||||||
|
//}));
|
||||||
|
}
|
||||||
|
[HttpPut("Update")]
|
||||||
|
public async Task<ActionResult<bool>> Update(RCOD item)
|
||||||
|
{
|
||||||
|
return Ok();
|
||||||
|
////-----GetUserAndCompany
|
||||||
|
//var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||||
|
//var UserID = claim.Value;
|
||||||
|
//var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||||
|
|
||||||
|
////-----Validaton
|
||||||
|
//var resultValidationmodel = await _addorupdateCustomerValidation.ValidateAsync(Tuple.Create(user.RolUsers.First().CompanyID, item, eActionValidation.update));
|
||||||
|
//if (!resultValidationmodel.IsValid)
|
||||||
|
// return BadRequest(resultValidationmodel.Errors.Select(s => s.ErrorMessage).ToList());
|
||||||
|
|
||||||
|
////-----Get Cus
|
||||||
|
//var cus = await _servCus.GetCustomerByCustomerID(item.ID.Value, user.RolUsers.First().CompanyID);
|
||||||
|
//if (cus == null)
|
||||||
|
// return BadRequest(new List<string> { "Cus notFound..." });
|
||||||
|
|
||||||
|
////-----change Cus
|
||||||
|
//cus.Address = item.Address;
|
||||||
|
//cus.BranchID = item.BranchID;
|
||||||
|
//cus.CompanyID = user.RolUsers.First().CompanyID;
|
||||||
|
//cus.CustomerType = item.CustomerType;
|
||||||
|
//cus.EconomicCode = item.EconomicCode;
|
||||||
|
//cus.Email = item.Email;
|
||||||
|
//cus.FullName = item.FullName;
|
||||||
|
//cus.Info = item.Info;
|
||||||
|
//cus.MeliCode = item.MeliCode;
|
||||||
|
//cus.PassportNumber = item.PassportNumber;
|
||||||
|
//cus.Phone = item.Phone;
|
||||||
|
//cus.ZipCode = item.ZipCode;
|
||||||
|
//cus.IsDeleted = false;
|
||||||
|
|
||||||
|
////----Update and sendResult
|
||||||
|
//return Ok(await _servCus.AddOrUpdateCustomer(cus));
|
||||||
|
}
|
||||||
|
[HttpDelete("Delete/{ID}")]
|
||||||
|
public async Task<ActionResult<bool>> Delete(int ID)
|
||||||
|
{
|
||||||
|
return Ok();
|
||||||
|
////-----GetUserAndCompany
|
||||||
|
//var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||||
|
//var UserID = claim.Value;
|
||||||
|
//var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||||
|
|
||||||
|
////-----Get Cus
|
||||||
|
//var cus = await _servCus.GetCustomerByCustomerID(ID, user.RolUsers.First().CompanyID);
|
||||||
|
//if (cus == null)
|
||||||
|
// return NotFound();
|
||||||
|
|
||||||
|
////----Update and sendResult
|
||||||
|
//return Ok(await _servCus.DeleteCustomer(cus));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,6 +40,7 @@ builder.Services.AddScoped<servTaxPayer>();
|
|||||||
builder.Services.AddScoped<servCustomer>();
|
builder.Services.AddScoped<servCustomer>();
|
||||||
builder.Services.AddScoped<CompanyRegistrationValidation>();
|
builder.Services.AddScoped<CompanyRegistrationValidation>();
|
||||||
builder.Services.AddScoped<AddOrCustomerValidation>();
|
builder.Services.AddScoped<AddOrCustomerValidation>();
|
||||||
|
builder.Services.AddScoped<ServCOD>();
|
||||||
builder.Services.AddScoped(c => new mpNuget.RestClient("09119660045", "C54S2"));
|
builder.Services.AddScoped(c => new mpNuget.RestClient("09119660045", "C54S2"));
|
||||||
|
|
||||||
string origins = "OriginTaxPayer";
|
string origins = "OriginTaxPayer";
|
||||||
|
@@ -13,7 +13,7 @@ namespace Shared.DTOs
|
|||||||
public int? ID { get; set; }
|
public int? ID { get; set; }
|
||||||
[Display(Name = "شناسه مالیاتی")]
|
[Display(Name = "شناسه مالیاتی")]
|
||||||
public string? TaxID { get; set; }
|
public string? TaxID { get; set; }
|
||||||
[Display(Name = "عنوان")]
|
[Display(Name = "نام کالا")]
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public int UnitID { get; set; }
|
public int UnitID { get; set; }
|
||||||
[Display(Name = "واحد")]
|
[Display(Name = "واحد")]
|
||||||
|
182
TaxPayerFull/CUSComponent/CodItem.razor
Normal file
182
TaxPayerFull/CUSComponent/CodItem.razor
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
@using Front.Services
|
||||||
|
@using Shared.DTOs
|
||||||
|
@inject HttpClientController hc;
|
||||||
|
<form>
|
||||||
|
@* alert *@
|
||||||
|
<div class="row">
|
||||||
|
<Alert hidden="@Hidealert" Color="@alertColor" Dismissable="false">
|
||||||
|
<Icon Name="@alertIconName" class="me-2"></Icon>
|
||||||
|
@alertMessage
|
||||||
|
</Alert>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label class="col-sm-4 col-form-label" style="color:red" for="inputTitle">نام کالا</label>
|
||||||
|
<InputText @bind-Value="Cod.Title" type="text" class="form-control" id="inputTitle" placeholder="نام کالا" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label class="col-sm-5 col-form-label" style="color:red" for="inputUnitID">واحد اندازه گیزی</label>
|
||||||
|
<select @bind="Cod.UnitID" class="form-control" aria-label="Default select example" id="inputUnitID">
|
||||||
|
<option value="0" style="color: #b5b5b5" selected>انتخاب کنید...</option>
|
||||||
|
@if (Unitrequest != null)
|
||||||
|
{
|
||||||
|
foreach (var item in Unitrequest)
|
||||||
|
{
|
||||||
|
<option value="@item.ID">@item.Title</option>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="col-sm-5 col-form-label">شناسه مالیاتی کالا</label>
|
||||||
|
<InputText @bind-Value="Cod.TaxID" type="text" class="form-control" id="inputTaxID" placeholder="شناسه مالیاتی کالا" />
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label style="color:red" class="col-sm-5 col-form-label">% نرخ مالیات کالا</label>
|
||||||
|
<NumberInput @bind-Value="Cod.TaxRate" type="text" class="form-control" id="inputTaxRate" placeholder="نرخ مالیات کالا" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
@if (Cod.ID == 0)
|
||||||
|
{
|
||||||
|
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
|
||||||
|
جدید
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
|
||||||
|
ثبت تغییرات
|
||||||
|
</Button>
|
||||||
|
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="OnClickDelete" Type="ButtonType.Button">
|
||||||
|
حذف
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@code {
|
||||||
|
// alert
|
||||||
|
AlertColor alertColor = AlertColor.Primary;
|
||||||
|
IconName alertIconName = IconName.CheckCircleFill;
|
||||||
|
bool Hidealert = true;
|
||||||
|
string alertMessage = "";
|
||||||
|
[Parameter] public RCOD Cod { get; set; }
|
||||||
|
[Parameter] public EventCallback<ActionInResultComponent> OnMultipleOfThree { get; set; }
|
||||||
|
[Parameter] public List<IdName<int>>? Unitrequest { get; set; }
|
||||||
|
public ActionInResultComponent result { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
protected override Task OnParametersSetAsync()
|
||||||
|
{
|
||||||
|
|
||||||
|
result = new ActionInResultComponent()
|
||||||
|
{
|
||||||
|
Status = ComponentStatus.fild
|
||||||
|
};
|
||||||
|
Hidealert = true;
|
||||||
|
alertMessage = "";
|
||||||
|
return base.OnParametersSetAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@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 OnClickDelete()
|
||||||
|
{
|
||||||
|
|
||||||
|
var rsp = await hc.Delete($"Cod/Delete/{Cod.ID}");
|
||||||
|
if (rsp.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||||
|
if (request)
|
||||||
|
{
|
||||||
|
result.Status = ComponentStatus.success;
|
||||||
|
result.Action = ComponentAction.delete;
|
||||||
|
await OnMultipleOfThree.InvokeAsync(result);
|
||||||
|
}
|
||||||
|
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (rsp.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||||
|
{
|
||||||
|
ShowDangerAlert("کالا با این شناسه یافت نشد");
|
||||||
|
}
|
||||||
|
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public async Task OnClickUpdate()
|
||||||
|
{
|
||||||
|
if (Cod.UnitID > 0 && Cod.TaxRate > 0 && !string.IsNullOrEmpty(Cod.Title))
|
||||||
|
{
|
||||||
|
|
||||||
|
var rsp = await hc.Put<RCOD>("Cod/Update", Cod);
|
||||||
|
if (rsp.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||||
|
if (request)
|
||||||
|
{
|
||||||
|
result.Status = ComponentStatus.success;
|
||||||
|
result.Action = ComponentAction.update;
|
||||||
|
await OnMultipleOfThree.InvokeAsync(result);
|
||||||
|
}
|
||||||
|
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||||
|
ShowDangerAlert(request[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else ShowDangerAlert("فیلدهای قرمز باید مقدار دهی شوند");
|
||||||
|
}
|
||||||
|
public async Task OnClickAdd()
|
||||||
|
{
|
||||||
|
if (Cod.UnitID > 0 && Cod.TaxRate > 0 && !string.IsNullOrEmpty(Cod.Title))
|
||||||
|
{
|
||||||
|
|
||||||
|
var rsp = await hc.Post<RCOD>("Cod/Add", Cod);
|
||||||
|
if (rsp.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||||
|
|
||||||
|
if (request)
|
||||||
|
{
|
||||||
|
result.Status = ComponentStatus.success;
|
||||||
|
result.Action = ComponentAction.add;
|
||||||
|
await OnMultipleOfThree.InvokeAsync(result);
|
||||||
|
}
|
||||||
|
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||||
|
ShowDangerAlert(request[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else ShowDangerAlert("فیلدهای قرمز باید مقدار دهی شوند");
|
||||||
|
}
|
||||||
|
}
|
@@ -20,7 +20,7 @@
|
|||||||
</NavLink>
|
</NavLink>
|
||||||
</li>
|
</li>
|
||||||
<li class="menu-item @cssActionItem[2]" @onclick="() => onClickcssActionItem(2)">
|
<li class="menu-item @cssActionItem[2]" @onclick="() => onClickcssActionItem(2)">
|
||||||
<NavLink href="icons-boxicons.html" class="menu-link">
|
<NavLink href="Cod" class="menu-link">
|
||||||
<i class="menu-icon tf-icons bx bx-collection"></i>
|
<i class="menu-icon tf-icons bx bx-collection"></i>
|
||||||
<div>کالا</div>
|
<div>کالا</div>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
|
213
TaxPayerFull/Pages/UserPanel/COD.razor
Normal file
213
TaxPayerFull/Pages/UserPanel/COD.razor
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
@page "/Cod"
|
||||||
|
@using Front.Services
|
||||||
|
@using Shared.DTOs
|
||||||
|
@using Front.CUSComponent
|
||||||
|
@using Shared.DTOs.Serch
|
||||||
|
@inject HttpClientController hc;
|
||||||
|
<PageTitle>کالا</PageTitle>
|
||||||
|
<Modal @ref="modal" />
|
||||||
|
|
||||||
|
<Preload LoadingText="در حال بارگذاری..." />
|
||||||
|
@* search *@
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="card mb-2">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<ul class="list-group fa-padding" style="border: 2px solid #0d6efd">
|
||||||
|
<li class="list-group-item" data-toggle="modal" data-target="#issue">
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input @bind-value="itemsearch.CODID" placeholder="شناسه" style="text-align:center;" class="form-control" type="text" >
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input @bind-value="itemsearch.Title" placeholder="نام کالا" style="text-align:center;" class="form-control" type="text">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<select @bind="itemsearch.UnitID" class="form-control" aria-label="Default select example">
|
||||||
|
<option value="0" style="color: #b5b5b5" selected>واحد اندازه گیری ...</option>
|
||||||
|
@if (Unitrequest!=null)
|
||||||
|
{
|
||||||
|
foreach (var item in Unitrequest)
|
||||||
|
{
|
||||||
|
<option value="@item.ID">@item.Title</option>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input @bind-value="itemsearch.ItemTaxID" placeholder="شناسه مالیاتی" style="text-align:center;" class="form-control" type="text">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-auto">
|
||||||
|
<button @onclick="() => LoadCod(1)" type="submit" class="btn btn-primary">جستجو</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@* action *@
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="mb-2">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="col-auto">
|
||||||
|
<button type="submit" @onclick="()=>CodItem(0)" class="btn btn-primary">جدید</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@* alert *@
|
||||||
|
<div class="row">
|
||||||
|
<Alert hidden="@Hidealert" Color="@alertColor" Dismissable="false">
|
||||||
|
<Icon Name="@alertIconName" class="me-2"></Icon>
|
||||||
|
@alertMessage
|
||||||
|
</Alert>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@* data *@
|
||||||
|
@if (request != null)
|
||||||
|
{
|
||||||
|
<LTable ModelinComponent="request?.list" OnMultipleOfThree="EventCallback.Factory.Create<int>(this,CodItem)" />
|
||||||
|
@* pagination *@
|
||||||
|
<p style="color:red">@request?.RowCount آیتم یافت شد</p>
|
||||||
|
<nav aria-label="Page navigation">
|
||||||
|
<ul class="pagination justify-content-center">
|
||||||
|
@for (int page = 1; page <= request?.PageCount; page++)
|
||||||
|
{
|
||||||
|
if (page == PageIndex)
|
||||||
|
{
|
||||||
|
<li class="page-item active">
|
||||||
|
<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
|
||||||
|
@code {
|
||||||
|
|
||||||
|
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
||||||
|
ItemSerchGetCOD itemsearch = new ItemSerchGetCOD();
|
||||||
|
[Parameter, SupplyParameterFromQuery]
|
||||||
|
public int? PageIndex { get; set; }
|
||||||
|
public List<IdName<int>>? Unitrequest { get; set; }
|
||||||
|
public Shared.DTOs.PagingDto<RCOD>? request { get; set; }
|
||||||
|
private Modal modal = default!;
|
||||||
|
// alert
|
||||||
|
AlertColor alertColor = AlertColor.Primary;
|
||||||
|
IconName alertIconName = IconName.CheckCircleFill;
|
||||||
|
bool Hidealert = true;
|
||||||
|
string alertMessage = "";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
var rsp = await hc.Get("COD/GetUnits");
|
||||||
|
if (rsp.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
Unitrequest = await rsp.Content.ReadFromJsonAsync<List<IdName<int>>>();
|
||||||
|
}
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
}
|
||||||
|
protected override async Task OnParametersSetAsync()
|
||||||
|
{
|
||||||
|
if (PageIndex == null) PageIndex = 1;
|
||||||
|
await LoadCod(PageIndex.Value);
|
||||||
|
await base.OnParametersSetAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@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 LoadCod(int pi)
|
||||||
|
{
|
||||||
|
|
||||||
|
itemsearch.PageSize = 10;
|
||||||
|
itemsearch.PageIndex = pi;
|
||||||
|
PreloadService.Show(SpinnerColor.Dark);
|
||||||
|
var rsp = await hc.Post<ItemSerchGetCOD>("COD/GetAll", itemsearch);
|
||||||
|
if (rsp.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
request = await rsp.Content.ReadFromJsonAsync<PagingDto<RCOD>>();
|
||||||
|
}
|
||||||
|
else if(rsp.StatusCode==System.Net.HttpStatusCode.Forbidden)
|
||||||
|
{
|
||||||
|
ShowDangerAlert("شما دسترسی به خواندن اطلاعات کالا را نداربد");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||||
|
}
|
||||||
|
PreloadService.Hide();
|
||||||
|
}
|
||||||
|
public async Task CallBackCodItem(ActionInResultComponent result)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (result.Action == ComponentAction.add)
|
||||||
|
{
|
||||||
|
if (result.Status==ComponentStatus.success)
|
||||||
|
ShowSuccessAlert("کالا جدید با موفقیت اضافه شد");
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (result.Action == ComponentAction.update)
|
||||||
|
{
|
||||||
|
if (result.Status == ComponentStatus.success)
|
||||||
|
ShowSuccessAlert("اطلاعات کالا با موفقیت ویرایش شد");
|
||||||
|
}
|
||||||
|
else if (result.Action == ComponentAction.delete)
|
||||||
|
{
|
||||||
|
if (result.Status == ComponentStatus.success)
|
||||||
|
ShowSuccessAlert("کالا با موفقیت حذف شد");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.Status == ComponentStatus.success)
|
||||||
|
await LoadCod(1);
|
||||||
|
|
||||||
|
await modal.HideAsync();
|
||||||
|
}
|
||||||
|
public async Task CodItem(int ID)
|
||||||
|
{
|
||||||
|
|
||||||
|
var parameters = new Dictionary<string, object>();
|
||||||
|
|
||||||
|
if(ID == 0) parameters.Add("Cod", new RCOD(){ID=0});
|
||||||
|
else parameters.Add("Cod", request.list.Where(w=>w.ID==ID).First().Clone());
|
||||||
|
parameters.Add("Unitrequest", Unitrequest);
|
||||||
|
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create<ActionInResultComponent>(this, CallBackCodItem));
|
||||||
|
await modal.ShowAsync<CodItem>(title: ID == 0 ? "کالا جدید" : "ویرایش اطلاعات", parameters: parameters);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -200,7 +200,7 @@
|
|||||||
else parameters.Add("Cus", request.list.Where(w=>w.ID==ID).First().Clone());
|
else parameters.Add("Cus", request.list.Where(w=>w.ID==ID).First().Clone());
|
||||||
|
|
||||||
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create<ActionInResultComponent>(this, CallBackCustomerItem));
|
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create<ActionInResultComponent>(this, CallBackCustomerItem));
|
||||||
await modal.ShowAsync<CustomerItem>(title: ID == null ? "مشتری جدید" : "ویرایش اطلاعات", parameters: parameters);
|
await modal.ShowAsync<CustomerItem>(title: ID == 0 ? "مشتری جدید" : "ویرایش اطلاعات", parameters: parameters);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -33,9 +33,9 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
|
|||||||
}) ;
|
}) ;
|
||||||
|
|
||||||
|
|
||||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
||||||
|
|
||||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||||
|
|
||||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user