...
This commit is contained in:
@@ -83,14 +83,14 @@ namespace Back.Controllers
|
|||||||
{
|
{
|
||||||
ID = item.ID,
|
ID = item.ID,
|
||||||
acn = item.acn,
|
acn = item.acn,
|
||||||
iinn = item.acn,
|
iinn = item.iinn,
|
||||||
pcn = item.acn,
|
pcn = item.pcn,
|
||||||
PaymentDateTime = item.PaymentDateTime.ShamciToFormatShamci(),
|
PaymentDateTime = item.PaymentDateTime.ShamciToFormatShamci(),
|
||||||
pid = item.pid,
|
pid = item.pid,
|
||||||
pmt = item.pmt,
|
pmt = item.pmt,
|
||||||
pv = item.pv,
|
pv = item.pv,
|
||||||
trmn = item.trmn,
|
trmn = item.trmn,
|
||||||
trn = item.acn,
|
trn = item.trn,
|
||||||
paymentMethod = item.pmt.HasValue ? codings.Where(w => w.Code == item.pmt.Value.ToString()).Select(s => s.Title).FirstOrDefault() : null,
|
paymentMethod = item.pmt.HasValue ? codings.Where(w => w.Code == item.pmt.Value.ToString()).Select(s => s.Title).FirstOrDefault() : null,
|
||||||
} :null);
|
} :null);
|
||||||
}
|
}
|
||||||
@@ -159,14 +159,14 @@ namespace Back.Controllers
|
|||||||
{
|
{
|
||||||
ID = modelout.ID,
|
ID = modelout.ID,
|
||||||
acn = modelout.acn,
|
acn = modelout.acn,
|
||||||
iinn = modelout.acn,
|
iinn = modelout.iinn,
|
||||||
pcn = modelout.acn,
|
pcn = modelout.pcn,
|
||||||
PaymentDateTime = modelout.PaymentDateTime.ShamciToFormatShamci(),
|
PaymentDateTime = modelout.PaymentDateTime.ShamciToFormatShamci(),
|
||||||
pid = modelout.pid,
|
pid = modelout.pid,
|
||||||
pmt = modelout.pmt,
|
pmt = modelout.pmt,
|
||||||
pv = modelout.pv,
|
pv = modelout.pv,
|
||||||
trmn = modelout.trmn,
|
trmn = modelout.trmn,
|
||||||
trn = modelout.acn,
|
trn = modelout.trn,
|
||||||
paymentMethod = modelout.pmt.HasValue ? codings.Where(w => w.Code == modelout.pmt.Value.ToString()).Select(s => s.Title).FirstOrDefault() : null,
|
paymentMethod = modelout.pmt.HasValue ? codings.Where(w => w.Code == modelout.pmt.Value.ToString()).Select(s => s.Title).FirstOrDefault() : null,
|
||||||
} : null);
|
} : null);
|
||||||
}
|
}
|
||||||
@@ -191,10 +191,10 @@ namespace Back.Controllers
|
|||||||
if (payitem == null)
|
if (payitem == null)
|
||||||
return NotFound(new List<string> { "invoice pay notFound..." });
|
return NotFound(new List<string> { "invoice pay notFound..." });
|
||||||
|
|
||||||
////-----Validaton
|
//////-----Validaton
|
||||||
var resultValidationmodel = await _validation.ValidateAsync(Tuple.Create(user.RolUsers.First().CompanyID, payitem.InvoiceID, new InvoicePaymentDTO(), eActionValidation.delete));
|
//var resultValidationmodel = await _validation.ValidateAsync(Tuple.Create(user.RolUsers.First().CompanyID, payitem.InvoiceID, new InvoicePaymentDTO(), eActionValidation.delete));
|
||||||
if (!resultValidationmodel.IsValid)
|
//if (!resultValidationmodel.IsValid)
|
||||||
return BadRequest(resultValidationmodel.Errors.Select(s => s.ErrorMessage).ToList());
|
// return BadRequest(resultValidationmodel.Errors.Select(s => s.ErrorMessage).ToList());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -3,8 +3,9 @@
|
|||||||
@using Shared.DTOs
|
@using Shared.DTOs
|
||||||
@inject Fixedvalues fv;
|
@inject Fixedvalues fv;
|
||||||
@inject HttpClientController hc;
|
@inject HttpClientController hc;
|
||||||
|
<ConfirmDialog @ref="dialog" />
|
||||||
<Grid @ref="grid"
|
<Grid @ref="grid"
|
||||||
|
AllowRowClick="true"
|
||||||
TItem="InvoicePaymentDTO"
|
TItem="InvoicePaymentDTO"
|
||||||
Class="table table-hover table-bordered table-striped mt-3"
|
Class="table table-hover table-bordered table-striped mt-3"
|
||||||
Data="invoice.payments"
|
Data="invoice.payments"
|
||||||
@@ -130,6 +131,7 @@
|
|||||||
<CurrencyInput TValue="long?" @bind-Value="item.pv" Locale="fa-Ir" Placeholder="مبلغ" style="text-align: center" />
|
<CurrencyInput TValue="long?" @bind-Value="item.pv" Locale="fa-Ir" Placeholder="مبلغ" style="text-align: center" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<br />
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<Alert hidden="@Hidealert" Color="@alertColor" Dismissable="false">
|
<Alert hidden="@Hidealert" Color="@alertColor" Dismissable="false">
|
||||||
@@ -138,39 +140,40 @@
|
|||||||
</Alert>
|
</Alert>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row g-3">
|
|
||||||
|
|
||||||
@if (add)
|
@if (add)
|
||||||
{
|
{
|
||||||
<div class="form-group col-md-2">
|
<div class="row g-3">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
<Button class="mt-3" Color="ButtonColor.Success" @onclick="AddPay" Type="ButtonType.Button">
|
<Button class="mt-3" Color="ButtonColor.Success" @onclick="AddPay" Type="ButtonType.Button">
|
||||||
جدید
|
جدید
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ <div class="row g-3">
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-6">
|
||||||
<Button class="mt-3" Color="ButtonColor.Info" @onclick="AddPay" Type="ButtonType.Button">
|
<Button class="mt-3" Color="ButtonColor.Info" @onclick="UpdatePay" Type="ButtonType.Button">
|
||||||
ویرایش
|
ویرایش
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2">
|
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="DeletePay" Type="ButtonType.Button">
|
||||||
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="AddPay" Type="ButtonType.Button">
|
|
||||||
حذف
|
حذف
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<Button class="mt-3" Color="ButtonColor.Primary" @onclick="cancell" Type="ButtonType.Button">
|
<Button class="mt-3" Color="ButtonColor.Primary" @onclick="cancell" Type="ButtonType.Button">
|
||||||
انصراف
|
انصراف
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
private ConfirmDialog dialog = default!;
|
||||||
bool add = true;
|
bool add = true;
|
||||||
[Parameter] public InvoiceDTO invoice { get; set; }
|
[Parameter] public InvoiceDTO invoice { get; set; }
|
||||||
Grid<InvoicePaymentDTO> grid = default!;
|
Grid<InvoicePaymentDTO> grid = default!;
|
||||||
@@ -193,17 +196,19 @@
|
|||||||
@functions {
|
@functions {
|
||||||
private async Task OnRowClick(GridRowEventArgs<InvoicePaymentDTO> args)
|
private async Task OnRowClick(GridRowEventArgs<InvoicePaymentDTO> args)
|
||||||
{
|
{
|
||||||
|
Hidealert = true;
|
||||||
item = args.Item;
|
item = args.Item;
|
||||||
add = false;
|
add = false;
|
||||||
}
|
}
|
||||||
async Task cancell()
|
async Task cancell()
|
||||||
{
|
{
|
||||||
|
Hidealert = true;
|
||||||
add = true;
|
add = true;
|
||||||
item = new InvoicePaymentDTO();
|
item = new InvoicePaymentDTO();
|
||||||
}
|
}
|
||||||
async Task AddPay()
|
async Task AddPay()
|
||||||
{
|
{
|
||||||
|
Hidealert = true;
|
||||||
if (await Validation())
|
if (await Validation())
|
||||||
{
|
{
|
||||||
var sentItem = new InvoiceItemAction<InvoicePaymentDTO>()
|
var sentItem = new InvoiceItemAction<InvoicePaymentDTO>()
|
||||||
@@ -221,6 +226,7 @@
|
|||||||
invoice.payments.Add(request);
|
invoice.payments.Add(request);
|
||||||
await grid.RefreshDataAsync();
|
await grid.RefreshDataAsync();
|
||||||
item = new InvoicePaymentDTO();
|
item = new InvoicePaymentDTO();
|
||||||
|
ShowSuccessAlert("پرداخت ثبت شد");
|
||||||
}
|
}
|
||||||
|
|
||||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||||
@@ -238,6 +244,7 @@
|
|||||||
}
|
}
|
||||||
async Task UpdatePay()
|
async Task UpdatePay()
|
||||||
{
|
{
|
||||||
|
Hidealert = true;
|
||||||
if (await Validation())
|
if (await Validation())
|
||||||
{
|
{
|
||||||
var rsp = await hc.Put<InvoiceItemAction<InvoicePaymentDTO>>("InvoicePayment/UpdatePay", new InvoiceItemAction<InvoicePaymentDTO>()
|
var rsp = await hc.Put<InvoiceItemAction<InvoicePaymentDTO>>("InvoicePayment/UpdatePay", new InvoiceItemAction<InvoicePaymentDTO>()
|
||||||
@@ -251,9 +258,12 @@
|
|||||||
|
|
||||||
if (request != null && request.ID.HasValue)
|
if (request != null && request.ID.HasValue)
|
||||||
{
|
{
|
||||||
|
invoice.payments.Remove(item);
|
||||||
invoice.payments.Add(request);
|
invoice.payments.Add(request);
|
||||||
await grid.RefreshDataAsync();
|
await grid.RefreshDataAsync();
|
||||||
item = new InvoicePaymentDTO();
|
item = new InvoicePaymentDTO();
|
||||||
|
add = true;
|
||||||
|
ShowSuccessAlert("تغییرات با موفقیت اعمال شد");
|
||||||
}
|
}
|
||||||
|
|
||||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||||
@@ -268,6 +278,14 @@
|
|||||||
}
|
}
|
||||||
async Task DeletePay()
|
async Task DeletePay()
|
||||||
{
|
{
|
||||||
|
var confirmation = await dialog.ShowAsync(
|
||||||
|
title: "عملیات حذف پرداخت",
|
||||||
|
message1: $"از حذف پرداخت",
|
||||||
|
message2: "اطمینان دارید?");
|
||||||
|
|
||||||
|
if (confirmation)
|
||||||
|
{
|
||||||
|
Hidealert = true;
|
||||||
if (item.ID.HasValue)
|
if (item.ID.HasValue)
|
||||||
{
|
{
|
||||||
var rsp = await hc.Delete($"InvoicePayment/DeletePay/{item.ID.Value}");
|
var rsp = await hc.Delete($"InvoicePayment/DeletePay/{item.ID.Value}");
|
||||||
@@ -277,9 +295,11 @@
|
|||||||
|
|
||||||
if (request)
|
if (request)
|
||||||
{
|
{
|
||||||
invoice.payments.Add(item);
|
invoice.payments.Remove(item);
|
||||||
await grid.RefreshDataAsync();
|
await grid.RefreshDataAsync();
|
||||||
item = new InvoicePaymentDTO();
|
item = new InvoicePaymentDTO();
|
||||||
|
add = true;
|
||||||
|
ShowSuccessAlert("پرداخت خذف شد");
|
||||||
}
|
}
|
||||||
|
|
||||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||||
@@ -292,6 +312,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
private void ShowSuccessAlert(string msg)
|
private void ShowSuccessAlert(string msg)
|
||||||
{
|
{
|
||||||
Hidealert = false;
|
Hidealert = false;
|
||||||
@@ -308,9 +330,10 @@
|
|||||||
}
|
}
|
||||||
async Task<bool> Validation()
|
async Task<bool> Validation()
|
||||||
{
|
{
|
||||||
if (item.pv<=0)
|
if (item.pv==null || item.pv <= 0)
|
||||||
{
|
{
|
||||||
ShowDangerAlert("مبلغ پرداختی باید بیشتر از صفر باشد.");
|
ShowDangerAlert("مبلغ پرداختی باید بیشتر از صفر باشد.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (invoice.tbill < invoice.payments.Sum(s => s.pv) + item.pv)
|
if (invoice.tbill < invoice.payments.Sum(s => s.pv) + item.pv)
|
||||||
{
|
{
|
||||||
@@ -341,7 +364,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowDangerAlert("تاریخ پرداخت نمی تواند از امروز جلوتر باشد");
|
ShowDangerAlert("تاریخ پرداخت نمی تواند از امروز جلوتر باشد"); return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -36,10 +36,10 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
|
|||||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://195.88.208.142:7075/api/") });
|
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://195.88.208.142:7075/api/") });
|
||||||
|
|
||||||
//Home
|
//Home
|
||||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
||||||
|
|
||||||
//farzan
|
//farzan
|
||||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||||
|
|
||||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user