feat: Begrüßung und Dokumentdetails auf Umschlagseite aktualisiert

This commit is contained in:
Developer 02 2024-04-08 16:39:02 +02:00
parent 2512de0f26
commit 1584fd6f1c
6 changed files with 16 additions and 14 deletions

View File

@ -9,6 +9,6 @@ namespace EnvelopeGenerator.Application.Contracts
{
Task<IServiceResult<IEnumerable<EnvelopeDto>>> ReadAllWithAsync(bool documents = false, bool receivers = false, bool history = false, bool documentReceiverElement = false);
Task<IServiceResult<EnvelopeDto>> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false);
Task<IServiceResult<EnvelopeDto>> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withAll = false);
}
}

View File

@ -23,9 +23,9 @@ namespace EnvelopeGenerator.Application.Services
return Successful(readDto);
}
public async Task<IServiceResult<EnvelopeDto>> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false)
public async Task<IServiceResult<EnvelopeDto>> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withAll = false)
{
var envelope = await _repository.ReadByUuidAsync(uuid: uuid, signature: signature, withDocuments: withDocuments, withReceivers: withReceivers, withHistory: withHistory, withDocumentReceiverElement: withDocumentReceiverElement);
var envelope = await _repository.ReadByUuidAsync(uuid: uuid, signature: signature, withDocuments: withDocuments, withReceivers: withReceivers, withHistory: withHistory, withDocumentReceiverElement: withDocumentReceiverElement, withAll:withAll);
if (envelope is null)
return Failed<EnvelopeDto>();

View File

@ -7,6 +7,6 @@ namespace EnvelopeGenerator.Infrastructure.Contracts
{
Task<IEnumerable<Envelope>> ReadAllWithAsync(bool documents = false, bool receivers = false, bool history = false, bool documentReceiverElement = true);
Task<Envelope?> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false);
Task<Envelope?> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withAll = false);
}
}

View File

@ -31,23 +31,23 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
return await query.ToListAsync();
}
public async Task<Envelope?> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false)
public async Task<Envelope?> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withAll = false)
{
var query = _dbSet.Where(e => e.Uuid == uuid);
if (signature is not null)
query = query.Where(e => e.Receivers != null && e.Receivers.Any(er => er.Receiver != null && er.Receiver.Signature == signature));
if (withDocuments)
if (withAll || withDocuments)
if (withDocumentReceiverElement)
query = query.Include(e => e.Documents!).ThenInclude(d => d.Elements);
else
query = query.Include(e => e.Documents);
if (withReceivers)
if (withAll || withReceivers)
query = query.Include(e => e.Receivers!).ThenInclude(er => er.Receiver);
if (withHistory)
if (withAll || withHistory)
query = query.Include(e => e.History);
return await query.FirstOrDefaultAsync();

View File

@ -80,7 +80,7 @@ namespace EnvelopeGenerator.Web.Controllers
if (verification.IsSuccess)
{
var envelope = await _envelopeService.ReadByUuidAsync(decodedId.EnvelopeUuid, decodedId.ReceiverSignature, true, true, true);
var envelope = await _envelopeService.ReadByUuidAsync(uuid: decodedId.EnvelopeUuid, signature: decodedId.ReceiverSignature, withAll:true);
database.Services.actionService.EnterCorrectAccessCode(response.Envelope, response.Receiver); //for history
ViewData["EnvelopeKey"] = envelopeReceiverId;
ViewData["EnveResponse"] = response;

View File

@ -7,8 +7,10 @@
@if (Model.IsSuccess && Model.Data is not null)
{
var envelope = Model.Data;
var defaultDocument = envelope.Documents?.FirstOrDefault();
var pages = defaultDocument?.Elements?.Select(e => e.Page) ?? Array.Empty<int>();
var document = envelope.Documents?.FirstOrDefault();
var receiver = envelope.Receivers?.FirstOrDefault();
var receiverName = receiver?.Name ?? string.Empty;
var pages = document?.Elements?.Select(e => e.Page) ?? Array.Empty<int>();
var stPageIndexes = string.Join(pages.Count() > 1 ? ", " : "", pages.Take(pages.Count() - 1))
+ (pages.Count() > 1 ? " und " : "") + pages.LastOrDefault();
@ -17,7 +19,7 @@
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-brand me-auto ms-5 envelope-message">@envelope.Message</div>
<div class="navbar-brand me-auto ms-5 envelope-message">@($"Hallo {receiverName}, {@envelope.Message}")</div>
<div class="col-1 p-0 m-0 me-3 d-flex">
<img src="~/img/digital_data.svg" alt="...">
</div>
@ -32,8 +34,8 @@
</div>
<div class="col p-0 m-0">
<div class="card-body p-0 m-0">
<h5 class="card-title p-0 m-0">@envelope.Title</h5>
<p class="card-text p-0 m-0">@($"Sie haben {(pages.Count())} Briefe zu unterschreiben. Bitte prüfen Sie die Seiten {stPageIndexes}.")</p>
<h5 class="card-title p-0 m-0">@($"{envelope.Title}")</h5>
<p class="card-text p-0 m-0">@($"Sie haben {(pages.Count())} Briefe zu unterschreiben. Bitte prüfen Sie die Seiten {stPageIndexes}.")</p>
<p class="card-text p-0 m-0"><small class="text-body-secondary">Erstellt am @envelope.AddedWhen</small></p>
</div>
</div>