diff --git a/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/WorkerReportLogic.cs b/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/WorkerReportLogic.cs index 87bada3..af2f990 100644 --- a/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/WorkerReportLogic.cs +++ b/HardwareShop/HardwareShopBusinessLogic/BusinessLogics/Worker/WorkerReportLogic.cs @@ -152,6 +152,7 @@ namespace HardwareShopContracts.BusinessLogicsContracts /// public void SendByMailPurchaseReport(ReportBindingModel model) { + model.FileName = "temp.pdf"; _saveToPdf.GetPurchaseReportFile(new() { FileName = model.FileName, diff --git a/HardwareShop/HardwareShopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/HardwareShop/HardwareShopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs index 6ac6744..21f5e9b 100644 --- a/HardwareShop/HardwareShopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/HardwareShop/HardwareShopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -26,7 +26,7 @@ namespace HardwareShopBusinessLogic.OfficePackage ParagraphAlignment = PdfParagraphAlignmentType.Center }); - CreateTable(new List { "5cm", "5cm", "5cm", "5cm", "5cm" }); + CreateTable(new List { "3cm", "4cm", "3cm", "4cm", "4cm" }); CreateRow(new PdfRowParameters { @@ -73,7 +73,7 @@ namespace HardwareShopBusinessLogic.OfficePackage }); } } - + CreateParagraph(new PdfParagraph { Text = $"Итого: {info.ReportPurchases.Sum(x => x.PurchaseSum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); SavePdf(info); } diff --git a/HardwareShop/HardwareShopClientApp/Views/Storekeeper/ListBuilds.cshtml b/HardwareShop/HardwareShopClientApp/Views/Storekeeper/ListBuilds.cshtml index cfc8c7b..c89f385 100644 --- a/HardwareShop/HardwareShopClientApp/Views/Storekeeper/ListBuilds.cshtml +++ b/HardwareShop/HardwareShopClientApp/Views/Storekeeper/ListBuilds.cshtml @@ -24,8 +24,8 @@
- - + +
diff --git a/HardwareShop/HardwareShopDatabaseImplement/HardwareShopDatabase.cs b/HardwareShop/HardwareShopDatabaseImplement/HardwareShopDatabase.cs index 939b6a4..4246e31 100644 --- a/HardwareShop/HardwareShopDatabaseImplement/HardwareShopDatabase.cs +++ b/HardwareShop/HardwareShopDatabaseImplement/HardwareShopDatabase.cs @@ -10,7 +10,7 @@ namespace HardwareShopDatabaseImplement { protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - optionsBuilder.UseNpgsql("Host=localhost;Port=5433;Database=Computer_Hardware_Store;Username=user;Password=12345"); + optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=Computer_Hardware_Store4;Username=postgres;Password=1234"); AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); } diff --git a/HardwareShop/HardwareShopRestApi/Controllers/ReportController.cs b/HardwareShop/HardwareShopRestApi/Controllers/ReportController.cs index 656316c..f32fe9e 100644 --- a/HardwareShop/HardwareShopRestApi/Controllers/ReportController.cs +++ b/HardwareShop/HardwareShopRestApi/Controllers/ReportController.cs @@ -122,7 +122,15 @@ namespace HardwareShopRestApi.Controllers [HttpPost] public void SendByMailPurchaseReport(ReportBindingModel reportModel) { - _reportWorkerLogic.SendByMailPurchaseReport(reportModel); + try + { + _reportWorkerLogic.SendByMailPurchaseReport(reportModel); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка получения сведений по полученным пользователем комплектующим за период"); + throw; + } } } diff --git a/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs b/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs index 484b7bf..dba2e79 100644 --- a/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs +++ b/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs @@ -1,4 +1,5 @@ -using HardwareShopContracts.BindingModels; +using DocumentFormat.OpenXml.Spreadsheet; +using HardwareShopContracts.BindingModels; using HardwareShopContracts.SearchModels; using HardwareShopContracts.ViewModels; using HardwareShopDatabaseImplement.Models; @@ -56,9 +57,39 @@ namespace HardwareShopWorkerApp.Controllers return View(); } + [HttpGet] public IActionResult Privacy() { - return View(); + if (APIClient.User == null) + { + return Redirect("~/Home/Enter"); + } + return View(APIClient.User); + } + + [HttpPost] + public void Privacy(string login, string email, string password) + { + if (APIClient.User == null) + { + throw new Exception("Вы как суда попали? Суда вход только авторизованным"); + } + if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password)) + { + throw new Exception("Введите логин, пароль и ФИО"); + } + APIClient.PostRequest("api/user/updatedata", new UserBindingModel + { + Id = APIClient.User.Id, + Login = login, + Email = email, + Password = password + }); + + APIClient.User.Login = login; + APIClient.User.Email = email; + APIClient.User.Password = password; + Response.Redirect("MainWorker"); } [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Home/Builds.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/Builds.cshtml index 631ed28..6dc0d0c 100644 --- a/HardwareShop/HardwareShopWorkerApp/Views/Home/Builds.cshtml +++ b/HardwareShop/HardwareShopWorkerApp/Views/Home/Builds.cshtml @@ -15,6 +15,7 @@

Сборки

+
@@ -48,15 +49,15 @@ @Html.DisplayFor(modelItem => item.BuildName) } @@ -65,13 +66,6 @@ -
- - - - - -
-
- - - -
+ + + + +
@@ -29,7 +30,7 @@ Текст } @@ -61,10 +64,6 @@
- Название сборки к которой относиться комментарий + Название сборки к которой относится комментарий Действия @@ -50,10 +51,12 @@ @Html.DisplayFor(modelItem => item.BuildName) -
- - -
+ +
-
- - -
-
- - - - - -
- - -*@ \ No newline at end of file +} \ No newline at end of file diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Home/LinkPurchase.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/LinkPurchase.cshtml index 2c23262..4a7cc40 100644 --- a/HardwareShop/HardwareShopWorkerApp/Views/Home/LinkPurchase.cshtml +++ b/HardwareShop/HardwareShopWorkerApp/Views/Home/LinkPurchase.cshtml @@ -13,7 +13,7 @@
@{

- +

@@ -224,11 +224,11 @@
- - - - - + + + + +
@@ -56,24 +56,12 @@
- @**@ }
@Html.DisplayFor(modelItem => item.PurchaseStatus) -
- - -
-
-
- - @* - - *@ -
} diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Home/UpdatePurchase.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/UpdatePurchase.cshtml index c150829..0b2b803 100644 --- a/HardwareShop/HardwareShopWorkerApp/Views/Home/UpdatePurchase.cshtml +++ b/HardwareShop/HardwareShopWorkerApp/Views/Home/UpdatePurchase.cshtml @@ -17,7 +17,6 @@

Товары

-
@@ -68,6 +67,7 @@ const saveBtn = document.getElementById("createpurchase"); const countElem = document.getElementById("count"); const resultTable = document.getElementById("result"); + const totalSum = document.getElementById("sum"); submitGoodBtn.addEventListener("click", () => { console.log('try to add good') @@ -138,7 +138,10 @@ ` count++; console.log(elem); + price += elem.good.price * elem.count }) + totalSum.value = Math.round(price * 110) / 100 + console.log(totalSum.value); } function deleteGood(id) { @@ -173,70 +176,4 @@ getPurchase(); -} - - -@* -
-
-

Товары

-
-
-
- - - - - - - - - - -
- Номер - - Название товара - - Цена - - Количество -
- - -
- - - - - -
- - -*@ \ No newline at end of file +} \ No newline at end of file diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Home/WorkerReport.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/WorkerReport.cshtml index 5c263c2..93ebc95 100644 --- a/HardwareShop/HardwareShopWorkerApp/Views/Home/WorkerReport.cshtml +++ b/HardwareShop/HardwareShopWorkerApp/Views/Home/WorkerReport.cshtml @@ -3,29 +3,15 @@ Layout = "~/Views/Shared/_LayoutWorker.cshtml"; } -

Отчет по покупкам

- -
-
-

+
+
+ + + +
-
- -
-
-

Дата начала:

- -
-
-

Дата конца:

- -
- - + +

@@ -34,21 +20,20 @@  по  ...

-
- - - - - - - - - - - - -
Номер покупкиДата покупкиСумма покупкиКомментарииКомплектующие
-
+ + + + + + + + + + + + + +
Номер покупкиДата покупкиСумма покупкиКомментарииКомплектующие
@section Scripts { @@ -72,9 +57,6 @@ "DateFrom": dateFrom, "DateTo": dateTo }; - if (!validate(reportModel)) { - return; - } $.ajax({ url: "/home/WorkerReport", type: "POST", @@ -94,9 +76,6 @@ "DateFrom": dateFrom, "DateTo": dateTo }; - if (!validate(reportModel)) { - return; - } $.ajax({ url: "/home/SendByMailPurchaseReport", type: "POST", @@ -106,14 +85,6 @@ }); }); - dateFromInput.addEventListener("input", () => { - errorDivShell.style.gridTemplateRows = "0fr"; - }); - - dateToInput.addEventListener("input", () => { - errorDivShell.style.gridTemplateRows = "0fr"; - }); - // ![Event listeners] // [HTML gen] @@ -167,25 +138,6 @@ // [Other] - const validate = function (reportModel) { - if (isNaN(reportModel["DateFrom"])) { - errorDivShell.style.gridTemplateRows = "1fr"; - errorP.innerHTML = "Выберите начальную дату"; - return false; - } - if (isNaN(reportModel["DateTo"])) { - errorDivShell.style.gridTemplateRows = "1fr"; - errorP.innerHTML = "Выберите конечную дату"; - return false; - } - if (reportModel["DateFrom"] >= reportModel["DateTo"]) { - errorDivShell.style.gridTemplateRows = "1fr"; - errorP.innerHTML = "Начальная дата должна быть меньше конечной"; - return false; - } - return true; - } - const getDate = function (iso) { const year = iso.substring(0, 4); const month = iso.substring(5, 7); diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Home/listComponents.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/listComponents.cshtml index ea4942c..ed1dc8d 100644 --- a/HardwareShop/HardwareShopWorkerApp/Views/Home/listComponents.cshtml +++ b/HardwareShop/HardwareShopWorkerApp/Views/Home/listComponents.cshtml @@ -24,8 +24,8 @@
- - + +
diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Shared/_LayoutWorker.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Shared/_LayoutWorker.cshtml index 2b7096b..aa26c35 100644 --- a/HardwareShop/HardwareShopWorkerApp/Views/Shared/_LayoutWorker.cshtml +++ b/HardwareShop/HardwareShopWorkerApp/Views/Shared/_LayoutWorker.cshtml @@ -36,6 +36,9 @@ +
diff --git a/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/FontAwesome.otf b/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/FontAwesome.otf new file mode 100644 index 0000000..401ec0f Binary files /dev/null and b/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/FontAwesome.otf differ diff --git a/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.eot b/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.eot new file mode 100644 index 0000000..e9f60ca Binary files /dev/null and b/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.eot differ diff --git a/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.svg b/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.svg new file mode 100644 index 0000000..855c845 --- /dev/null +++ b/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.svg @@ -0,0 +1,2671 @@ + + + + +Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016 + By ,,, +Copyright Dave Gandy 2016. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.ttf b/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.ttf new file mode 100644 index 0000000..35acda2 Binary files /dev/null and b/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.ttf differ diff --git a/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.woff b/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.woff new file mode 100644 index 0000000..400014a Binary files /dev/null and b/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.woff differ diff --git a/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.woff2 b/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.woff2 new file mode 100644 index 0000000..4d13fc6 Binary files /dev/null and b/HardwareShop/HardwareShopWorkerApp/wwwroot/lib/font-awesome-4.7.0/fonts/fontawesome-webfont.woff2 differ