20-11-23
This commit is contained in:
parent
36e441106a
commit
ea35ed0e29
@ -2,7 +2,5 @@
|
|||||||
Public EnvelopeId As Integer
|
Public EnvelopeId As Integer
|
||||||
Public UserReference As String
|
Public UserReference As String
|
||||||
Public ActionType As Constants.EnvelopeHistoryActionType
|
Public ActionType As Constants.EnvelopeHistoryActionType
|
||||||
Public ActionDescription As String
|
Public ActionDate As Date
|
||||||
Public ActionDate As DateTime
|
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -7,6 +7,15 @@ Public Class HistoryModel
|
|||||||
MyBase.New(pState)
|
MyBase.New(pState)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Function GetActionDescription(pActionType As Constants.EnvelopeHistoryActionType)
|
||||||
|
Select Case pActionType
|
||||||
|
Case Constants.EnvelopeHistoryActionType.Created
|
||||||
|
Return "Umschlag erfolgreich erstellt"
|
||||||
|
Case Else
|
||||||
|
Return pActionType.ToString()
|
||||||
|
End Select
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Function Insert(pHistory As EnvelopeHistoryEntry) As Boolean
|
Public Function Insert(pHistory As EnvelopeHistoryEntry) As Boolean
|
||||||
Try
|
Try
|
||||||
Dim oSql = "INSERT INTO [dbo].[TBSIG_ENVELOPE_HISTORY] "
|
Dim oSql = "INSERT INTO [dbo].[TBSIG_ENVELOPE_HISTORY] "
|
||||||
@ -26,7 +35,7 @@ Public Class HistoryModel
|
|||||||
oCommand.Parameters.Add("ENVELOPE_ID", SqlDbType.Int).Value = pHistory.EnvelopeId
|
oCommand.Parameters.Add("ENVELOPE_ID", SqlDbType.Int).Value = pHistory.EnvelopeId
|
||||||
oCommand.Parameters.Add("USER_REFERENCE", SqlDbType.NVarChar).Value = pHistory.UserReference
|
oCommand.Parameters.Add("USER_REFERENCE", SqlDbType.NVarChar).Value = pHistory.UserReference
|
||||||
oCommand.Parameters.Add("ACTION_TYPE", SqlDbType.Int).Value = pHistory.ActionType
|
oCommand.Parameters.Add("ACTION_TYPE", SqlDbType.Int).Value = pHistory.ActionType
|
||||||
oCommand.Parameters.Add("ACTION_DESCRIPTION", SqlDbType.NVarChar).Value = pHistory.ActionDescription
|
oCommand.Parameters.Add("ACTION_DESCRIPTION", SqlDbType.NVarChar).Value = GetActionDescription(pHistory.ActionType)
|
||||||
oCommand.Parameters.Add("ACTION_DATE", SqlDbType.DateTime).Value = Now()
|
oCommand.Parameters.Add("ACTION_DATE", SqlDbType.DateTime).Value = Now()
|
||||||
|
|
||||||
If Database.ExecuteNonQuery(oCommand) Then
|
If Database.ExecuteNonQuery(oCommand) Then
|
||||||
|
|||||||
@ -96,7 +96,6 @@ Public Class EnvelopeEditorController
|
|||||||
Dim newHistoryEntry As New EnvelopeHistoryEntry With {
|
Dim newHistoryEntry As New EnvelopeHistoryEntry With {
|
||||||
.EnvelopeId = oEnvelope.Id,
|
.EnvelopeId = oEnvelope.Id,
|
||||||
.ActionType = EnvelopeHistoryActionType.Created,
|
.ActionType = EnvelopeHistoryActionType.Created,
|
||||||
.ActionDescription = "Envelope wurde neu erstellt",
|
|
||||||
.UserReference = oEnvelope.User.Email
|
.UserReference = oEnvelope.User.Email
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,36 +40,5 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
return ErrorResponse(e);
|
return ErrorResponse(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//[HttpPost]
|
|
||||||
//[Route("api/document/{envelopeKey}")]
|
|
||||||
//public async Task<IActionResult> Update(string envelopeKey)
|
|
||||||
//{
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// logger.Info("DocumentController/Update");
|
|
||||||
|
|
||||||
// // Validate Envelope Key and load envelope
|
|
||||||
// envelopeService.EnsureValidEnvelopeKey(envelopeKey);
|
|
||||||
// EnvelopeResponse response = envelopeService.LoadEnvelope(envelopeKey);
|
|
||||||
|
|
||||||
// // Load Document info
|
|
||||||
// var Request = ControllerContext.HttpContext.Request;
|
|
||||||
// var document = envelopeService.GetDocument(Request, envelopeKey);
|
|
||||||
|
|
||||||
// // Update the document with new data
|
|
||||||
// await envelopeService.UpdateDocument(Request.Body, document.Filepath);
|
|
||||||
|
|
||||||
// // Add history entry
|
|
||||||
// envelopeService.InsertHistoryEntrySigned(response);
|
|
||||||
|
|
||||||
// return Ok();
|
|
||||||
// }
|
|
||||||
// catch (Exception e)
|
|
||||||
// {
|
|
||||||
// return ErrorResponse(e);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,6 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
public class ActionObject
|
public class ActionObject
|
||||||
{
|
{
|
||||||
public string? ActionType { get; set; }
|
public string? ActionType { get; set; }
|
||||||
public string? ActionDescription { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HistoryController : BaseController
|
public class HistoryController : BaseController
|
||||||
@ -33,7 +32,6 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
EnvelopeResponse response = envelopeService.LoadEnvelope(envelopeKey);
|
EnvelopeResponse response = envelopeService.LoadEnvelope(envelopeKey);
|
||||||
|
|
||||||
string actionTypeString = action.ActionType;
|
string actionTypeString = action.ActionType;
|
||||||
string actionDescription = action.ActionDescription;
|
|
||||||
|
|
||||||
if (!Enum.TryParse<EnvelopeHistoryActionType>(actionTypeString, out var actionType))
|
if (!Enum.TryParse<EnvelopeHistoryActionType>(actionTypeString, out var actionType))
|
||||||
{
|
{
|
||||||
@ -42,7 +40,6 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
|
|
||||||
envelopeService.InsertHistoryEntry(new EnvelopeHistoryEntry()
|
envelopeService.InsertHistoryEntry(new EnvelopeHistoryEntry()
|
||||||
{
|
{
|
||||||
ActionDescription = actionDescription,
|
|
||||||
ActionDate = DateTime.Now,
|
ActionDate = DateTime.Now,
|
||||||
ActionType = actionType,
|
ActionType = actionType,
|
||||||
EnvelopeId = response.Envelope.Id,
|
EnvelopeId = response.Envelope.Id,
|
||||||
|
|||||||
@ -110,7 +110,6 @@ namespace EnvelopeGenerator.Web.Services
|
|||||||
{
|
{
|
||||||
return historyModel.Insert(new EnvelopeHistoryEntry()
|
return historyModel.Insert(new EnvelopeHistoryEntry()
|
||||||
{
|
{
|
||||||
ActionDescription = "Dokument wurde signiert",
|
|
||||||
ActionDate = DateTime.Now,
|
ActionDate = DateTime.Now,
|
||||||
ActionType = EnvelopeHistoryActionType.Signed,
|
ActionType = EnvelopeHistoryActionType.Signed,
|
||||||
EnvelopeId = response.Envelope.Id,
|
EnvelopeId = response.Envelope.Id,
|
||||||
|
|||||||
13
EnvelopeGenerator.Web/package-lock.json
generated
Normal file
13
EnvelopeGenerator.Web/package-lock.json
generated
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "EnvelopeGenerator.Web",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"requires": true,
|
||||||
|
"dependencies": {
|
||||||
|
"prettier": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
EnvelopeGenerator.Web/package.json
Normal file
15
EnvelopeGenerator.Web/package.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "EnvelopeGenerator.Web",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"prettier": "^3.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
8
EnvelopeGenerator.Web/prettier.config.js
Normal file
8
EnvelopeGenerator.Web/prettier.config.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
const config = {
|
||||||
|
trailingComma: "es5",
|
||||||
|
tabWidth: 4,
|
||||||
|
semi: false,
|
||||||
|
singleQuote: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
@ -70,6 +70,35 @@
|
|||||||
return annotation
|
return annotation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async createFrameAnnotation(annotation, receiver) {
|
||||||
|
const left = annotation.boundingBox.left - 25;
|
||||||
|
const top = annotation.boundingBox.top - 25;
|
||||||
|
const width = 150;
|
||||||
|
const height = 75;
|
||||||
|
|
||||||
|
const imageUrl = await this.Annotation.createAnnotationFrameBlob(receiver.name, width, height);
|
||||||
|
const request = await fetch(imageUrl);
|
||||||
|
const blob = await request.blob();
|
||||||
|
|
||||||
|
const imageAttachmentId = await this.Instance.createAttachment(blob);
|
||||||
|
const frameAnnotation = new PSPDFKit.Annotations.ImageAnnotation({
|
||||||
|
pageIndex: annotation.pageIndex,
|
||||||
|
isSignature: false,
|
||||||
|
readOnly: true,
|
||||||
|
locked: true,
|
||||||
|
lockedContents: true,
|
||||||
|
contentType: 'image/png',
|
||||||
|
imageAttachmentId,
|
||||||
|
description: 'FRAME',
|
||||||
|
boundingBox: new PSPDFKit.Geometry.Rect({
|
||||||
|
left: left,
|
||||||
|
top: top,
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async createAnnotationFrameBlob(receiverName, width, height) {
|
async createAnnotationFrameBlob(receiverName, width, height) {
|
||||||
const canvas = document.createElement("canvas");
|
const canvas = document.createElement("canvas");
|
||||||
canvas.width = width;
|
canvas.width = width;
|
||||||
|
|||||||
@ -62,8 +62,7 @@ class App {
|
|||||||
const annotations = this.Annotation.createAnnotations(this.currentDocument)
|
const annotations = this.Annotation.createAnnotations(this.currentDocument)
|
||||||
const createdAnnotations = await this.Instance.create(annotations)
|
const createdAnnotations = await this.Instance.create(annotations)
|
||||||
|
|
||||||
const description = "Umschlag wurde geöffnet"
|
await this.Network.postHistory(this.envelopeKey, ActionType.Seen)
|
||||||
await this.Network.postHistory(this.envelopeKey, ActionType.Seen, description);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
@ -77,47 +76,12 @@ class App {
|
|||||||
handleAnnotationsChange() {}
|
handleAnnotationsChange() {}
|
||||||
|
|
||||||
async handleAnnotationsCreate(createdAnnotations) {
|
async handleAnnotationsCreate(createdAnnotations) {
|
||||||
console.log("annotations created");
|
|
||||||
|
|
||||||
console.log(createdAnnotations.toJS())
|
|
||||||
|
|
||||||
const annotation = createdAnnotations.toJS()[0];
|
const annotation = createdAnnotations.toJS()[0];
|
||||||
const isFormField = !!annotation.formFieldName;
|
const isFormField = !!annotation.formFieldName;
|
||||||
const isSignature = !!annotation.isSignature;
|
const isSignature = !!annotation.isSignature;
|
||||||
|
|
||||||
if (isFormField === false && isSignature === true) {
|
if (isFormField === false && isSignature === true) {
|
||||||
|
await this.Annotation.createFrameAnnotation(annotation, this.currentReceiver)
|
||||||
const left = annotation.boundingBox.left - 25;
|
|
||||||
const top = annotation.boundingBox.top - 25;
|
|
||||||
const width = 150;
|
|
||||||
const height = 75;
|
|
||||||
|
|
||||||
console.log(annotation.boundingBox)
|
|
||||||
|
|
||||||
const imageUrl = await this.Annotation.createAnnotationFrameBlob(this.currentReceiver.name, width, height);
|
|
||||||
|
|
||||||
const request = await fetch(imageUrl);
|
|
||||||
const blob = await request.blob();
|
|
||||||
const imageAttachmentId = await this.Instance.createAttachment(blob);
|
|
||||||
const frameAnnotation = new PSPDFKit.Annotations.ImageAnnotation({
|
|
||||||
pageIndex: annotation.pageIndex,
|
|
||||||
isSignature: false,
|
|
||||||
readOnly: true,
|
|
||||||
locked: true,
|
|
||||||
lockedContents: true,
|
|
||||||
contentType: 'image/png',
|
|
||||||
imageAttachmentId,
|
|
||||||
description: 'FRAME',
|
|
||||||
boundingBox: new PSPDFKit.Geometry.Rect({
|
|
||||||
left: left,
|
|
||||||
top: top,
|
|
||||||
width: width,
|
|
||||||
height: height,
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
this.Instance.create(frameAnnotation);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,6 +133,9 @@ class App {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Redirect to success page after saving to database
|
||||||
|
window.location.href = `/EnvelopeKey/${this.envelopeKey}/Success`
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -9,25 +9,6 @@
|
|||||||
.then(res => res.arrayBuffer());
|
.then(res => res.arrayBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
postDocument(envelopeKey, documentId, buffer) {
|
|
||||||
const url = `/api/document/${envelopeKey}?index=${documentId}`;
|
|
||||||
const options = {
|
|
||||||
credentials: "include",
|
|
||||||
method: "POST",
|
|
||||||
body: buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
console.debug("PostDocument/Calling url: " + url)
|
|
||||||
return fetch(url, this.withCSRFToken(options))
|
|
||||||
.then(this.handleResponse)
|
|
||||||
.then((res) => {
|
|
||||||
if (!res.ok) {
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
postEnvelope(envelopeKey, documentId, jsonString) {
|
postEnvelope(envelopeKey, documentId, jsonString) {
|
||||||
const url = `/api/envelope/${envelopeKey}?index=${documentId}`;
|
const url = `/api/envelope/${envelopeKey}?index=${documentId}`;
|
||||||
const options = {
|
const options = {
|
||||||
@ -47,12 +28,11 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
postHistory(envelopeKey, actionType, actionDescription) {
|
postHistory(envelopeKey, actionType) {
|
||||||
const url = `/api/history/${envelopeKey}`;
|
const url = `/api/history/${envelopeKey}`;
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
actionDescription: actionDescription,
|
actionType: actionType
|
||||||
actionType: actionType.toString()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user