Skip to content

Commit

Permalink
Update - Modification de la page de suivi des déclarations
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmugnier committed Nov 30, 2020
1 parent efef745 commit 4410f72
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions Sheaft.Web.Manage/Controllers/DeclarationsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public async Task<IActionResult> Index(CancellationToken token, int page = 0, in

var entities = await _context.Legals
.OfType<BusinessLegal>()
.ProjectTo<BusinessLegalViewModel>(_configurationProvider)
.OrderByDescending(c => c.CreatedOn)
.Skip(page * take)
.Take(take)
Expand Down
27 changes: 17 additions & 10 deletions Sheaft.Web.Manage/Views/Declarations/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@model IEnumerable<ProducerRequiredDeclarationViewModel>
@model IEnumerable<BusinessLegalViewModel>
@{
ViewData["Title"] = "Declarations";
int take = ViewBag.Take;
Expand All @@ -15,8 +15,7 @@
<tr>
<th scope="col">Name</th>
<th scope="col">Email</th>
<th scope="col">Phone</th>
<th scope="col">Total</th>
<th scope="col">Declaration requise</th>
<th scope="col">
</th>
</tr>
Expand All @@ -27,12 +26,20 @@
<tr>
<th scope="row">@entity.Name</th>
<td>@entity.Email</td>
<td>@entity.Phone</td>
<td>@(entity.Total)€</td>
<td>@(entity.Kind == LegalKind.Business)</td>
<td>
<a asp-controller="Producers" asp-action="Edit" asp-route-id="@entity.Id" class="btn btn-info">
<i class="fa fa-pen"></i>
</a>
@if (entity.Kind == LegalKind.Business && entity.Declaration == null)
{
<a asp-controller="Declarations" asp-action="Create" asp-route-legalId="@entity.Id" class="btn btn-success">
<i class="fa fa-plus"></i>
</a>
}
@if (entity.Kind == LegalKind.Business && entity.Declaration != null)
{
<a asp-controller="Declarations" asp-action="Edit" asp-route-id="@entity.Declaration.Id" class="btn btn-info">
<i class="fa fa-pen"></i>
</a>
}
</td>
</tr>
}
Expand All @@ -42,13 +49,13 @@
<td colspan="6">
@if (currentPage >= 1)
{
<a asp-controller="Producers" asp-action="Index" asp-route-take="@take" asp-route-page="@(currentPage-1)" class="btn btn-outline-secondary">
<a asp-controller="Declarations" asp-action="Index" asp-route-take="@take" asp-route-page="@(currentPage-1)" class="btn btn-outline-secondary">
<i class="fa fa-caret-left"></i>
</a>
}
@if (take == Model.Count())
{
<a asp-controller="Producers" asp-action="Index" asp-route-take="@take" asp-route-page="@(currentPage+1)" class="btn btn-outline-secondary">
<a asp-controller="Declarations" asp-action="Index" asp-route-take="@take" asp-route-page="@(currentPage+1)" class="btn btn-outline-secondary">
<i class="fa fa-caret-right"></i>
</a>
}
Expand Down

0 comments on commit 4410f72

Please sign in to comment.