diff --git a/Pds/Pds.Api.Contracts/Controllers/Bill/CreateBill/CreateBillRequest.cs b/Pds/Pds.Api.Contracts/Controllers/Bill/CreateBill/CreateBillRequest.cs index 3f1623ea..8cda988d 100644 --- a/Pds/Pds.Api.Contracts/Controllers/Bill/CreateBill/CreateBillRequest.cs +++ b/Pds/Pds.Api.Contracts/Controllers/Bill/CreateBill/CreateBillRequest.cs @@ -37,4 +37,6 @@ public class CreateBillRequest public string ContactEmail { get; set; } public ContactType? ContactType { get; set; } + + public bool IsContactAgent { get; set; } } \ No newline at end of file diff --git a/Pds/Pds.Api.Contracts/Controllers/Bill/EditBill/EditBillRequest.cs b/Pds/Pds.Api.Contracts/Controllers/Bill/EditBill/EditBillRequest.cs index a5923ca7..5e6ef4b3 100644 --- a/Pds/Pds.Api.Contracts/Controllers/Bill/EditBill/EditBillRequest.cs +++ b/Pds/Pds.Api.Contracts/Controllers/Bill/EditBill/EditBillRequest.cs @@ -43,4 +43,6 @@ public class EditBillRequest public string ContactName { get; set; } public ContactType? ContactType { get; set; } + + public bool IsContactAgent { get; set; } } \ No newline at end of file diff --git a/Pds/Pds.Api.Contracts/Controllers/Bill/GetBill/GetBillResponse.cs b/Pds/Pds.Api.Contracts/Controllers/Bill/GetBill/GetBillResponse.cs index ce0561a4..e91bf94b 100644 --- a/Pds/Pds.Api.Contracts/Controllers/Bill/GetBill/GetBillResponse.cs +++ b/Pds/Pds.Api.Contracts/Controllers/Bill/GetBill/GetBillResponse.cs @@ -34,5 +34,7 @@ public class GetBillResponse public ContactType? ContactType { get; set; } + public bool IsContactAgent { get; set; } + public GetBillContentDto Content { get; set; } } \ No newline at end of file diff --git a/Pds/Pds.Api.Contracts/Controllers/Content/CreateContent/CreateContentBillDto.cs b/Pds/Pds.Api.Contracts/Controllers/Content/CreateContent/CreateContentBillDto.cs index dc9f1389..d49f7145 100644 --- a/Pds/Pds.Api.Contracts/Controllers/Content/CreateContent/CreateContentBillDto.cs +++ b/Pds/Pds.Api.Contracts/Controllers/Content/CreateContent/CreateContentBillDto.cs @@ -19,6 +19,8 @@ public class CreateContentBillDto [EnumDataType(typeof(ContactType))] public ContactType? ContactType { get; set; } + public bool IsContactAgent { get; set; } + [Range(10, Double.MaxValue, ErrorMessage = "Значение поля {0} должно быть больше чем {1}.")] public decimal Value { get; set; } } \ No newline at end of file diff --git a/Pds/Pds.Api.Contracts/Controllers/Content/EditContent/EditContentBillDto.cs b/Pds/Pds.Api.Contracts/Controllers/Content/EditContent/EditContentBillDto.cs index 75a63977..b12b75f8 100644 --- a/Pds/Pds.Api.Contracts/Controllers/Content/EditContent/EditContentBillDto.cs +++ b/Pds/Pds.Api.Contracts/Controllers/Content/EditContent/EditContentBillDto.cs @@ -19,6 +19,8 @@ public class EditContentBillDto [EnumDataType(typeof(ContactType))] public ContactType? ContactType { get; set; } + public bool IsContactAgent { get; set; } + [Range(10, Double.MaxValue, ErrorMessage = "Значение поля {0} должно быть больше чем {1}.")] public decimal Value { get; set; } } \ No newline at end of file diff --git a/Pds/Pds.Api.Contracts/Controllers/Content/GetContent/GetContentBillDto.cs b/Pds/Pds.Api.Contracts/Controllers/Content/GetContent/GetContentBillDto.cs index c4cc0406..d2fb2eee 100644 --- a/Pds/Pds.Api.Contracts/Controllers/Content/GetContent/GetContentBillDto.cs +++ b/Pds/Pds.Api.Contracts/Controllers/Content/GetContent/GetContentBillDto.cs @@ -16,6 +16,8 @@ public class GetContentBillDto : IPaymentStatus public string ContactName { get; set; } + public bool IsContactAgent { get; set; } + public ContactType? ContactType { get; set; } public PaymentStatus PaymentStatus { get; set; } diff --git a/Pds/Pds.Data/Entities/Bill.cs b/Pds/Pds.Data/Entities/Bill.cs index b41a3ccf..f65ce262 100644 --- a/Pds/Pds.Data/Entities/Bill.cs +++ b/Pds/Pds.Data/Entities/Bill.cs @@ -33,6 +33,8 @@ public class Bill : EntityBase public string ContactName { get; set; } public ContactType? ContactType { get; set; } + + public bool IsContactAgent { get; set; } [Column(TypeName = "varchar(50)")] public string ContractNumber { get; set; } diff --git a/Pds/Pds.Data/Migrations/20220626152846_IsAgentBill.Designer.cs b/Pds/Pds.Data/Migrations/20220626152846_IsAgentBill.Designer.cs new file mode 100644 index 00000000..3ad6c957 --- /dev/null +++ b/Pds/Pds.Data/Migrations/20220626152846_IsAgentBill.Designer.cs @@ -0,0 +1,665 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Pds.Data; + +#nullable disable + +namespace Pds.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20220626152846_IsAgentBill")] + partial class IsAgentBill + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("BrandPerson", b => + { + b.Property("BrandsId") + .HasColumnType("uniqueidentifier"); + + b.Property("PersonsId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("BrandsId", "PersonsId"); + + b.HasIndex("PersonsId"); + + b.ToTable("BrandPerson"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Bill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BrandId") + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("Contact") + .HasColumnType("varchar(300)"); + + b.Property("ContactEmail") + .HasColumnType("varchar(100)"); + + b.Property("ContactName") + .HasColumnType("varchar(300)"); + + b.Property("ContactType") + .HasColumnType("int"); + + b.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractDate") + .HasColumnType("datetime2"); + + b.Property("ContractNumber") + .HasColumnType("varchar(50)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("IsContactAgent") + .HasColumnType("bit"); + + b.Property("IsNeedPayNds") + .HasColumnType("bit"); + + b.Property("PaidAt") + .HasColumnType("datetime2"); + + b.Property("PaymentStatus") + .HasColumnType("int"); + + b.Property("PaymentType") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.Property("Value") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("BrandId"); + + b.HasIndex("ClientId"); + + b.HasIndex("ContentId") + .IsUnique() + .HasFilter("[ContentId] IS NOT NULL"); + + b.ToTable("Bills"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Brand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("Info") + .HasColumnType("varchar(300)"); + + b.Property("IsArchived") + .HasColumnType("bit"); + + b.Property("IsDefault") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(300)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("Brands"); + + b.HasData( + new + { + Id = new Guid("5aa23fa2-4b73-4a3f-c3d4-08d8d2705c5f"), + CreatedAt = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Info = "https://youtube.com/itbeard", + IsArchived = false, + IsDefault = true, + Name = "АйТиБорода" + }, + new + { + Id = new Guid("6bb23fa2-4b73-4a3f-c3d4-08d8d2705c5f"), + CreatedAt = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Info = "https://youtube.com/thedarkless", + IsArchived = false, + IsDefault = false, + Name = "Тёмный Лес" + }); + }); + + modelBuilder.Entity("Pds.Data.Entities.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(300)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Content", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillId") + .HasColumnType("uniqueidentifier"); + + b.Property("BrandId") + .HasColumnType("uniqueidentifier"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("PersonId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReleaseDate") + .HasColumnType("datetime2"); + + b.Property("SocialMediaType") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasColumnType("varchar(300)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("BrandId"); + + b.HasIndex("PersonId"); + + b.ToTable("Contents"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Cost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BrandId") + .HasColumnType("uniqueidentifier"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("PaidAt") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.Property("Value") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("BrandId"); + + b.HasIndex("ContentId"); + + b.ToTable("Costs"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Gift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BrandId") + .HasColumnType("uniqueidentifier"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("CompletedAt") + .HasColumnType("datetime2"); + + b.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("FirstName") + .HasColumnType("varchar(300)"); + + b.Property("LastName") + .HasColumnType("varchar(300)"); + + b.Property("PostalAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("PreviousStatus") + .HasColumnType("int"); + + b.Property("RaffledAt") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("ThirdName") + .HasColumnType("varchar(300)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("BrandId"); + + b.HasIndex("ContentId"); + + b.ToTable("Gifts"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Person", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ArchivedAt") + .HasColumnType("datetime2"); + + b.Property("City") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("varchar(300)"); + + b.Property("Info") + .HasColumnType("nvarchar(max)"); + + b.Property("IsContactEstablished") + .HasColumnType("bit"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("varchar(300)"); + + b.Property("Latitude") + .HasColumnType("nvarchar(max)"); + + b.Property("Longitude") + .HasColumnType("nvarchar(max)"); + + b.Property("Rate") + .HasColumnType("int"); + + b.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("ThirdName") + .HasColumnType("varchar(300)"); + + b.Property("Topics") + .HasColumnType("nvarchar(max)"); + + b.Property("UnarchivedAt") + .HasColumnType("datetime2"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Resource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PersonId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.Property("Url") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("PersonId"); + + b.ToTable("Resources"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Key") + .IsRequired() + .HasColumnType("varchar(100)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("Key") + .IsUnique(); + + b.ToTable("Settings"); + + b.HasData( + new + { + Id = new Guid("0bb23fa2-4b73-4a3f-c3d4-08d8d2705c5f"), + CreatedAt = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Название первой custom-ссылки в меню навигации", + Key = "ExternalLink1_Title", + Value = "Link #1" + }, + new + { + Id = new Guid("1bb23fa2-4b73-4a3f-c3d4-08d8d2705c5f"), + CreatedAt = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "URL первой custom-ссылки в меню навигации", + Key = "ExternalLink1_Url", + Value = "https://google.com" + }, + new + { + Id = new Guid("2bb23fa2-4b73-4a3f-c3d4-08d8d2705c5f"), + CreatedAt = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Название второй custom-ссылки в меню навигации", + Key = "ExternalLink2_Title", + Value = "Link #2" + }, + new + { + Id = new Guid("3bb23fa2-4b73-4a3f-c3d4-08d8d2705c5f"), + CreatedAt = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "URL второй custom-ссылки в меню навигации", + Key = "ExternalLink2_Url", + Value = "https://youtube.com" + }, + new + { + Id = new Guid("4bb23fa2-4b73-4a3f-c3d4-08d8d2705c5f"), + CreatedAt = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Значение по умолчанию для фильтра \"Контент -> Когда -> С\"", + Key = "FilterContentReleaseDateFrom", + Value = "" + }, + new + { + Id = new Guid("5bb23fa2-4b73-4a3f-c3d4-08d8d2705c5f"), + CreatedAt = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Значение по умолчанию для фильтра \"Доходы -> Когда -> С\"", + Key = "FilterBillsDateFrom", + Value = "" + }, + new + { + Id = new Guid("6bb23fa2-4b73-4a3f-c3d4-08d8d2705c5f"), + CreatedAt = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Значение по умолчанию для фильтра \"Расходы -> Когда -> С\"", + Key = "FilterCostsDateFrom", + Value = "" + }); + }); + + modelBuilder.Entity("BrandPerson", b => + { + b.HasOne("Pds.Data.Entities.Brand", null) + .WithMany() + .HasForeignKey("BrandsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Pds.Data.Entities.Person", null) + .WithMany() + .HasForeignKey("PersonsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Pds.Data.Entities.Bill", b => + { + b.HasOne("Pds.Data.Entities.Brand", "Brand") + .WithMany("Bills") + .HasForeignKey("BrandId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Pds.Data.Entities.Client", "Client") + .WithMany("Bills") + .HasForeignKey("ClientId"); + + b.HasOne("Pds.Data.Entities.Content", "Content") + .WithOne("Bill") + .HasForeignKey("Pds.Data.Entities.Bill", "ContentId"); + + b.Navigation("Brand"); + + b.Navigation("Client"); + + b.Navigation("Content"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Content", b => + { + b.HasOne("Pds.Data.Entities.Brand", "Brand") + .WithMany("Contents") + .HasForeignKey("BrandId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Pds.Data.Entities.Person", "Person") + .WithMany("Contents") + .HasForeignKey("PersonId"); + + b.Navigation("Brand"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Cost", b => + { + b.HasOne("Pds.Data.Entities.Brand", "Brand") + .WithMany("Costs") + .HasForeignKey("BrandId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Pds.Data.Entities.Content", "Content") + .WithMany("Costs") + .HasForeignKey("ContentId"); + + b.Navigation("Brand"); + + b.Navigation("Content"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Gift", b => + { + b.HasOne("Pds.Data.Entities.Brand", "Brand") + .WithMany("Gifts") + .HasForeignKey("BrandId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Pds.Data.Entities.Content", "Content") + .WithMany() + .HasForeignKey("ContentId"); + + b.Navigation("Brand"); + + b.Navigation("Content"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Resource", b => + { + b.HasOne("Pds.Data.Entities.Person", "Person") + .WithMany("Resources") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Brand", b => + { + b.Navigation("Bills"); + + b.Navigation("Contents"); + + b.Navigation("Costs"); + + b.Navigation("Gifts"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Client", b => + { + b.Navigation("Bills"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Content", b => + { + b.Navigation("Bill"); + + b.Navigation("Costs"); + }); + + modelBuilder.Entity("Pds.Data.Entities.Person", b => + { + b.Navigation("Contents"); + + b.Navigation("Resources"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Pds/Pds.Data/Migrations/20220626152846_IsAgentBill.cs b/Pds/Pds.Data/Migrations/20220626152846_IsAgentBill.cs new file mode 100644 index 00000000..02ff5e3b --- /dev/null +++ b/Pds/Pds.Data/Migrations/20220626152846_IsAgentBill.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Pds.Data.Migrations +{ + public partial class IsAgentBill : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsContactAgent", + table: "Bills", + type: "bit", + nullable: false, + defaultValue: false); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IsContactAgent", + table: "Bills"); + } + } +} diff --git a/Pds/Pds.Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Pds/Pds.Data/Migrations/ApplicationDbContextModelSnapshot.cs index 643225b0..ea47a207 100644 --- a/Pds/Pds.Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Pds/Pds.Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -76,6 +76,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CreatedAt") .HasColumnType("datetime2"); + b.Property("IsContactAgent") + .HasColumnType("bit"); + b.Property("IsNeedPayNds") .HasColumnType("bit"); diff --git a/Pds/Pds.Services.Models/Bill/EditBillModel.cs b/Pds/Pds.Services.Models/Bill/EditBillModel.cs index 62dc1406..77fb8ed0 100644 --- a/Pds/Pds.Services.Models/Bill/EditBillModel.cs +++ b/Pds/Pds.Services.Models/Bill/EditBillModel.cs @@ -32,4 +32,6 @@ public class EditBillModel public string ContactEmail { get; set; } public ContactType ContactType { get; set; } + + public bool IsContactAgent { get; set; } } \ No newline at end of file diff --git a/Pds/Pds.Services.Models/Content/CreateContentBillModel.cs b/Pds/Pds.Services.Models/Content/CreateContentBillModel.cs index d8c19d71..a3e42ebd 100644 --- a/Pds/Pds.Services.Models/Content/CreateContentBillModel.cs +++ b/Pds/Pds.Services.Models/Content/CreateContentBillModel.cs @@ -14,6 +14,8 @@ public class CreateContentBillModel public ContactType ContactType { get; set; } + public bool IsContactAgent { get; set; } + public decimal Value { get; set; } } \ No newline at end of file diff --git a/Pds/Pds.Services.Models/Content/EditContentBillModel.cs b/Pds/Pds.Services.Models/Content/EditContentBillModel.cs index 144f1b5b..bbc608b9 100644 --- a/Pds/Pds.Services.Models/Content/EditContentBillModel.cs +++ b/Pds/Pds.Services.Models/Content/EditContentBillModel.cs @@ -14,6 +14,8 @@ public class EditContentBillModel public ContactType ContactType { get; set; } + public bool IsContactAgent { get; set; } + public decimal Value { get; set; } } \ No newline at end of file diff --git a/Pds/Pds.Services/Services/BillService.cs b/Pds/Pds.Services/Services/BillService.cs index 7ad68495..75cccff5 100644 --- a/Pds/Pds.Services/Services/BillService.cs +++ b/Pds/Pds.Services/Services/BillService.cs @@ -86,7 +86,7 @@ public async Task CreateAsync(Bill bill) bill.ContactName = null; bill.ContactEmail = null; bill.Contact = null; - bill.ContactType = null; + bill.IsContactAgent = false; } var result = await unitOfWork.Bills.InsertAsync(bill); @@ -148,6 +148,7 @@ public async Task EditAsync(EditBillModel model) bill.ContactType = !string.IsNullOrEmpty(bill.Contact) ? bill.ContactType : null; + bill.IsContactAgent = model.IsContactAgent; } else { diff --git a/Pds/Pds.Services/Services/ContentService.cs b/Pds/Pds.Services/Services/ContentService.cs index 1c2f1867..04205d2a 100644 --- a/Pds/Pds.Services/Services/ContentService.cs +++ b/Pds/Pds.Services/Services/ContentService.cs @@ -85,6 +85,7 @@ public async Task CreateAsync(CreateContentModel model) Type = BillType.Content, BrandId = model.BrandId, ClientId = model.Bill.ClientId, + IsContactAgent = model.Bill.IsContactAgent, Comment = $"Created automatically for content with id {content.Id} ({content.Title})" }; @@ -150,6 +151,7 @@ public async Task EditAsync(EditContentModel model) content.Bill.ContactType = !string.IsNullOrEmpty(model.Bill.Contact) ? model.Bill.ContactType : null; + content.Bill.IsContactAgent = model.Bill.IsContactAgent; content.Bill.Value = model.Bill.Value; content.Bill.UpdatedAt = DateTime.UtcNow; } diff --git a/Pds/Pds.Web/Pages/Bills/Create.razor b/Pds/Pds.Web/Pages/Bills/Create.razor index 4ba2bee1..beef8845 100644 --- a/Pds/Pds.Web/Pages/Bills/Create.razor +++ b/Pds/Pds.Web/Pages/Bills/Create.razor @@ -121,6 +121,11 @@ else + +
+ + +
diff --git a/Pds/Pds.Web/Pages/Bills/Edit.razor b/Pds/Pds.Web/Pages/Bills/Edit.razor index f48bd741..5dae2b10 100644 --- a/Pds/Pds.Web/Pages/Bills/Edit.razor +++ b/Pds/Pds.Web/Pages/Bills/Edit.razor @@ -137,6 +137,11 @@ else
+ +
+ + +
diff --git a/Pds/Pds.Web/Pages/Content/Create.razor b/Pds/Pds.Web/Pages/Content/Create.razor index ec0ffd9f..79aa2731 100644 --- a/Pds/Pds.Web/Pages/Content/Create.razor +++ b/Pds/Pds.Web/Pages/Content/Create.razor @@ -111,6 +111,11 @@ else
+ +
+ + +
diff --git a/Pds/Pds.Web/Pages/Content/Edit.razor b/Pds/Pds.Web/Pages/Content/Edit.razor index c38a77f2..f38d53a0 100644 --- a/Pds/Pds.Web/Pages/Content/Edit.razor +++ b/Pds/Pds.Web/Pages/Content/Edit.razor @@ -109,6 +109,11 @@ else
+ +
+ + +
diff --git a/Pds/Pds.Web/Pages/Content/Info.razor b/Pds/Pds.Web/Pages/Content/Info.razor index edf99fdb..c4509692 100644 --- a/Pds/Pds.Web/Pages/Content/Info.razor +++ b/Pds/Pds.Web/Pages/Content/Info.razor @@ -123,16 +123,28 @@ else +
+ + +
+
Контакт
+
+
+ @if (content.Bill.IsContactAgent) + { + агент + } @content.Bill.ContactName @if (!string.IsNullOrEmpty(content.Bill.Contact)) { - / + / @EnumsTranslator.ContactTypeToRu(content.Bill.ContactType).ToLower(): @((MarkupString) ContactBuilder.ToLink(content.Bill.ContactType, content.Bill.Contact)) } - + @if (!string.IsNullOrEmpty(content.Bill.ContactEmail)) { / @content.Bill.ContactEmail @@ -141,7 +153,7 @@ else
} - + @if (content.Person != null) {
diff --git a/Pds/Pds.Web/Pages/Content/Info.razor.css b/Pds/Pds.Web/Pages/Content/Info.razor.css index 97400c1c..be4b1dfc 100644 --- a/Pds/Pds.Web/Pages/Content/Info.razor.css +++ b/Pds/Pds.Web/Pages/Content/Info.razor.css @@ -47,7 +47,8 @@ background-color: gainsboro; } -.bill-cost i.payment-type { +.bill-cost i.payment-type, +.contact-info i.payment-type { font-size: 0.8rem; padding: 2px 4px; border-radius: 4px; @@ -56,7 +57,8 @@ margin-right: 5px } -.bill-cost i.white { +.bill-cost i.white, +.contact-info i.white { background-color: white; color: black; }