..
This commit is contained in:
@@ -59,8 +59,8 @@ namespace Back.Controllers
|
|||||||
// return BadRequest(item);
|
// return BadRequest(item);
|
||||||
|
|
||||||
//-----GetUserAndCompany
|
//-----GetUserAndCompany
|
||||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
var claim = "64"/* HttpContext.User.Claims.First(c => c.Type == "UserID")*/;
|
||||||
var UserID = claim.Value;
|
var UserID = claim;
|
||||||
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||||
|
|
||||||
//-----Validaton
|
//-----Validaton
|
||||||
|
@@ -11,6 +11,7 @@ namespace Back.Data.Contracts
|
|||||||
public interface IAsyncRepository<T>
|
public interface IAsyncRepository<T>
|
||||||
{
|
{
|
||||||
IQueryable<T> GetAll();
|
IQueryable<T> GetAll();
|
||||||
|
IQueryable<T> TrackingGet(Expression<Func<T, bool>> predicate);
|
||||||
IQueryable<T> Get(Expression<Func<T, bool>> predicate);
|
IQueryable<T> Get(Expression<Func<T, bool>> predicate);
|
||||||
IQueryable<T> Get(Expression<Func<T, bool>> predicate = null,
|
IQueryable<T> Get(Expression<Func<T, bool>> predicate = null,
|
||||||
Func<IQueryable<T>, IOrderedQueryable<T>> orderBy = null,
|
Func<IQueryable<T>, IOrderedQueryable<T>> orderBy = null,
|
||||||
|
@@ -30,10 +30,14 @@ namespace Back.Data.Infrastructure.Repository
|
|||||||
public IQueryable<T> Get(Expression<Func<T, bool>> predicate)
|
public IQueryable<T> Get(Expression<Func<T, bool>> predicate)
|
||||||
{
|
{
|
||||||
var query = _query.AsQueryable();
|
var query = _query.AsQueryable();
|
||||||
query = query.AsNoTracking();
|
// query = query.AsNoTracking();
|
||||||
|
return query.Where(predicate).AsQueryable();
|
||||||
|
}
|
||||||
|
public IQueryable<T> TrackingGet(Expression<Func<T, bool>> predicate)
|
||||||
|
{
|
||||||
|
var query = _query.AsQueryable();
|
||||||
return query.Where(predicate).AsQueryable();
|
return query.Where(predicate).AsQueryable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQueryable<T> Get(
|
public IQueryable<T> Get(
|
||||||
Expression<Func<T, bool>> predicate = null,
|
Expression<Func<T, bool>> predicate = null,
|
||||||
Func<IQueryable<T>, IOrderedQueryable<T>> orderBy = null,
|
Func<IQueryable<T>, IOrderedQueryable<T>> orderBy = null,
|
||||||
@@ -80,9 +84,18 @@ namespace Back.Data.Infrastructure.Repository
|
|||||||
|
|
||||||
public async Task<T> AddAsync(T entity)
|
public async Task<T> AddAsync(T entity)
|
||||||
{
|
{
|
||||||
await _query.AddAsync(entity);
|
try
|
||||||
await _dbContext.SaveChangesAsync();
|
{
|
||||||
return entity;
|
await _query.AddAsync(entity);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public T? Add(T entity)
|
public T? Add(T entity)
|
||||||
{
|
{
|
||||||
@@ -109,7 +122,7 @@ namespace Back.Data.Infrastructure.Repository
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
_dbContext.Entry(entity).State = EntityState.Modified;
|
_dbContext.Entry(entity).State = EntityState.Modified;
|
||||||
var result = await _dbContext.SaveChangesAsync();
|
var result = await _dbContext.SaveChangesAsync();
|
||||||
return result > 0;
|
return result > 0;
|
||||||
|
@@ -26,7 +26,7 @@ namespace Back.Data.Models
|
|||||||
public long? Indati2m { get { return new DateTimeOffset(InvoiceDate.Trim().ToMiladi()).ToUnixTimeMilliseconds(); } }
|
public long? Indati2m { get { return new DateTimeOffset(InvoiceDate.Trim().ToMiladi()).ToUnixTimeMilliseconds(); } }
|
||||||
//نوع صورتحساب
|
//نوع صورتحساب
|
||||||
[MaxLength(1)]
|
[MaxLength(1)]
|
||||||
public int? inty { get { return pattern.BillType.inty; } }
|
public int? inty { get { return pattern?.BillType.inty; } }
|
||||||
//الگوی صورتحساب
|
//الگوی صورتحساب
|
||||||
[MaxLength(2)]
|
[MaxLength(2)]
|
||||||
public int? inp { get { return pattern?.inp; } }
|
public int? inp { get { return pattern?.inp; } }
|
||||||
@@ -102,7 +102,7 @@ namespace Back.Data.Models
|
|||||||
public InvoiceType invoiceType { get; set; }
|
public InvoiceType invoiceType { get; set; }
|
||||||
//شماره منحصر به فرد مالیاتی
|
//شماره منحصر به فرد مالیاتی
|
||||||
[MaxLength(22)]
|
[MaxLength(22)]
|
||||||
public string? taxid { get; set; }
|
public string? taxid { get; set; }
|
||||||
//شماره منحصر به فرد مالیاتی صورتحساب مرجع
|
//شماره منحصر به فرد مالیاتی صورتحساب مرجع
|
||||||
[MaxLength(22)]
|
[MaxLength(22)]
|
||||||
public string? irtaxid { get; set; }
|
public string? irtaxid { get; set; }
|
||||||
@@ -160,13 +160,13 @@ namespace Back.Data.Models
|
|||||||
public virtual Customer Customer { get; set; }
|
public virtual Customer Customer { get; set; }
|
||||||
[ForeignKey("LastChangeUserID")]
|
[ForeignKey("LastChangeUserID")]
|
||||||
public virtual User user { get; set; }
|
public virtual User user { get; set; }
|
||||||
public virtual ICollection<InvoiceItem> invoiceDetails { get; set; }
|
public virtual ICollection<InvoiceItem>? invoiceDetails { get; set; }
|
||||||
[ForeignKey("BillReference")]
|
[ForeignKey("BillReference")]
|
||||||
public virtual Invoice? invoice { get; set; }
|
public virtual Invoice? invoice { get; set; }
|
||||||
public virtual ICollection<InvoicePayment> payments { get; set; }
|
public virtual ICollection<InvoicePayment>? payments { get; set; }
|
||||||
public virtual ICollection<InvoiceStatusChang> invoiceStatusChangs { get; set; }
|
public virtual ICollection<InvoiceStatusChang>? invoiceStatusChangs { get; set; }
|
||||||
public virtual ICollection<SentTax> sentTax { get; set; }
|
public virtual ICollection<SentTax>? sentTax { get; set; }
|
||||||
[ForeignKey("PatternsID")]
|
[ForeignKey("PatternID")]
|
||||||
public virtual Pattern? pattern { get; set; }
|
public virtual Pattern? pattern { get; set; }
|
||||||
[ForeignKey("CompanyID")]
|
[ForeignKey("CompanyID")]
|
||||||
public virtual Company? company { get; set; }
|
public virtual Company? company { get; set; }
|
||||||
|
@@ -6,6 +6,7 @@ using Back.Services;
|
|||||||
using Back.Validations;
|
using Back.Validations;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
using Microsoft.OpenApi.Models;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using TaxPayer.Infrastructure.Persistence;
|
using TaxPayer.Infrastructure.Persistence;
|
||||||
|
|
||||||
@@ -16,7 +17,34 @@ var builder = WebApplication.CreateBuilder(args);
|
|||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen();
|
builder.Services.AddSwaggerGen(option =>
|
||||||
|
{
|
||||||
|
option.SwaggerDoc("v1", new OpenApiInfo { Title = "TaxPayer API", Version = "Preview" });
|
||||||
|
option.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
In = ParameterLocation.Header,
|
||||||
|
Description = "Please enter a valid token",
|
||||||
|
Name = "Authorization",
|
||||||
|
Type = SecuritySchemeType.Http,
|
||||||
|
BearerFormat = "JWT",
|
||||||
|
Scheme = "Bearer"
|
||||||
|
});
|
||||||
|
option.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||||
|
{
|
||||||
|
{
|
||||||
|
new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Reference = new OpenApiReference
|
||||||
|
{
|
||||||
|
Type=ReferenceType.SecurityScheme,
|
||||||
|
Id="Bearer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new string[]{}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
builder.Services.AddDbContext<SqlDbContext>(options =>
|
builder.Services.AddDbContext<SqlDbContext>(options =>
|
||||||
{
|
{
|
||||||
options.UseSqlServer(builder.Configuration.GetConnectionString("Base"));
|
options.UseSqlServer(builder.Configuration.GetConnectionString("Base"));
|
||||||
@@ -27,7 +55,7 @@ builder.Services.AddScoped<Back.Services.ServBase>();
|
|||||||
builder.Services.AddScoped<MobileValidation> ();
|
builder.Services.AddScoped<MobileValidation> ();
|
||||||
builder.Services.AddScoped<Service.Main>();
|
builder.Services.AddScoped<Service.Main>();
|
||||||
builder.Services.AddScoped<servTicket > ();
|
builder.Services.AddScoped<servTicket > ();
|
||||||
builder.Services.AddScoped < ServValidatinMsg>();
|
builder.Services.AddScoped<ServValidatinMsg>();
|
||||||
builder.Services.AddScoped<GetVerificationValidation> ();
|
builder.Services.AddScoped<GetVerificationValidation> ();
|
||||||
builder.Services.AddScoped<GetVerificationValidation>();
|
builder.Services.AddScoped<GetVerificationValidation>();
|
||||||
builder.Services.AddScoped<CheckPermission>();
|
builder.Services.AddScoped<CheckPermission>();
|
||||||
|
@@ -17,10 +17,10 @@ namespace Back.Services
|
|||||||
}
|
}
|
||||||
private async Task<bool> AllowPermissionInCompany(int CompanyID,int PermissionID,int Allowednumber = 1)
|
private async Task<bool> AllowPermissionInCompany(int CompanyID,int PermissionID,int Allowednumber = 1)
|
||||||
{
|
{
|
||||||
|
PermissionPeriod permissionPeriod =await _repoPermissionPeriod
|
||||||
PermissionPeriod? permissionPeriod = _repoPermissionPeriod
|
.TrackingGet(w => w.CompanyID == CompanyID && w.PermissionID == PermissionID && (!w.IsLocked.HasValue || !w.IsLocked.Value)
|
||||||
.Get(w => w.CompanyID == CompanyID && w.PermissionID == PermissionID && (!w.IsLocked.HasValue || !w.IsLocked.Value))
|
)
|
||||||
.FirstOrDefault();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
if (permissionPeriod == null)
|
if (permissionPeriod == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -51,7 +51,8 @@ namespace Back.Services
|
|||||||
{
|
{
|
||||||
|
|
||||||
return await _repoPermissionUser
|
return await _repoPermissionUser
|
||||||
.Get(w => w.RolUser.UserID == UserID && w.RolUser.CompanyID == CompanyID && w.PermissionID==PermissionID)
|
.TrackingGet(w => w.RolUser.UserID == UserID && w.RolUser.CompanyID == CompanyID && w.PermissionID==PermissionID
|
||||||
|
)
|
||||||
.AnyAsync();
|
.AnyAsync();
|
||||||
|
|
||||||
|
|
||||||
@@ -59,10 +60,10 @@ namespace Back.Services
|
|||||||
}
|
}
|
||||||
public async Task<bool> ExtensionofAccess(int CompanyID, int PermissionID, string value)
|
public async Task<bool> ExtensionofAccess(int CompanyID, int PermissionID, string value)
|
||||||
{
|
{
|
||||||
PermissionPeriod? permissionPeriod = _repoPermissionPeriod
|
PermissionPeriod permissionPeriod = await _repoPermissionPeriod
|
||||||
.Get(w => w.CompanyID == CompanyID && w.PermissionID == PermissionID
|
.TrackingGet(w => w.CompanyID == CompanyID && w.PermissionID == PermissionID
|
||||||
&& (!w.IsLocked.HasValue || !w.IsLocked.Value))
|
&& (!w.IsLocked.HasValue || !w.IsLocked.Value))
|
||||||
.FirstOrDefault();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
||||||
//تعداد
|
//تعداد
|
||||||
@@ -76,8 +77,8 @@ namespace Back.Services
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var res= await _repoPermissionPeriod.UpdateAsync(permissionPeriod);
|
||||||
return await _repoPermissionPeriod.UpdateAsync(permissionPeriod);
|
return res;
|
||||||
//SysLog log = new SysLog()
|
//SysLog log = new SysLog()
|
||||||
//{
|
//{
|
||||||
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
|
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
|
||||||
|
@@ -107,7 +107,7 @@ namespace Back.Services
|
|||||||
|
|
||||||
if (item.ID == null || item.ID <= 0)
|
if (item.ID == null || item.ID <= 0)
|
||||||
{
|
{
|
||||||
if (await _checkPermission.ExtensionofAccess(item.CompanyID, 5, "-1"))
|
if (await _checkPermission.ExtensionofAccess(item.CompanyID, 4, "-1"))
|
||||||
return await _CODRepo.AddBoolResultAsync(item);
|
return await _CODRepo.AddBoolResultAsync(item);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@@ -136,11 +136,11 @@ namespace Back.Services
|
|||||||
invoice.PreparedtoSendtoTax = false;
|
invoice.PreparedtoSendtoTax = false;
|
||||||
if (calculate)
|
if (calculate)
|
||||||
{
|
{
|
||||||
if (await _checkPermission.ExtensionofAccess(invoice.CompanyID.Value, 3, "-1"))
|
//if (await _checkPermission.ExtensionofAccess(invoice.CompanyID.Value, 3, "-1"))
|
||||||
{
|
// {
|
||||||
var item= await _invoiceRepo.AddAsync(invoice);
|
var item= await _invoiceRepo.AddAsync(invoice);
|
||||||
return item.ID;
|
return item.ID;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
@using Shared.DTOs
|
@using Shared.DTOs
|
||||||
@inject HttpClientController hc;
|
@inject HttpClientController hc;
|
||||||
@inject Fixedvalues fv;
|
@inject Fixedvalues fv;
|
||||||
|
<ConfirmDialog @ref="dialog" />
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
@* alert *@
|
@* alert *@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -13,10 +15,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
|
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-5">
|
||||||
<label class="col-sm-4 col-form-label" style="color:red" for="inputcod">کالا</label>
|
<label class="col-sm-4 col-form-label" style="color:red" for="inputcod">کالا</label>
|
||||||
<select @bind="itemDTO.CODID" @bind:after="() =>
|
<select @bind="itemDTO.CODID" @bind:after="async () =>
|
||||||
{
|
{
|
||||||
|
await AfterAsync();
|
||||||
if(itemDTO.ID==null)
|
if(itemDTO.ID==null)
|
||||||
itemDTO.vra=cods.Where(w=>w.ID==itemDTO.CODID).Select(s=>s.Tax).FirstOrDefault();
|
itemDTO.vra=cods.Where(w=>w.ID==itemDTO.CODID).Select(s=>s.Tax).FirstOrDefault();
|
||||||
}" class="form-control" aria-label="Default select example" id="inputcod">
|
}" class="form-control" aria-label="Default select example" id="inputcod">
|
||||||
@@ -49,41 +52,47 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label class="col-sm-4 col-form-label" style="color:red" for="inputFullName">تعداد</label>
|
|
||||||
<InputNumber @bind-Value="itemDTO.am" @bind-Value:after="AfterAsync" type="text" class="form-control" id="inputam" placeholder="تعداد" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label style="color:red" class="col-sm-6 col-form-label">مبلغ واحد</label>
|
|
||||||
<InputNumber @bind-Value="itemDTO.fee" @bind-Value:after="AfterAsync" type="text" class="form-control" id="inputfee" placeholder="مبلغ واحد" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row g-3">
|
|
||||||
<div class="form-group col-md-4">
|
|
||||||
<label class="col-sm-6 col-form-label">مبلغ کل</label>
|
|
||||||
<InputNumber @bind-Value="itemDTO.prdis" type="text" class="form-control" id="inputfee" placeholder="مبلغ کل" readonly />
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<label class="col-sm-6 col-form-label">مبلغ تخفیف</label>
|
|
||||||
<InputNumber @bind-Value="itemDTO.dis" type="text" @bind-Value:after="AfterAsync" class="form-control" id="inputdis" placeholder="مبلغ تخفیف" />
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<label class="col-sm-8 col-form-label">مبلغ بعد تخفیف</label>
|
|
||||||
<InputNumber @bind-Value="itemDTO.adis" type="text" class="form-control" id="inputadis" placeholder="مبلغ تخفیف" readonly />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row g-3">
|
|
||||||
<div class="form-group col-md-4">
|
|
||||||
<label class="col-sm-6 col-form-label">نرخ مالیات</label>
|
<label class="col-sm-6 col-form-label">نرخ مالیات</label>
|
||||||
<InputNumber @bind-Value="itemDTO.vra" type="text" class="form-control" id="inputvra" placeholder="نرخ مالیات" readonly />
|
<InputNumber @bind-Value="itemDTO.vra" type="text" class="form-control" id="inputvra" placeholder="نرخ مالیات" readonly />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label class="col-sm-6 col-form-label">مبلغ مالیات</label>
|
<label class="col-sm-4 col-form-label" style="color:red" for="inputFullName">تعداد</label>
|
||||||
<InputNumber @bind-Value="itemDTO.vam" type="text" class="form-control" id="inputvra" placeholder="مبلغ مالیات" readonly />
|
<InputNumber @bind-Value="itemDTO.am" @bind-Value:after="AfterAsync" type="text" class="form-control" id="inputam" placeholder="تعداد" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label style="color:red" class="col-sm-6 col-form-label">مبلغ واحد</label>
|
||||||
|
<CurrencyInput TValue="decimal" @bind-Value="@itemDTO.fee" @bind-Value:after="AfterAsync" Locale="fa-Ir" Placeholder="مبلغ واحد" />
|
||||||
|
@* <InputNumber @bind-Value="itemDTO.fee" @bind-Value:after="AfterAsync" type="text" class="form-control" id="inputfee" placeholder="مبلغ واحد" /> *@
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label class="col-sm-6 col-form-label">مبلغ کل</label>
|
||||||
|
<CurrencyInput TValue="decimal?" @bind-Value="itemDTO.prdis" Locale="fa-Ir" Placeholder="مبلغ کل" readonly />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="col-sm-6 col-form-label">مبلغ تخفیف</label>
|
||||||
|
<CurrencyInput TValue="decimal?" @bind-Value="itemDTO.dis" Locale="fa-Ir" @bind-Value:after="AfterAsync" Placeholder="مبلغ تخفیف" />
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="col-sm-8 col-form-label">مبلغ بعد تخفیف</label>
|
||||||
|
<CurrencyInput TValue="decimal?" @bind-Value="itemDTO.adis" Locale="fa-Ir" Placeholder="مبلغ بعد تخفیف" readonly />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row g-3">
|
||||||
|
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label class="col-sm-6 col-form-label">مبلغ مالیات</label>
|
||||||
|
<CurrencyInput TValue="decimal?" @bind-Value="itemDTO.vam" Locale="fa-Ir" Placeholder="مبلغ مالیات" readonly />
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
<label class="col-sm-6 col-form-label">مبلغ نهایی</label>
|
<label class="col-sm-6 col-form-label">مبلغ نهایی</label>
|
||||||
<InputNumber @bind-Value="itemDTO.tsstam" type="text" class="form-control" id="inputvra" placeholder="مبلغ نهایی" readonly />
|
<CurrencyInput TValue="decimal?" @bind-Value="itemDTO.tsstam" Locale="fa-Ir" Placeholder="مبلغ نهایی" readonly />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -100,13 +109,15 @@ else
|
|||||||
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
|
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
|
||||||
ثبت تغییرات
|
ثبت تغییرات
|
||||||
</Button>
|
</Button>
|
||||||
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="OnClickDelete" Type="ButtonType.Button">
|
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
|
||||||
حذف
|
حذف
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
[Inject] ToastService ToastService { get; set; } = default!;
|
||||||
|
private ConfirmDialog dialog = default!;
|
||||||
// alert
|
// alert
|
||||||
AlertColor alertColor = AlertColor.Primary;
|
AlertColor alertColor = AlertColor.Primary;
|
||||||
IconName alertIconName = IconName.CheckCircleFill;
|
IconName alertIconName = IconName.CheckCircleFill;
|
||||||
@@ -233,22 +244,22 @@ else
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var rsp = await hc.Put<InvoiceItemDTO>($"InvoiceItem/UpdateItem/{InvoiceID}", itemDTO);
|
var rsp = await hc.Put<InvoiceItemDTO>($"InvoiceItem/UpdateItem/{InvoiceID}", itemDTO);
|
||||||
if (rsp.IsSuccessStatusCode)
|
if (rsp.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||||
|
if (request)
|
||||||
{
|
{
|
||||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
result.Status = ComponentStatus.success;
|
||||||
if (request)
|
result.Action = ComponentAction.update;
|
||||||
{
|
await OnMultipleOfThree.InvokeAsync(result);
|
||||||
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("خطایی در اجرای عملیات رخ داده");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||||
|
ShowDangerAlert(request[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public async Task OnClickAdd()
|
public async Task OnClickAdd()
|
||||||
{
|
{
|
||||||
@@ -281,19 +292,40 @@ else
|
|||||||
{
|
{
|
||||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||||
|
|
||||||
if (request)
|
if (request)
|
||||||
{
|
{
|
||||||
result.Status = ComponentStatus.success;
|
result.Status = ComponentStatus.success;
|
||||||
result.Action = ComponentAction.add;
|
result.Action = ComponentAction.add;
|
||||||
await OnMultipleOfThree.InvokeAsync(result);
|
await OnMultipleOfThree.InvokeAsync(result);
|
||||||
}
|
}
|
||||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||||
ShowDangerAlert(request[0]);
|
ShowDangerAlert(request[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private async Task ShowConfirmationDeleteAsync()
|
||||||
|
{
|
||||||
|
if (itemDTO.ID != null && itemDTO.ID > 0 && InvoiceID != null && InvoiceID > 0)
|
||||||
|
{
|
||||||
|
var confirmation = await dialog.ShowAsync(
|
||||||
|
title: "عملیات حذف آیتم صورتحساب",
|
||||||
|
message1: $"از حذف آیتم {itemDTO.ID} از صورتحساب {InvoiceID}",
|
||||||
|
message2: "اطمینان دارید?");
|
||||||
|
|
||||||
|
if (confirmation)
|
||||||
|
{
|
||||||
|
await OnClickDelete();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ToastService.Notify(new ToastMessage(ToastType.Secondary, $"عملیات حذف متوقف شد"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -27,7 +27,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label class="col-sm-4 col-form-label" for="inputinvoiceTypeTitle">نوع</label>
|
<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 (InvoiceID == 0 || InvoiceID == null ? false : true){
|
||||||
|
<select @bind="invoice.invoiceType" disabled class="form-control" aria-label="Default select example" id="inputinvoiceTypeTitle">
|
||||||
@if (!invoice.invoiceType.HasValue)
|
@if (!invoice.invoiceType.HasValue)
|
||||||
{
|
{
|
||||||
<option value="0" style="color: #b5b5b5" selected>انتخاب کنید...</option>
|
<option value="0" style="color: #b5b5b5" selected>انتخاب کنید...</option>
|
||||||
@@ -53,7 +54,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<select @bind="invoice.invoiceType" class="form-control" aria-label="Default select example" disabled id="inputinvoiceTypeTitle">
|
||||||
|
<option value="10" style="color: #b5b5b5" selected>پیشنهاد قیمت</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
@@ -121,6 +130,9 @@
|
|||||||
<InputText style=" text-align: center;" @bind-Value="invoice.InvoiceDate" type="text" class="form-control" id="inputInvoiceDate" placeholder="تاریخ" />
|
<InputText style=" text-align: center;" @bind-Value="invoice.InvoiceDate" type="text" class="form-control" id="inputInvoiceDate" placeholder="تاریخ" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@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">
|
||||||
@@ -160,19 +172,21 @@
|
|||||||
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
}
|
||||||
<hr class="hr" />
|
<hr class="hr" />
|
||||||
<br />
|
<br />
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="form-group col-md-8">
|
<div class="form-group col-md-6">
|
||||||
<label class="col-sm-4 col-form-label" for="inputdes">توضیحات</label>
|
<label class="col-form-label" for="inputdes">توضیحات</label>
|
||||||
<InputText @bind-Value="invoice.Des" type="text" class="form-control" id="inputdes" placeholder="توضیحات" />
|
<InputText @bind-Value="invoice.Des" type="text" class="form-control" id="inputdes" placeholder="توضیحات" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label class="col-sm-5 col-form-label" for="inputUdate">آخرین ویرایش</label>
|
<label class="col-form-label" for="inputUdate">آخرین ویرایش</label>
|
||||||
<InputText style=" text-align: center;" @bind-Value="invoice.Udate" class="form-control" id="inputUdate" readonly />
|
<InputText style=" text-align: center;" @bind-Value="invoice.Udate" class="form-control" id="inputUdate" readonly />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-4">
|
||||||
<br />
|
<br />
|
||||||
@if (invoice.ID == 0)
|
@if (invoice.ID == 0)
|
||||||
{
|
{
|
||||||
@@ -411,8 +425,8 @@
|
|||||||
{
|
{
|
||||||
CustomerID = invoice.CustomerID,
|
CustomerID = invoice.CustomerID,
|
||||||
Des = invoice.Des,
|
Des = invoice.Des,
|
||||||
InvoiceDate = invoice.InvoiceDate,
|
InvoiceDate = invoice.InvoiceDate.Replace("/",""),
|
||||||
InvoicIssueDate = invoice.InvoicIssueDate,
|
InvoicIssueDate = invoice.InvoicIssueDate.Replace("/", ""),
|
||||||
PatternID = invoice.PatternID,
|
PatternID = invoice.PatternID,
|
||||||
Title = invoice.Title
|
Title = invoice.Title
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user