Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
3329f4d0
Commit
3329f4d0
authored
5 years ago
by
Alex ORLUC
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #13573 TIME 0:25 fix sign unsign main doc
parent
4c85e4cc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/frontend/app/signature-book.component.ts
+110
-90
110 additions, 90 deletions
src/frontend/app/signature-book.component.ts
with
110 additions
and
90 deletions
src/frontend/app/signature-book.component.ts
+
110
−
90
View file @
3329f4d0
...
...
@@ -16,14 +16,14 @@ import { ActionsService } from './actions/actions.service';
import
{
HeaderService
}
from
'
../service/header.service
'
;
import
{
AppService
}
from
'
../service/app.service
'
;
declare
function
$j
(
selector
:
string
)
:
any
;
declare
function
$j
(
selector
:
string
):
any
;
declare
var
angularGlobals
:
any
;
declare
var
angularGlobals
:
any
;
@
Pipe
({
name
:
'
safeUrl
'
})
export
class
SafeUrlPipe
implements
PipeTransform
{
constructor
(
private
sanitizer
:
DomSanitizer
)
{}
constructor
(
private
sanitizer
:
DomSanitizer
)
{
}
transform
(
url
:
string
)
{
return
this
.
sanitizer
.
bypassSecurityTrustResourceUrl
(
url
);
}
...
...
@@ -36,44 +36,44 @@ export class SafeUrlPipe implements PipeTransform {
})
export
class
SignatureBookComponent
implements
OnInit
{
coreUrl
:
string
;
resId
:
number
;
basketId
:
number
;
groupId
:
number
;
userId
:
number
;
lang
:
any
=
LANG
;
coreUrl
:
string
;
resId
:
number
;
basketId
:
number
;
groupId
:
number
;
userId
:
number
;
lang
:
any
=
LANG
;
signatureBook
:
any
=
{
consigne
:
""
,
documents
:
[],
attachments
:
[],
resList
:
[],
resListIndex
:
0
,
lang
:
{}
consigne
:
""
,
documents
:
[],
attachments
:
[],
resList
:
[],
resListIndex
:
0
,
lang
:
{}
};
rightSelectedThumbnail
:
number
=
0
;
leftSelectedThumbnail
:
number
=
0
;
rightViewerLink
:
string
=
""
;
leftViewerLink
:
string
=
""
;
headerTab
:
string
=
"
document
"
;
showTopRightPanel
:
boolean
=
false
;
showTopLeftPanel
:
boolean
=
false
;
showResLeftPanel
:
boolean
=
true
;
showLeftPanel
:
boolean
=
true
;
showRightPanel
:
boolean
=
true
;
showAttachmentPanel
:
boolean
=
false
;
showSignaturesPanel
:
boolean
=
false
;
loading
:
boolean
=
false
;
loadingSign
:
boolean
=
false
;
rightSelectedThumbnail
:
number
=
0
;
leftSelectedThumbnail
:
number
=
0
;
rightViewerLink
:
string
=
""
;
leftViewerLink
:
string
=
""
;
headerTab
:
string
=
"
document
"
;
showTopRightPanel
:
boolean
=
false
;
showTopLeftPanel
:
boolean
=
false
;
showResLeftPanel
:
boolean
=
true
;
showLeftPanel
:
boolean
=
true
;
showRightPanel
:
boolean
=
true
;
showAttachmentPanel
:
boolean
=
false
;
showSignaturesPanel
:
boolean
=
false
;
loading
:
boolean
=
false
;
loadingSign
:
boolean
=
false
;
subscription
:
Subscription
;
currentResourceLock
:
any
=
null
;
leftContentWidth
:
string
=
"
44%
"
;
rightContentWidth
:
string
=
"
44%
"
;
leftContentWidth
:
string
=
"
44%
"
;
rightContentWidth
:
string
=
"
44%
"
;
dialogRef
:
MatDialogRef
<
any
>
;
processTool
:
any
[]
=
[
{
id
:
'
notes
'
,
...
...
@@ -106,9 +106,9 @@ export class SignatureBookComponent implements OnInit {
constructor
(
public
http
:
HttpClient
,
private
appService
:
AppService
,
private
route
:
ActivatedRoute
,
private
router
:
Router
,
private
zone
:
NgZone
,
private
route
:
ActivatedRoute
,
private
router
:
Router
,
private
zone
:
NgZone
,
private
notify
:
NotificationService
,
public
privilegeService
:
PrivilegeService
,
public
dialog
:
MatDialog
,
...
...
@@ -125,21 +125,21 @@ export class SignatureBookComponent implements OnInit {
});
}
ngOnInit
()
:
void
{
ngOnInit
():
void
{
this
.
coreUrl
=
angularGlobals
.
coreUrl
;
this
.
loading
=
true
;
this
.
route
.
params
.
subscribe
(
params
=>
{
this
.
resId
=
+
params
[
'
resId
'
];
this
.
basketId
=
params
[
'
basketId
'
];
this
.
groupId
=
params
[
'
groupId
'
];
this
.
userId
=
params
[
'
userId
'
];
this
.
resId
=
+
params
[
'
resId
'
];
this
.
basketId
=
params
[
'
basketId
'
];
this
.
groupId
=
params
[
'
groupId
'
];
this
.
userId
=
params
[
'
userId
'
];
this
.
signatureBook
.
resList
=
[];
// This line is added because of manage action behaviour (processAfterAction is called twice)
this
.
lockResource
();
this
.
http
.
get
(
"
../../rest/signatureBook/users/
"
+
this
.
userId
+
"
/groups/
"
+
this
.
groupId
+
"
/baskets/
"
+
this
.
basketId
+
"
/resources/
"
+
this
.
resId
)
.
subscribe
((
data
:
any
)
=>
{
.
subscribe
((
data
:
any
)
=>
{
if
(
data
.
error
)
{
location
.
hash
=
""
;
location
.
search
=
""
;
...
...
@@ -147,19 +147,19 @@ export class SignatureBookComponent implements OnInit {
}
this
.
signatureBook
=
data
;
this
.
headerTab
=
"
document
"
;
this
.
leftSelectedThumbnail
=
0
;
this
.
headerTab
=
"
document
"
;
this
.
leftSelectedThumbnail
=
0
;
this
.
rightSelectedThumbnail
=
0
;
this
.
leftViewerLink
=
""
;
this
.
rightViewerLink
=
""
;
this
.
showLeftPanel
=
true
;
this
.
showRightPanel
=
true
;
this
.
showResLeftPanel
=
true
;
this
.
showTopLeftPanel
=
false
;
this
.
showTopRightPanel
=
false
;
this
.
showAttachmentPanel
=
false
;
this
.
leftContentWidth
=
"
44%
"
;
this
.
leftViewerLink
=
""
;
this
.
rightViewerLink
=
""
;
this
.
showLeftPanel
=
true
;
this
.
showRightPanel
=
true
;
this
.
showResLeftPanel
=
true
;
this
.
showTopLeftPanel
=
false
;
this
.
showTopRightPanel
=
false
;
this
.
showAttachmentPanel
=
false
;
this
.
leftContentWidth
=
"
44%
"
;
this
.
rightContentWidth
=
"
44%
"
;
if
(
this
.
signatureBook
.
documents
[
0
])
{
this
.
leftViewerLink
=
this
.
signatureBook
.
documents
[
0
].
viewerLink
;
...
...
@@ -171,13 +171,13 @@ export class SignatureBookComponent implements OnInit {
this
.
rightViewerLink
=
this
.
signatureBook
.
attachments
[
0
].
viewerLink
;
}
this
.
signatureBook
.
resListIndex
=
this
.
signatureBook
.
resList
.
map
((
e
:
any
)
=>
{
return
e
.
res_id
;
}).
indexOf
(
this
.
resId
);
this
.
signatureBook
.
resListIndex
=
this
.
signatureBook
.
resList
.
map
((
e
:
any
)
=>
{
return
e
.
res_id
;
}).
indexOf
(
this
.
resId
);
this
.
displayPanel
(
"
RESLEFT
"
);
this
.
loading
=
false
;
setTimeout
(()
=>
{
$j
(
"
#rightPanelContent
"
).
niceScroll
({
touchbehavior
:
false
,
cursorcolor
:
"
#666
"
,
cursoropacitymax
:
0.6
,
cursorwidth
:
4
});
$j
(
"
#rightPanelContent
"
).
niceScroll
({
touchbehavior
:
false
,
cursorcolor
:
"
#666
"
,
cursoropacitymax
:
0.6
,
cursorwidth
:
4
});
if
(
$j
(
"
.tooltipstered
"
).
length
==
0
)
{
$j
(
"
#obsVersion
"
).
tooltipster
({
interactive
:
true
...
...
@@ -227,14 +227,14 @@ export class SignatureBookComponent implements OnInit {
})
).
subscribe
();
}
loadActions
()
{
this
.
http
.
get
(
"
../../rest/resourcesList/users/
"
+
this
.
userId
+
"
/groups/
"
+
this
.
groupId
+
"
/baskets/
"
+
this
.
basketId
+
"
/actions?resId=
"
+
this
.
resId
)
.
subscribe
((
data
:
any
)
=>
{
this
.
signatureBook
.
actions
=
data
.
actions
;
},
(
err
)
=>
{
this
.
notify
.
error
(
err
.
error
.
errors
);
});
.
subscribe
((
data
:
any
)
=>
{
this
.
signatureBook
.
actions
=
data
.
actions
;
},
(
err
)
=>
{
this
.
notify
.
error
(
err
.
error
.
errors
);
});
}
processAfterAttach
(
mode
:
string
)
{
...
...
@@ -312,7 +312,7 @@ export class SignatureBookComponent implements OnInit {
this
.
leftContentWidth
=
"
44%
"
;
if
(
this
.
signatureBook
.
resList
.
length
==
0
||
typeof
this
.
signatureBook
.
resList
[
0
].
creation_date
===
'
undefined
'
)
{
this
.
http
.
get
(
"
../../rest/signatureBook/users/
"
+
this
.
userId
+
"
/groups/
"
+
this
.
groupId
+
"
/baskets/
"
+
this
.
basketId
+
"
/resources
"
)
.
subscribe
((
data
:
any
)
=>
{
.
subscribe
((
data
:
any
)
=>
{
this
.
signatureBook
.
resList
=
data
.
resources
;
this
.
signatureBook
.
resList
.
forEach
((
value
:
any
,
index
:
number
)
=>
{
if
(
value
.
res_id
==
this
.
resId
)
{
...
...
@@ -320,7 +320,7 @@ export class SignatureBookComponent implements OnInit {
}
});
setTimeout
(()
=>
{
$j
(
"
#resListContent
"
).
niceScroll
({
touchbehavior
:
false
,
cursorcolor
:
"
#666
"
,
cursoropacitymax
:
0.6
,
cursorwidth
:
4
});
$j
(
"
#resListContent
"
).
niceScroll
({
touchbehavior
:
false
,
cursorcolor
:
"
#666
"
,
cursoropacitymax
:
0.6
,
cursorwidth
:
4
});
$j
(
"
#resListContent
"
).
scrollTop
(
0
);
$j
(
"
#resListContent
"
).
scrollTop
(
$j
(
"
.resListContentFrameSelected
"
).
offset
().
top
-
42
);
},
0
);
...
...
@@ -352,13 +352,13 @@ export class SignatureBookComponent implements OnInit {
refreshAttachments
(
mode
:
string
)
{
if
(
mode
==
"
rightContent
"
)
{
this
.
http
.
get
(
this
.
coreUrl
+
'
rest/signatureBook/
'
+
this
.
resId
+
'
/incomingMailAttachments
'
)
.
subscribe
((
data
:
any
)
=>
{
.
subscribe
((
data
:
any
)
=>
{
this
.
signatureBook
.
documents
=
data
;
});
}
else
{
this
.
http
.
get
(
this
.
coreUrl
+
'
rest/signatureBook/
'
+
this
.
resId
+
'
/attachments
'
)
.
subscribe
((
data
:
any
)
=>
{
.
subscribe
((
data
:
any
)
=>
{
var
i
=
0
;
if
(
mode
==
"
add
"
)
{
var
found
=
false
;
...
...
@@ -413,14 +413,15 @@ export class SignatureBookComponent implements OnInit {
if
(
!
this
.
loadingSign
&&
this
.
signatureBook
.
canSign
)
{
this
.
loadingSign
=
true
;
var
route
=
attachment
.
isResource
?
'
../../rest/resources/
'
+
attachment
.
res_id
+
'
/sign
'
:
'
../../rest/attachments/
'
+
attachment
.
res_id
+
'
/sign
'
;
this
.
http
.
put
(
route
,
{
'
signatureId
'
:
signature
.
id
})
.
subscribe
((
data
:
any
)
=>
{
this
.
http
.
put
(
route
,
{
'
signatureId
'
:
signature
.
id
})
.
subscribe
((
data
:
any
)
=>
{
if
(
!
attachment
.
isResource
)
{
this
.
rightViewerLink
=
"
../../rest/attachments/
"
+
data
.
id
+
"
/content
"
;
this
.
signatureBook
.
attachments
[
this
.
rightSelectedThumbnail
].
status
=
'
SIGN
'
;
this
.
signatureBook
.
attachments
[
this
.
rightSelectedThumbnail
].
idToDl
=
data
.
new_id
;
}
else
{
this
.
rightViewerLink
+=
"
?tsp=
"
+
Math
.
floor
(
Math
.
random
()
*
100
);
this
.
signatureBook
.
attachments
[
this
.
rightSelectedThumbnail
].
status
=
'
SIGN
'
;
}
this
.
signatureBook
.
attachments
[
this
.
rightSelectedThumbnail
].
viewerLink
=
this
.
rightViewerLink
;
var
allSigned
=
true
;
...
...
@@ -442,32 +443,51 @@ export class SignatureBookComponent implements OnInit {
}
unsignFile
(
attachment
:
any
)
{
this
.
http
.
put
(
'
../../rest/attachments/
'
+
attachment
.
res_id
+
'
/unsign
'
,
{})
.
subscribe
(()
=>
{
this
.
rightViewerLink
=
"
../../rest/attachments/
"
+
attachment
.
res_id
+
"
/content
"
;
this
.
signatureBook
.
attachments
[
this
.
rightSelectedThumbnail
].
viewerLink
=
this
.
rightViewerLink
;
this
.
signatureBook
.
attachments
[
this
.
rightSelectedThumbnail
].
status
=
'
A_TRA
'
;
this
.
signatureBook
.
attachments
[
this
.
rightSelectedThumbnail
].
idToDl
=
attachment
.
res_id
;
if
(
this
.
signatureBook
.
resList
.
length
>
0
)
{
this
.
signatureBook
.
resList
[
this
.
signatureBook
.
resListIndex
].
allSigned
=
false
;
}
if
(
this
.
headerTab
==
"
visaCircuit
"
){
this
.
changeSignatureBookLeftContent
(
"
document
"
);
setTimeout
(()
=>
{
this
.
changeSignatureBookLeftContent
(
"
visaCircuit
"
);
},
0
);
}
if
(
attachment
.
isResource
)
{
this
.
http
.
put
(
'
../../rest/resources/
'
+
attachment
.
res_id
+
'
/unsign
'
,
{})
.
subscribe
(()
=>
{
this
.
rightViewerLink
+=
"
?tsp=
"
+
Math
.
floor
(
Math
.
random
()
*
100
);
this
.
signatureBook
.
attachments
[
this
.
rightSelectedThumbnail
].
status
=
'
A_TRA
'
;
if
(
this
.
signatureBook
.
resList
.
length
>
0
)
{
this
.
signatureBook
.
resList
[
this
.
signatureBook
.
resListIndex
].
allSigned
=
false
;
}
if
(
this
.
headerTab
==
"
visaCircuit
"
)
{
this
.
changeSignatureBookLeftContent
(
"
document
"
);
setTimeout
(()
=>
{
this
.
changeSignatureBookLeftContent
(
"
visaCircuit
"
);
},
0
);
}
});
}
else
{
this
.
http
.
put
(
'
../../rest/attachments/
'
+
attachment
.
res_id
+
'
/unsign
'
,
{})
.
subscribe
(()
=>
{
this
.
rightViewerLink
=
"
../../rest/attachments/
"
+
attachment
.
res_id
+
"
/content
"
;
this
.
signatureBook
.
attachments
[
this
.
rightSelectedThumbnail
].
viewerLink
=
this
.
rightViewerLink
;
this
.
signatureBook
.
attachments
[
this
.
rightSelectedThumbnail
].
status
=
'
A_TRA
'
;
this
.
signatureBook
.
attachments
[
this
.
rightSelectedThumbnail
].
idToDl
=
attachment
.
res_id
;
if
(
this
.
signatureBook
.
resList
.
length
>
0
)
{
this
.
signatureBook
.
resList
[
this
.
signatureBook
.
resListIndex
].
allSigned
=
false
;
}
if
(
this
.
headerTab
==
"
visaCircuit
"
)
{
this
.
changeSignatureBookLeftContent
(
"
document
"
);
setTimeout
(()
=>
{
this
.
changeSignatureBookLeftContent
(
"
visaCircuit
"
);
},
0
);
}
});
}
});
}
backToBasket
()
{
let
path
=
'
/basketList/users/
'
+
this
.
userId
+
'
/groups/
'
+
this
.
groupId
+
'
/baskets/
'
+
this
.
basketId
;
let
path
=
'
/basketList/users/
'
+
this
.
userId
+
'
/groups/
'
+
this
.
groupId
+
'
/baskets/
'
+
this
.
basketId
;
this
.
http
.
put
(
'
../../rest/resourcesList/users/
'
+
this
.
userId
+
'
/groups/
'
+
this
.
groupId
+
'
/baskets/
'
+
this
.
basketId
+
'
/unlock
'
,
{
resources
:
[
this
.
resId
]
})
.
subscribe
((
data
:
any
)
=>
{
this
.
router
.
navigate
([
path
]);
this
.
router
.
navigate
([
path
]);
},
(
err
:
any
)
=>
{
this
.
router
.
navigate
([
path
]);
this
.
router
.
navigate
([
path
]);
});
}
...
...
@@ -476,7 +496,7 @@ export class SignatureBookComponent implements OnInit {
.
subscribe
((
data
:
any
)
=>
{
this
.
router
.
navigate
([
`/resources/
${
this
.
resId
}
`
]);
},
(
err
:
any
)
=>
{
});
}
changeLocation
(
resId
:
number
,
origin
:
string
)
{
...
...
@@ -486,7 +506,7 @@ export class SignatureBookComponent implements OnInit {
alert
(
data
.
lockedResources
+
'
'
+
this
.
lang
.
warnLockRes
+
'
.
'
);
}
else
{
let
path
=
"
signatureBook/users/
"
+
this
.
userId
+
"
/groups/
"
+
this
.
groupId
+
"
/baskets/
"
+
this
.
basketId
+
"
/resources/
"
+
resId
;
this
.
router
.
navigate
([
path
]);
this
.
router
.
navigate
([
path
]);
}
},
(
err
:
any
)
=>
{
this
.
notify
.
handleErrors
(
err
);
...
...
@@ -550,8 +570,8 @@ export class SignatureBookComponent implements OnInit {
showAttachment
(
attachment
:
any
)
{
if
(
attachment
.
canModify
&&
attachment
.
status
!=
"
SIGN
"
)
{
this
.
dialogRef
=
this
.
dialog
.
open
(
AttachmentPageComponent
,
{
height
:
'
99vh
'
,
width
:
this
.
appService
.
getViewMode
()
?
'
99vw
'
:
'
90vw
'
,
maxWidth
:
this
.
appService
.
getViewMode
()
?
'
99vw
'
:
'
90vw
'
,
panelClass
:
'
attachment-modal-container
'
,
disableClose
:
true
,
data
:
{
resId
:
attachment
.
res_id
}
});
this
.
dialogRef
=
this
.
dialog
.
open
(
AttachmentPageComponent
,
{
height
:
'
99vh
'
,
width
:
this
.
appService
.
getViewMode
()
?
'
99vw
'
:
'
90vw
'
,
maxWidth
:
this
.
appService
.
getViewMode
()
?
'
99vw
'
:
'
90vw
'
,
panelClass
:
'
attachment-modal-container
'
,
disableClose
:
true
,
data
:
{
resId
:
attachment
.
res_id
}
});
this
.
dialogRef
.
afterClosed
().
pipe
(
filter
((
data
:
string
)
=>
data
===
'
success
'
),
tap
(()
=>
{
...
...
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