9
9
</h2 >
10
10
<span class =" field-label" >
11
11
<span class =" icon icon-user" />
12
- {{ t('approval', 'Users') }}
12
+ {{ t('approval', 'Users or email addresses ') }}
13
13
</span >
14
14
<MultiselectWho
15
15
class =" userInput"
16
- :value =" selectedUsers "
16
+ :value =" selectedItems "
17
17
:max-height =" 200"
18
18
:types =" [0]"
19
+ :enable-emails =" true"
19
20
:placeholder =" t('approval', 'Choose Nextcloud users')"
20
- @update:value =" updateSelectedUsers($event)" />
21
- <span class =" field-label" >
22
- <span class =" icon icon-mail" />
23
- {{ t('approval', 'Email addresses (coma separated)') }}
24
- </span >
25
- <input v-model =" emails"
26
- :placeholder =" t('approval', 'Coma separated email addresses')"
27
- type =" text" >
21
+ @update:value =" updateSelectedItems($event)" />
28
22
<p class =" settings-hint" >
29
23
{{ t('approval', 'Recipients will receive an email from DocuSign with a link to sign the document. You will be informed by email when the document has been signed by all recipients.') }}
30
24
</p >
@@ -69,18 +63,13 @@ export default {
69
63
show: false ,
70
64
loading: false ,
71
65
fileId: 0 ,
72
- emails: ' ' ,
73
- selectedUsers: [],
66
+ selectedItems: [],
74
67
}
75
68
},
76
69
77
70
computed: {
78
- emailIsValid () {
79
- return / ^ \w + ([. +-] ? \w + )* @\w + ([. -] ? \w + )* (\. \w {2,} )+ (?:,\w + ([. +-] ? \w + )* @\w + ([. -] ? \w + )* (\. \w {2,} )+ )* $ /
80
- .test (this .emails .replace (/ \s * ,\s * / g , ' ,' ))
81
- },
82
71
canValidate () {
83
- return this .selectedUsers .length > 0 || this . emailIsValid
72
+ return this .selectedItems .length > 0
84
73
},
85
74
},
86
75
@@ -95,22 +84,24 @@ export default {
95
84
this .show = true
96
85
},
97
86
closeRequestModal () {
98
- this .selectedUsers = []
99
- this .emails = ' '
87
+ this .selectedItems = []
100
88
this .show = false
101
89
},
102
90
setFileId (fileId ) {
103
91
this .fileId = fileId
104
92
},
105
- updateSelectedUsers (newValue ) {
106
- this .selectedUsers = newValue
107
- console .debug (this .selectedUsers )
93
+ updateSelectedItems (newValue ) {
94
+ this .selectedItems = newValue
95
+ console .debug (this .selectedItems )
108
96
},
109
97
onSignClick () {
110
98
this .loading = true
99
+
100
+ const targetUserIds = this .selectedItems .filter ((i ) => { return i .type === ' user' }).map ((i ) => { return i .entityId })
101
+ const targetEmails = this .selectedItems .filter ((i ) => { return i .type === ' email' }).map ((i ) => { return i .email })
111
102
const req = {
112
- targetUserIds: this . selectedUsers . map (( u ) => { return u . entityId }) ,
113
- targetEmails: this . emails ? this . emails . replace ( / \s * , \s * / g , ' , ' ). split ( ' , ' ) : undefined ,
103
+ targetUserIds,
104
+ targetEmails,
114
105
}
115
106
const url = generateUrl (' /apps/approval/' + this .fileId + ' /standalone-sign' )
116
107
axios .put (url, req).then ((response ) => {
0 commit comments