From 74dd85bd7ecfe984da5ac23042120c56a280692c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=91=D0=B0=D0=BA=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D1=81=D0=BA=D0=B0=D1=8F?= Date: Wed, 29 May 2024 22:45:43 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D0=B0=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D1=8B=20=D0=B8=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D1=81=D1=82=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B5=D0=B3=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D1=86=D0=B8=D0=B8,=20=D0=BB=D0=BE?= =?UTF-8?q?=D0=B3=D0=B8=D0=BD=D0=B0,=20=D0=BF=D0=B5=D1=80=D0=B5=D1=87?= =?UTF-8?q?=D0=B8=D1=81=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=20=D0=B2=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=20=D0=BE=D1=82=20=D1=81=D0=BE=D1=81=D1=82=D0=BE=D1=8F?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=20=D0=B8=20=D1=82=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PolyclinicWebAppSuretor/LoginManager.cs | 9 +++ .../Models/UserPrivacyModel.cs | 13 ++++ .../RestrictionEnum.cs | 12 ++++ .../PolyclinicWebAppSuretor/SiteMenuItems.cs | 27 ++++---- .../Views/Home/Login.cshtml | 9 ++- .../Views/Home/Privacy.cshtml | 40 +++++++++-- .../Views/Home/Register.cshtml | 10 ++- .../Views/Shared/_Layout.cshtml | 68 ++++++++++++------- 8 files changed, 145 insertions(+), 43 deletions(-) create mode 100644 Polyclinic/PolyclinicWebAppSuretor/LoginManager.cs create mode 100644 Polyclinic/PolyclinicWebAppSuretor/Models/UserPrivacyModel.cs create mode 100644 Polyclinic/PolyclinicWebAppSuretor/RestrictionEnum.cs diff --git a/Polyclinic/PolyclinicWebAppSuretor/LoginManager.cs b/Polyclinic/PolyclinicWebAppSuretor/LoginManager.cs new file mode 100644 index 0000000..7590620 --- /dev/null +++ b/Polyclinic/PolyclinicWebAppSuretor/LoginManager.cs @@ -0,0 +1,9 @@ +using PolyclinicContracts.ViewModels; + +namespace PolyclinicWebAppSuretor +{ + public class LoginManager + { + public static UserViewModel? LogginedUser { get; set; } + } +} diff --git a/Polyclinic/PolyclinicWebAppSuretor/Models/UserPrivacyModel.cs b/Polyclinic/PolyclinicWebAppSuretor/Models/UserPrivacyModel.cs new file mode 100644 index 0000000..d3990d2 --- /dev/null +++ b/Polyclinic/PolyclinicWebAppSuretor/Models/UserPrivacyModel.cs @@ -0,0 +1,13 @@ +using PolyclinicDataModels.Enums; +using System.ComponentModel; + +namespace PolyclinicWebAppSuretor.Models +{ + public class UserPrivacyModel + { + public int Id { get; set; } + + [DisplayName("Роль")] + public UserRole Role { get; set; } + } +} diff --git a/Polyclinic/PolyclinicWebAppSuretor/RestrictionEnum.cs b/Polyclinic/PolyclinicWebAppSuretor/RestrictionEnum.cs new file mode 100644 index 0000000..881e7ae --- /dev/null +++ b/Polyclinic/PolyclinicWebAppSuretor/RestrictionEnum.cs @@ -0,0 +1,12 @@ +namespace PolyclinicWebAppSuretor +{ + public class RestrictionEnum + { + public enum PageVisible + { + AllowAnyBody = 0, + AllowOnlyAuthorized = 1, + AllowOnlyNotAuthorized = 2, + } + } +} diff --git a/Polyclinic/PolyclinicWebAppSuretor/SiteMenuItems.cs b/Polyclinic/PolyclinicWebAppSuretor/SiteMenuItems.cs index a791e92..6aa0fcc 100644 --- a/Polyclinic/PolyclinicWebAppSuretor/SiteMenuItems.cs +++ b/Polyclinic/PolyclinicWebAppSuretor/SiteMenuItems.cs @@ -1,20 +1,23 @@ -namespace PolyclinicWebAppSuretor +using static PolyclinicWebAppSuretor.RestrictionEnum; + +namespace PolyclinicWebAppSuretor { public static class SiteMenuItems { - public static (string Url, string Title) Index = ("", "Главная"); - public static (string Url, string Title) Medicaments = ("Medicaments", "Лекарства"); - public static (string Url, string Title) Procedures = ("Procedures", "Процедуры"); - public static (string Url, string Title) Recipes = ("Recipes", "Рецепты"); - public static (string Url, string Title) Login = ("Login", "Вход"); - public static (string Url, string Title) Register = ("Register", "Регистрация"); - public static (string Url, string Title) AddSymptomToMedicament = ("AddSymptomToMedicament", "Привязка симптома к лекарству"); - public static (string Url, string Title) ProceduresReport = ("ProceduresReport", "Отчет по процедурам"); - public static (string Url, string Title) ListCoursesByProcedures = ("ListCoursesByProcedures", "Список курсов приема препаратов"); + public static (string Url, string Title, PageVisible Visible) Index = ("", "Главная", PageVisible.AllowAnyBody); + public static (string Url, string Title, PageVisible Visible) Medicaments = ("Medicaments", "Лекарства", PageVisible.AllowOnlyAuthorized); + public static (string Url, string Title, PageVisible Visible) Procedures = ("Procedures", "Процедуры", PageVisible.AllowOnlyAuthorized); + public static (string Url, string Title, PageVisible Visible) Recipes = ("Recipes", "Рецепты", PageVisible.AllowOnlyAuthorized); + public static (string Url, string Title, PageVisible Visible) Login = ("Login", "Вход", PageVisible.AllowOnlyNotAuthorized); + public static (string Url, string Title, PageVisible Visible) Register = ("Register", "Регистрация", PageVisible.AllowOnlyNotAuthorized); + public static (string Url, string Title, PageVisible Visible) AddSymptomToMedicament = ("AddSymptomToMedicament", "Привязка симптома к лекарству", PageVisible.AllowOnlyAuthorized); + public static (string Url, string Title, PageVisible Visible) ProceduresReport = ("ProceduresReport", "Отчет по процедурам", PageVisible.AllowOnlyAuthorized); + public static (string Url, string Title, PageVisible Visible) ListCoursesByProcedures = ("ListCoursesByProcedures", "Список курсов приема препаратов", PageVisible.AllowOnlyAuthorized); + public static (string Url, string Title, PageVisible Visible) Privacy = ("Privacy", "Личный кабинет", PageVisible.AllowOnlyAuthorized); - public static List<(string Url, string Title)> MenuItemsOrder = new List<(string Url, string Title)> + public static List<(string Url, string Title, PageVisible Visible)> MenuItemsOrder = new List<(string Url, string Title, PageVisible Visible)> { - Index, Medicaments, Procedures, Recipes, ListCoursesByProcedures, Login, Register, AddSymptomToMedicament, ProceduresReport + Index, Medicaments, Procedures, Recipes, ListCoursesByProcedures, Login, Register, AddSymptomToMedicament, ProceduresReport, Privacy }; } } diff --git a/Polyclinic/PolyclinicWebAppSuretor/Views/Home/Login.cshtml b/Polyclinic/PolyclinicWebAppSuretor/Views/Home/Login.cshtml index c7e4e0c..02501fc 100644 --- a/Polyclinic/PolyclinicWebAppSuretor/Views/Home/Login.cshtml +++ b/Polyclinic/PolyclinicWebAppSuretor/Views/Home/Login.cshtml @@ -1,9 +1,16 @@ -@{ +@model LoginModel +@{ ViewBag.SelectedSiteMenuItem = SiteMenuItems.Login; }

Вход

+ @foreach (var item in Model.Errors) + { + + }
-