...
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
@using Front.Services
|
||||
@using Shared.DTOs
|
||||
@using Shared
|
||||
|
||||
|
||||
@inject HttpClientController hc;
|
||||
@layout PanelLayout
|
||||
@inject Fixedvalues fv;
|
||||
@@ -10,6 +12,15 @@
|
||||
<Preload LoadingText="در حال بارگذاری..." />
|
||||
<ConfirmDialog @ref="dialog" />
|
||||
<Toasts AutoHide="true" Delay="6000" class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
|
||||
|
||||
|
||||
|
||||
@if (invoice.IsDeleted)
|
||||
{
|
||||
<h1 style="color:red">این صورتحساب حذف شده و در دسترس نمی باشد</h1>
|
||||
<br />
|
||||
<hr class="hr" />
|
||||
}
|
||||
<form>
|
||||
@* alert *@
|
||||
<div class="row">
|
||||
@@ -19,7 +30,7 @@
|
||||
</Alert>
|
||||
|
||||
</div>
|
||||
@if (InvoiceID == 0 || InvoiceID == null ? false : true)
|
||||
@if (InvoiceID == 0 || InvoiceID == null ? false : true && !invoice.IsDeleted)
|
||||
{
|
||||
<div class="row g-3">
|
||||
|
||||
@@ -27,31 +38,31 @@
|
||||
@switch (invoice.invoiceType)
|
||||
{
|
||||
case(InvoiceType.Bidding):
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Sale)" id="cut"><span>فاکتور</span></button>
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.CANCEL)" id="sred1"><span>لغو</span></button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.Sale)" id="cut"><span>فاکتور</span></Button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.Cancellation)" id="sred1"><span>ابطال</span></Button>
|
||||
break;
|
||||
|
||||
case (InvoiceType.Sale):
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.BackFrmSale)" id="copy"><span>برگشت فروش</span></button>
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Repair)" id="paste"><span>اصلاح</span></button>
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Cancellation)" id="sred"><span>ابطال</span></button>
|
||||
<button class="button" id="sred1" @onclick="() => ChangeStatus(InvoiceType.CANCEL)"><span>لغو</span></button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.BackFrmSale)" id="copy"><span>برگشت فروش</span></Button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.Repair)" id="paste"><span>اصلاح</span></Button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.Cancellation)" id="sred"><span>ابطال</span></Button>
|
||||
@* <Button class="button" style="color:white;" id="sred1" @onclick="() => ChangeStatus((int)InvoiceType.CANCEL)"><span>لغو</span></Button> *@
|
||||
break;
|
||||
|
||||
case (InvoiceType.BackFrmSale):
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Cancellation)" id="sred"><span>ابطال</span></button>
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.CANCEL)" id="sred1"><span>لغو</span></button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.Cancellation)" id="sred"><span>ابطال</span></Button>
|
||||
@* <Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.CANCEL)" id="sred1"><span>لغو</span></Button> *@
|
||||
break;
|
||||
|
||||
case (InvoiceType.Repair):
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Cancellation)" id="sred"><span>ابطال</span></button>
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.CANCEL)" id="sred1"><span>لغو</span></button>
|
||||
<button class="button" id="copy" @onclick="() => ChangeStatus(InvoiceType.BackFrmSale)"><span>برگشت فروش</span></button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.Cancellation)" id="sred"><span>ابطال</span></Button>
|
||||
@* <Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.CANCEL)" id="sred1"><span>لغو</span></Button> *@
|
||||
<Button class="button" style="color:white;" id="copy" @onclick="() => ChangeStatus((int)InvoiceType.BackFrmSale)"><span>برگشت فروش</span></Button>
|
||||
break;
|
||||
|
||||
case (InvoiceType.Cancellation):
|
||||
<button class="button" id="sred1" @onclick="() => ChangeStatus(InvoiceType.CANCEL)"><span>لغو</span></button>
|
||||
break;
|
||||
@* case (InvoiceType.Cancellation):
|
||||
<Button class="button" style="color:white;" id="sred1" @onclick="() => ChangeStatus((int)InvoiceType.CANCEL)"><span>لغو</span></Button>
|
||||
break; *@
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +174,7 @@
|
||||
<InputText style=" text-align: center;" @bind-Value="invoice.InvoiceDate" type="text" class="form-control" id="inputInvoiceDate" placeholder="تاریخ" />
|
||||
</div>
|
||||
</div>
|
||||
@if (InvoiceID == 0 || InvoiceID == null ? false : true)
|
||||
@if (InvoiceID == 0 || InvoiceID == null ? false : true )
|
||||
{
|
||||
<br /> <hr class="hr" />
|
||||
<div class="row g-3">
|
||||
@@ -174,15 +185,18 @@
|
||||
<div class="form-group col-md-11">
|
||||
@if (InvoiceID.HasValue && invoice.items.Count > 0)
|
||||
{
|
||||
<LGridInvoiceItem InvoiceID="InvoiceID.Value" OnMultipleOfThree="EventCallback.Factory.Create<string>(this, CallBack)" InvoiceItems="invoice.items" />
|
||||
<LGridInvoiceItem IsDeleted="invoice.IsDeleted" InvoiceID="InvoiceID.Value" OnMultipleOfThree="EventCallback.Factory.Create<string>(this, CallBack)" InvoiceItems="invoice.items" />
|
||||
|
||||
}
|
||||
</div>
|
||||
<div class="form-group col-md-1">
|
||||
|
||||
<Button class="mt-3" Color="ButtonColor.Dark" @onclick="NewItemClick" Outline="true" Type="ButtonType.Button">
|
||||
+
|
||||
</Button>
|
||||
@if (!invoice.IsDeleted)
|
||||
{
|
||||
<Button class="mt-3" Color="ButtonColor.Dark" @onclick="NewItemClick" Outline="true" Type="ButtonType.Button">
|
||||
+
|
||||
</Button>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -236,35 +250,46 @@
|
||||
<InputText style=" text-align: center;" @bind-Value="invoice.Udate" class="form-control" id="inputUdate" readonly />
|
||||
|
||||
</div>
|
||||
@* @if (invoice.BillReference.HasValue)
|
||||
{
|
||||
<div class="row g-3">
|
||||
<Button Color="ButtonColor.Link"><NavLink href="InvoiceDetails/@invoice.BillReference.Value">صورتحساب مرجع</NavLink></Button>
|
||||
</div>
|
||||
} *@
|
||||
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<br />
|
||||
@if (InvoiceID == 0 || InvoiceID == null)
|
||||
@if (!invoice.IsDeleted)
|
||||
{
|
||||
<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="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
|
||||
حذف
|
||||
</Button>
|
||||
@if (InvoiceID == 0 || InvoiceID == null)
|
||||
{
|
||||
<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="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
|
||||
حذف
|
||||
</Button>
|
||||
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="ShowReport" Type="ButtonType.Button">
|
||||
چاپ
|
||||
</Button>
|
||||
}
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<br />
|
||||
<div class="row g-3">
|
||||
@if (invoice.BillReference.HasValue)
|
||||
{
|
||||
<div class="row g-3">
|
||||
@{
|
||||
string Prefence = "InvoiceDetails/" + invoice.BillReference.Value.ToString();
|
||||
}
|
||||
<Button Color="ButtonColor.Link"><NavLink href="@Prefence">صورتحساب مرجع</NavLink></Button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -272,6 +297,7 @@
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
List<ToastMessage> messages = new List<ToastMessage>();
|
||||
private ConfirmDialog dialog = default!;
|
||||
private Modal modal = default!;
|
||||
@@ -285,9 +311,10 @@
|
||||
public List<ForCustomerSearch>? Cus { get; set; }
|
||||
public List<IdName<int>>? Patterns { get; set; }
|
||||
public InvoiceDTO? invoice { get; set; }
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
invoice = new InvoiceDTO();
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
@@ -344,15 +371,17 @@
|
||||
|
||||
|
||||
}
|
||||
private async Task ChangeStatus(InvoiceType type)
|
||||
private async Task ChangeStatus(int type)
|
||||
{
|
||||
var rsp = await hc.Post<InvoiceType>($"Invoice/ChangeInvoiceType/{InvoiceID}",type);
|
||||
|
||||
var rsp = await hc.Post($"Invoice/ChangeInvoiceType/{InvoiceID}?invoiceType={type}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var resinvoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
||||
if (resinvoice!=null)
|
||||
{
|
||||
invoice = resinvoice;
|
||||
InvoiceID = resinvoice.ID;
|
||||
ShowSuccessAlert("تغییر وضعیت با موفقیت انجام شد");
|
||||
}
|
||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
@@ -362,20 +391,33 @@
|
||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(request[0]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private async Task ShowReport()
|
||||
{
|
||||
if (InvoiceID.HasValue)
|
||||
{
|
||||
hc._nav.NavigateTo($"InvoiceReport/{InvoiceID}");
|
||||
}
|
||||
}
|
||||
private async Task LoadData()
|
||||
{
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
var rsp = await hc.Get($"Invoice/Get/{InvoiceID}");
|
||||
var rsp = await hc.Get($"Invoice/Get/{InvoiceID}/{true}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
invoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
||||
invoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
||||
}
|
||||
else if(rsp.StatusCode==System.Net.HttpStatusCode.BadRequest)
|
||||
{
|
||||
ShowDangerAlert("صورتحساب مرجع یافت نشد");
|
||||
}
|
||||
else
|
||||
hc._nav.NavigateTo("/Panel");
|
||||
|
||||
{
|
||||
ShowDangerAlert("خطایی در بارگذاری");
|
||||
}
|
||||
PreloadService.Hide();
|
||||
}
|
||||
public async Task CallBack(ActionInResultComponent result)
|
||||
|
Reference in New Issue
Block a user