idk what to do...
This commit is contained in:
parent
0f32e361e0
commit
506e1cacaa
@ -12,5 +12,6 @@ namespace BeautyStudioContracts.BindingModels
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set;}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
@ -22,8 +22,4 @@
|
||||
<ProjectReference Include="..\BeautyStudioDataModels\BeautyStudioDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -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
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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 =>
|
@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace BeautyStudioDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SecondMig : Migration
|
||||
public partial class ThirdMig : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
@ -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 =>
|
||||
|
@ -50,9 +50,6 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
}
|
||||
// список косметики в закаче
|
||||
public virtual List<CosmeticProcedure> Procedures { get; set; } = new();
|
||||
// связь многие-ко-многим косметики с процедурами
|
||||
[ForeignKey("CosmeticId")]
|
||||
public virtual List<ServiceCosmetic> Services { get; set; } = new();
|
||||
|
||||
public static Cosmetic Create(BeautyStudioDatabase context, CosmeticBindingModel model)
|
||||
{
|
||||
|
@ -54,7 +54,8 @@ namespace BeautyStudioDatabaseImplement.Models
|
||||
{
|
||||
Id = Id,
|
||||
TimeSpent = TimeSpent,
|
||||
Difficulty = Difficulty
|
||||
Difficulty = Difficulty,
|
||||
StoreKeeperId = StoreKeeper.Id
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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("");
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
<!-- Цена -->
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="price" value="@Model.CosmeticPrice" /></div>
|
||||
<div class="col-8"><input type="number" name="price" value="@Model.CosmeticPrice" /></div>
|
||||
</div>
|
||||
|
||||
<!-- Трудозатрата -->
|
||||
|
@ -1,47 +1,93 @@
|
||||
@{
|
||||
ViewData["Title"] = "Report";
|
||||
@using BeautyStudioContracts.ViewModels
|
||||
@model List<ReportServicesViewModel>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Отчеты";
|
||||
}
|
||||
|
||||
<h4 class="fw-bold">Отчет по услугам</h4>
|
||||
|
||||
<div class="d-flex flex-wrap gap-1 align-items-end mb-2">
|
||||
<div class="mb-2">
|
||||
<p class="mb-0">Дата начала:</p>
|
||||
<input id="date-from-input" class="form-control" type="date" />
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<p class="mb-0">Дата конца:</p>
|
||||
<input id="date-to-input" class="form-control" type="date" />
|
||||
</div>
|
||||
<button id="generate-button" class="button-primary mb-2">
|
||||
Показать
|
||||
</button>
|
||||
<button id="send-by-mail-button" class="button-primary mb-2">
|
||||
На почту
|
||||
</button>
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Отчеты</h2>
|
||||
</div>
|
||||
|
||||
<p class="mb-0">
|
||||
<span>За период с </span>
|
||||
<span id="date-from-span" class="fw-bold">...</span>
|
||||
<span> по </span>
|
||||
<span id="date-to-span" class="fw-bold">...</span>
|
||||
</p>
|
||||
<div class="table-shell mb-2 border">
|
||||
<table class="table mb-0">
|
||||
<thead class="table-head">
|
||||
<tr>
|
||||
<th>Дата создания</th>
|
||||
<th>Услуга</th>
|
||||
<th>Стоимость</th>
|
||||
<th>Наименование</th>
|
||||
<th>Стоимость косметики</th>
|
||||
<th>Процедуры</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<form method="post" enctype="multipart/form-data" style="margin-top: 10px">
|
||||
<div class="d-flex flex-column justify-content-start" style="margin-top: 20px;">
|
||||
<!-- Кнопка для сохранения отчета в формате Word -->
|
||||
<div class="text-center">
|
||||
<button type="submit" class="btn btn-primary" formaction="@Url.Action("CreateReportWord", "Home")">Список процедур по косметике Word</button>
|
||||
</div>
|
||||
|
||||
<script src="~/js/report.js" asp-append-version="true"></script>
|
||||
<!-- Кнопка для сохранения отчета в формате Excel -->
|
||||
<div class="text-center" style="margin-top: 10px;">
|
||||
<button type="submit" class="btn btn-primary" formaction="@Url.Action("CreateReportExcel", "Home")">Список процедур по косметике Excel</button>
|
||||
</div>
|
||||
|
||||
<!-- Кнопка для сохранения отчета в формате Pdf -->
|
||||
<div class="text-center" style="margin-top: 10px; margin-bottom: 20px;">
|
||||
<button type="submit" class="btn btn-primary" formaction="@Url.Action("CreateReportPdf", "Home")">Сведения об услугах Pdf</button>
|
||||
</div>
|
||||
<!-- Отправить отчет на почту -->
|
||||
<div class="text-center" style="margin-top: 10px;">
|
||||
<label for="fileUpload" class="d-block"></label>
|
||||
<input type="file" id="fileUpload" name="fileUpload" class="form-control-file w-auto">
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="btn btn-primary" formaction="@Url.Action("SendReport", "Home")">Отправить отчет на почту</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Таблица для вывода отчета на форму -->
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Список услуг: </h1>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Услуга</th>
|
||||
<th>Процедуры</th>
|
||||
<th>Косметика</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (Model == null || Model.Count <= 0)
|
||||
{
|
||||
<td class="text-center" colspan="3">Нет доступных данных</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var record in Model)
|
||||
{
|
||||
<td>@record.ServiceName</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
||||
// Конвертируем из HashSet в List, чтобы можно было обращаться по индексу
|
||||
var cosmetics = new List<string>();
|
||||
foreach (var kvp in record.Cosmetics)
|
||||
{
|
||||
var cosmeticModel = kvp.Value.Item1;
|
||||
cosmetics.Add(cosmeticModel.CosmeticName);
|
||||
}
|
||||
var procedures = new List<string>();
|
||||
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++)
|
||||
{
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>@(i < cosmetics.Count ? cosmetics[i] : "")</td>
|
||||
<td>@(i < procedures.Count ? procedures[i] : "")</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
@ -13,7 +13,7 @@
|
||||
<form method="post" style="margin-top: 50px">
|
||||
<div class="row">
|
||||
<div class="col-4">Количество часов:</div>
|
||||
<div class="col-8"><input type="text" name="hours" value="@Model.TimeSpent" /></div>
|
||||
<div class="col-8"><input type="number" name="hours" value="@Model.TimeSpent" /></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
@ -1,35 +0,0 @@
|
||||
@{
|
||||
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"><input type="text" name="name" id="name" /></div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Цена -->
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="price" id="price" /></div>
|
||||
</div>
|
||||
|
||||
<!-- Описание -->
|
||||
<div class="row">
|
||||
<div class="col-4">Описание:</div>
|
||||
<div class="col-8"><input type="text" name="description" id="description" /></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,70 +0,0 @@
|
||||
@using BeautyStudioContracts.ViewModels
|
||||
|
||||
@model List<ProcedureViewModel>
|
||||
|
||||
@{
|
||||
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="CreateProcedures">Создать процедуры</a>
|
||||
</p>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Номер</th>
|
||||
<th>Название</th>
|
||||
<th>Цена</th>
|
||||
<th>Описание</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach (var procedures in Model)
|
||||
{
|
||||
<tr>
|
||||
<th>@procedures.Id</th>
|
||||
<td>@procedures.ProcedureName</td>
|
||||
<td>@procedures.ProcedureCost</td>
|
||||
<td>@procedures.ProcedureDescription</td>
|
||||
<td>
|
||||
<p><button type="button" class="btn btn-primary" onclick="location.href='@Url.Action("UpdateProcedures", "/Procedure", new { id = procedures.Id })'">Изменить</button></p>
|
||||
</td>
|
||||
<td>
|
||||
<p><button type="button" class="btn btn-primary" onclick="deleteProcedure(@procedures.Id)">Удалить</button></p>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
|
||||
@section scripts {
|
||||
<script>
|
||||
function deleteProcedure(id) {
|
||||
if (confirm("Вы уверены, что хотите удалить процедуру?")) {
|
||||
$.post('@Url.Action("deleteProcedure", "/Procedure")' + '/' + id, function () {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
}
|
||||
|
||||
|
@ -1,37 +0,0 @@
|
||||
@using BeautyStudioContracts.ViewModels
|
||||
|
||||
@model ProcedureViewModel
|
||||
|
||||
@{
|
||||
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"><input type="text" name="name" value="@Model.ProcedureName" /></div>
|
||||
</div>
|
||||
|
||||
<!-- Цена -->
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" name="price" value="@Model.ProcedureCost" /></div>
|
||||
</div>
|
||||
|
||||
<!-- Длительность -->
|
||||
<div class="row">
|
||||
<div class="col-4">Длительность:</div>
|
||||
<div class="col-8"><input type="text" name="Duration" value="@Model.ProcedureDescription" /></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,24 @@
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "AddProcedureToService";
|
||||
}
|
||||
<head>
|
||||
<link rel="stylesheet" href="~/css/style.css" asp-append-version="true" />
|
||||
</head>
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1">Привязка процедуры к услуге</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="list">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Название процедуры: </label>
|
||||
<select id="procedure" name="procedure" class="form-control" asp-items="@(new SelectList(@ViewBag.Procedures, "Id", "ProcedureName"))"></select>
|
||||
</div>
|
||||
<div class="list">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Номер услуги: </label>
|
||||
<select id="service" name="service" class="form-control" asp-items="@(new SelectList(@ViewBag.Services, "Id", "ServiceName"))"></select>
|
||||
</div>
|
||||
<div class="button">
|
||||
<button class="button-action">Добавить привязку</button>
|
||||
</div>
|
||||
</form>
|
@ -17,7 +17,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="date" class="form-control" name="name" value="@Model.ServicePrice" /></div>
|
||||
<div class="col-8"><input type="number" class="form-control" name="name" value="@Model.ServicePrice" /></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
@ -0,0 +1,24 @@
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "AddProcedureToService";
|
||||
}
|
||||
<head>
|
||||
<link rel="stylesheet" href="~/css/style.css" asp-append-version="true" />
|
||||
</head>
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1">Привязка процедуры к услуге</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="list">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Название процедуры: </label>
|
||||
<select id="procedure" name="procedure" class="form-control" asp-items="@(new SelectList(@ViewBag.Procedures, "Id", "ProcedureName"))"></select>
|
||||
</div>
|
||||
<div class="list">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Номер услуги: </label>
|
||||
<select id="service" name="service" class="form-control" asp-items="@(new SelectList(@ViewBag.Services, "Id", "ServiceName"))"></select>
|
||||
</div>
|
||||
<div class="button">
|
||||
<button class="button-action">Добавить привязку</button>
|
||||
</div>
|
||||
</form>
|
@ -37,6 +37,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Cosmetic" asp-action="Cosmetics">Косметика</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Service" asp-action="AddProcedureToService">Привязка</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Reports">Отчет</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user