переделанный макет работника

This commit is contained in:
Николай 2023-04-02 14:53:07 +04:00
parent 410ee5cb9f
commit c4c8069645
17 changed files with 165 additions and 13 deletions

View File

@ -106,7 +106,7 @@ namespace HardwareShopContracts.BusinessLogicsContracts
{
throw new ArgumentNullException("Некорректный идентификатор у сборки", nameof(model.Id));
}
_logger.LogInformation("Build. BuildName:{BuildName}. Price:{Price}. Id:{Id}", model.BuildName, model.Price, model.Id);
_logger.LogInformation("Build. UserId:{UserId}. BuildName:{BuildName}. Price:{Price}. Id:{Id}", model.UserId, model.BuildName, model.Price, model.Id);
var element = _buildStorage.GetElement(new BuildSearchModel
{
BuildName = model.BuildName

View File

@ -100,8 +100,12 @@ namespace HardwareShopContracts.BusinessLogicsContracts
{
throw new ArgumentNullException("Некорректный идентификатор у комментария", nameof(model.Id));
}
if (model.UserId < 0)
{
throw new ArgumentNullException("Некорректный идентификатор у клиента", nameof(model.UserId));
}
_logger.LogInformation("Comment. BuildId:{BuildId}. Id:{Id}", model.BuildId, model.Id);
_logger.LogInformation("Comment. UserId:{UserId}. BuildId:{BuildId}. Id:{Id}", model.UserId, model.BuildId, model.Id);
}
}
}

View File

@ -121,7 +121,7 @@ namespace HardwareShopContracts.BusinessLogicsContracts
{
throw new ArgumentNullException("Сумма заказа должна быть больше 0", nameof(model.Sum));
}
_logger.LogInformation("Purchase. PurchaseID:{Id}. Sum:{ Sum}", model.Id, model.Sum);
_logger.LogInformation("Purchase. UserId:{UserId}. PurchaseID:{Id}. Sum:{ Sum}", model.UserId, model.Id, model.Sum);
}
}
}

View File

@ -74,5 +74,11 @@ namespace HardwareShopClientApp.Controllers
return View();
}
[HttpGet]
public IActionResult linkingBuild()
{
return View();
}
}
}

View File

@ -5,7 +5,7 @@
ViewData["Title"] = "Build";
}
@model List<GoodViewModel>
@model List<ComponentViewModel>
@section Header {
<header>
@ -32,6 +32,9 @@
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>
@ -41,7 +44,7 @@
<form class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Товар</h2>
<h2 class="display-4">Комплектующие</h2>
</div>
<div class="col-sm-3">
<label class="form-label">Название сборки</label>

View File

@ -30,6 +30,9 @@
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>
@ -72,5 +75,7 @@
<button type="submit" class="btn btn-primary btn-lg mb-5">Изменить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Удалить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Обновить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Привязать сборку</button>
</div>
</form>

View File

@ -30,6 +30,9 @@
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>

View File

@ -27,6 +27,9 @@
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>

View File

@ -30,6 +30,9 @@
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>

View File

@ -29,6 +29,9 @@
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
@ -37,7 +40,7 @@
</header>
}
<form method="post" class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="col-sm-8">
<div class="text-center">
<h2 class="display-4">Покупки</h2>
</div>

View File

@ -28,6 +28,9 @@
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>

View File

@ -0,0 +1,116 @@

@using HardwareShopContracts.ViewModels
@{
ViewData["Title"] = "linkingBuild";
}
@model List<GoodViewModel>
@section Header {
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Purchases">Purchases</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Builds">Builds</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Comments">Comments</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="listComponents">listComponents</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
}
<form class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Выбранные покупки</h2>
</div>
<div>
<label class="form-label">Сборка</label>
<select class="form-select" name="role">
<option value="1">Сборка 1</option>
<option value="2">Сборка 2</option>
</select>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Комплектующее
</th>
<th>
Цена
</th>
<th>
Логин пользователя
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="text-center d-flex flex-column mt-5">
<button type="submit" class="btn btn-primary btn-lg mb-5">Save</button>
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Добавить</button>
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Изменить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Удалить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Обновить</button>
</div>
<!-- Модальное окно -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Покупка</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
</div>
<div class="modal-body">
<div>
<label class="form-label">Покупка</label>
<select class="form-select" name="purchase">
<option value="1">Покупка 1</option>
<option value="2">Покупка 2</option>
</select>
</div>
<div>
<label class="form-label">Количество</label>
<input type="number" class="form-control" name="count">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
<button type="button" class="btn btn-primary">Сохранить</button>
</div>
</div>
</div>
</div>
</form>

View File

@ -30,6 +30,9 @@
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>

View File

@ -12,7 +12,7 @@ namespace HardwareShopContracts.ViewModels
[DisplayName("Название компонента")]
public string BuildName { get; set; } = string.Empty;
[DisplayName("Логин работника")]
[DisplayName("Логин пользователя")]
public string UserLogin { get; set; } = string.Empty;
public int UserId { get; set; }

View File

@ -17,7 +17,7 @@ namespace HardwareShopContracts.ViewModels
public int UserId { get; set; }
[DisplayName("Логин работника")]
[DisplayName("Логин пользователя")]
public string UserLogin { get; set; } = string.Empty;
}
}

View File

@ -18,7 +18,7 @@ namespace HardwareShopContracts.ViewModels
public int UserId { get; set; }
[DisplayName("Логин работника")]
[DisplayName("Логин пользователя")]
public string UserLogin { get; set; } = string.Empty;
public Dictionary<int, (IBuildModel, int)>? PurchaseBuilds { get; set; }

View File

@ -23,14 +23,14 @@ namespace HardwareShopDatabaseImplement.Models.Worker
public virtual User User { get; set; }
[ForeignKey("BuildId")]
public virtual List<Comment>? Comments { get; set; }
public virtual List<Comment> Comments { get; set; } = new();
[ForeignKey("BuildId")]
public virtual List<BuildComponent>? Components { get; set; }
public virtual List<BuildComponent> Components { get; set; } = new();
[ForeignKey("BuildId")]
public virtual List<PurchaseBuild>? Purchases { get; set; }
public virtual List<PurchaseBuild> Purchases { get; set; } = new();
private Dictionary<int, (IComponentModel, int)>? _buildComponents = null;