This commit is contained in:
mmrbnjd
2024-08-08 18:20:21 +03:30
parent cd95332a3d
commit 70df7d48b4
5 changed files with 119 additions and 19 deletions

View File

@@ -12,6 +12,8 @@ namespace Front
public readonly HttpClientController _hc;
private List<ForCustomerSearch>? Cus = null;
private List<IdName<int>>? Patterns = null;
private List<IdName<int>>? Patternsbyinp = null;
private List<IdName<int>>? BillTypes = null;
private List<IdName<int>>? Units = null;
private List<CODIdName<int>>? Cods = null;
private CompanyDTO? InfoCompany = null;
@@ -68,6 +70,34 @@ namespace Front
return Patterns;
}
public async Task<List<IdName<int>>?> GetPatternsbyinp()
{
if (Patternsbyinp == null)
{
var request = await _hc.Get($"TaxPayer/GetPatterns");
if (request.IsSuccessStatusCode)
{
Patternsbyinp = await request.Content.ReadFromJsonAsync<List<IdName<int>>>();
}
}
return Patternsbyinp;
}
public async Task<List<IdName<int>>?> GetBillTypes()
{
if (BillTypes == null)
{
var request = await _hc.Get($"TaxPayer/GetBillTypes");
if (request.IsSuccessStatusCode)
{
BillTypes = await request.Content.ReadFromJsonAsync<List<IdName<int>>>();
}
}
return BillTypes;
}
public async Task<CompanyDTO?> GetInfoCompany()
{

View File

@@ -4,6 +4,7 @@
@using Shared.DTOs
@layout PanelLayout
@inject HttpClientController hc;
@inject Fixedvalues fv;
<Preload LoadingText="در حال بارگذاری..." />
<ConfirmDialog @ref="dialog" />
<Toasts AutoHide="true" Delay="6000" class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
@@ -74,11 +75,11 @@ else
{
if (item.Des != null && item.Des.Count() > 0 && !FullInvoice)
{
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(item.Des,item.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
<label style="color:red;" class="form-label">@item.fName</label>
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(item.Des,item.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
<label style="color:red;" class="form-label">@item.fName</label>
}
else
{
@@ -90,10 +91,10 @@ else
{
if (item.Des != null && item.Des.Count() > 0 && !FullInvoice)
{
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(item.Des,item.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
<label class="form-label">@item.fName</label>
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(item.Des,item.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
<label class="form-label">@item.fName</label>
}
else
{
@@ -122,7 +123,48 @@ else
}
else if (item.InputBox == "autofild")
{
<input @bind-value="item.Value" style="text-align:center;" class="form-control" type="text" placeholder="@item.fName" disabled />
if (item.eName.ToLower() == "inty")
{
var bill = BillTypes.Where(w => w.ID == Convert.ToInt32(item.Value)).Select(s => s.Title).FirstOrDefault();
if (bill != null)
{
item.Value = bill;
}
<input @bind-value="item.Value" style="text-align:center;" class="form-control" type="text" placeholder="@item.fName" disabled />
}
else if (item.eName.ToLower() == "inp")
{
var patt = Patterns.Where(w => w.ID == Convert.ToInt32(item.Value)).Select(s => s.Title).FirstOrDefault();
if (patt != null)
{
item.Value = patt;
}
<input @bind-value="item.Value" style="text-align:center;" class="form-control" type="text" placeholder="@item.fName" disabled />
}
else if (item.eName.ToLower() == "ins")
{
var patt = Patterns.Where(w => w.ID == Convert.ToInt32(item.Value)).Select(s => s.Title).FirstOrDefault();
if (patt != null)
{
item.Value = patt;
}
<input @bind-value="item.Value" style="text-align:center;" class="form-control" type="text" placeholder="@item.fName" disabled />
}
else
{
<input @bind-value="item.Value" style="text-align:center;" class="form-control" type="text" placeholder="@item.fName" disabled />
}
}
@@ -167,8 +209,8 @@ else
{
if (itemB.Des != null && itemB.Des.Count() > 0 && !FullInvoice)
{
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(itemB.Des,itemB.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
<label style="color:red;" class="form-label">@itemB.fName</label>
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(itemB.Des,itemB.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
<label style="color:red;" class="form-label">@itemB.fName</label>
}
else
{
@@ -179,8 +221,8 @@ else
{
if (itemB.Des != null && itemB.Des.Count() > 0 && !FullInvoice)
{
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(itemB.Des,itemB.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
<label class="form-label">@itemB.fName</label>
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(itemB.Des,itemB.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
<label class="form-label">@itemB.fName</label>
}
else
{
@@ -212,6 +254,8 @@ else
{
<input @bind-value="itemB.Value" style="text-align:center;" class="form-control" type="text" placeholder="@itemB.fName" disabled />
}
else
{
@@ -269,6 +313,8 @@ else
@code {
private List<IdName<int>>? Patterns = new List<IdName<int>>();
private List<IdName<int>>? BillTypes = new List<IdName<int>>();
private Modal modal = default!;
private ConfirmDialog dialog = default!;
[Parameter] public int? InvoiceID { get; set; }
@@ -285,6 +331,9 @@ else
protected override async Task OnParametersSetAsync()
{
PreloadService.Show(SpinnerColor.Dark);
Patterns = await fv.GetPatternsbyinp();
BillTypes = await fv.GetBillTypes();
await LoadData();
PreloadService.Hide();
@@ -352,7 +401,7 @@ else
}
else
{
ShowMessage(ToastType.Danger, "خطای در آماده سازی اطلاعات رخ داده");
ShowMessage(ToastType.Danger, "خطای در آماده سازی اطلاعات رخ داده");
}
}
else

View File

@@ -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");