20-11-23
This commit is contained in:
parent
36e441106a
commit
ea35ed0e29
@ -2,7 +2,5 @@
|
||||
Public EnvelopeId As Integer
|
||||
Public UserReference As String
|
||||
Public ActionType As Constants.EnvelopeHistoryActionType
|
||||
Public ActionDescription As String
|
||||
Public ActionDate As DateTime
|
||||
|
||||
Public ActionDate As Date
|
||||
End Class
|
||||
|
||||
@ -7,6 +7,15 @@ Public Class HistoryModel
|
||||
MyBase.New(pState)
|
||||
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
|
||||
Try
|
||||
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("USER_REFERENCE", SqlDbType.NVarChar).Value = pHistory.UserReference
|
||||
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()
|
||||
|
||||
If Database.ExecuteNonQuery(oCommand) Then
|
||||
|
||||
@ -96,7 +96,6 @@ Public Class EnvelopeEditorController
|
||||
Dim newHistoryEntry As New EnvelopeHistoryEntry With {
|
||||
.EnvelopeId = oEnvelope.Id,
|
||||
.ActionType = EnvelopeHistoryActionType.Created,
|
||||
.ActionDescription = "Envelope wurde neu erstellt",
|
||||
.UserReference = oEnvelope.User.Email
|
||||
}
|
||||
|
||||
|
||||
@ -40,36 +40,5 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
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 string? ActionType { get; set; }
|
||||
public string? ActionDescription { get; set; }
|
||||
}
|
||||
|
||||
public class HistoryController : BaseController
|
||||
@ -33,7 +32,6 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
EnvelopeResponse response = envelopeService.LoadEnvelope(envelopeKey);
|
||||
|
||||
string actionTypeString = action.ActionType;
|
||||
string actionDescription = action.ActionDescription;
|
||||
|
||||
if (!Enum.TryParse<EnvelopeHistoryActionType>(actionTypeString, out var actionType))
|
||||
{
|
||||
@ -42,7 +40,6 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
|
||||
envelopeService.InsertHistoryEntry(new EnvelopeHistoryEntry()
|
||||
{
|
||||
ActionDescription = actionDescription,
|
||||
ActionDate = DateTime.Now,
|
||||
ActionType = actionType,
|
||||
EnvelopeId = response.Envelope.Id,
|
||||
|
||||
@ -110,7 +110,6 @@ namespace EnvelopeGenerator.Web.Services
|
||||
{
|
||||
return historyModel.Insert(new EnvelopeHistoryEntry()
|
||||
{
|
||||
ActionDescription = "Dokument wurde signiert",
|
||||
ActionDate = DateTime.Now,
|
||||
ActionType = EnvelopeHistoryActionType.Signed,
|
||||
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
|
||||
}
|
||||
|
||||
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) {
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = width;
|
||||
|
||||
@ -62,8 +62,7 @@ class App {
|
||||
const annotations = this.Annotation.createAnnotations(this.currentDocument)
|
||||
const createdAnnotations = await this.Instance.create(annotations)
|
||||
|
||||
const description = "Umschlag wurde geöffnet"
|
||||
await this.Network.postHistory(this.envelopeKey, ActionType.Seen, description);
|
||||
await this.Network.postHistory(this.envelopeKey, ActionType.Seen)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
@ -77,47 +76,12 @@ class App {
|
||||
handleAnnotationsChange() {}
|
||||
|
||||
async handleAnnotationsCreate(createdAnnotations) {
|
||||
console.log("annotations created");
|
||||
|
||||
console.log(createdAnnotations.toJS())
|
||||
|
||||
const annotation = createdAnnotations.toJS()[0];
|
||||
const isFormField = !!annotation.formFieldName;
|
||||
const isSignature = !!annotation.isSignature;
|
||||
|
||||
if (isFormField === false && isSignature === true) {
|
||||
|
||||
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);
|
||||
|
||||
await this.Annotation.createFrameAnnotation(annotation, this.currentReceiver)
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,6 +133,9 @@ class App {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Redirect to success page after saving to database
|
||||
window.location.href = `/EnvelopeKey/${this.envelopeKey}/Success`
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return false;
|
||||
|
||||
@ -9,25 +9,6 @@
|
||||
.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) {
|
||||
const url = `/api/envelope/${envelopeKey}?index=${documentId}`;
|
||||
const options = {
|
||||
@ -47,12 +28,11 @@
|
||||
});
|
||||
}
|
||||
|
||||
postHistory(envelopeKey, actionType, actionDescription) {
|
||||
postHistory(envelopeKey, actionType) {
|
||||
const url = `/api/history/${envelopeKey}`;
|
||||
|
||||
const data = {
|
||||
actionDescription: actionDescription,
|
||||
actionType: actionType.toString()
|
||||
actionType: actionType
|
||||
}
|
||||
|
||||
const options = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user