annotation background, sidebar, reject button

This commit is contained in:
Jonathan Jenne 2023-11-22 13:42:50 +01:00
parent 56688d2690
commit e52eca809e
4 changed files with 55 additions and 6 deletions

View File

@ -3,32 +3,50 @@
https://tailwindcss.com/docs/customizing-colors#default-color-palette
*/
/* Toolbar Buttons */
.button-finish {
transition: background-color linear 300ms;
background-color: #059669;
background-color: #059669; /* emerald-600 */
color: white;
border-left: none;
}
.button-finish:hover, .button-finish:focus, .button-finish:active {
background-color: #10b981;
background-color: #10b981; /* emerald-500 */
color: white;
}
.button-reject {
transition: background-color linear 300ms;
background-color: #d97706; /* amber-600 */
color: white;
border-left: none;
}
.button-reject:hover, .button-reject:focus, .button-reject:active {
background-color: #f59e0b; /* amber-500 */
color: white;
}
.button-reset {
transition: background-color linear 300ms;
background-color: #2563eb;
background-color: #2563eb; /* blue-600 */
color: white;
border-left: none;
}
.button-reset:hover, .button-reset:focus, .button-reset:active {
background-color: #3b82f6;
background-color: #3b82f6; /* blue-500 */
color: white;
}
/* Success Page */
#page-success header .icon {
display: inline-block;
border-radius: 100px;
padding: 15px;
margin-bottom: 2rem;
}
}

View File

@ -90,6 +90,8 @@
id: id,
pageIndex: pageIndex,
formFieldName: id,
backgroundColor: PSPDFKit.Color.YELLOW,
blendMode: "multiply",
boundingBox: new PSPDFKit.Geometry.Rect({
width,
height,

View File

@ -142,6 +142,9 @@ class App {
}
break
case 'REJECT':
alert('Dokument abgelent!')
}
}

View File

@ -19,11 +19,13 @@
styleSheets: ['/css/site.css'],
container: container,
document: arrayBuffer,
autoSaveMode: 'DISABLED',
annotationPresets: this.getPresets(),
electronicSignatures: {
creationModes: ['DRAW', 'TYPE'],
},
initialViewState: new PSPDFKit.ViewState({
sidebarMode: PSPDFKit.SidebarMode.THUMBNAILS,
}),
isEditableAnnotation: function (annotation) {
// Check if the annotation is a signature
// This will allow new signatures, but not allow edits.
@ -40,6 +42,9 @@
//return !annotation.isSignature;
},
customRenderers: {
Annotation: this.annotationRenderer
}
})
}
@ -50,6 +55,14 @@
console.debug('PSPDFKit configured!')
}
annotationRenderer(data) {
console.log(data)
console.log(data.annotation.toJS())
// leave everything as is
return null
}
getToolbarItems(instance, handler) {
const customItems = this.getCustomItems(handler)
const defaultItems = this.getDefaultItems(instance.toolbarItems)
@ -79,6 +92,19 @@
<path d="M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466z"/>
</svg>`,
},
{
type: 'custom',
id: 'button-reject',
className: 'button-reject',
title: 'Ablehnen',
onPress() {
console.log('REJECT')
callback('REJECT')
},
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-hand-thumbs-down" viewBox="0 0 16 16">
<path d="M8.864 15.674c-.956.24-1.843-.484-1.908-1.42-.072-1.05-.23-2.015-.428-2.59-.125-.36-.479-1.012-1.04-1.638-.557-.624-1.282-1.179-2.131-1.41C2.685 8.432 2 7.85 2 7V3c0-.845.682-1.464 1.448-1.546 1.07-.113 1.564-.415 2.068-.723l.048-.029c.272-.166.578-.349.97-.484C6.931.08 7.395 0 8 0h3.5c.937 0 1.599.478 1.934 1.064.164.287.254.607.254.913 0 .152-.023.312-.077.464.201.262.38.577.488.9.11.33.172.762.004 1.15.069.13.12.268.159.403.077.27.113.567.113.856 0 .289-.036.586-.113.856-.035.12-.08.244-.138.363.394.571.418 1.2.234 1.733-.206.592-.682 1.1-1.2 1.272-.847.283-1.803.276-2.516.211a9.877 9.877 0 0 1-.443-.05 9.364 9.364 0 0 1-.062 4.51c-.138.508-.55.848-1.012.964zM11.5 1H8c-.51 0-.863.068-1.14.163-.281.097-.506.229-.776.393l-.04.025c-.555.338-1.198.73-2.49.868-.333.035-.554.29-.554.55V7c0 .255.226.543.62.65 1.095.3 1.977.997 2.614 1.709.635.71 1.064 1.475 1.238 1.977.243.7.407 1.768.482 2.85.025.362.36.595.667.518l.262-.065c.16-.04.258-.144.288-.255a8.34 8.34 0 0 0-.145-4.726.5.5 0 0 1 .595-.643h.003l.014.004.058.013a8.912 8.912 0 0 0 1.036.157c.663.06 1.457.054 2.11-.163.175-.059.45-.301.57-.651.107-.308.087-.67-.266-1.021L12.793 7l.353-.354c.043-.042.105-.14.154-.315.048-.167.075-.37.075-.581 0-.211-.027-.414-.075-.581-.05-.174-.111-.273-.154-.315l-.353-.354.353-.354c.047-.047.109-.176.005-.488a2.224 2.224 0 0 0-.505-.804l-.353-.354.353-.354c.006-.005.041-.05.041-.17a.866.866 0 0 0-.121-.415C12.4 1.272 12.063 1 11.5 1"/>
</svg>`
},
{
type: 'custom',
id: 'button-finish',