ReportCards
This commit is contained in:
parent
663f0122eb
commit
2244321365
@ -247,9 +247,56 @@ namespace BankYouBankruptClientApp.Controllers
|
|||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(new ReportClientCardsViewModel() {
|
return View(new ReportClientCardsViewModel()
|
||||||
Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}")
|
{
|
||||||
});
|
Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}").Select(x => new CheckboxViewModel() {
|
||||||
|
Id = x.Id,
|
||||||
|
LabelName = x.Number,
|
||||||
|
IsChecked = false
|
||||||
|
}).ToList()
|
||||||
|
}) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult ReportWithCards(List<CheckboxViewModel> cards)
|
||||||
|
{
|
||||||
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<int> cardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList();
|
||||||
|
List<ReportViewModel> creditings = APIClient.GetRequest<List<CreditingViewModel>>($"api/Client/getUsersCreditings?userId={APIClient.Client.Id}")
|
||||||
|
.Where(x => cardList.Contains(x.CardId)).Select(x => new ReportViewModel() {
|
||||||
|
Id=x.Id,
|
||||||
|
CardId=x.CardId,
|
||||||
|
DateOpen=x.DateOpen,
|
||||||
|
DateClose=x.DateClose,
|
||||||
|
CardNumber=x.CardNumber,
|
||||||
|
Status = x.Status,
|
||||||
|
Sum = x.Sum,
|
||||||
|
TypeOperation = TypeOperationEnum.Пополнение
|
||||||
|
}).ToList();
|
||||||
|
List<ReportViewModel> debitings = APIClient.GetRequest<List<DebitingViewModel>>($"api/Client/getUsersDebitings?userId={APIClient.Client.Id}")
|
||||||
|
.Where(x => cardList.Contains(x.CardId)).Select(x => new ReportViewModel()
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
CardId = x.CardId,
|
||||||
|
DateOpen = x.DateOpen,
|
||||||
|
DateClose = x.DateClose,
|
||||||
|
CardNumber = x.CardNumber,
|
||||||
|
Status = x.Status,
|
||||||
|
Sum = x.Sum,
|
||||||
|
TypeOperation = TypeOperationEnum.Снятие
|
||||||
|
}).ToList();
|
||||||
|
List<ReportViewModel> result = creditings.Concat(debitings).OrderBy(x => x.DateOpen).ToList();
|
||||||
|
|
||||||
|
return View(new ReportClientCardsViewModel()
|
||||||
|
{
|
||||||
|
Cards = cards,
|
||||||
|
Operations = result,
|
||||||
|
|
||||||
|
}) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,41 +15,73 @@
|
|||||||
<div class="row" sf-type="container" sf-label="Row" sf-uid="3">
|
<div class="row" sf-type="container" sf-label="Row" sf-uid="3">
|
||||||
<div class="mb-4 mb-md-0 aos-init aos-animate col-md-3" sf-type="container" sf-label="Column" sf-anim-delay="1.5" data-aos="fade-down" data-aos-delay="400" sf-uid="4">
|
<div class="mb-4 mb-md-0 aos-init aos-animate col-md-3" sf-type="container" sf-label="Column" sf-anim-delay="1.5" data-aos="fade-down" data-aos-delay="400" sf-uid="4">
|
||||||
<div sf-type="container" sf-label="Container" class="py-15 h-100 bg-bg-2" sf-uid="5">
|
<div sf-type="container" sf-label="Container" class="py-15 h-100 bg-bg-2" sf-uid="5">
|
||||||
@foreach (var item in Model.Cards)
|
<form method="post">
|
||||||
{
|
@for (var item = 0; item < @Model.Cards.Count(); item++)
|
||||||
<div class="form-check form-switch">
|
{
|
||||||
<input class="form-check-input" type="checkbox" id="flexSwitchCheckDefault">
|
<div class="form-check form-switch">
|
||||||
<label class="form-check-label" for="flexSwitchCheckDefault">@item.Number</label>
|
<input class="form-check-input" type="checkbox" id="flexSwitchCheckDefault" asp-for="@Model.Cards[item].IsChecked">
|
||||||
</div>
|
<label class="form-check-label" for="flexSwitchCheckDefault">@Model.Cards[item].LabelName</label>
|
||||||
|
<input type="hidden" asp-for="@Model.Cards[item].Id" />
|
||||||
}
|
<input type="hidden" asp-for="@Model.Cards[item].LabelName" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<div>
|
||||||
|
<input class="btn btn-primary mt-3" type="submit" value="Submit" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="aos-init aos-animate col-md" sf-type="container" sf-label="Column" sf-anim-delay="2" data-aos="fade-down" data-aos-delay="500" sf-uid="8">
|
<div class="aos-init aos-animate col-md" sf-type="container" sf-label="Column" sf-anim-delay="2" data-aos="fade-down" data-aos-delay="500" sf-uid="8">
|
||||||
<div sf-type="container" sf-label="Container" class="py-15 h-100 bg-bg-2" sf-uid="9">
|
<div sf-type="container" sf-label="Container" class="py-15 h-100 bg-bg-2" sf-uid="9">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
Номер карты
|
Номер карты
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Сумма
|
Тип операции
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Статус
|
Сумма
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Дата открытия
|
Статус
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Дата закрытия
|
Дата открытия
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
<th>
|
||||||
</thead>
|
Дата закрытия
|
||||||
<tbody>
|
</th>
|
||||||
</tbody>
|
</tr>
|
||||||
</table>
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model.Operations)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.CardNumber)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.TypeOperation)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Sum)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Status)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.DateOpen)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.DateClose)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
using BankYouBankruptDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankYouBankruptContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class CheckboxViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string LabelName { get; set; }
|
||||||
|
public bool IsChecked { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankYouBankruptContracts.ViewModels
|
||||||
|
{
|
||||||
|
internal class ReportCardViewModel
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -8,10 +8,8 @@ namespace BankYouBankruptContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class ReportClientCardsViewModel
|
public class ReportClientCardsViewModel
|
||||||
{
|
{
|
||||||
public List<CardViewModel>? Cards { get; set; } = new();
|
public List<CheckboxViewModel>? Cards { get; set; } = new();
|
||||||
|
|
||||||
public List<DebitingViewModel>? Debitings { get; set; } = new();
|
public List<ReportViewModel>? Operations { get; set; } = new();
|
||||||
|
|
||||||
public List<CreditingViewModel>? Creditings { get; set; } = new();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,4 @@ namespace BankYouBankruptContracts.ViewModels
|
|||||||
|
|
||||||
public DateTime? DateComplite { get; set; }
|
public DateTime? DateComplite { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
using BankYouBankruptDataModels.Enums;
|
||||||
|
using BankYouBankruptDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankYouBankruptContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int CardId { get; set; }
|
||||||
|
|
||||||
|
public string? CardNumber { get; set; }
|
||||||
|
|
||||||
|
public int Sum { get; set; }
|
||||||
|
|
||||||
|
public DateTime DateOpen { get; set; }
|
||||||
|
|
||||||
|
public DateTime? DateClose { get; set; }
|
||||||
|
|
||||||
|
public StatusEnum Status { get; set; }
|
||||||
|
|
||||||
|
public TypeOperationEnum TypeOperation { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankYouBankruptDataModels.Enums
|
||||||
|
{
|
||||||
|
public enum TypeOperationEnum
|
||||||
|
{
|
||||||
|
Снятие = 1,
|
||||||
|
Пополнение = 2
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user