Skip to content

Commit

Permalink
Fix - Correction de la gestion des documents sur manage
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmugnier committed Dec 8, 2020
1 parent fdc7fc3 commit 646aa09
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Sheaft.Web.Manage/Controllers/DocumentsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ public async Task<IActionResult> DeletePage(Guid documentId, Guid pageId, Cancel
[ValidateAntiForgeryToken]
public async Task<IActionResult> Delete(Guid id, CancellationToken token)
{
var entity = await _context.Legals
.SingleOrDefaultAsync(c => c.Documents.Any(d => d.Id == id), token);

var result = await _mediatr.Process(new DeleteDocumentCommand(await GetRequestUser(token))
{
Id = id
Expand All @@ -265,9 +268,6 @@ public async Task<IActionResult> Delete(Guid id, CancellationToken token)
if (!result.Success)
throw result.Exception;

var entity = await _context.Legals
.SingleOrDefaultAsync(c => c.Documents.Any(d => d.Id == id), token);

if (entity.Kind != LegalKind.Natural)
return RedirectToAction("EditLegalBusiness", "Legals", new { entity.Id });

Expand Down
6 changes: 3 additions & 3 deletions Sheaft.Web.Manage/Views/Documents/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}
}

@if (Model.Status == DocumentStatus.Locked || Model.Status == DocumentStatus.Refused || Model.Status == DocumentStatus.OutOfDate)
@if (Model.Status == DocumentStatus.Locked)
{
@using (Html.BeginForm("Unlock", "Documents", new { id = Model.Id }, FormMethod.Post, true, new { @class = "form d-inline" }))
{
Expand Down Expand Up @@ -149,7 +149,7 @@
<th scope="col">Size</th>
<th scope="col">UploadedOn</th>
<th scope="col">
@if (Model.Status != DocumentStatus.Locked && Model.Status != DocumentStatus.Validated && Model.Status != DocumentStatus.ValidationAsked)
@if (Model.Status == DocumentStatus.Created || Model.Status == DocumentStatus.UnLocked)
{
<a asp-controller="Documents" asp-action="AddPage" asp-route-documentid="@Model.Id" class="btn btn-info">
<i class="fa fa-plus"></i>
Expand All @@ -173,7 +173,7 @@
<i class="fa fa-download"></i>
</button>
}
@if (Model.Status != DocumentStatus.Locked && Model.Status != DocumentStatus.Validated && Model.Status != DocumentStatus.ValidationAsked)
@if (Model.Status == DocumentStatus.Created || Model.Status == DocumentStatus.UnLocked)
{
@using (Html.BeginForm("DeletePage", "Documents", new { documentId = Model.Id, pageId = docPage.Id }, FormMethod.Post, true, new { @class = "form d-inline" }))
{
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Views/Legals/EditLegalBusiness.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
</button>
}

@if (document.Status != DocumentStatus.ValidationAsked && document.Status != DocumentStatus.Validated)
@if (document.Status == DocumentStatus.Created || document.Status == DocumentStatus.Refused)
{
@using (Html.BeginForm("Delete", "Documents", new { id = document.Id }, FormMethod.Post, true, new { @class = "form d-inline" }))
{
Expand Down

0 comments on commit 646aa09

Please sign in to comment.