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 int ClientId { get; set; }
public DateTime DealDate { get; set; } = DateTime.Now.Date; public DateTime DealDate { get; set; } = DateTime.Now;
public int OperatorId { get; set; } public int OperatorId { get; set; }

View File

@ -10,7 +10,7 @@ namespace BankContracts.BindingModels
public class PaymentBindingModel : IPaymentModel public class PaymentBindingModel : IPaymentModel
{ {
public int Id { get; set; } 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(); public Dictionary<int, IDealModel> DealPayments { get; set; } = new();

View File

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

View File

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

View File

@ -134,5 +134,33 @@ namespace OperatorApp.Controllers
}); });
Response.Redirect("Index"); 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> </div>
<form method="post"> <form method="post">
<div class="row"> <div class="row">
<div class="col-4">Изделие:</div> <div class="col-4">Сделки:</div>
<div class="col-8"> <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> </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="row">
<div class="col-8"></div> <div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></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> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Сделки</a>
</li> </li>
<li class="nav-item"> <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>
<li class="nav-item"> <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>
<li class="nav-item"> <li class="nav-item">
<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="Privacy">Личные данные</a>
@ -51,7 +51,7 @@
<footer class="border-top footer text-muted"> <footer class="border-top footer text-muted">
<div class="container"> <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> </div>
</footer> </footer>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script> <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>