...
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Service">
|
||||
<HintPath>..\..\Dlls\Service.dll</HintPath>
|
||||
<HintPath>..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
@@ -11,8 +11,8 @@ namespace Shared.DTOs
|
||||
public int ID { get; set; }
|
||||
public int PermissionID { get; set; }
|
||||
public string PermissionTitle { get; set; }
|
||||
public int CreditAmount { get; set; }
|
||||
public decimal APrice { get; set; }
|
||||
public int CreditAmount { get; set; }
|
||||
public decimal APrice { get; set; }
|
||||
public decimal TPrice { get { return APrice * CreditAmount; } }
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ namespace Shared.DTOs
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public decimal TotalPrice { get { return promotionDetails==null ? 0 : promotionDetails.Sum(s => s.TPrice); } }
|
||||
public ICollection<PromotionDetailDto> promotionDetails { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -6,10 +6,10 @@
|
||||
|
||||
|
||||
|
||||
<div class="row g-3">
|
||||
<div class="col-md-2">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<Dropdown Color="DropdownColor.Secondary">
|
||||
<DropdownToggleButton>نوع سفارش</DropdownToggleButton>
|
||||
<DropdownToggleButton>@orderSelectName</DropdownToggleButton>
|
||||
<DropdownMenu>
|
||||
@foreach (var i in orderstype)
|
||||
{
|
||||
@@ -18,46 +18,172 @@
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
|
||||
<label>@orderSelectName</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-3">
|
||||
<hr class="hr" />
|
||||
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:40%" scope="col">سیستم</th>
|
||||
<th style="width:30%" scope="col">قیمت پایه</th>
|
||||
<th scope="col">تعداد</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (Selected!=null)
|
||||
{
|
||||
if (Selected.promotionDetails.Any(w => w.PermissionID == 3))
|
||||
{
|
||||
<tr>
|
||||
<td>@Selected.promotionDetails.Where(w => w.PermissionID == 3).Select(s => s.PermissionTitle).FirstOrDefault()</td>
|
||||
<td>@Selected.promotionDetails.Where(w => w.PermissionID == 3).Select(s => s.APrice).FirstOrDefault().ToString("N0") ريال</td>
|
||||
<td>
|
||||
@if (Selected.ID < 0)
|
||||
{
|
||||
<InputNumber @bind-Value="values[0]" @bind-Value:after="OnInput" type="text" class="form-control" id="inputfa" style="text-align:center;" placeholder="تعداد" />
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<input value="@Selected.promotionDetails.Where(w => w.PermissionID == 3).Select(s => s.CreditAmount).FirstOrDefault()" style="text-align:center;" class="form-control" type="text" readonly>
|
||||
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
if (Selected.promotionDetails.Any(w => w.PermissionID == 4))
|
||||
{
|
||||
<tr>
|
||||
<td>@Selected.promotionDetails.Where(w => w.PermissionID == 4).Select(s => s.PermissionTitle).FirstOrDefault()</td>
|
||||
<td>@Selected.promotionDetails.Where(w => w.PermissionID == 4).Select(s => s.APrice).FirstOrDefault().ToString("N0") ريال</td>
|
||||
<td>
|
||||
@if (Selected.ID < 0)
|
||||
{
|
||||
<InputNumber @bind-Value="values[1]" @bind-Value:after="OnInput" type="text" class="form-control" id="inputcod" style="text-align:center;" placeholder="تعداد" />
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<input value="@Selected.promotionDetails.Where(w => w.PermissionID == 4).Select(s => s.CreditAmount).FirstOrDefault()" style="text-align:center;" class="form-control" type="text" readonly>
|
||||
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
|
||||
if (Selected.promotionDetails.Any(w => w.PermissionID == 5))
|
||||
{
|
||||
<tr>
|
||||
<td>@Selected.promotionDetails.Where(w => w.PermissionID == 5).Select(s => s.PermissionTitle).FirstOrDefault()</td>
|
||||
<td>@Selected.promotionDetails.Where(w => w.PermissionID == 5).Select(s => s.APrice).FirstOrDefault().ToString("N0") ريال</td>
|
||||
<td>
|
||||
@if (Selected.ID < 0)
|
||||
{
|
||||
<InputNumber @bind-Value="values[2]" @bind-Value:after="OnInput" type="text" class="form-control" id="inputcus" style="text-align:center;" placeholder="تعداد" />
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<input value="@Selected.promotionDetails.Where(w => w.PermissionID == 5).Select(s => s.CreditAmount).FirstOrDefault()" style="text-align:center;" class="form-control" type="text" readonly>
|
||||
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
if (Selected.promotionDetails.Any(w => w.PermissionID == 16))
|
||||
{
|
||||
<tr>
|
||||
<td>@Selected.promotionDetails.Where(w => w.PermissionID == 16).Select(s => s.PermissionTitle).FirstOrDefault()</td>
|
||||
<td>@Selected.promotionDetails.Where(w => w.PermissionID == 16).Select(s => s.APrice).FirstOrDefault().ToString("N0") ريال</td>
|
||||
<td>
|
||||
@if (Selected.ID < 0)
|
||||
{
|
||||
<InputNumber @bind-Value="values[3]" @bind-Value:after="OnInput" type="text" class="form-control" id="inputax" style="text-align:center;" placeholder="تعداد" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input value="@Selected.promotionDetails.Where(w => w.PermissionID == 16).Select(s => s.CreditAmount).FirstOrDefault()" style="text-align:center;" class="form-control" type="text" readonly>
|
||||
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<span class="text-muted fw-light">قیمت نهایی :</span> @TotalPrice.ToString("N0") ريال
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<button type="submit" @onclick="NewOrder" class="btn btn-primary">ثبت</button>
|
||||
<button type="submit" @onclick="NewOrder" class="btn btn-primary">ثبت</button>
|
||||
</div>
|
||||
</div>
|
||||
@code {
|
||||
string orderSelectName = "";
|
||||
string orderSelectName = "نوع سفارش";
|
||||
int orderSelectID = 0;
|
||||
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
||||
[Parameter] public EventCallback<OrderDto> OnMultipleOfThree { get; set; }
|
||||
List<IdName<int>> orderstype = new List<IdName<int>>()
|
||||
{ new IdName<int>() { ID=999,Title="شخصی" },
|
||||
new IdName<int>() { ID=919,Title="qw" }};
|
||||
public List<PromotionDto> Promotions { get; set; } = new();
|
||||
public List<PricingDto> Pricing { get; set; } = new();
|
||||
List<IdName<int>> orderstype = new List<IdName<int>>();
|
||||
public List<PromotionDto> Promotions { get; set; } = new();
|
||||
public PromotionDto? Selected { get; set; } = null;
|
||||
// invoice cod cus tax
|
||||
int[] values = { 0,0,0,0};
|
||||
decimal TotalPrice = 0;
|
||||
}
|
||||
@functions {
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
|
||||
Promotions = await fv.LoadPromotion();
|
||||
Pricing = await fv.LoadPricing();
|
||||
|
||||
orderstype.AddRange(Promotions.Select(s => new IdName<int>
|
||||
{
|
||||
ID = s.ID,
|
||||
Title = s.Name
|
||||
}).ToList());
|
||||
{ ID = s.ID, Title = s.Name }).ToList());
|
||||
|
||||
await base.OnParametersSetAsync();
|
||||
|
||||
}
|
||||
public async Task OnChange(int ID,string Title)
|
||||
public async Task OnChange(int ID, string Title)
|
||||
{
|
||||
orderSelectID = ID;
|
||||
orderSelectName = Title;
|
||||
|
||||
Selected = Promotions.Where(w => w.ID == ID).First();
|
||||
}
|
||||
private async Task OnInput()
|
||||
{
|
||||
if (Selected != null)
|
||||
{
|
||||
var itemFac= Selected.promotionDetails.Where(w => w.PermissionID == 3).FirstOrDefault();
|
||||
if (itemFac!=null)
|
||||
itemFac.CreditAmount = values[0];
|
||||
|
||||
var itemcod = Selected.promotionDetails.Where(w => w.PermissionID == 4).FirstOrDefault();
|
||||
if (itemcod != null)
|
||||
itemcod.CreditAmount = values[1];
|
||||
|
||||
var itemcus = Selected.promotionDetails.Where(w => w.PermissionID == 5).FirstOrDefault();
|
||||
if (itemcus != null)
|
||||
itemcus.CreditAmount = values[2];
|
||||
|
||||
var itemtax = Selected.promotionDetails.Where(w => w.PermissionID == 16).FirstOrDefault();
|
||||
if (itemtax != null)
|
||||
itemtax.CreditAmount = values[3];
|
||||
|
||||
TotalPrice = Selected.TotalPrice;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public async Task NewOrder()
|
||||
{
|
||||
|
||||
}
|
||||
public async Task NewOrder() { }
|
||||
}
|
||||
|
@@ -18,8 +18,8 @@ namespace Front
|
||||
public InvoiceDTO? invoice { get; set; } = null;
|
||||
public DashBoardDTO? dashBoard { get; set; } = null;
|
||||
|
||||
private List<PromotionDto>? Promotions { get; set; } = null;
|
||||
private List<PricingDto>? Pricing { get; set; } = null;
|
||||
private List<PromotionDto> Promotions { get; set; } = null;
|
||||
|
||||
public Fixedvalues(HttpClientController hc)
|
||||
{
|
||||
_hc = hc;
|
||||
@@ -114,26 +114,41 @@ namespace Front
|
||||
|
||||
|
||||
|
||||
}
|
||||
public async Task<List<PricingDto>> LoadPricing()
|
||||
{
|
||||
if (Pricing == null)
|
||||
{
|
||||
var rsp = await _hc.Get($"Orders/GetAllPricing");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
Pricing = await rsp.Content.ReadFromJsonAsync<List<PricingDto>>();
|
||||
}
|
||||
return Pricing ?? new List<PricingDto>() ;
|
||||
|
||||
}
|
||||
public async Task<List<PromotionDto>> LoadPromotion()
|
||||
{
|
||||
if(Promotions==null)
|
||||
{var rsp = await _hc.Get($"Orders/GetAllPromotion");
|
||||
if (Promotions == null)
|
||||
{
|
||||
List<PricingDto> Pricing = new List<PricingDto>();
|
||||
var rsp = await _hc.Get($"Orders/GetAllPromotion");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
Promotions = await rsp.Content.ReadFromJsonAsync<List<PromotionDto>>();
|
||||
{
|
||||
Promotions = await rsp.Content.ReadFromJsonAsync<List<PromotionDto>>() ?? new List<PromotionDto>();
|
||||
|
||||
rsp = await _hc.Get($"Orders/GetAllPricing");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
Pricing = await rsp.Content.ReadFromJsonAsync<List<PricingDto>>() ?? new List<PricingDto>();
|
||||
|
||||
if (Pricing.Count>0)
|
||||
{
|
||||
Promotions.Add(new PromotionDto()
|
||||
{
|
||||
ID = -1,
|
||||
Name = "شخصی",
|
||||
promotionDetails = Pricing.Select(s => new PromotionDetailDto
|
||||
{
|
||||
ID = 0,
|
||||
APrice = s.Price,
|
||||
CreditAmount = 0,
|
||||
PermissionID = s.PermissionID,
|
||||
PermissionTitle = s.PermissionTitle
|
||||
}).ToList()
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return Promotions?? new List<PromotionDto>();
|
||||
return Promotions ?? new List<PromotionDto>();
|
||||
|
||||
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
@inject Fixedvalues fv;
|
||||
<PageTitle>سفارشات</PageTitle>
|
||||
<Modal Size="ModalSize.ExtraLarge" @ref="modal" />
|
||||
<Modal Size="ModalSize.ExtraLarge" @ref="Newordermodal" />
|
||||
<Modal Size="ModalSize.Small" @ref="Newordermodal" />
|
||||
<Preload LoadingText="در حال بارگذاری..." />
|
||||
@* search *@
|
||||
<div class="row">
|
||||
|
@@ -37,10 +37,10 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://195.88.208.142:7075/api/") });
|
||||
|
||||
//Home
|
||||
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/") });
|
||||
|
||||
//farzan
|
||||
//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");
|
||||
|
||||
|
Reference in New Issue
Block a user