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 HttpClientController hc;
@inject Fixedvalues fv; @inject Fixedvalues fv;
<ConfirmDialog @ref="dialog" /> <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> <form>
@* alert *@ @* alert *@

View File

@@ -9,7 +9,7 @@
<Modal @ref="modal" /> <Modal @ref="modal" />
<Preload LoadingText="در حال بارگذاری..." /> <Preload LoadingText="در حال بارگذاری..." />
<ConfirmDialog @ref="dialog" /> <ConfirmDialog @ref="dialog" />
<Toasts AutoHide="true" Delay="6000" class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
<form> <form>
@* alert *@ @* alert *@
<div class="row"> <div class="row">
@@ -19,7 +19,28 @@
</Alert> </Alert>
</div> </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="row g-3">
<div class="form-group col-md-2"> <div class="form-group col-md-2">
<label class="col-sm-4 col-form-label" style="color:red" for="inputTitle">عنوان</label> <label class="col-sm-4 col-form-label" style="color:red" for="inputTitle">عنوان</label>
@@ -124,12 +145,11 @@
</div> </div>
@if (InvoiceID == 0 || InvoiceID == null ? false : true) @if (InvoiceID == 0 || InvoiceID == null ? false : true)
{ {
<br /> <hr class="hr" /> <br /> <hr class="hr" />
<div class="row g-3"> <div class="row g-3">
<Tabs NavStyle="NavStyle.VerticalUnderline"> @* <Tabs NavStyle="NavStyle.VerticalUnderline">
<Tab Title="آیتم ها" IsActive="true"> <Tab Title="آیتم ها" IsActive="true">
<Content> <Content> *@
<div class="row g-3"> <div class="row g-3">
<div class="form-group col-md-11"> <div class="form-group col-md-11">
@if (InvoiceID.HasValue && invoice.items.Count > 0) @if (InvoiceID.HasValue && invoice.items.Count > 0)
@@ -146,8 +166,8 @@
</div> </div>
</div> </div>
</Content> @* </Content>
</Tab> </Tab> *@
@* <Tab Title="پرداختی ها"> @* <Tab Title="پرداختی ها">
<Content> <Content>
<div class="row g-3"> <div class="row g-3">
@@ -166,11 +186,25 @@
</Content> </Content>
</Tab> *@ </Tab> *@
</Tabs> @* </Tabs> *@
</div> </div>
} }
<br />
<hr class="hr" /> <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 /> <br />
<div class="row g-3"> <div class="row g-3">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
@@ -184,7 +218,7 @@
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<br /> <br />
@if(InvoiceID == 0 || InvoiceID == null) @if (InvoiceID == 0 || InvoiceID == null)
{ {
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button"> <Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
جدید جدید
@@ -211,7 +245,7 @@
@code { @code {
[Inject] ToastService ToastService { get; set; } = default!; List<ToastMessage> messages = new List<ToastMessage>();
private ConfirmDialog dialog = default!; private ConfirmDialog dialog = default!;
private Modal modal = default!; private Modal modal = default!;
[Inject] protected PreloadService PreloadService { get; set; } = default!; [Inject] protected PreloadService PreloadService { get; set; } = default!;
@@ -245,7 +279,7 @@
{ {
invoice = new InvoiceDTO() invoice = new InvoiceDTO()
{ {
invoiceType=InvoiceType.Bidding, invoiceType = InvoiceType.Bidding,
ID = 0, ID = 0,
InvoiceDate = DateTime.Now.ConvertMiladiToShamsiinFront().ShamciToFormatShamciinFront(), InvoiceDate = DateTime.Now.ConvertMiladiToShamsiinFront().ShamciToFormatShamciinFront(),
InvoicIssueDate = DateTime.Now.ConvertMiladiToShamsiinFront().ShamciToFormatShamciinFront(), InvoicIssueDate = DateTime.Now.ConvertMiladiToShamsiinFront().ShamciToFormatShamciinFront(),
@@ -261,6 +295,14 @@
} }
} }
@functions { @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() private async Task NewItemClick()
{ {
if (InvoiceID.HasValue) if (InvoiceID.HasValue)
@@ -382,7 +424,7 @@
if (request) if (request)
{ {
ToastService.Notify(new ToastMessage(ToastType.Success, $"عملیات با موفقیت انجام شد")); ShowSuccessAlert("ویرایش با موفقیت انجام شد");
} }
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده"); else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
@@ -426,7 +468,7 @@
{ {
CustomerID = invoice.CustomerID, CustomerID = invoice.CustomerID,
Des = invoice.Des, Des = invoice.Des,
InvoiceDate = invoice.InvoiceDate.Replace("/",""), InvoiceDate = invoice.InvoiceDate.Replace("/", ""),
InvoicIssueDate = invoice.InvoicIssueDate.Replace("/", ""), InvoicIssueDate = invoice.InvoicIssueDate.Replace("/", ""),
PatternID = invoice.PatternID, PatternID = invoice.PatternID,
Title = invoice.Title Title = invoice.Title
@@ -495,8 +537,8 @@
{ ShowDangerAlert("تاریخ صدور نمی تواند از امروز جلوتر باشد"); return false; } { ShowDangerAlert("تاریخ صدور نمی تواند از امروز جلوتر باشد"); return false; }
} }
if (invoice.PatternID.HasValue) if (invoice.PatternID.HasValue && invoice.PatternID > 0)
if (invoice.PatternID <= 0 || !Patterns.Any(w => w.ID == invoice.PatternID.Value)) if (!Patterns.Any(w => w.ID == invoice.PatternID.Value))
{ ShowDangerAlert("شناسه الگو صحیح نمی باشد"); return false; } { ShowDangerAlert("شناسه الگو صحیح نمی باشد"); return false; }
if (invoice.CustomerID == null || invoice.CustomerID <= 0 || !Cus.Any(w => w.ID == invoice.CustomerID)) if (invoice.CustomerID == null || invoice.CustomerID <= 0 || !Cus.Any(w => w.ID == invoice.CustomerID))
@@ -519,7 +561,7 @@
} }
else else
{ {
ToastService.Notify(new ToastMessage(ToastType.Secondary, $"عملیات حذف متوقف شد")); ShowMessage(ToastType.Secondary, "عملیات حذف متوقف شد");
} }
} }