This commit is contained in:
mmrbnjd
2024-05-28 17:29:20 +03:30
parent 325a2bad5e
commit dd17d8cb1e
2 changed files with 95 additions and 53 deletions

View File

@@ -3,7 +3,7 @@
@inject HttpClientController hc;
@inject Fixedvalues fv;
<ConfirmDialog @ref="dialog" />
<Toasts class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
<Toasts AutoHide="true" Delay="6000" class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
<form>
@* alert *@

View File

@@ -9,7 +9,7 @@
<Modal @ref="modal" />
<Preload LoadingText="در حال بارگذاری..." />
<ConfirmDialog @ref="dialog" />
<Toasts AutoHide="true" Delay="6000" class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
<form>
@* alert *@
<div class="row">
@@ -19,7 +19,28 @@
</Alert>
</div>
@if (InvoiceID == 0 || InvoiceID == null ? false : true)
{
<div class="row g-3">
<div class="col-md-1">
<Button Color="ButtonColor.Success" Outline="true"> فاکتور </Button>
</div>
<div class="col-md-2">
<Button Color="ButtonColor.Info" Disabled="true" Outline="true"> برگشت از فروش </Button>
</div>
<div class="col-md-1">
<Button Color="ButtonColor.Primary" Disabled="true" Outline="true"> اصلاح </Button>
</div>
<div class="col-md-1">
<Button Color="ButtonColor.Danger" Disabled="true" Outline="true"> ابطال </Button>
</div>
<div class="col-md-1">
<Button Color="ButtonColor.Dark" Outline="true"> لغو </Button>
</div>
</div>
<br />
<hr class="hr" />
}
<div class="row g-3">
<div class="form-group col-md-2">
<label class="col-sm-4 col-form-label" style="color:red" for="inputTitle">عنوان</label>
@@ -27,7 +48,7 @@
</div>
<div class="form-group col-md-2">
<label class="col-sm-4 col-form-label" for="inputinvoiceTypeTitle">نوع</label>
<select @bind="invoice.invoiceType" class="form-control" aria-label="Default select example" disabled id="inputinvoiceTypeTitle">
<select @bind="invoice.invoiceType" class="form-control" aria-label="Default select example" disabled id="inputinvoiceTypeTitle">
@if (!invoice.invoiceType.HasValue)
{
<option value="0" style="color: #b5b5b5" selected>انتخاب کنید...</option>
@@ -122,55 +143,68 @@
<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">
<Tabs NavStyle="NavStyle.VerticalUnderline">
<Tab Title="آیتم ها" IsActive="true">
<Content>
<div class="row g-3">
<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" />
}
</div>
<div class="form-group col-md-1">
<Button class="mt-3" Color="ButtonColor.Dark" @onclick="NewItemClick" Outline="true" Type="ButtonType.Button">
+
</Button>
</div>
</div>
</Content>
</Tab>
@* <Tab Title="پرداختی ها">
<Content>
<br /> <hr class="hr" />
<div class="row g-3">
@* <Tabs NavStyle="NavStyle.VerticalUnderline">
<Tab Title="آیتم ها" IsActive="true">
<Content> *@
<div class="row g-3">
<div class="form-group col-md-11">
<LGridInvoicePayment InvoicePays="invoice.payments" />
</div>
<div class="form-group col-md-1">
<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" />
<Button class="mt-3" Color="ButtonColor.Dark" @onclick="OnClickDelete" Outline="true" Type="ButtonType.Button">
+
</Button>
</div>
}
</div>
<div class="form-group col-md-1">
<Button class="mt-3" Color="ButtonColor.Dark" @onclick="NewItemClick" Outline="true" Type="ButtonType.Button">
+
</Button>
</div>
</div>
@* </Content>
</Tab> *@
@* <Tab Title="پرداختی ها">
<Content>
<div class="row g-3">
<div class="form-group col-md-11">
<LGridInvoicePayment InvoicePays="invoice.payments" />
</div>
<div class="form-group col-md-1">
</Content>
</Tab> *@
<Button class="mt-3" Color="ButtonColor.Dark" @onclick="OnClickDelete" Outline="true" Type="ButtonType.Button">
+
</Button>
</div>
</div>
</Tabs>
</div>
</Content>
</Tab> *@
@* </Tabs> *@
</div>
}
<br />
<hr class="hr" />
<div class="row g-3">
<div class="form-group col-md-4">
<label class="col-sm-6 col-form-label">مجموع تخفیف</label>
<CurrencyInput TValue="decimal?" @bind-Value="invoice.tdis" Locale="fa-Ir" Placeholder="مجموع تخفیف" readonly />
</div>
<div class="form-group col-md-4">
<label class="col-sm-6 col-form-label">مجموع مالیات</label>
<CurrencyInput TValue="decimal?" @bind-Value="invoice.tvam" Locale="fa-Ir" Placeholder="مجموع مالیات" readonly />
</div> <div class="form-group col-md-4">
<label class="col-sm-6 col-form-label">مجموع صورتحساب</label>
<CurrencyInput TValue="decimal?" @bind-Value="invoice.tbill" Locale="fa-Ir" Placeholder="مجموع صورتحساب" readonly />
</div>
</div>
<br />
<div class="row g-3">
<div class="form-group col-md-6">
@@ -184,7 +218,7 @@
</div>
<div class="form-group col-md-4">
<br />
@if(InvoiceID == 0 || InvoiceID == null)
@if (InvoiceID == 0 || InvoiceID == null)
{
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
جدید
@@ -211,7 +245,7 @@
@code {
[Inject] ToastService ToastService { get; set; } = default!;
List<ToastMessage> messages = new List<ToastMessage>();
private ConfirmDialog dialog = default!;
private Modal modal = default!;
[Inject] protected PreloadService PreloadService { get; set; } = default!;
@@ -245,7 +279,7 @@
{
invoice = new InvoiceDTO()
{
invoiceType=InvoiceType.Bidding,
invoiceType = InvoiceType.Bidding,
ID = 0,
InvoiceDate = DateTime.Now.ConvertMiladiToShamsiinFront().ShamciToFormatShamciinFront(),
InvoicIssueDate = DateTime.Now.ConvertMiladiToShamsiinFront().ShamciToFormatShamciinFront(),
@@ -261,6 +295,14 @@
}
}
@functions {
private void ShowMessage(ToastType toastType, string msg) => messages.Add(CreateToastMessage(toastType, msg));
private ToastMessage CreateToastMessage(ToastType toastType, string msg)
=> new ToastMessage
{
Type = toastType,
Message = msg,
};
private async Task NewItemClick()
{
if (InvoiceID.HasValue)
@@ -382,7 +424,7 @@
if (request)
{
ToastService.Notify(new ToastMessage(ToastType.Success, $"عملیات با موفقیت انجام شد"));
ShowSuccessAlert("ویرایش با موفقیت انجام شد");
}
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
@@ -426,7 +468,7 @@
{
CustomerID = invoice.CustomerID,
Des = invoice.Des,
InvoiceDate = invoice.InvoiceDate.Replace("/",""),
InvoiceDate = invoice.InvoiceDate.Replace("/", ""),
InvoicIssueDate = invoice.InvoicIssueDate.Replace("/", ""),
PatternID = invoice.PatternID,
Title = invoice.Title
@@ -495,8 +537,8 @@
{ ShowDangerAlert("تاریخ صدور نمی تواند از امروز جلوتر باشد"); return false; }
}
if (invoice.PatternID.HasValue)
if (invoice.PatternID <= 0 || !Patterns.Any(w => w.ID == invoice.PatternID.Value))
if (invoice.PatternID.HasValue && invoice.PatternID > 0)
if (!Patterns.Any(w => w.ID == invoice.PatternID.Value))
{ ShowDangerAlert("شناسه الگو صحیح نمی باشد"); return false; }
if (invoice.CustomerID == null || invoice.CustomerID <= 0 || !Cus.Any(w => w.ID == invoice.CustomerID))
@@ -519,7 +561,7 @@
}
else
{
ToastService.Notify(new ToastMessage(ToastType.Secondary, $"عملیات حذف متوقف شد"));
ShowMessage(ToastType.Secondary, "عملیات حذف متوقف شد");
}
}