...
This commit is contained in:
@@ -2,6 +2,11 @@
|
||||
@using Shared.DTOs
|
||||
@using Shared
|
||||
@inject HttpClientController hc;
|
||||
@layout PanelLayout
|
||||
@inject Fixedvalues fv;
|
||||
@page "/InvoiceDetails/{InvoiceID:int}"
|
||||
@page "/InvoiceDetails"
|
||||
<Preload LoadingText="در حال بارگذاری..." />
|
||||
<form>
|
||||
@* alert *@
|
||||
<div class="row">
|
||||
@@ -29,9 +34,9 @@
|
||||
<option value="0" style="color: #b5b5b5">انتخاب کنید...</option>
|
||||
}
|
||||
|
||||
|
||||
@foreach (InvoiceType i in Enum.GetValues(typeof(InvoiceType)))
|
||||
{
|
||||
|
||||
@foreach (InvoiceType i in Enum.GetValues(typeof(InvoiceType)))
|
||||
{
|
||||
|
||||
if (invoice.invoiceType == i)
|
||||
{
|
||||
@@ -42,16 +47,16 @@
|
||||
<option value="@i">@i.GetEnumDisplayName()</option>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label class="col-sm-8 col-form-label" for="inputPatternID">الگو صورتحساب</label>
|
||||
<select @bind="invoice.PatternID" class="form-control" aria-label="Default select example" id="inputPatternID">
|
||||
@if (invoice.PatternID == null || invoice.PatternID ==0)
|
||||
@if (invoice.PatternID == null || invoice.PatternID == 0)
|
||||
{
|
||||
<option value="0" style="color: #b5b5b5" selected>انتخاب کنید...</option>
|
||||
}
|
||||
@@ -126,7 +131,7 @@
|
||||
<p class="ms-3">This is the placeholder content for the <b>Profile</b> tab.</p>
|
||||
</Content>
|
||||
</Tab>
|
||||
|
||||
|
||||
</Tabs>
|
||||
</div>
|
||||
<hr class="hr" />
|
||||
@@ -139,12 +144,12 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label class="col-sm-4 col-form-label" for="inputUdate">آخرین ویرایش</label>
|
||||
<InputText style=" text-align: center;" @bind-Value="invoice.Udate" class="form-control" id="inputUdate" readonly />
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
@@ -166,29 +171,55 @@ else
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
||||
// alert
|
||||
AlertColor alertColor = AlertColor.Primary;
|
||||
IconName alertIconName = IconName.CheckCircleFill;
|
||||
bool Hidealert = true;
|
||||
string alertMessage = "";
|
||||
[Parameter] public List<ForCustomerSearch> Cus { get; set; }
|
||||
[Parameter] public List<IdName<int>> Patterns { get; set; }
|
||||
[Parameter] public InvoiceDTO invoice { get; set; }
|
||||
[Parameter] public EventCallback<ActionInResultComponent> OnMultipleOfThree { get; set; }
|
||||
// [Parameter] public List<IdName<int>>? Unitrequest { get; set; }
|
||||
public ActionInResultComponent result { get; set; }
|
||||
[Parameter] public int? InvoiceID { get; set; }
|
||||
public List<ForCustomerSearch>? Cus { get; set; }
|
||||
public List<IdName<int>>? Patterns { get; set; }
|
||||
public InvoiceDTO? invoice { get; set; }
|
||||
|
||||
|
||||
protected override Task OnParametersSetAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
result = new ActionInResultComponent()
|
||||
invoice = new InvoiceDTO();
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
Cus =await fv.GetCustomers();
|
||||
Patterns = await fv.GetPatterns();
|
||||
if (InvoiceID != null && InvoiceID > 0)
|
||||
{
|
||||
var rsp = await hc.Get($"Invoice/Get/{InvoiceID}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
Status = ComponentStatus.fild
|
||||
};
|
||||
invoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
||||
}
|
||||
else
|
||||
hc._nav.NavigateTo("/Pael");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
invoice = new InvoiceDTO()
|
||||
{
|
||||
ID = 0,
|
||||
InvoiceDate = DateTime.Now.ConvertMiladiToShamsiinFront().ShamciToFormatShamciinFront(),
|
||||
InvoicIssueDate = DateTime.Now.ConvertMiladiToShamsiinFront().ShamciToFormatShamciinFront(),
|
||||
Udate = DateTime.Now.ConvertMiladiToShamsiinFront().ShamciToFormatShamciinFront()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Hidealert = true;
|
||||
alertMessage = "";
|
||||
return base.OnParametersSetAsync();
|
||||
PreloadService.Hide();
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
}
|
||||
@functions {
|
||||
@@ -209,24 +240,25 @@ else
|
||||
public async Task OnClickDelete()
|
||||
{
|
||||
|
||||
var rsp = await hc.Delete($"Cod/Delete/{invoice.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("خطایی در اجرای عملیات رخ داده");
|
||||
}
|
||||
// var rsp = await hc.Delete($"Cod/Delete/{invoice.ID}");
|
||||
// if (rsp.IsSuccessStatusCode)
|
||||
// {
|
||||
// var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
// if (request)
|
||||
// {
|
||||
// result.Status = ComponentStatus.success;
|
||||
// result.Action = ComponentAction.delete;
|
||||
|
||||
else if (rsp.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||
{
|
||||
ShowDangerAlert("کالا با این شناسه یافت نشد");
|
||||
}
|
||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
// //await OnMultipleOfThree.InvokeAsync(result);
|
||||
// }
|
||||
// else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
// }
|
||||
|
||||
// else if (rsp.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||
// {
|
||||
// ShowDangerAlert("کالا با این شناسه یافت نشد");
|
||||
// }
|
||||
// else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user