@Master['master.html']
@Model['OrderLogMailOverviewViewModel']
@Section['Content']
<form class="mt-3" method="post">
    <div class="row mt-2">
        <h3>
            Status der Bounce-Erkennung
            <small class="text-muted">Auftrag "@Model.OrderName, Auftragsstart am @Model.OrderStartedAt"</small>
        </h3>
    </div>
    <div class="row mt-2">
        <div class="control-group mb-3">
            <div class="controls">
                <a class="btn btn-primary" href="/OrderLog/OrderLogBouncesStatus?OrderId=@Model.OrderId&OrderLogId=@Model.OrderLogId"><img src="/static/iconic/svg/reload.svg" style="width:16px;height:16px;fill:white;stroke:white" alt="reload">&nbsp;Aktualisieren</></a>
                @IfNot.BounceRecognitionIsRunning
                <a href="/OrderLog/OrderLogBounces?OrderId=@Model.OrderId&OrderLogId=@Model.OrderLogId" class="btn btn-secondary"><img class="iconic" src="/static/iconic/svg/wrench.svg" style="width:16px;height:16px;fill:white;stroke:white" alt="wrench">&nbsp;Bounce-Erkennung starten</a>
                <a href="/OrderLog/OrderLogInactivateBounces?OrderId=@Model.OrderId&OrderLogId=@Model.OrderLogId" class="btn btn-secondary"><img class="iconic" src="/static/iconic/svg/wrench.svg" style="width:16px;height:16px;fill:white;stroke:white" alt="wrench">&nbsp;Bounce-Einträge in Vertec inaktivieren</a>
                @EndIf
            </div>
        </div>
    </div>
    <div class="row mt-2">
        <div class="col-2">
            Status:
        </div>
        <div class="col-10">
            @If.BounceRecognitionIsRunning Bounce-Erkennung läuft @EndIf
            @IfNot.BounceRecognitionIsRunning Bounce-Erkennung abgeschlossen oder noch nicht durchgeführt @EndIf
        </div>
    </div>
    @If.BounceRecognitionIsRunning
    <div class="row mt-2">
        <div class="col-2">
            Fortschritt:
        </div>
        <div class="col-10">
            <div class="progress">
                <div class="progress-bar" role="progressbar" aria-valuenow="@Model.BounceRecognitionProgress" aria-valuemin="0" aria-valuemax="100"></div>
            </div>
        </div>
    </div>
    @EndIf
    <p></p>
    <div class="list-group">
        @Each.FoundBounces
        <div class="list-group-item list-group-item-action">
            <div class="d-flex w-100 justify-content-between">
                <div class="d-flex w-75 flex-grow-1 justify-content-between" style="margin-right:10px;">
                    <div class="d-flex align-items-start flex-column">
                        <h5 class="mb-1">Sendezeitpunkt: @Current.MailSentAt</h5>
                        <p class="mb-1">Empfänger: @Current.AllRecipients</p>
                        @If.HasCcRecipients <p class="mb-1">CC: @Current.AllCcRecipients</p> @EndIf
                        @If.HasBccRecipients <p class="mb-1">BCC: @Current.AllBccRecipients</p> @EndIf
                    </div>
                    <div class="d-flex align-items-end flex-column">
                        <p class="mb-1">Bounce-Status: @Current.BounceActionAsString</p>
                        <p><a href="vertec://@!Current.VertecId"><img src="/static/Vertec.png" title="Objekt mit Vertec-Link öffnen" /></a></p>
                        @If.HasEmailFile
                        <a href="/OrderLog/DownloadOrderLogMail?OrderId=@Current.OrderId&OrderLogId=@Current.OrderLogId&Id=@Current.Id" class="btn btn-success" disabled><img class="iconic" src="/static/iconic/svg/wrench.svg" style="width:16px;height:16px;fill:white;stroke:white" alt="wrench">&nbsp;E-Mail herunterladen</a>
                        @EndIf
                        &nbsp;
                    </div>
                </div>
            </div>
        </div>
        @EndEach
    </div>
</form>
@EndSection
