Макет для покупок готов

This commit is contained in:
Николай 2023-04-02 12:36:49 +04:00
parent b7fb6df828
commit e558896d4f
5 changed files with 194 additions and 60 deletions

View File

@ -88,7 +88,7 @@ namespace HardwareShopClientApp.Controllers
} }
else else
{ {
return RedirectToAction("Index", "Worker"); return Redirect("Index");
} }
} }

View File

@ -46,6 +46,25 @@ namespace HardwareShopClientApp.Controllers
return View(APIClient.GetRequest<List<PurchaseViewModel>>($"api/client/getpurchases?UserId={APIClient.User.Id}")); return View(APIClient.GetRequest<List<PurchaseViewModel>>($"api/client/getpurchases?UserId={APIClient.User.Id}"));
} }
[HttpPost]
public void Purchases(int id)
{
//return View();
//string login = (string)TempData["UserId"];
Response.Redirect("Purchase");
}
[HttpGet]
public IActionResult Purchase()
{
//return View();
//string login = (string)TempData["UserId"];
return View();
}
public IActionResult WorkerReport() public IActionResult WorkerReport()
{ {
return View(); return View();

View File

@ -14,6 +14,10 @@
<label class="form-label">Пароль</label> <label class="form-label">Пароль</label>
<input type="password" class="form-control" name="password"> <input type="password" class="form-control" name="password">
</div> </div>
<button type="submit" class="btn btn-primary mt-3 px-4">Submit</button> <div class="col-sm-2 d-flex justify-content-evenly align-items-baseline">
<button type="submit" class="btn btn-primary mt-3 px-4">Submit</button>
<a asp-action="Register">Регистрация</a>
</div>
</form> </form>

View File

@ -0,0 +1,106 @@
@using HardwareShopContracts.ViewModels
@{
ViewData["Title"] = "Purchase";
}
@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>
</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 class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<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="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 class="col-sm-3">
<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="col-sm-3">
<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

@ -36,63 +36,68 @@
</nav> </nav>
</header> </header>
} }
<form method="post" class="d-flex justify-content-evenly">
<div class="text-center"> <div class=" col-sm-8">
<h2 class="display-4">Регистрация</h2> <div class="text-center">
</div> <h2 class="display-4">Покупки</h2>
<div class="text-center"> </div>
@{ <div class="text-center" name="id">
if (Model == null) @{
{ if (Model == null)
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Блюдо
</th>
<th>
Дата создания
</th>
<th>
Количество
</th>
<th>
Сумма
</th>
<th>
Статус
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{ {
<tr> <h3 class="display-4">Авторизируйтесь</h3>
<td> return;
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.DatePurchase)
</td>
<td>
@Html.DisplayFor(modelItem => item.Sum)
</td>
<td>
@Html.DisplayFor(modelItem => item.PurchaseStatus)
</td>
<td>
@Html.DisplayFor(modelItem => item.UserLogin)
</td>
</tr>
} }
</tbody> <table class="table">
</table> <thead>
} <tr>
</div> <th>
Номер
</th>
<th>
Дата оплаты
</th>
<th>
Сумма
</th>
<th>
Статус
</th>
<th>
Пользователь
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.DatePurchase)
</td>
<td>
@Html.DisplayFor(modelItem => item.Sum)
</td>
<td>
@Html.DisplayFor(modelItem => item.PurchaseStatus)
</td>
<td>
@Html.DisplayFor(modelItem => item.UserLogin)
</td>
</tr>
}
</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">Добавить</button>
<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>
</div>
</form>