@RenderBody() diff --git a/EnvelopeGenerator.Web/wwwroot/js/app.js b/EnvelopeGenerator.Web/wwwroot/js/app.js index 22c3a7f9..98580a11 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/app.js +++ b/EnvelopeGenerator.Web/wwwroot/js/app.js @@ -177,52 +177,68 @@ class App { icon: 'warning', }) return false - - } - - // Save changes before doing anything - try { - await this.Instance.save() - } catch (e) { - Swal.fire({ - title: 'Fehler', - text: 'Umschlag konnte nicht signiert werden!', - icon: 'error', - }) - return false } - // Export annotation data and save to database - try { - const json = await this.Instance.exportInstantJSON() - const postEnvelopeResult = await this.Network.postEnvelope( - this.envelopeKey, - this.currentDocument.id, - json - ) - - if (postEnvelopeResult.fatal) { - Swal.fire({ - title: 'Fehler', - text: 'Umschlag konnte nicht signiert werden!', - icon: 'error', - }) - return false - } + return Swal.fire({ + title: localized.Confirmation, + html: `
${localized.SigAgree}
`, + icon: "question", + showCancelButton: true, + confirmButtonColor: "#3085d6", + cancelButtonColor: "#d33", + confirmButtonText: localized.Finalize, + cancelButtonText: localized.Review + }).then(async (result) => { + if (result.isConfirmed) { + //--- + // Save changes before doing anything + try { + await this.Instance.save() + } catch (e) { + Swal.fire({ + title: 'Fehler', + text: 'Umschlag konnte nicht signiert werden!', + icon: 'error', + }) + return false + } - if (postEnvelopeResult.error) { - Swal.fire({ - title: 'Warnung', - text: 'Umschlag ist nicht mehr verfügbar.', - icon: 'warning', - }) - return false + // Export annotation data and save to database + try { + const json = await this.Instance.exportInstantJSON() + const postEnvelopeResult = await this.Network.postEnvelope( + this.envelopeKey, + this.currentDocument.id, + json + ) + + if (postEnvelopeResult.fatal) { + Swal.fire({ + title: 'Fehler', + text: 'Umschlag konnte nicht signiert werden!', + icon: 'error', + }) + return false + } + + if (postEnvelopeResult.error) { + Swal.fire({ + title: 'Warnung', + text: 'Umschlag ist nicht mehr verfügbar.', + icon: 'warning', + }) + return false + } + + return true + } catch (e) { + return false + } + //--- } - - return true - } catch (e) { - return false - } + else + return false; + }); }