order in front
This commit is contained in:
@@ -34,7 +34,7 @@ namespace Back.Controllers
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<List<PricingDto>>> GetAllPricing() => Ok(await _servPricing.GetPricing());
|
||||
[HttpPost("GetAllOrder")]
|
||||
public async Task<ActionResult<List<OrderDto>>> GetAllOrder(ItemSerachOrder itemSerach)
|
||||
public async Task<ActionResult<PagingDto< OrderDto>>> GetAllOrder(ItemSerachOrder itemSerach)
|
||||
{
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
var UserID = claim.Value;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Common;
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.DTOs;
|
||||
@@ -18,7 +19,7 @@ namespace Back.Services
|
||||
_repoOrderItem = repoOrderItem;
|
||||
|
||||
}
|
||||
public async Task<List<OrderDto>> GetOrdersByCompanyID(int CompanyID, ItemSerachOrder itemSerach)
|
||||
public async Task<PagingDto<OrderDto>> GetOrdersByCompanyID(int CompanyID, ItemSerachOrder itemSerach)
|
||||
{
|
||||
var request = _repoOrder.Get(w => w.CompanyID == CompanyID);
|
||||
|
||||
@@ -41,7 +42,7 @@ namespace Back.Services
|
||||
TPrice = w.TPrice,
|
||||
TTax = w.TPrice,
|
||||
lstDiscount = w.lstDiscount,
|
||||
}).ToListAsync();
|
||||
}).Paging(itemSerach.PageIndex,itemSerach.PageSize);
|
||||
}
|
||||
public async Task<List<OrderItemDto>> GetOrderItems(int OrderID,int CompanyID)
|
||||
{
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -8,15 +9,25 @@ namespace Shared.DTOs
|
||||
{
|
||||
public class OrderDto
|
||||
{
|
||||
[Display(Name = "شناسه")]
|
||||
public int ID { get; set; }
|
||||
|
||||
public StatusOrder Status { get; set; }
|
||||
[Display(Name = "وضعیت")]
|
||||
public string StatusTitle { get { return Status.GetEnumDisplayName(); } }
|
||||
[Display(Name = "زمان ایجاد")]
|
||||
public string DateCreate { get; set; }
|
||||
[Display(Name = "زمان پرداخت")]
|
||||
public string ApprovalDate { get; set; }
|
||||
[Display(Name = "مبلغ سفارش")]
|
||||
public decimal PreDiscount { get; set; }
|
||||
[Display(Name = "تخفیف سفارش")]
|
||||
public decimal TDiscount { get; set; }
|
||||
[Display(Name = "مبلغ بغد از تخفیف")]
|
||||
public decimal lstDiscount { get; set; }
|
||||
[Display(Name = "مبلغ مالیات")]
|
||||
public decimal TTax { get; set; }
|
||||
[Display(Name = "مبلغ نهایی")]
|
||||
public decimal TPrice { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -6,9 +6,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTOs.Serch
|
||||
{
|
||||
public class ItemSerachOrder
|
||||
public class ItemSerachOrder : IFildGlobalItemSerch
|
||||
{
|
||||
public int? ID { get; set; }
|
||||
public StatusOrder? Status { get; set; }
|
||||
public int PageIndex { get; set; } = 1;
|
||||
public int PageSize { get; set; } = 5;
|
||||
}
|
||||
}
|
||||
|
@@ -51,23 +51,23 @@
|
||||
<div>پشتیبانی</div>
|
||||
</NavLink>
|
||||
</li>
|
||||
@* <li class="menu-item @cssActionItem[6]" @onclick="() => onClickcssActionItem(6)">
|
||||
<NavLink href="#" class="menu-link">
|
||||
<i class="menu-icon tf-icons bx bx-copy"></i>
|
||||
<div >سفارشات</div>
|
||||
</NavLink>
|
||||
</li> *@
|
||||
|
||||
<li class="menu-item @cssActionItem[7]" @onclick="() => onClickcssActionItem(7)">
|
||||
<NavLink href="Setting" class="menu-link">
|
||||
<i class="menu-icon tf-icons bx bx-file"></i>
|
||||
<div>تنظیمات</div>
|
||||
</NavLink>
|
||||
</li>
|
||||
|
||||
<li class="menu-item @cssActionItem[8]" @onclick="() => onClickcssActionItem(8)">
|
||||
<NavLink href="Orders" class="menu-link">
|
||||
<i class="menu-icon tf-icons bx bx-copy"></i>
|
||||
<div >سفارشات</div>
|
||||
</NavLink>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
@code{
|
||||
string[] cssActionItem = { "active", "", "", "", "", "", "", "" };
|
||||
string[] cssActionItem = { "active", "", "", "", "", "", "", "", "" };
|
||||
|
||||
}
|
||||
@functions{
|
||||
|
211
TaxPayerFull/Pages/UserPanel/Orders.razor
Normal file
211
TaxPayerFull/Pages/UserPanel/Orders.razor
Normal file
@@ -0,0 +1,211 @@
|
||||
@page "/Orders"
|
||||
@using Front.Services
|
||||
@using Shared
|
||||
@using Shared.DTOs
|
||||
@using Front.CUSComponent
|
||||
@using Shared.DTOs.Serch
|
||||
@inject HttpClientController hc;
|
||||
@inject Fixedvalues fv;
|
||||
<PageTitle>سفارشات</PageTitle>
|
||||
<Modal Size="ModalSize.ExtraLarge" @ref="modal" />
|
||||
<Preload LoadingText="در حال بارگذاری..." />
|
||||
@* search *@
|
||||
<div class="row">
|
||||
<h4 class="fw-bold py-3 mb-4">
|
||||
<span class="text-muted fw-light">متفرقه /</span> سفارشات
|
||||
</h4>
|
||||
<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.ID" placeholder="شناسه" style="text-align:center;" class="form-control" type="text">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select @bind="ItemSearchOrdertype" class="form-control" aria-label="Default select example">
|
||||
<option value="0" style="color: #b5b5b5" selected>وضعیت سفارش ...</option>
|
||||
|
||||
@foreach (StatusOrder i in Enum.GetValues(typeof(StatusOrder)))
|
||||
{
|
||||
|
||||
<option value="@Convert.ToInt32(i)">@i.GetEnumDisplayName()</option>
|
||||
|
||||
|
||||
}
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-auto">
|
||||
<button @onclick="() => GetOrders(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">
|
||||
<ul class="list-group fa-padding">
|
||||
<li class="list-group-item" data-toggle="modal" data-target="#issue">
|
||||
<div class="row g-3">
|
||||
<div class="col-auto">
|
||||
|
||||
<button type="submit" @onclick="()=>OrderItem(0)" class="btn btn-primary">جدید</button>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</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,OrderItem)" />
|
||||
@* 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 {
|
||||
//private Modal stuffmodal = default!;
|
||||
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
||||
ItemSerachOrder itemsearch = new ItemSerachOrder();
|
||||
public int? ItemSearchOrdertype { get; set; }
|
||||
[Parameter, SupplyParameterFromQuery]
|
||||
public int? PageIndex { get; set; }
|
||||
public Shared.DTOs.PagingDto<OrderDto>? 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()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (PageIndex == null) PageIndex = 1;
|
||||
await GetOrders(PageIndex.Value);
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
}
|
||||
@functions {
|
||||
public async Task GetOrders(int pi=1)
|
||||
{
|
||||
if (ItemSearchOrdertype == 0 || ItemSearchOrdertype == null)
|
||||
itemsearch.Status = null;
|
||||
else
|
||||
itemsearch.Status = (StatusOrder)ItemSearchOrdertype;
|
||||
|
||||
itemsearch.PageSize = 10;
|
||||
itemsearch.PageIndex = pi;
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
var rsp = await hc.Post<ItemSerachOrder>("Orderss/GetAllOrder",itemsearch);
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
request = await rsp.Content.ReadFromJsonAsync<Shared.DTOs.PagingDto<OrderDto>?>();
|
||||
else
|
||||
ShowDangerAlert("خطایی در بارگیری سفارشات رخ داده");
|
||||
PreloadService.Hide();
|
||||
|
||||
}
|
||||
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 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 GetOrders(1);
|
||||
|
||||
await modal.HideAsync();
|
||||
}
|
||||
public async Task OrderItem(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);
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user