Не будь дураком! Будь тем, чем другие не были.
Не выходи из комнаты! То есть дай волю мебели, слейся лицом с обоями. Запрись и забаррикадируйся шкафом от хроноса, космоса, эроса, расы, вируса.
This commit is contained in:
parent
e105e51563
commit
4fffa92f6f
@ -6,92 +6,112 @@ using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace WorkerWebApp.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
|
||||
public class EvaluationController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IEvaluationLogic _logic;
|
||||
private readonly IProcedureLogic _procedureLogic;
|
||||
|
||||
public EvaluationController(IEvaluationLogic logic, ILogger<EvaluationController> logger)
|
||||
private readonly IEvaluationLogic _evaluationLogic;
|
||||
|
||||
public EvaluationController(ILogger<EvaluationController> logger, IEvaluationLogic evaluationLogic, IProcedureLogic procedureLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_evaluationLogic = evaluationLogic;
|
||||
_procedureLogic = procedureLogic;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public EvaluationViewModel? GetEvaluation(int id)
|
||||
public IActionResult Evaluation()
|
||||
{
|
||||
try
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
return _logic.ReadElement(new EvaluationSearchModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения оценки");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return View(_evaluationLogic.ReadList(null));
|
||||
}
|
||||
[HttpGet]
|
||||
public List<EvaluationViewModel>? GetAllEvaluations()
|
||||
public IActionResult CreateEvaluation()
|
||||
{
|
||||
try
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
return _logic.ReadList(null);
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
ViewBag.Procedure = _procedureLogic.ReadList(new ProcedureSearchModel
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка оценок");
|
||||
throw;
|
||||
}
|
||||
WorkerId = APIWorker.Worker.Id,
|
||||
});
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateEvaluation(EvaluationBindingModel model)
|
||||
public void CreateEvaluation(double pointsProcedures, double pointsCosmetics, int procedure)
|
||||
{
|
||||
try
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
_logic.Create(model);
|
||||
throw new Exception("Необходимо авторизоваться!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания оценки");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
if (procedure <= 0)
|
||||
{
|
||||
throw new Exception("Введены не все данные!");
|
||||
}
|
||||
|
||||
_evaluationLogic.Create(new EvaluationBindingModel
|
||||
{
|
||||
PointsProcedure = pointsProcedures,
|
||||
PointsCosmetics = pointsCosmetics,
|
||||
ProcedureId = procedure
|
||||
});
|
||||
|
||||
Response.Redirect("/Evaluation/Evaluations");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult UpdateEvaluation(int id)
|
||||
{
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
ViewBag.Procedures = _procedureLogic.ReadList(new ProcedureSearchModel
|
||||
{
|
||||
WorkerId = APIWorker.Worker.Id,
|
||||
});
|
||||
|
||||
return View(_evaluationLogic.ReadElement(new EvaluationSearchModel
|
||||
{
|
||||
Id = id
|
||||
}));
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdateEvaluation(EvaluationBindingModel model)
|
||||
public void UpdateEvaluation(int id, double pointsProcedures, double pointsCosmetics, int procedure)
|
||||
{
|
||||
try
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
_logic.Update(model);
|
||||
throw new Exception("Необходимо авторизоваться!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка обновления оценки");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
public void DeleteEvaluation(EvaluationBindingModel model)
|
||||
{
|
||||
try
|
||||
if (procedure <= 0)
|
||||
{
|
||||
_logic.Delete(model);
|
||||
throw new Exception("Введены не все данные!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
|
||||
_evaluationLogic.Update(new EvaluationBindingModel
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления оценки");
|
||||
throw;
|
||||
}
|
||||
Id = id,
|
||||
PointsProcedure = pointsProcedures,
|
||||
PointsCosmetics = pointsCosmetics,
|
||||
ProcedureId = procedure
|
||||
});
|
||||
|
||||
Response.Redirect("/Evaluation/Evaluations");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,100 +1,239 @@
|
||||
using BeautySalonContracts.BindingModels;
|
||||
using BeautySalonBusinesLogic.BusinessLogic;
|
||||
using BeautySalonContracts.BindingModels;
|
||||
using BeautySalonContracts.BusinessLogicContracts;
|
||||
using BeautySalonContracts.SearchModels;
|
||||
using BeautySalonContracts.ViewModels;
|
||||
using BeautySalonDatabaseImplement.Models;
|
||||
using BeautySalonDataModels.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace WorkerWebApp.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class OrderController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class OrderController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IOrderLogic _logic;
|
||||
private readonly IOrderLogic _orderLogic;
|
||||
|
||||
public OrderController(IOrderLogic logic, ILogger<OrderController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
private readonly IServiceLogic _serviceLogic;
|
||||
|
||||
[HttpGet]
|
||||
public OrderViewModel? GetOrder(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadElement(new OrderSearchModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения заказа");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Бизнес-логика для сущности "Процедура"
|
||||
/// </summary>
|
||||
private readonly IProcedureLogic _procedureLogic;
|
||||
|
||||
/// <summary>
|
||||
/// Получение заказов по id пользователя (полный список, кот. будет выводиться)
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public List<OrderViewModel>? GetOrders(int? workerId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadList(new OrderSearchModel { WorkerId = workerId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка заказов клиента id={Id}", workerId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public OrderController(ILogger<OrderController> logger, IOrderLogic orderLogic, IProcedureLogic procedureLogic, IServiceLogic serviceLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_orderLogic = orderLogic;
|
||||
_procedureLogic = procedureLogic;
|
||||
_serviceLogic = serviceLogic;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateOrder(OrderBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.Create(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания заказа");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdateOrder(OrderBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.Update(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка обновления заказа");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpDelete]
|
||||
public void DeleteOrder(OrderBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.Delete(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления заказа");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Orders()
|
||||
{
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
return View(_orderLogic.ReadList(new OrderSearchModel
|
||||
{
|
||||
WorkerId = APIWorker.Worker.Id,
|
||||
}));
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение заказов по id пользователя (полный список, кот. будет выводиться)
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public IActionResult CreateOrder()
|
||||
{
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
ViewBag.Services = _serviceLogic.ReadList(null);
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateOrder(double amount, DateTime datacreate, DateTime dateimplement, List<int> services)
|
||||
{
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
throw new Exception("Необходимо авторизоваться!");
|
||||
}
|
||||
|
||||
if (amount == 0 || datacreate == DateTime.MinValue || dateimplement == DateTime.MinValue || services == null)
|
||||
{
|
||||
throw new Exception("Введены не все данные!");
|
||||
}
|
||||
|
||||
Dictionary<int, IServiceModel> orderServices = new Dictionary<int, IServiceModel>();
|
||||
foreach (var serviceId in services)
|
||||
{
|
||||
orderServices.Add(serviceId, _serviceLogic.ReadElement(new ServiceSearchModel { Id = serviceId })!);
|
||||
}
|
||||
|
||||
_orderLogic.Create(new OrderBindingModel
|
||||
{
|
||||
OrderAmount = amount,
|
||||
DateCreate = datacreate,
|
||||
DateImplement = dateimplement,
|
||||
WorkerId = APIWorker.Worker.Id,
|
||||
OrderServices = orderServices
|
||||
});
|
||||
|
||||
Response.Redirect("/Order/Orders");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult UpdateOrder(int id)
|
||||
{
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
ViewBag.Services = _serviceLogic.ReadList(null);
|
||||
|
||||
return View(_orderLogic.ReadElement(new OrderSearchModel
|
||||
{
|
||||
Id = id
|
||||
}));
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdateOrder(int id, double amount, DateTime datacreate, DateTime dateimplement, List<int> services)
|
||||
{
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
throw new Exception("Необходимо авторизоваться!");
|
||||
}
|
||||
|
||||
if (amount == 0 || datacreate == DateTime.MinValue || dateimplement == DateTime.MinValue || services == null)
|
||||
{
|
||||
throw new Exception("Введены не все данные!");
|
||||
}
|
||||
|
||||
Dictionary<int, IServiceModel> orderServices = new Dictionary<int, IServiceModel>();
|
||||
foreach (var serviceId in services)
|
||||
{
|
||||
orderServices.Add(serviceId, _serviceLogic.ReadElement(new ServiceSearchModel { Id = serviceId })!);
|
||||
}
|
||||
|
||||
var order = _orderLogic.ReadElement(new OrderSearchModel { Id = id });
|
||||
_orderLogic.Update(new OrderBindingModel
|
||||
{
|
||||
Id = id,
|
||||
OrderAmount = amount,
|
||||
DateCreate = datacreate,
|
||||
DateImplement = dateimplement,
|
||||
WorkerId = APIWorker.Worker.Id,
|
||||
OrderProcedures = order!.OrderProcedures,
|
||||
OrderServices = orderServices
|
||||
});
|
||||
|
||||
Response.Redirect("/Order/Orders");
|
||||
}
|
||||
[HttpPost]
|
||||
public void DeleteOrder(int id)
|
||||
{
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
throw new Exception("Необходимо авторизоваться!");
|
||||
}
|
||||
|
||||
_orderLogic.Delete(new OrderBindingModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
|
||||
Response.Redirect("/Order/Orders");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult CreateOrderProcedure()
|
||||
{
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
throw new Exception("Необходимо авторизоваться!");
|
||||
}
|
||||
|
||||
ViewBag.Orders = _orderLogic.ReadList(new OrderSearchModel
|
||||
{
|
||||
WorkerId = APIWorker.Worker.Id
|
||||
});
|
||||
ViewBag.Procedures = _procedureLogic.ReadList(new ProcedureSearchModel
|
||||
{
|
||||
WorkerId = APIWorker.Worker.Id
|
||||
});
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreatePatientProcedure(int orderId, List<int> procedures)
|
||||
{
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
throw new Exception("Необходимо авторизоваться!");
|
||||
}
|
||||
|
||||
if (orderId <= 0 || procedures == null)
|
||||
{
|
||||
throw new Exception("Введены не все данные!");
|
||||
}
|
||||
|
||||
Dictionary<int, IProcedureModel> orderProcedures = new Dictionary<int, IProcedureModel>();
|
||||
foreach (var procedureId in procedures)
|
||||
{
|
||||
orderProcedures.Add(procedureId, _procedureLogic.ReadElement(new ProcedureSearchModel { Id = procedureId })!);
|
||||
}
|
||||
|
||||
var order = _orderLogic.ReadElement(new OrderSearchModel { Id = orderId });
|
||||
_orderLogic.Update(new OrderBindingModel
|
||||
{
|
||||
Id = order!.Id,
|
||||
OrderAmount = order!.OrderAmount,
|
||||
DateCreate = order!.DateCreate,
|
||||
DateImplement = order!.DateImplement,
|
||||
WorkerId = APIWorker.Worker.Id,
|
||||
OrderServices = order!.OrderServices,
|
||||
OrderProcedures = orderProcedures
|
||||
});
|
||||
|
||||
Response.Redirect("/Order/Orders");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public JsonResult GetOrderProcedures(int orderId)
|
||||
{
|
||||
if (APIWorker.Worker == null)
|
||||
{
|
||||
throw new Exception("Необходимо авторизоваться!");
|
||||
}
|
||||
|
||||
var allProcedures = _procedureLogic.ReadList(new ProcedureSearchModel
|
||||
{
|
||||
WorkerId = APIWorker.Worker.Id
|
||||
});
|
||||
|
||||
var order = _orderLogic.ReadElement(new OrderSearchModel { Id = orderId });
|
||||
var orderProceduresIds = order?.OrderProcedures?.Select(x => x.Key).ToList() ?? new List<int>();
|
||||
|
||||
var result = new
|
||||
{
|
||||
allProcedures = allProcedures.Select(r => new { id = r.Id }),
|
||||
orderProceduresIds = orderProceduresIds
|
||||
};
|
||||
|
||||
return Json(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using WorkerWebApp;
|
||||
|
||||
namespace WorkerWebApp.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
{
|
||||
public class ProcedureController : Controller
|
||||
{
|
||||
private readonly ILogger<ProcedureController> logger;
|
||||
@ -82,10 +80,12 @@ namespace WorkerWebApp.Controllers
|
||||
ProcedureName = name,
|
||||
ProcedurePrice = price,
|
||||
ProcedureDuration = duration
|
||||
|
||||
|
||||
});
|
||||
|
||||
return RedirectToAction("Procedures");
|
||||
}
|
||||
return RedirectToAction("Procedures", "Procedure");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult UpdateProcedures(int id)
|
||||
@ -124,8 +124,8 @@ namespace WorkerWebApp.Controllers
|
||||
ProcedureDuration = duration
|
||||
});
|
||||
|
||||
return RedirectToAction("Procedures");
|
||||
}
|
||||
return RedirectToAction("Procedures", "Procedure");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult DeleteProcedure(int id)
|
||||
@ -140,7 +140,7 @@ namespace WorkerWebApp.Controllers
|
||||
Id = id
|
||||
});
|
||||
|
||||
return RedirectToAction("Procedures");
|
||||
}
|
||||
return RedirectToAction("Procedures", "Procedure");
|
||||
}
|
||||
}
|
||||
}
|
34
BeautySalonView/ClientWebApp/Views/Evaluation/Create.cshtml
Normal file
34
BeautySalonView/ClientWebApp/Views/Evaluation/Create.cshtml
Normal file
@ -0,0 +1,34 @@
|
||||
@{
|
||||
ViewData["Title"] = "Создание оценки";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание оценки</h2>
|
||||
</div>
|
||||
|
||||
<form method="post" style="margin-top: 50px">
|
||||
<p class="mb-0">Баллы за процедуру:</p>
|
||||
<input type="number" min="0" max="10" step="0.01" name="pointsProcedure" class="form-control mb-2" />
|
||||
<p class="mb-0">Баллы за косметику:</p>
|
||||
<input type="number" min="0" max="10" step="0.01" name="pointsCosmetics" class="form-control mb-2" />
|
||||
|
||||
<!-- Рецепт -->
|
||||
<div class="row">
|
||||
<div class="col-4">Процедура:</div>
|
||||
<div class="col-8">
|
||||
<select name="procedure" id="procedure" class="form-control">
|
||||
@foreach (var procedure in ViewBag.Procedures)
|
||||
{
|
||||
<option value="@procedure.Id">@procedure.Id - @procedure.IssueDate.ToShortDateString()</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Кнопка "Создать" -->
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -0,0 +1,69 @@
|
||||
@using BeautySalonContracts.ViewModels
|
||||
|
||||
@model List<EvaluationViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Оценки";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Оценки</h1>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
|
||||
<p>
|
||||
<a asp-action="CreateEvaluation">Создать оценку</a>
|
||||
</p>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Номер</th>
|
||||
<th>Оценка за процедуру</th>
|
||||
<th>Оценка за косметику</th>
|
||||
<th>Номер процедуры</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach (var evaluation in Model)
|
||||
{
|
||||
<tr>
|
||||
<th>@evaluation.Id</th>
|
||||
<td>@evaluation.PointsProcedure</td>
|
||||
<td>@evaluation.PointsCosmetics</td>
|
||||
<td>@evaluation.ProcedureId</td>
|
||||
<td>
|
||||
<p><button type="button" class="btn btn-primary" onclick="location.href='@Url.Action("UpdateEvaluation", "/Evaluation", new { id = evaluation.Id })'">Изменить</button></p>
|
||||
</td>
|
||||
<td>
|
||||
<p><button type="button" class="btn btn-primary" onclick="deleteDisease(@evaluation.Id)">Удалить</button></p>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
|
||||
@section scripts {
|
||||
<script>
|
||||
function deleteEvaluation(id) {
|
||||
if (confirm("Вы уверены, что хотите удалить оценку?")) {
|
||||
$.post('@Url.Action("DeleteEvaluation", "/Evaluation")' + '/' + id, function () {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
}
|
||||
|
41
BeautySalonView/ClientWebApp/Views/Evaluation/Update.cshtml
Normal file
41
BeautySalonView/ClientWebApp/Views/Evaluation/Update.cshtml
Normal file
@ -0,0 +1,41 @@
|
||||
@using BeautySalonContracts.ViewModels
|
||||
|
||||
@model EvaluationViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Редактирование оценки";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Редактирование оценки</h2>
|
||||
</div>
|
||||
|
||||
<form method="post" style="margin-top: 50px">
|
||||
<input name="id" value="@ViewBag.Rating.Id" style="display: none;" />
|
||||
<p class="mb-0">Баллы за процедуру:</p>
|
||||
<input type="number" min="0" max="10" step="0.01" name="pointsProcedure" class="form-control mb-2"
|
||||
value="@ViewBag.Rating.PointsProcedure.ToString("0.00").Replace(",", ".")" />
|
||||
<p class="mb-0">Баллы за косметику:</p>
|
||||
<input type="number" min="0" max="10" step="0.01" name="pointsCosmetics" class="form-control mb-2"
|
||||
value="@ViewBag.Rating.PointsCosmetics.ToString("0.00").Replace(",", ".")" />
|
||||
|
||||
<!-- Рецепт -->
|
||||
<div class="row">
|
||||
<div class="col-4">Процедура:</div>
|
||||
<div class="col-8">
|
||||
<select name="procedure" id="procedure" class="form-control">
|
||||
@foreach (var procedure in ViewBag.Procedures)
|
||||
{
|
||||
var isSelected = Model.ProcedureId.Equals(procedure.Id);
|
||||
<option value="@procedure.Id" selected="@isSelected">@procedure.Id - @procedure.IssueDate.ToShortDateString()</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Кнопка "Сохранить" -->
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
@ -1,75 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "Заказ";
|
||||
}
|
||||
|
||||
<h4 class="fw-bold">Создать заказ</h4>
|
||||
|
||||
<p class="mb-0 fw-bold">Выбранные услуги:</p>
|
||||
<div>
|
||||
<table class="table mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Стоимость</th>
|
||||
<th>Количество</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="service-tbody">
|
||||
<tr>
|
||||
<td>Не выбрано</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="mb-0 fw-bold">Добавить услугу:</p>
|
||||
<p class="mb-0">Наименование:</p>
|
||||
<select class="form-select mb-0" id="service-select"></select>
|
||||
<p class="mb-0">Количество:</p>
|
||||
<input type="number" min="1" value="1" id="service-count-input" class="form-control mb-2" />
|
||||
<button id="add-service-button" class="button-primary">
|
||||
Добавить
|
||||
</button>
|
||||
|
||||
<p class="mb-0 fw-bold">Выбранные процедуры:</p>
|
||||
<div>
|
||||
<table class="table mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Стоимость</th>
|
||||
<th>Количество</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="procedure-tbody">
|
||||
<tr>
|
||||
<td>Не выбрано</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="mb-0 fw-bold">Привязать процедуру:</p>
|
||||
<p class="mb-0">Наименование:</p>
|
||||
<select class="form-select mb-0" id="procedure-select"></select>
|
||||
<p class="mb-0">Количество:</p>
|
||||
<input type="number" min="1" value="1" id="procedure-count-input" class="form-control mb-2" />
|
||||
<button id="add-procedure-button" class="button-primary">
|
||||
Привязать
|
||||
</button>
|
||||
|
||||
<p class="mb-0 fw-bold">Стоимость заказа:</p>
|
||||
<input type="number" step="0.01" id="price-input" class="form-control mb-2" value="0.01" readonly />
|
||||
<button id="create-button" class="button-primary">
|
||||
Создать
|
||||
</button>
|
||||
|
||||
<script src="~/js/order-create.js" asp-append-version="true"></script>
|
46
BeautySalonView/ClientWebApp/Views/Order/CreateOrder.cshtml
Normal file
46
BeautySalonView/ClientWebApp/Views/Order/CreateOrder.cshtml
Normal file
@ -0,0 +1,46 @@
|
||||
@{
|
||||
ViewData["Title"] = "Создание заказа";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание заказа</h2>
|
||||
</div>
|
||||
|
||||
<form method="post" style="margin-top: 50px">
|
||||
|
||||
<p class="mb-0 fw-bold">Стоимость заказа:</p>
|
||||
<input type="number" step="0.01" id="price-input" class="form-control mb-2" value="0.01" readonly />
|
||||
<button id="create-button" class="button-primary">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">Дата создания:</div>
|
||||
<div class="col-8"><input type="date" class="form-control" name="datecreate" id="datecreate" /></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">Дата выполнения:</div>
|
||||
<div class="col-8"><input type="date" class="form-control" name="dateimplement" id="dateimplement" /></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Процедуры -->
|
||||
<div class="row">
|
||||
<div class="col-4">Услуги:</div>
|
||||
<div class="col-8">
|
||||
<select name="services" id="services" class="form-control" size="4" multiple>
|
||||
@foreach (var service in ViewBag.Service)
|
||||
{
|
||||
<option value="@service.Id">@service.ServiceName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Кнопка "Создать" -->
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,65 @@
|
||||
@{
|
||||
ViewData["Title"] = "Связать заказ с услугой";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Связать заказ с услугой</h2>
|
||||
</div>
|
||||
|
||||
<form method="post" style="margin-top: 50px">
|
||||
<!-- Пациенты -->
|
||||
<div class="row">
|
||||
<div class="col-4">Заказы:</div>
|
||||
<div class="col-8">
|
||||
<select name="orderId" id="orderId" class="form-control" onchange="loadOrderServices()">
|
||||
@foreach (var order in ViewBag.Orders)
|
||||
{
|
||||
<option value="@order.Id"></option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Рецепты -->
|
||||
<div class="row">
|
||||
<div class="col-4">Процедуры:</div>
|
||||
<div class="col-8">
|
||||
<select name="procedures" id="procedures" class="form-control" size="4" multiple>
|
||||
@foreach (var procedure in ViewBag.Procedures)
|
||||
{
|
||||
<option value="@procedure.Id">@procedure.Id</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Кнопка "Выписать" -->
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Связать заказ с услугой" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Загрузка выписанных ранее рецептов пациента -->
|
||||
<script>
|
||||
function loadOrderServices() {
|
||||
var orderId = document.getElementById("orderId").value;
|
||||
if (orderId) {
|
||||
fetch('/Order/GetOrderServices?orderId=' + orderId)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
var serviceSelect = document.getElementById("services");
|
||||
recipeSelect.innerHTML = '';
|
||||
data.allRecipes.forEach(function (service) {
|
||||
var option = document.createElement("option");
|
||||
option.value = service.id;
|
||||
option.text = service.id;
|
||||
if (data.orderServiceIds.includes(recipe.id)) {
|
||||
option.selected = true;
|
||||
}
|
||||
serviceSelect.appendChild(option);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
67
BeautySalonView/ClientWebApp/Views/Order/Orders.cshtml
Normal file
67
BeautySalonView/ClientWebApp/Views/Order/Orders.cshtml
Normal file
@ -0,0 +1,67 @@
|
||||
@using BeautySalonContracts.ViewModels
|
||||
|
||||
@model List<OrderViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Заказы";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Заказы</h1>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
|
||||
<p>
|
||||
<a asp-action="CreateOrder">Создать заказ</a>
|
||||
</p>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Стоимость</th>
|
||||
<th>Дата создания</th>
|
||||
<th>Дата выполнения</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach (var order in Model)
|
||||
{
|
||||
<tr>
|
||||
<th>@order.Id</th>
|
||||
<td>@order.DateCreate</td>
|
||||
<td>@order.DateImplement</td>
|
||||
|
||||
<td>
|
||||
<p><button type="button" class="btn btn-primary" onclick="location.href='@Url.Action("UpdateOrder", "/Order", new { id = order.Id })'">Изменить</button></p>
|
||||
</td>
|
||||
<td>
|
||||
<p><button type="button" class="btn btn-primary" onclick="deletePatient(@order.Id)">Удалить</button></p>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
|
||||
@section scripts {
|
||||
<script>
|
||||
function deleteOrder(id) {
|
||||
if (confirm("Вы уверены, что хотите удалить заказ?")) {
|
||||
$.post('@Url.Action("DeleteOrder", "/Order")' + '/' + id, function () {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "Заказ";
|
||||
}
|
||||
|
||||
<h4 class="fw-bold">Обновить заказ</h4>
|
||||
|
||||
<p class="mb-0 fw-bold">Выбранные услуги:</p>
|
||||
<div>
|
||||
<table class="table mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Стоимость</th>
|
||||
<th>Количество</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="service-tbody">
|
||||
<tr>
|
||||
<td>Не выбрано</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="mb-0 fw-bold">Добавить услугу:</p>
|
||||
<p class="mb-0">Наименование:</p>
|
||||
<select class="form-select mb-0" id="service-select"></select>
|
||||
<p class="mb-0">Количество:</p>
|
||||
<input type="number" min="1" value="1" id="service-count-input" class="form-control mb-2" />
|
||||
<button id="add-service-button" class="button-primary">
|
||||
Добавить
|
||||
</button>
|
||||
|
||||
<p class="mb-0 fw-bold">Выбранные процедуры:</p>
|
||||
<div>
|
||||
<table class="table mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Стоимость</th>
|
||||
<th>Количество</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="procedure-tbody">
|
||||
<tr>
|
||||
<td>Не выбрано</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="mb-0 fw-bold">Добавить процедуру:</p>
|
||||
<p class="mb-0">Наименование:</p>
|
||||
<select class="form-select mb-0" id="procedure-select"></select>
|
||||
<p class="mb-0">Количество:</p>
|
||||
<input type="number" min="1" value="1" id="procedure-count-input" class="form-control mb-2" />
|
||||
<button id="add-procedure-button" class="button-primary">
|
||||
Добавить
|
||||
</button>
|
||||
|
||||
<p class="mb-0 fw-bold">Стоимость заказа:</p>
|
||||
<input type="number" step="0.01" id="price-input" class="form-control mb-2" value="0.01" readonly />
|
||||
<button id="update-button" class="button-primary">
|
||||
Обновить
|
||||
</button>
|
||||
|
||||
<input id="id" value="@ViewBag.Id" style="display: none;" />
|
||||
|
||||
<script src="~/js/order-update.js" asp-append-version="true"></script>
|
61
BeautySalonView/ClientWebApp/Views/Order/UpdateOrder.cshtml
Normal file
61
BeautySalonView/ClientWebApp/Views/Order/UpdateOrder.cshtml
Normal file
@ -0,0 +1,61 @@
|
||||
@using BeautySalonContracts.ViewModels
|
||||
|
||||
@model OrderViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Редактирование заказа";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Редактирование заказа</h2>
|
||||
</div>
|
||||
|
||||
<form method="post" style="margin-top: 50px">
|
||||
<p class="mb-0 fw-bold">Стоимость заказа:</p>
|
||||
<input type="number" step="0.01" id="price-input" class="form-control mb-2" value="0.01" readonly />
|
||||
<button id="create-button" class="button-primary">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">Дата создания:</div>
|
||||
<div class="col-8"><input type="date" class="form-control" name="datecreate" id="datecreate" /></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">Дата выполнения:</div>
|
||||
<div class="col-8"><input type="date" class="form-control" name="dateimplement" id="dateimplement" /></div>
|
||||
</div>
|
||||
|
||||
<!-- Процедуры -->
|
||||
<div class="row">
|
||||
<div class="col-4">Услуги:</div>
|
||||
<div class="col-8">
|
||||
<select name="services" id="services" class="form-control" size="4" multiple>
|
||||
@foreach (var service in ViewBag.Services)
|
||||
{
|
||||
var isSelected = Model.OrderServices.Any(x => x.Key.Equals(service.Id));
|
||||
<option value="@service.Id" selected="@isSelected" >@service.ServiceName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Рецепты -->
|
||||
<div class="row">
|
||||
<div class="col-4">Процедуры:</div>
|
||||
<div class="col-8">
|
||||
<ul>
|
||||
@foreach (var procedure in Model.OrderProcedures)
|
||||
{
|
||||
<li>@procedure.Value</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Кнопка "Сохранить" -->
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
@ -1,25 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "Оценка";
|
||||
}
|
||||
|
||||
<h4 class="fw-bold">Создать оценку</h4>
|
||||
|
||||
<form method="post" asp-controller="Rating" asp-action="Create">
|
||||
<p class="mb-0">Баллы за процедуру:</p>
|
||||
<input type="number" min="0" max="10" step="0.01" name="pointsProcedure" class="form-control mb-2" />
|
||||
<p class="mb-0">Баллы за косметику:</p>
|
||||
<input type="number" min="0" max="10" step="0.01" name="pointsCosmetics" class="form-control mb-2" />
|
||||
<p class="mb-0">Процедура:</p>
|
||||
<select class="form-select mb-2" name="procedureId">
|
||||
@foreach (var procedure in @ViewBag.Procedure)
|
||||
{
|
||||
<option value="@procedure.Id">
|
||||
@(procedure.ProcedureName); @(procedure.ProcedurePrice) р.
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
<button class="button-primary text-button">
|
||||
Создать
|
||||
</button>
|
||||
</form>
|
||||
|
@ -1,38 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "Оценка";
|
||||
}
|
||||
|
||||
<h4 class="fw-bold">Обновить оценку</h4>
|
||||
|
||||
<form method="post" asp-controller="Rating" asp-action="Create">
|
||||
<input name="id" value="@ViewBag.Rating.Id" style="display: none;" />
|
||||
<p class="mb-0">Баллы за процедуру:</p>
|
||||
<input type="number" min="0" max="10" step="0.01" name="pointsProcedure" class="form-control mb-2"
|
||||
value="@ViewBag.Rating.PointsProcedure.ToString("0.00").Replace(",", ".")" />
|
||||
<p class="mb-0">Баллы за косметику:</p>
|
||||
<input type="number" min="0" max="10" step="0.01" name="pointsCosmetics" class="form-control mb-2"
|
||||
value="@ViewBag.Rating.PointsCosmetics.ToString("0.00").Replace(",", ".")" />
|
||||
<p class="mb-0">Процедура:</p>
|
||||
<select class="form-select mb-2" name="procedureId">
|
||||
@foreach (var procedure in @ViewBag.Procedure)
|
||||
{
|
||||
@if (procedure.Id == ViewBag.Rating.ProcedureId)
|
||||
{
|
||||
<option value="@procedure.Id" selected>
|
||||
@(procedure.ProcedureName); @(procedure.ProcedurePrice) р.
|
||||
</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@procedure.Id">
|
||||
@(procedure.ProcedureName); @(procedure.ProcedurePrice) р.
|
||||
</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<button class="button-primary text-button">
|
||||
Обновить
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<script src="~/js/rating.js" asp-append-version="true"></script>
|
@ -32,13 +32,13 @@
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Авторизация</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Procedure">Процедуры</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Procedure" asp-action="Procedures">Процедуры</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Order">Заказы</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Order" asp-action="Orders">Заказы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Rating">Оценки</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Evaluation" asp-action="Evaluations">Оценки</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ServiceList">Список</a>
|
||||
|
Loading…
Reference in New Issue
Block a user