Сделял привязку и отчеты

This commit is contained in:
Максим Яковлев 2024-04-30 17:49:26 +04:00
parent b810a49461
commit 91af9630c6
5 changed files with 215 additions and 1 deletions

View File

@ -158,6 +158,59 @@ namespace ServiceStationExecutorApp.Controllers
cars.Add(car); cars.Add(car);
return View(Tuple.Create(technicalWorks, cars)); return View(Tuple.Create(technicalWorks, cars));
} }
public IActionResult BindingTechnicalWorkToWork()
{
var technicalWork = new TechnicalWorkViewModel
{
Id = 1,
WorkType = "type1",
WorkPrice = 1000.0,
DateStartWork = DateTime.Now,
ExecutorId = 1
};
var work = new WorkViewModel
{
Id = 1,
WorkName = "work1",
WorkPrice = 1000.0,
Status = ServiceStationDataModels.Enums.WorkStatus.Принята
};
List<TechnicalWorkViewModel> technicalWorks = new List<TechnicalWorkViewModel>();
List <WorkViewModel> works = new List<WorkViewModel>();
technicalWorks.Add(technicalWork);
works.Add(work);
return View(Tuple.Create(technicalWorks, works));
}
public IActionResult ListWorkToFile()
{
var car = new CarViewModel
{
Id = 1,
CarNumber = "111",
CarBrand = "lamba"
};
var car2 = new CarViewModel
{
Id = 2,
CarNumber = "121",
CarBrand = "lamba"
};
var car3 = new CarViewModel
{
Id = 3,
CarNumber = "131",
CarBrand = "lamba"
};
List<CarViewModel> cars = new List<CarViewModel>();
cars.Add(car);
cars.Add(car2);
cars.Add(car3);
return View(cars);
}
public IActionResult ListCarsToPdf()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error() public IActionResult Error()

View File

@ -0,0 +1,36 @@
@using ServiceStationContracts.ViewModels;
@using ServiceStationDataModels.Models;
@{
ViewData["Title"] = "BindingTechnicalWorkToWork";
}
@model Tuple<List<TechnicalWorkViewModel>, List<WorkViewModel>>
<div class="container w-50">
<h2>Добавление машин к неисправностям:</h2>
<form method="post">
<div class="form-group">
<label for="technicalWork">Выберите ТО</label>
<select id="technicalWork" name="technicalWork" class="form-control">
@foreach (var technicalWork in Model.Item1)
{
<option value="@technicalWork.Id">@Html.DisplayFor(modelItem => technicalWork.WorkType)</option>
}
</select>
</div>
<div class="form-group">
<label for="work">Выберите Работу</label>
<select id="work" name="work" class="form-control">
@foreach (var work in Model.Item2)
{
<option value="@work.Id">@Html.DisplayFor(modelItem => work.WorkName)</option>
}
</select>
</div>
<br>
<div>
<input type="submit" value="Добавить" class="btn btn-secondary" />
</div>
</form>
</div>

View File

@ -0,0 +1,37 @@
@using ServiceStationContracts.ViewModels
@{
ViewData["Title"] = "ListCarsToPdf";
}
<div class="text-center">
<h2> Отчет по машинам за период </h2>
</div>
<div class="text-center">
<form method="post">
<div class="row py-4">
<div class="col-6">
<label for="dateFrom">Начало периода</label>
<input type="datetime-local" placeholder="Выберите дату начала периода" id="dateFrom" name="dateFrom" class="form-control" />
</div>
<div class="col-6">
<label for="dateTo">Окончание периода</label>
<input type="datetime-local" placeholder="Выберите дату окончания периода" id="dateTo" name="dateTo" class="form-control" />
</div>
</div>
<div>
<label>Введите почту</label>
<input type="email" placeholder="Введите вашу почту" name="organiserEmail" class="form-control w-25 mx-auto" />
</div>
<div class="pt-3">
<div class="col-8"></div>
<div class ="mx-auto col-4"><input type="submit" value="Отправить на почту" class="btn btn-secondary" /></div>
</div>
<div class="pt-3" id="report">
</div>
</form>
<div>
<div class="col-8"></div>
<div class="col-4 mx-auto"><button type="button" id="demonstrate" class="btn btn-secondary">Показать</button></div>
</div>
</div>

View File

@ -0,0 +1,82 @@
@using ServiceStationContracts.ViewModels
@model List<CarViewModel>
@{
ViewData["Title"] = "ListWorkToFile";
}
<div class="text-center">
<h2>
Создание отчета по машинам
</h2>
</div>
<div class="text-center w-50 mx-auto">
<form method="post">
<div class="py-3">
<label>
Выберите формат файла:
</label>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="type" value="docx" id="docx" checked>
<label for="docx">
Word-файл
</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="type" value="xlsx" id="xlsx">
<label for="xlsx">
Excel-файл
</label>
</div>
</div>
<div>
<div>
<div>
<table class="table">
<colgroup>
<col width="10%" />
<col width="60%" />
<col width="30%" />
</colgroup>
<thead>
<tr style="height: 31px">
<th>
</th>
<th>
Номер машины
</th>
<th>
Марка машины
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr style="height: 75px">
<td>
<input type="checkbox" class="form-check-input" name="Ids[]" value="@item.Id" id="@item.Id">
</td>
<td>
@Html.DisplayFor(modelItem => item.CarNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.CarBrand)
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
<div style="padding-bottom: 120px" class="row">
<div class="col-4"></div>
<div class="col-4"><input type="submit" class="btn btn-secondary w-100" value="Создать файл" /></div>
<div class="col-4"></div>
</div>
</form>
</div>

View File

@ -42,7 +42,13 @@
</ul> </ul>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-controller="Home" asp-action="BindingTechnicalWork">Привязка ТО</a> <a class="nav-link text-dark" asp-controller="Home" asp-action="BindingTechnicalWorkToWork">Привязка ТО</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-controller="Home" asp-action="ListWorkToFile">Выгрузка списка</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-controller="Home" asp-action="ListCarsToPdf">Отчет</a>
</li> </li>
</ul> </ul>
</div> </div>