продолжение интерфейсов работника

This commit is contained in:
sardq 2024-04-29 22:58:28 +04:00
parent dac37e96b5
commit a1ddbe8312
9 changed files with 242 additions and 98 deletions

View File

@ -17,38 +17,13 @@ namespace FactoryWorkerApp.Controllers
public IActionResult Index()
{
if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}
//if (APIClient.Client == null)
//{
// return Redirect("~/Home/Enter");
//}
return View();
}
[HttpPost]
public void Privacy(string email, string password, string login)
{
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIClient.PostRequest("api/client/updatedata", new ClientBindingModel
{
Id = APIClient.Client.Id,
Login = login,
Email = email,
Password = password
});
APIClient.Client.Login = login;
APIClient.Client.Email = email;
APIClient.Client.Password = password;
Response.Redirect("Index");
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
@ -61,44 +36,12 @@ namespace FactoryWorkerApp.Controllers
return View();
}
[HttpPost]
public void Enter(string login, string password)
{
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
{
throw new Exception("Введите логин и пароль");
}
APIClient.Client = APIClient.GetRequest<ClientViewModel>($"api/client/login?login={login}&password={password}");
if (APIClient.Client == null)
{
throw new Exception("Неверный логин/пароль");
}
Response.Redirect("Index");
}
[HttpGet]
public IActionResult Register()
{
return View();
}
[HttpPost]
public void Register(string email, string password, string login)
{
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIClient.PostRequest("api/client/register", new ClientBindingModel
{
Login = login,
Email = email,
Password = password
});
Response.Redirect("Enter");
return;
}
[HttpGet]
public IActionResult Create()
{
@ -106,26 +49,35 @@ namespace FactoryWorkerApp.Controllers
return View();
}
[HttpPost]
public void Create(string name, double cost, string material)
[HttpGet]
public IActionResult Workpieces()
{
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
return View(new List<WorkpieceViewModel>());
}
if (cost<= 0)
[HttpGet]
public IActionResult Workpiece()
{
throw new Exception("Количество и сумма должны быть больше 0");
return View();
}
APIClient.PostRequest("api/main/createorder", new WorkpieceBindingModel
[HttpGet]
public IActionResult PlanProductions()
{
ClientId = APIClient.Client.Id,
Material = material,
Cost = cost,
WorkpieceName = name,
});
Response.Redirect("Index");
return View(new List<PlanProductionViewModel>());
}
[HttpGet]
public IActionResult PlanProduction()
{
return View();
}
[HttpGet]
public IActionResult ExecutionPhases()
{
return View(new List<ExecutionPhaseViewModel>());
}
[HttpGet]
public IActionResult ExecutionPhase()
{
return View();
}
}
}

View File

@ -0,0 +1,26 @@
@{
ViewData["Title"] = "Workpiece";
}
<div class="text-center">
<h2 class="display-4">Заготовка</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">План производства:</div>
<div class="col-8">
<select id="planproduction" name="planproduction" class="form-control" asp-items="@(new SelectList(@ViewBag.PlanProduction,"Id", "ProductionName"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Название:</div>
<div class="col-8"><input type="text" name="name" id="name" /></div>
</div>
<div class="row">
<div class="col-4">Статус:</div>
<div class="col-8"><input type="text" id="status" name="status" readonly /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,63 @@
@using FactoryContracts.ViewModels
@model List<ExecutionPhaseViewModel>
@{
ViewData["Title"] = "Execution Phases";
}
<div class="text-center">
<h1 class="display-4">Этапы выполнения</h1>
</div>
<div class="text-center">
@{
//if (Model == null)
//{
// <h3 class="display-4">Авторизируйтесь</h3>
// return;
//}
<p>
<a asp-action="ExecutionPhase">Создать</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Название
</th>
<th>
Логин клиента
</th>
<th>
ФИО исполнителя
</th>
<th>
Статус
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.ExecutionPhaseName)
</td>
<td>
@Html.DisplayFor(modelItem => item.ClientLogin)
</td>
<td>
@Html.DisplayFor(modelItem => item.ImplementerFIO)
</td>
<td>
@Html.DisplayFor(modelItem => item.Status)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -12,17 +12,25 @@
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
//if (Model == null)
//{
// <h3 class="display-4">Авторизируйтесь</h3>
// return;
//}
<p>
<a asp-action="Workpieces">Заготовки</a>
</p>
<p>
<a asp-action="PlanProductions">Планы производства</a>
</p>
<p>
<a asp-action="PlanProdctionExecutionPhase">Привзяка планов производства к заготовкам</a>
</p>
<p>
<a asp-action="ExecutionPhases">Этапы выполнения</a>
</p>
<p>
<a asp-action="Reports">Получение списка</a>
</p>
}

View File

@ -0,0 +1,24 @@
@{
ViewData["Title"] = "Plan Production";
}
<div class="text-center">
<h2 class="display-4">План производства</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Название:</div>
<div class="col-8"><input type="text" name="productionname" id="productionname" /></div>
</div>
<div class="row">
<div class="col-4">Количество:</div>
<div class="col-8"><input type="text" id="count" name="count" readonly /></div>
</div>
<div class="row">
<div class="col-4">Срок выполнения:</div>
<div class="col-8"><input type="text" id="deadline" name="deadline" readonly /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,69 @@
@using FactoryContracts.ViewModels
@model List<PlanProductionViewModel>
@{
ViewData["Title"] = "Plan Productions";
}
<div class="text-center">
<h1 class="display-4">Планы производства</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<p>
<a asp-action="PlanProduction">Создать</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Название
</th>
<th>
Логин клиента
</th>
<th>
Количество
</th>
<th>
Этап выполнения
</th>
<th>
Срок выполнения
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.ProductionName)
</td>
<td>
@Html.DisplayFor(modelItem => item.ClientLogin)
</td>
<td>
@Html.DisplayFor(modelItem => item.Count)
</td>
<td>
@Html.DisplayFor(modelItem => item.ExecutionPhaseName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Deadline)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -1,4 +1,5 @@
@{
@using FactoryContracts.ViewModels
@{
ViewData["Title"] = "Workpiece";
}
<div class="text-center">
@ -8,12 +9,16 @@
<div class="row">
<div class="col-4">Изделие:</div>
<div class="col-8">
<select id="product" name="product" class="form-control" asp-items="@(new SelectList(@ViewBag.Products,"Id", "ProductName"))"></select>
<select id="product" name="product" class="form-control"></select>
</div>
</div>
<div class="row">
<div class="col-4">Название:</div>
<div class="col-8"><input type="text" name="workpiecename" id="workpiecename" /></div>
</div>
<div class="row">
<div class="col-4">Материал:</div>
<div class="col-8"><input type="text" name="material" id="count" /></div>
<div class="col-8"><input type="text" name="material" id="material" /></div>
</div>
<div class="row">
<div class="col-4">Цена:</div>

View File

@ -11,11 +11,11 @@
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
//if (Model == null)
//{
// <h3 class="display-4">Авторизируйтесь</h3>
// return;
//}
<p>
<a asp-action="Workpiece">Создать заказ</a>

View File

@ -20,10 +20,7 @@
<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-page="/Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
<a class="nav-link text-dark" asp-area="" asp-action="Index">Главная</a>
</li>
</ul>
</div>