diff --git a/BeautyStudio/BeautyStudioContracts/BindingModels/ReportBindingModel.cs b/BeautyStudio/BeautyStudioContracts/BindingModels/ReportBindingModel.cs index 2f37802..9667313 100644 --- a/BeautyStudio/BeautyStudioContracts/BindingModels/ReportBindingModel.cs +++ b/BeautyStudio/BeautyStudioContracts/BindingModels/ReportBindingModel.cs @@ -12,5 +12,6 @@ namespace BeautyStudioContracts.BindingModels public string FileName { get; set; } = string.Empty; public DateTime? DateFrom { get; set; } public DateTime? DateTo { get; set;} + } } diff --git a/BeautyStudio/BeautyStudioContracts/BindingModels/ReportOrderBindingModel.cs b/BeautyStudio/BeautyStudioContracts/BindingModels/ReportOrderBindingModel.cs deleted file mode 100644 index c5bc4d1..0000000 --- a/BeautyStudio/BeautyStudioContracts/BindingModels/ReportOrderBindingModel.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BeautyStudioContracts.BindingModels -{ - public class ReportOrderBindingModel - { - public string FileName { get; set; } = string.Empty; - public DateTime? DateFrom { get; set; } = DateTime.Now; - public DateTime? DateTo { get; set; } = DateTime.Now; - public int? WorkerId { get; set; } - public string? Email { get; set; } - } -} diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/BeautyStudioDatabaseImplement.csproj b/BeautyStudio/BeautyStudioDatabaseImplement/BeautyStudioDatabaseImplement.csproj index 9d64e6b..cdbdb5e 100644 --- a/BeautyStudio/BeautyStudioDatabaseImplement/BeautyStudioDatabaseImplement.csproj +++ b/BeautyStudio/BeautyStudioDatabaseImplement/BeautyStudioDatabaseImplement.csproj @@ -22,8 +22,4 @@ - - - - diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240827175011_SecondMig.Designer.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240828201810_ThirdMig.Designer.cs similarity index 99% rename from BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240827175011_SecondMig.Designer.cs rename to BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240828201810_ThirdMig.Designer.cs index 2595bd7..32bd963 100644 --- a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240827175011_SecondMig.Designer.cs +++ b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240828201810_ThirdMig.Designer.cs @@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace BeautyStudioDatabaseImplement.Migrations { [DbContext(typeof(BeautyStudioDatabase))] - [Migration("20240827175011_SecondMig")] - partial class SecondMig + [Migration("20240828201810_ThirdMig")] + partial class ThirdMig { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -579,7 +579,7 @@ namespace BeautyStudioDatabaseImplement.Migrations modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceCosmetic", b => { b.HasOne("BeautyStudioDatabaseImplement.Models.Cosmetic", "Cosmetic") - .WithMany("Services") + .WithMany() .HasForeignKey("CosmeticId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -617,8 +617,6 @@ namespace BeautyStudioDatabaseImplement.Migrations modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Cosmetic", b => { b.Navigation("Procedures"); - - b.Navigation("Services"); }); modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b => diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240827175011_SecondMig.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240828201810_ThirdMig.cs similarity index 99% rename from BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240827175011_SecondMig.cs rename to BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240828201810_ThirdMig.cs index c61ba7a..10386b7 100644 --- a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240827175011_SecondMig.cs +++ b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240828201810_ThirdMig.cs @@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace BeautyStudioDatabaseImplement.Migrations { /// - public partial class SecondMig : Migration + public partial class ThirdMig : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/BeautyStudioDatabaseModelSnapshot.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/BeautyStudioDatabaseModelSnapshot.cs index d24b62c..5441932 100644 --- a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/BeautyStudioDatabaseModelSnapshot.cs +++ b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/BeautyStudioDatabaseModelSnapshot.cs @@ -576,7 +576,7 @@ namespace BeautyStudioDatabaseImplement.Migrations modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceCosmetic", b => { b.HasOne("BeautyStudioDatabaseImplement.Models.Cosmetic", "Cosmetic") - .WithMany("Services") + .WithMany() .HasForeignKey("CosmeticId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -614,8 +614,6 @@ namespace BeautyStudioDatabaseImplement.Migrations modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Cosmetic", b => { b.Navigation("Procedures"); - - b.Navigation("Services"); }); modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b => diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Models/Cosmetic.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Models/Cosmetic.cs index 19e6d1c..0b569f0 100644 --- a/BeautyStudio/BeautyStudioDatabaseImplement/Models/Cosmetic.cs +++ b/BeautyStudio/BeautyStudioDatabaseImplement/Models/Cosmetic.cs @@ -50,9 +50,6 @@ namespace BeautyStudioDatabaseImplement.Models } // список косметики в закаче public virtual List Procedures { get; set; } = new(); - // связь многие-ко-многим косметики с процедурами - [ForeignKey("CosmeticId")] - public virtual List Services { get; set; } = new(); public static Cosmetic Create(BeautyStudioDatabase context, CosmeticBindingModel model) { diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Models/LaborCost.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Models/LaborCost.cs index 052a0a3..a95cfa2 100644 --- a/BeautyStudio/BeautyStudioDatabaseImplement/Models/LaborCost.cs +++ b/BeautyStudio/BeautyStudioDatabaseImplement/Models/LaborCost.cs @@ -54,7 +54,8 @@ namespace BeautyStudioDatabaseImplement.Models { Id = Id, TimeSpent = TimeSpent, - Difficulty = Difficulty + Difficulty = Difficulty, + StoreKeeperId = StoreKeeper.Id }; } diff --git a/BeautyStudio/StoreKeeperWebApp/Controllers/ServiceController.cs b/BeautyStudio/StoreKeeperWebApp/Controllers/ServiceController.cs index 58430d8..72bdd05 100644 --- a/BeautyStudio/StoreKeeperWebApp/Controllers/ServiceController.cs +++ b/BeautyStudio/StoreKeeperWebApp/Controllers/ServiceController.cs @@ -2,7 +2,10 @@ using BeautyStudioContracts.BusinessLogicContracts; using BeautyStudioContracts.SearchModels; using BeautyStudioContracts.ViewModels; +using BeautyStudioDatabaseImplement.Models; +using BeautyStudioDataModels.Enums; using BeautyStudioDataModels.Models; +using DocumentFormat.OpenXml.Spreadsheet; using Microsoft.AspNetCore.Mvc; using System.Numerics; @@ -160,5 +163,32 @@ namespace StoreKeeperWebApp.Controllers Response.Redirect("/Service/Services"); } - } + + public IActionResult AddProcedureToService() + { + + if (APIStoreKeeper.Storekeeper == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.Procedures = _procedureLogic.ReadList(null); + ViewBag.Services = _serviceLogic.ReadList(null); + return View(); + } + //[HttpPost] + //public void AddProcedureToService(int product, int order) + //{ + // if (APIStoreKeeper.Storekeeper == null) + // { + // throw new Exception("Вы как сюда попали? Сюда вход только авторизованным"); + // } + // APIStoreKeeper.PostRequest("api/main/updateorder", new OrderBindingModel + // { + // Id = order, + // ProductId = product, + // Status = OrderStatus.Принят, + // }); + // Response.Redirect(""); + //} + } } diff --git a/BeautyStudio/StoreKeeperWebApp/Views/Cosmetic/UpdateCosmetics.cshtml b/BeautyStudio/StoreKeeperWebApp/Views/Cosmetic/UpdateCosmetics.cshtml index 019ec02..a1eb9fb 100644 --- a/BeautyStudio/StoreKeeperWebApp/Views/Cosmetic/UpdateCosmetics.cshtml +++ b/BeautyStudio/StoreKeeperWebApp/Views/Cosmetic/UpdateCosmetics.cshtml @@ -20,7 +20,7 @@
Цена:
-
+
diff --git a/BeautyStudio/StoreKeeperWebApp/Views/Home/Reports.cshtml b/BeautyStudio/StoreKeeperWebApp/Views/Home/Reports.cshtml index 6647d57..d5a02cd 100644 --- a/BeautyStudio/StoreKeeperWebApp/Views/Home/Reports.cshtml +++ b/BeautyStudio/StoreKeeperWebApp/Views/Home/Reports.cshtml @@ -1,47 +1,93 @@ -@{ - ViewData["Title"] = "Report"; +@using BeautyStudioContracts.ViewModels +@model List + +@{ + ViewBag.Title = "Отчеты"; } -

Отчет по услугам

- -
-
-

Дата начала:

- -
-
-

Дата конца:

- -
- - +
+

Отчеты

-

- За период с  - ... -  по  - ... -

-
- - - - - - - - - - - - - -
Дата созданияУслугаСтоимостьНаименованиеСтоимость косметикиПроцедуры
-
+
+
+ +
+ +
- + +
+ +
+ + +
+ +
+ +
+ + +
+
+ +
+
+
+ + +
+

Список услуг:

+
+ + + + + + + + + + @if (Model == null || Model.Count <= 0) + { + + } + else + { + foreach (var record in Model) + { + + + + + // Конвертируем из HashSet в List, чтобы можно было обращаться по индексу + var cosmetics = new List(); + foreach (var kvp in record.Cosmetics) + { + var cosmeticModel = kvp.Value.Item1; + cosmetics.Add(cosmeticModel.CosmeticName); + } + var procedures = new List(); + foreach (var kvp in record.Procedures) + { + var procedureModel = kvp.Value.Item1; + procedures.Add(procedureModel.ProcedureName); + } + + + // Записываем названия лекарств во 2 колонку + // и названия лекарств в 3 колонку + int maxLength = Math.Max(cosmetics.Count, procedures.Count); + for (int i = 0; i < maxLength; i++) + { + + + + + + } + } + } + +
УслугаПроцедурыКосметика
Нет доступных данных@record.ServiceName
@(i < cosmetics.Count ? cosmetics[i] : "")@(i < procedures.Count ? procedures[i] : "")
\ No newline at end of file diff --git a/BeautyStudio/StoreKeeperWebApp/Views/LaborCost/UpdateLaborCosts.cshtml b/BeautyStudio/StoreKeeperWebApp/Views/LaborCost/UpdateLaborCosts.cshtml index bdda888..17e26d2 100644 --- a/BeautyStudio/StoreKeeperWebApp/Views/LaborCost/UpdateLaborCosts.cshtml +++ b/BeautyStudio/StoreKeeperWebApp/Views/LaborCost/UpdateLaborCosts.cshtml @@ -13,7 +13,7 @@
Количество часов:
-
+
diff --git a/BeautyStudio/StoreKeeperWebApp/Views/Procedure/CreateProcedures.cshtml b/BeautyStudio/StoreKeeperWebApp/Views/Procedure/CreateProcedures.cshtml deleted file mode 100644 index df39891..0000000 --- a/BeautyStudio/StoreKeeperWebApp/Views/Procedure/CreateProcedures.cshtml +++ /dev/null @@ -1,35 +0,0 @@ -@{ - ViewData["Title"] = "Создание процедур"; -} - -
-

Создание процедуры

-
- - - -
-
Название:
-
-
- - - -
-
Цена:
-
-
- - -
-
Описание:
-
-
- - -
-
-
-
- - diff --git a/BeautyStudio/StoreKeeperWebApp/Views/Procedure/Procedures.cshtml b/BeautyStudio/StoreKeeperWebApp/Views/Procedure/Procedures.cshtml deleted file mode 100644 index 8de90a6..0000000 --- a/BeautyStudio/StoreKeeperWebApp/Views/Procedure/Procedures.cshtml +++ /dev/null @@ -1,70 +0,0 @@ -@using BeautyStudioContracts.ViewModels - -@model List - -@{ - ViewData["Title"] = "Процедуры"; -} - -
-

Процедуры

-
- -
- @{ - if (Model == null) - { -

Авторизируйтесь

- return; - } - -

- Создать процедуры -

- - - - - - - - - - - - - - - @foreach (var procedures in Model) - { - - - - - - - - - } - -
НомерНазваниеЦенаОписание
@procedures.Id@procedures.ProcedureName@procedures.ProcedureCost@procedures.ProcedureDescription -

-
-

-
- } -
- -@section scripts { - -} - - diff --git a/BeautyStudio/StoreKeeperWebApp/Views/Procedure/UpdateProcedures.cshtml b/BeautyStudio/StoreKeeperWebApp/Views/Procedure/UpdateProcedures.cshtml deleted file mode 100644 index 4df05c7..0000000 --- a/BeautyStudio/StoreKeeperWebApp/Views/Procedure/UpdateProcedures.cshtml +++ /dev/null @@ -1,37 +0,0 @@ -@using BeautyStudioContracts.ViewModels - -@model ProcedureViewModel - -@{ - ViewData["Title"] = "Редактирование процедур"; -} - -
-

Редактирование процедуры

-
- -
- -
-
Название:
-
-
- - -
-
Цена:
-
-
- - -
-
Длительность:
-
-
- - -
-
-
-
-
diff --git a/BeautyStudio/StoreKeeperWebApp/Views/Service/AddProcedureToService.cshtml b/BeautyStudio/StoreKeeperWebApp/Views/Service/AddProcedureToService.cshtml new file mode 100644 index 0000000..8df877c --- /dev/null +++ b/BeautyStudio/StoreKeeperWebApp/Views/Service/AddProcedureToService.cshtml @@ -0,0 +1,24 @@ + +@{ + ViewData["Title"] = "AddProcedureToService"; +} + + + + +
+

Привязка процедуры к услуге

+
+
+
+ + +
+
+ + +
+
+ +
+
\ No newline at end of file diff --git a/BeautyStudio/StoreKeeperWebApp/Views/Service/UpdateServices.cshtml b/BeautyStudio/StoreKeeperWebApp/Views/Service/UpdateServices.cshtml index cb21a13..9878179 100644 --- a/BeautyStudio/StoreKeeperWebApp/Views/Service/UpdateServices.cshtml +++ b/BeautyStudio/StoreKeeperWebApp/Views/Service/UpdateServices.cshtml @@ -17,7 +17,7 @@
Цена:
-
+
diff --git a/BeautyStudio/StoreKeeperWebApp/Views/Shared/AddProcedureToService.cshtml b/BeautyStudio/StoreKeeperWebApp/Views/Shared/AddProcedureToService.cshtml new file mode 100644 index 0000000..8df877c --- /dev/null +++ b/BeautyStudio/StoreKeeperWebApp/Views/Shared/AddProcedureToService.cshtml @@ -0,0 +1,24 @@ + +@{ + ViewData["Title"] = "AddProcedureToService"; +} + + + + +
+

Привязка процедуры к услуге

+
+
+
+ + +
+
+ + +
+
+ +
+
\ No newline at end of file diff --git a/BeautyStudio/StoreKeeperWebApp/Views/Shared/_Layout.cshtml b/BeautyStudio/StoreKeeperWebApp/Views/Shared/_Layout.cshtml index d1d96e3..0f8fe03 100644 --- a/BeautyStudio/StoreKeeperWebApp/Views/Shared/_Layout.cshtml +++ b/BeautyStudio/StoreKeeperWebApp/Views/Shared/_Layout.cshtml @@ -37,6 +37,9 @@ +