...
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
namespace Front.CUSComponent
|
||||
{
|
||||
public class Employee
|
||||
{
|
||||
public string LastName { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
}
|
||||
}
|
@@ -1,323 +0,0 @@
|
||||
@using Front.Services
|
||||
@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">
|
||||
<Alert hidden="@Hidealert" Color="@alertColor" Dismissable="false">
|
||||
<Icon Name="@alertIconName" class="me-2"></Icon>
|
||||
@alertMessage
|
||||
</Alert>
|
||||
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<InputText @bind-Value="invoice.Title" type="text" class="form-control" id="inputTitle" placeholder="عنوان" />
|
||||
</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" id="inputinvoiceTypeTitle">
|
||||
@if (!invoice.invoiceType.HasValue)
|
||||
{
|
||||
<option value="0" style="color: #b5b5b5" selected>انتخاب کنید...</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="0" style="color: #b5b5b5">انتخاب کنید...</option>
|
||||
}
|
||||
|
||||
|
||||
@foreach (InvoiceType i in Enum.GetValues(typeof(InvoiceType)))
|
||||
{
|
||||
|
||||
if (invoice.invoiceType == i)
|
||||
{
|
||||
<option value="@i" selected>@i.GetEnumDisplayName()</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<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)
|
||||
{
|
||||
<option value="0" style="color: #b5b5b5" selected>انتخاب کنید...</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="0" style="color: #b5b5b5">انتخاب کنید...</option>
|
||||
}
|
||||
|
||||
@if (Patterns != null)
|
||||
{
|
||||
foreach (var item in Patterns)
|
||||
{
|
||||
if (invoice.PatternID == item.ID)
|
||||
{
|
||||
<option value="@item.ID" selected>@item.Title</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@item.ID">@item.Title</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label class="col-sm-5 col-form-label" style="color:red" for="inputCustomerID">مشتری</label>
|
||||
<select @bind="invoice.CustomerID" class="form-control" aria-label="Default select example" id="inputCustomerID">
|
||||
@if (invoice.CustomerID == null || invoice.CustomerID == 0)
|
||||
{
|
||||
<option value="0" style="color: #b5b5b5" selected>انتخاب کنید...</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="0" style="color: #b5b5b5">انتخاب کنید...</option>
|
||||
}
|
||||
|
||||
@if (Cus != null)
|
||||
{
|
||||
foreach (var item in Cus)
|
||||
{
|
||||
if (invoice.CustomerID == item.ID)
|
||||
{
|
||||
<option value="@item.ID" selected>@item.CustomerName</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@item.ID">@item.CustomerName</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label class="col-sm-5 col-form-label" for="inputInvoicIssueDate">تاریخ صدور</label>
|
||||
<InputText style=" text-align: center;" @bind-Value="invoice.InvoicIssueDate" type="text" class="form-control" id="inputInvoicIssueDate" placeholder="تاریخ صدور" />
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label class="col-sm-4 col-form-label" for="inputInvoiceDate">تاریخ</label>
|
||||
<InputText style=" text-align: center;" @bind-Value="invoice.InvoiceDate" type="text" class="form-control" id="inputInvoiceDate" placeholder="تاریخ" />
|
||||
</div>
|
||||
</div>
|
||||
<br /> <hr class="hr" />
|
||||
<div class="row g-3">
|
||||
<Tabs NavStyle="NavStyle.VerticalUnderline">
|
||||
<Tab Title="آیتم ها" IsActive="true">
|
||||
<Content>
|
||||
<p class="ms-3">This is the placeholder content for the <b>Home</b> tab.</p>
|
||||
</Content>
|
||||
</Tab>
|
||||
<Tab Title="پرداختی ها">
|
||||
<Content>
|
||||
<p class="ms-3">This is the placeholder content for the <b>Profile</b> tab.</p>
|
||||
</Content>
|
||||
</Tab>
|
||||
|
||||
</Tabs>
|
||||
</div>
|
||||
<hr class="hr" />
|
||||
<br />
|
||||
<div class="row g-3">
|
||||
<div class="form-group col-md-8">
|
||||
<label class="col-sm-4 col-form-label" for="inputdes">توضیحات</label>
|
||||
<InputText @bind-Value="invoice.Des" type="text" class="form-control" id="inputdes" placeholder="توضیحات" />
|
||||
</div>
|
||||
<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>
|
||||
|
||||
|
||||
@if (invoice.ID == 0)
|
||||
{
|
||||
<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="OnClickDelete" Type="ButtonType.Button">
|
||||
حذف
|
||||
</Button>
|
||||
}
|
||||
|
||||
|
||||
@code {
|
||||
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
||||
// alert
|
||||
AlertColor alertColor = AlertColor.Primary;
|
||||
IconName alertIconName = IconName.CheckCircleFill;
|
||||
bool Hidealert = true;
|
||||
string alertMessage = "";
|
||||
[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 async Task OnInitializedAsync()
|
||||
{
|
||||
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)
|
||||
{
|
||||
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 = "";
|
||||
PreloadService.Hide();
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
}
|
||||
@functions {
|
||||
private void ShowSuccessAlert(string msg)
|
||||
{
|
||||
Hidealert = false;
|
||||
alertColor = AlertColor.Success;
|
||||
alertIconName = IconName.CheckCircleFill;
|
||||
alertMessage = msg;
|
||||
}
|
||||
private void ShowDangerAlert(string msg)
|
||||
{
|
||||
Hidealert = false;
|
||||
alertColor = AlertColor.Danger;
|
||||
alertIconName = IconName.ExclamationTriangleFill;
|
||||
alertMessage = msg;
|
||||
}
|
||||
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("خطایی در اجرای عملیات رخ داده");
|
||||
// }
|
||||
|
||||
// else if (rsp.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||
// {
|
||||
// ShowDangerAlert("کالا با این شناسه یافت نشد");
|
||||
// }
|
||||
// else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
public async Task OnClickUpdate()
|
||||
{
|
||||
// if (Cod.UnitID > 0 && Cod.TaxRate > 0 && !string.IsNullOrEmpty(Cod.Title))
|
||||
// {
|
||||
|
||||
// var rsp = await hc.Put<RCOD>("Cod/Update", Cod);
|
||||
// if (rsp.IsSuccessStatusCode)
|
||||
// {
|
||||
// var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
// if (request)
|
||||
// {
|
||||
// result.Status = ComponentStatus.success;
|
||||
// result.Action = ComponentAction.update;
|
||||
// await OnMultipleOfThree.InvokeAsync(result);
|
||||
// }
|
||||
// else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
// ShowDangerAlert(request[0]);
|
||||
// }
|
||||
// }
|
||||
// else ShowDangerAlert("فیلدهای قرمز باید مقدار دهی شوند");
|
||||
}
|
||||
public async Task OnClickAdd()
|
||||
{
|
||||
// if (Cod.UnitID > 0 && Cod.TaxRate > 0 && !string.IsNullOrEmpty(Cod.Title))
|
||||
// {
|
||||
|
||||
// var rsp = await hc.Post<RCOD>("Cod/Add", Cod);
|
||||
// if (rsp.IsSuccessStatusCode)
|
||||
// {
|
||||
// var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
|
||||
// if (request)
|
||||
// {
|
||||
// result.Status = ComponentStatus.success;
|
||||
// result.Action = ComponentAction.add;
|
||||
// await OnMultipleOfThree.InvokeAsync(result);
|
||||
// }
|
||||
// else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
// var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
// ShowDangerAlert(request[0]);
|
||||
// }
|
||||
// }
|
||||
// else ShowDangerAlert("فیلدهای قرمز باید مقدار دهی شوند");
|
||||
}
|
||||
public async Task<bool> Validate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -1,81 +0,0 @@
|
||||
@using System.Reflection
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Shared.DTOs
|
||||
@typeparam T
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="mb-4">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="table-responsive text-nowrap">
|
||||
<table class="table">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
@{
|
||||
PropertyInfo[] properties = typeof(T).GetProperties();
|
||||
foreach (var item in properties)
|
||||
{
|
||||
if (item.GetCustomAttributes(typeof(DisplayAttribute), false).Length > 0)
|
||||
{
|
||||
<th>
|
||||
@item.CustomAttributes.Where(w => w.AttributeType.Name == "DisplayAttribute").Select(s => s.NamedArguments.Where(w => w.MemberName == "Name").Select(ss => ss.TypedValue.Value).First()).First().ToString()
|
||||
</th>
|
||||
}
|
||||
|
||||
}
|
||||
<th>عملیات</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-border-bottom-0">
|
||||
@{
|
||||
foreach (var item in ModelinComponent)
|
||||
{
|
||||
<tr>
|
||||
@{
|
||||
properties = item.GetType().GetProperties();
|
||||
int id = 0;
|
||||
foreach (PropertyInfo property in properties)
|
||||
{
|
||||
if (property.Name.ToLower()=="id")
|
||||
id =Convert.ToInt32(property.GetValue(item, null));
|
||||
|
||||
if (property.CustomAttributes.Any(w => w.AttributeType.Name == "DisplayAttribute"))
|
||||
{
|
||||
<td>@property.GetValue(item, null)</td>
|
||||
}
|
||||
|
||||
}
|
||||
if (id>0)
|
||||
{
|
||||
<td><button @onclick="()=>OnMultipleOfThree.InvokeAsync(Convert.ToInt32(id))" type="button" class="btn btn-link">ویرایش</button></td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td><button type="button" class="btn btn-link disabled">ویرایش</button></td>
|
||||
}
|
||||
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public List<T> ModelinComponent { get; set; } = new List<T>();
|
||||
[Parameter] public EventCallback<int> OnMultipleOfThree { get; set; }
|
||||
}
|
Reference in New Issue
Block a user