Compare commits

...

2 Commits

8 changed files with 94 additions and 13 deletions

View File

@ -11,7 +11,7 @@ namespace BankContracts.BindingModels
{
public int ClientId { get; set; }
public DateTime DealDate { get; set; } = DateTime.Now.Date;
public DateTime DealDate { get; set; } = DateTime.Now;
public int OperatorId { get; set; }

View File

@ -10,7 +10,7 @@ namespace BankContracts.BindingModels
public class PaymentBindingModel : IPaymentModel
{
public int Id { get; set; }
public DateTime PaymentDate {get;set;} = DateTime.Now.Date;
public DateTime PaymentDate {get;set;} = DateTime.Now;
public Dictionary<int, IDealModel> DealPayments { get; set; } = new();

View File

@ -14,7 +14,7 @@ namespace BankContracts.ViewModels
[DisplayName("Номер клиента")]
public int ClientId {get;set;}
[DisplayName("Дата сделки")]
public DateTime DealDate {get;set;} = DateTime.Now.Date;
public DateTime DealDate {get;set;} = DateTime.Now;
public int OperatorId { get;set;}
[DisplayName("ФИО оператора")]
public string OperatorName { get; set; } = string.Empty;

View File

@ -13,7 +13,7 @@ namespace BankContracts.ViewModels
[DisplayName("Номер платы")]
public int Id { get; set; }
[DisplayName("Дата платы")]
public DateTime PaymentDate { get; set; } = DateTime.Now.Date;
public DateTime PaymentDate { get; set; } = DateTime.Now;
public Dictionary<int, IDealModel> DealPayments { get; set; } = new();
public Dictionary<int, ICurrencyModel> CurrencyPayments { get; set; } = new();
public int OperatorId { get; set; }

View File

@ -134,5 +134,33 @@ namespace OperatorApp.Controllers
});
Response.Redirect("Index");
}
public IActionResult Payments()
{
if (APIClient.Operator == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.GetRequest<List<PaymentViewModel>>($"api/payment/getpayments?operatorId={APIClient.Operator.Id}"));
}
[HttpGet]
public IActionResult CreatePayment()
{
ViewBag.Deals = APIClient.GetRequest<List<DealViewModel>>("api/deal/getdealslist");
return View();
}
[HttpPost]
public void CreatePayment(int clientid)
{
if (APIClient.Operator == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/deal/createdeal", new PaymentBindingModel
{
OperatorId = APIClient.Operator.Id,
});
Response.Redirect("Index");
}
}
}

View File

@ -6,15 +6,11 @@
</div>
<form method="post">
<div class="row">
<div class="col-4">Изделие:</div>
<div class="col-4">Сделки:</div>
<div class="col-8">
<select id="product" name="product" class="form-control" asp-items="@(new SelectList(@ViewBag.Pastrys,"Id", "PastryName"))"></select>
<select id="deals" name="deals" class="form-control" asp-items="@(new SelectList(@ViewBag.Deals,"Id", "DealDate"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">ID клиента:</div>
<div class="col-8"><input type="text" name="clientid" id="clientid" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>

View File

@ -0,0 +1,57 @@
@using BankContracts.ViewModels
@model List<PaymentViewModel>
@{
ViewData["Title"] = "Payments";
}
<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="CreatePayment">Создать выплату</a>
</p>
<table class="table">
<thead>
<tr>
<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.OperatorName)
</td>
<td>
@Html.DisplayFor(modelItem => item.PaymentDate)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -24,10 +24,10 @@
<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="Index">Выплаты</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Payments">Выплаты</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">З</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">Личные данные</a>
@ -51,7 +51,7 @@
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2023 - ConfectioneryClientApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
&copy; 2023 - OperationApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>