ViewUpdate

Around the world, around the world
Around the world, around the world
Around the world, around the world
Around the world, around the world
This commit is contained in:
Sergey Kozyrev 2024-04-30 00:44:32 +04:00
parent 6a4bc316c2
commit 8e9e4dd321
14 changed files with 313 additions and 37 deletions

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.ViewModels
{
public class DetailTimeReport
{
public string DetailName { get; set; } = string.Empty;
public List<string> Productions { get; set; } = new();
public List<string> Machines { get; set; } = new();
}
}

View File

@ -0,0 +1,8 @@
namespace Contracts.ViewModels
{
public class DetailWorkshopReportViewModel
{
public string DetailName { get; set; } = string.Empty;
public List<string> WorkShops { get; set; } = new();
}
}

View File

@ -4,6 +4,7 @@ using System.Diagnostics;
using BusinessLogic.BusinessLogic;
using Contracts.BusinessLogicsContracts;
using Contracts.ViewModels;
using DataModels.Models;
namespace ImplementerApp.Controllers
{
@ -35,7 +36,22 @@ namespace ImplementerApp.Controllers
}
public IActionResult IndexDetail()
{
return View(new List<DetailViewModel>());
var details = new List<DetailViewModel>();
details.Add(new DetailViewModel
{
Id = 1,
Name = "Test",
Cost = 55.5,
UserId = 1
});
details.Add(new DetailViewModel
{
Id = 2,
Name = "Test1",
Cost = 32,
UserId = 2
});
return View(details);
}
public IActionResult CreateDetail()
{
@ -48,7 +64,22 @@ namespace ImplementerApp.Controllers
}
public IActionResult CreateProduct()
{
return View();
var details = new List<DetailViewModel>();
details.Add(new DetailViewModel
{
Id = 1,
Name = "Test",
Cost = 55.5,
UserId = 1
});
details.Add(new DetailViewModel
{
Id = 2,
Name = "Test1",
Cost = 32,
UserId = 2
});
return View(details);
}
public IActionResult IndexProduction()
{
@ -56,12 +87,62 @@ namespace ImplementerApp.Controllers
}
public IActionResult CreateProduction()
{
return View();
var details = new List<DetailViewModel>();
details.Add(new DetailViewModel
{
Id = 1,
Name = "Test",
Cost = 55.5,
UserId = 1
});
details.Add(new DetailViewModel
{
Id = 2,
Name = "Test1",
Cost = 32,
UserId = 2
});
return View(details);
}
public IActionResult Privacy()
{
return View();
}
public IActionResult DetailTimeReport()
{
return View(new List<DetailTimeReport>());
}
public IActionResult DetailWorkshopReport()
{
return View(new List<DetailWorkshopReportViewModel>());
}
public IActionResult ReportsMenu()
{
return View();
}
public IActionResult ProductMachineAdd()
{
List<MachineViewModel> machines = new List<MachineViewModel>
{
new MachineViewModel
{
Id = 1,
Title = "Токарный станок",
Country = "Германия",
UserId = 1,
WorkerMachines = new()
},
new MachineViewModel
{
Id = 2,
Title = "Фрезерный станок",
Country = "Япония",
UserId = 2,
WorkerMachines = new()
}
};
return View(machines);
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()

View File

@ -1,4 +1,8 @@
@{
@using Contracts.ViewModels
@model List<DetailViewModel>
@{
ViewData["Title"] = "CreateProduct";
}
<div class="text-center">
@ -9,18 +13,32 @@
<div class="col-4">Название:</div>
<div class="col-8"><input type="text" name="title" id="title" /></div>
</div>
<div class="form-group">
<label>Details</label>
@foreach (var detail in ViewBag.Details)
{
<div class="form-group">
<label>
<input type="checkbox" name="details" value="@detail.Id" />
@detail.Name
</label>
<input type="number" name="count" value="0" min="0" class="form-control" />
</div>
}
<div class="container">
<div>Details</div>
<div class="table-responsive-lg">
<table id="detailsTable" class="display">
<thead>
<tr>
<th>Выбор</th>
<th>Название</th>
</tr>
</thead>
<tbody>
@foreach (var detail in Model)
{
<tr>
<td>
<input type="checkbox" name="details" value="@detail.Id" />
</td>
<td>@detail.Name</td>
<td>
<input type="number" name="count" value="0" min="0" class="form-control" />
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-4">Сумма:</div>
@ -30,4 +48,12 @@
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
</form>
</form>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.js"></script>
<script>
$(document).ready(function () {
$('#detailsTable').DataTable();
});
</script>

View File

@ -1,4 +1,8 @@
@{
@using Contracts.ViewModels
@model List<DetailViewModel>
@{
ViewData["Title"] = "CreateProduction";
}
<div class="text-center">
@ -9,18 +13,30 @@
<div class="col-4">Название:</div>
<div class="col-8"><input type="text" name="title" id="title" /></div>
</div>
<div class="form-group">
<label>Details</label>
@foreach (var detail in ViewBag.Details)
{
<div class="form-group">
<label>
<input type="checkbox" name="details" value="@detail.Id" />
@detail.Name
</label>
<input type="number" name="count" value="0" min="0" class="form-control" />
</div>
}
<div class="container">
<div>Details</div>
<div class="table-responsive-lg">
<table id="detailsTable" class="display">
<thead>
<tr>
<th>Выбор</th>
<th>Название</th>
<th>Количество</th>
</tr>
</thead>
<tbody>
@foreach (var detail in Model)
{
<tr>
<td>
<input type="checkbox" name="details" value="@detail.Id" />
</td>
<td>@detail.Name</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-4">Сумма:</div>
@ -30,4 +46,12 @@
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
</form>
</form>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.js"></script>
<script>
$(document).ready(function () {
$('#detailsTable').DataTable();
});
</script>

View File

@ -0,0 +1,50 @@
@using Contracts.ViewModels
@model List<DetailTimeReport>
@{
ViewData["Title"] = "Details on Time Reports";
}
<div class="text-center">
<h1 class="display-4">Список деталей в диапазоне времени</h1>
</div>
<form asp-controller="Report" method="post">
<button type="submit" class="btn btn-primary">Отправить отчет на почту</button>
</form>
<table class="table">
<thead>
<tr>
<th>Деталь</th>
<th>Станки</th>
<th>Производства</th>
</tr>
</thead>
<tbody>
@foreach (var detail in Model)
{
<tr>
<td>@detail.DetailName</td>
<td>
<ul>
@foreach (var machine in detail.Machines)
{
<li>@machine</li>
}
</ul>
</td>
<td>
<ul>
@foreach (var production in detail.Productions)
{
<li>@production</li>
}
</ul>
</td>
</tr>
}
</tbody>
</table>

View File

@ -0,0 +1,42 @@
@using Contracts.ViewModels
@model List<DetailWorkshopReportViewModel>
@{
ViewData["Title"] = "Details - Workshop Reports";
}
<div class="text-center">
<h1 class="display-4">Список деталей с отображением цехов</h1>
</div>
<form asp-controller="Report" method="post">
<button type="submit" class="btn btn-primary">Сгенерировать отчет в Word</button>
</form>
<form asp-controller="Report" method="post">
<button type="submit" class="btn btn-primary">Сгенерировать отчет в Excel</button>
</form>
<table class="table">
<thead>
<tr>
<th>Деталь</th>
<th>Цех</th>
</tr>
</thead>
<tbody>
@foreach (var detail in Model)
{
<tr>
<td>@detail.DetailName</td>
<td>
<ul>
@foreach (var workshop in detail.WorkShops)
{
<li>@workshop</li>
}
</ul>
</td>
</tr>
}
</tbody>
</table>

View File

@ -18,4 +18,4 @@
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Вход" class="btn btn-primary" /></div>
</div>
</form>
</form>

View File

@ -9,6 +9,7 @@
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexProduct">Изделия</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexProduction">Производства</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ReportsMenu">Меню отчетов</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
</div>

View File

@ -10,7 +10,6 @@
<h1 class="display-4">Детали</h1>
</div>
<div class="text-center">
@{
if (Model == null)

View File

@ -10,6 +10,7 @@
<h1 class="display-4">Изедлия</h1>
</div>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ProductMachineAdd">Привязать станок к изделию</a>
<div class="text-center">
@{

View File

@ -10,7 +10,6 @@
<h1 class="display-4">Производства</h1>
</div>
<div class="text-center">
@{
if (Model == null)

View File

@ -0,0 +1,31 @@
@using Contracts.ViewModels
@model List<MachineViewModel>
@{
ViewData["Title"] = "Product-Add-Machine";
}
<div class="text-center">
<h1 class="display-4">Изделие - @ViewBag.Product</h1>
</div>
<div class="container">
<h1>Список изделий</h1>
<div class="row">
@foreach (var machine in Model)
{
<div class="col-md-4">
<div class="card mb-4">
<div class="card-body">
<h5 class="card-title">@machine.Title</h5>
<form asp-controller="Cart" asp-action="AddToCart" method="post">
<input type="hidden" name="productId" value="@machine.Id" />
<button type="submit" class="btn btn-primary">Выбрать</button>
</form>
</div>
</div>
</div>
}
</div>
</div>

View File

@ -5,8 +5,7 @@
<div class="text-center">
<h1 class="display-4">Меню создания отчетов</h1>
<div class="list-group">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexDetail">Детали</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexProduct">Изделия</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexProduction">Производства</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="DetailWorkshopReport">Отчет деталь-цех</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="DetailTimeReport">Отчет по деталям по датам</a>
</div>
</div>