Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Signature Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Electronic Signature Service
Signature Frontend
Commits
cf97b404
Commit
cf97b404
authored
4 years ago
by
Reiter, Christoph
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
4fcf8995
No related branches found
No related tags found
No related merge requests found
Pipeline
#15473
passed
4 years ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dbp-official-signature-pdf-upload.js
+48
-7
48 additions, 7 deletions
src/dbp-official-signature-pdf-upload.js
with
48 additions
and
7 deletions
src/dbp-official-signature-pdf-upload.js
+
48
−
7
View file @
cf97b404
...
...
@@ -17,6 +17,7 @@ import nextcloudWebDavURL from 'consts:nextcloudWebDavURL';
import
nextcloudName
from
'
consts:nextcloudName
'
;
import
{
FileSink
}
from
"
@dbp-toolkit/file-handling
"
;
import
{
name
as
pkgName
}
from
'
./../package.json
'
;
import
{
getPDFSignatureCount
}
from
'
./utils.js
'
;
const
i18n
=
createI18nInstance
();
...
...
@@ -42,6 +43,7 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
this
.
withSigBlock
=
false
;
this
.
queuedFilesSignaturePlacements
=
[];
this
.
queuedFilesPlacementModes
=
[];
this
.
queuedFilesMissingPlacement
=
[];
this
.
currentPreviewQueueKey
=
''
;
}
...
...
@@ -101,12 +103,28 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
if
(
!
this
.
signingProcessEnabled
||
this
.
uploadInProgress
)
{
return
;
}
this
.
signaturePlacementInProgress
=
false
;
const
key
=
Object
.
keys
(
this
.
queuedFiles
)[
0
];
// Validate that all PDFs with a signature have manual placement
this
.
queuedFilesMissingPlacement
=
[];
for
(
const
[
key
,
file
]
of
Object
.
entries
(
this
.
queuedFiles
))
{
let
isManual
=
this
.
queuedFilesPlacementModes
[
key
]
===
'
manual
'
;
if
(
!
isManual
)
{
let
sigCount
=
await
getPDFSignatureCount
(
file
);
if
(
sigCount
>
0
)
this
.
queuedFilesMissingPlacement
[
key
]
=
true
;
}
}
// Some have a signature but are not "manual", stop everything
if
(
Object
.
keys
(
this
.
queuedFilesMissingPlacement
).
length
)
{
this
.
signingProcessEnabled
=
false
;
this
.
signingProcessActive
=
false
;
return
;
}
// take the file off the queue
const
key
=
Object
.
keys
(
this
.
queuedFiles
)[
0
];
let
file
=
this
.
takeFileFromQueue
(
key
);
this
.
currentFile
=
file
;
...
...
@@ -136,7 +154,13 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
}
storePDFData
(
event
)
{
this
.
queuedFilesSignaturePlacements
[
this
.
currentPreviewQueueKey
]
=
event
.
detail
;
let
placement
=
event
.
detail
;
let
placementMode
=
'
manual
'
;
let
key
=
this
.
currentPreviewQueueKey
;
this
.
queuedFilesSignaturePlacements
[
key
]
=
placement
;
this
.
queuedFilesPlacementModes
[
key
]
=
placementMode
;
delete
this
.
queuedFilesMissingPlacement
[
key
];
this
.
signaturePlacementInProgress
=
false
;
}
...
...
@@ -338,6 +362,7 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
clearQueuedFiles
()
{
this
.
queuedFilesSignaturePlacements
=
[];
this
.
queuedFilesPlacementModes
=
[];
this
.
queuedFilesMissingPlacement
=
[];
super
.
clearQueuedFiles
();
}
...
...
@@ -492,9 +517,14 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
.file-block div.bottom-line {
display: grid;
align-items: center;
grid-template-columns: auto 190px;
grid-gap: 10px;
margin-top: 10px;
grid-template-columns: auto auto;
grid-gap: 6px;
margin-top: 6px;
}
.file-block .error-line {
margin-top: 6px;
color: var(--dbp-override-danger-bg-color);
}
.file-block.error div.bottom-line {
...
...
@@ -558,6 +588,10 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
border-top: 1px solid black;
}
.placement-missing {
border: solid 2px var(--dbp-override-danger-bg-color);
}
/* Handling for small displays (like mobile devices) */
@media (max-width: 680px) {
/* Modal preview, upload and external auth */
...
...
@@ -601,10 +635,12 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
*/
getQueuedFilesHtml
()
{
const
ids
=
Object
.
keys
(
this
.
queuedFiles
);
let
results
=
[];
ids
.
forEach
((
id
)
=>
{
const
file
=
this
.
queuedFiles
[
id
];
const
placementMissing
=
this
.
queuedFilesMissingPlacement
[
id
];
results
.
push
(
html
`
<div class="file-block">
...
...
@@ -625,12 +661,17 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
<dbp-textswitch name1="auto"
name2="manual"
name="
${
this
.
queuedFilesPlacementModes
[
id
]
||
"
auto
"
}
"
class="
switch
"
class="
${
classMap
({
'
placement-missing
'
:
placementMissing
,
'
switch
'
:
true
})}
"
value1="
${
i18n
.
t
(
'
official-pdf-upload.positioning-automatic
'
)}
"
value2="
${
i18n
.
t
(
'
official-pdf-upload.positioning-manual
'
)}
"
?disabled="
${
this
.
signingProcessEnabled
}
"
@change=
${
(
e
)
=>
this
.
queuePlacementSwitch
(
id
,
e
.
target
.
name
)
}
></dbp-textswitch>
</div>
<div class="error-line">
${
this
.
queuedFilesMissingPlacement
[
id
]
?
html
`
Bestehende Signatur vorhanden, manuelle Positionierung nötig.
`
:
''
}
</div>
</div>
`
);
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment