Done views

This commit is contained in:
ShabOl 2024-05-15 00:03:25 +04:00
parent c9d251a794
commit fd667be8b0
8 changed files with 202 additions and 35 deletions

View File

@ -124,7 +124,7 @@ namespace AutoWorkshopShopApp.Controllers
}
ViewBag.Shops = ApiClient.GetRequest<List<ShopViewModel>>($"api/shop/getshoplist?password={ApiClient.Password}");
ViewBag.Pizzas = ApiClient.GetRequest<List<RepairViewModel>>($"api/main/getpizzalist");
ViewBag.Repairs = ApiClient.GetRequest<List<RepairViewModel>>($"api/main/getrepairlist");
return View();
}

View File

@ -0,0 +1,15 @@
@{
ViewData["Title"] = "Enter";
}
<div class="text-center">
<h2 class="display-4">Вход в систему</h2>
</div>
<form method="post">
<div class="mb-3">
<label class="form-label">Пароль</label>
<input class="form-control" type="password" name="password">
</div>
<input type="submit" value="Вход" class="btn btn-primary" />
</form>

View File

@ -1,8 +1,68 @@
@{
@using AutoWorkshopContracts.ViewModels
@model List<ShopViewModel>
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
<h1 class="display-4">Магазины</h1>
</div>
<div class="text-center ">
<p>
<a asp-action="Create">Создать магазин</a>
</p>
<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>
<td>
@Html.DisplayFor(ModelItem => Item.Id)
</td>
<td>
@Html.DisplayFor(ModelItem => Item.ShopName)
</td>
<td>
@Html.DisplayFor(ModelItem => Item.Address)
</td>
<td>
@Html.DisplayFor(ModelItem => Item.OpeningDate)
</td>
<td>
@Html.DisplayFor(ModelItem => Item.RepairsMaxCount)
</td>
<td>
<a class="btn btn-primary" asp-action="Update" asp-route-Id="@(Item.Id)" role="button">Изменить</a>
</td>
</tr>
}
</tbody>
</table>
</div>

View File

@ -1,6 +0,0 @@
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>

View File

@ -0,0 +1,75 @@
@using AutoWorkshopDataModels.Models;
@using AutoWorkshopContracts.ViewModels;
@model ShopRepairViewModel
@{
ViewData["Title"] = "Shop";
}
<div class="text-center">
@{
if (Model == null)
{
<h2 class="display-4">Создание магазина</h2>
}
else
{
<h2 class="display-4">Изменение магазина</h2>
}
}
</div>
<form method="post">
<div class="mb-3">
<label class="form-label">Название</label>
<input type="text" class="form-control" name="shopname" id="shopname" value="@(Model==null ? "" : Model.Shop?.ShopName)" />
</div>
<div class="mb-3">
<label class="form-label">Адрес</label>
<input type="text" class="form-control" name="adress" id="adress" value="@(Model==null ? "" : Model.Shop?.Address)" />
</div>
<div class="mb-3">
<label for="startDate">Дата открытия</label>
<input class="form-control" type="date" name="openingdate" id="openingdate" value="@(Model==null ? "" : Model.Shop?.OpeningDate.ToString("yyyy-MM-dd"))" />
</div>
<div class="mb-3">
<label class="form-label">Вместимость</label>
<input type="number" min="0" step="1" pattern="[0-9]" class="form-control" name="maxcount" id="maxcount" value="@(Model==null ? "" : Model.Shop?.RepairsMaxCount)" />
</div>
<div class="mb-3 ">
<input class="btn btn-primary" type="submit" value="Сохранить">
@{
if (Model != null && Model.Shop != null)
{
<input class="btn btn-danger" asp-action="Delete" type="submit" value="Удалить" asp-route-Id="@(Model==null ? 0 : Model.Shop.Id.ToString())">
}
}
</div>
</form>
@{
if (Model != null && Model.Shop != null)
{
<div>
<h6>Содержимое магазина</h6>
</div>
<table class="table">
<thead>
<tr>
<th>Название</th>
<th>Количество</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.ShopRepairs)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.Value.Repair.RepairName)</td>
<td>@Html.DisplayFor(modelItem => item.Value.Count)</td>
</tr>
}
</tbody>
</table>
}
}

View File

@ -0,0 +1,22 @@
@{
ViewData["Title"] = "Supply";
}
<div class="text-center">
<h2 class="display-4">Создание поставки</h2>
</div>
<form method="post">
<div class="mb-3">
<label class="form-label">Магазин</label>
<select class="form-select form-select-lg" id="shop" name="shop" asp-items="@(new SelectList(@ViewBag.Shops,"Id", "ShopName"))"></select>
</div>
<div class="mb-3">
<label class="form-label">Ремонт</label>
<select class="form-select form-select-lg" id="repair" name="repair" asp-items="@(new SelectList(@ViewBag.Repairs,"Id", "RepairName"))"></select>
</div>
<div class="mb-3">
<label class="form-label">Количество</label>
<input type="number" min="0" step="1" pattern="[0-9]" class="form-control" name="count" id="count">
</div>
<input class="btn btn-success" type="submit" value="Создать поставку">
<a class="btn btn-primary" href="./Index" role="button">Отмена</a>
</form>

View File

@ -12,7 +12,7 @@
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">AutoWorkshopShopApp</a>
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">AutoWorkshopShopsApi</a>
<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>
@ -20,10 +20,10 @@
<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="Home" asp-action="Index">Home</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Главная</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Supply">Поставка</a>
</li>
</ul>
</div>
@ -38,7 +38,7 @@
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2024 - AutoWorkshopShopApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
&copy; 2024 - AutoWorkshop - <a asp-area="" asp-controller="Home" asp-action="Index">Главная</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
@ -46,4 +46,4 @@
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>
</html>

View File

@ -2,47 +2,48 @@
for details on configuring this project to bundle and minify static web assets. */
a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
white-space: normal;
text-align: center;
word-break: break-all;
}
a {
color: #0077cc;
color: #0077cc;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.border-top {
border-top: 1px solid #e5e5e5;
border-top: 1px solid #e5e5e5;
}
.border-bottom {
border-bottom: 1px solid #e5e5e5;
border-bottom: 1px solid #e5e5e5;
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
button.accept-policy {
font-size: 1rem;
line-height: inherit;
font-size: 1rem;
line-height: inherit;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px;
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px;
}