@things-factory/auth-ui 6.2.6 → 6.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/components/abstract-auth-page.ts +16 -13
- package/client/components/create-domain-popup.ts +2 -2
- package/client/components/create-role.ts +38 -34
- package/client/components/create-user.ts +27 -52
- package/client/components/invite-customer.ts +29 -29
- package/client/components/invite-user.ts +15 -14
- package/client/components/ownership-transfer-popup.ts +29 -30
- package/client/components/partner-role-editor.ts +28 -28
- package/client/components/role-privilege-editor.ts +32 -31
- package/client/components/role-selector.ts +2 -2
- package/client/components/user-role-editor.ts +64 -66
- package/client/entries/auth/forgot-password.ts +1 -1
- package/client/entries/auth/signup.ts +15 -9
- package/client/entries/oauth2/oauth2-decision-page.ts +2 -2
- package/client/pages/role/role-management.ts +0 -1
- package/client/pages/user/user-management.ts +26 -26
- package/dist-client/components/abstract-auth-page.js +16 -14
- package/dist-client/components/abstract-auth-page.js.map +1 -1
- package/dist-client/components/create-domain-popup.js +2 -2
- package/dist-client/components/create-domain-popup.js.map +1 -1
- package/dist-client/components/create-role.js +30 -27
- package/dist-client/components/create-role.js.map +1 -1
- package/dist-client/components/create-user.js +26 -51
- package/dist-client/components/create-user.js.map +1 -1
- package/dist-client/components/invite-customer.js +24 -25
- package/dist-client/components/invite-customer.js.map +1 -1
- package/dist-client/components/invite-user.js +8 -9
- package/dist-client/components/invite-user.js.map +1 -1
- package/dist-client/components/ownership-transfer-popup.js +23 -23
- package/dist-client/components/ownership-transfer-popup.js.map +1 -1
- package/dist-client/components/partner-role-editor.js +21 -22
- package/dist-client/components/partner-role-editor.js.map +1 -1
- package/dist-client/components/role-privilege-editor.js +25 -25
- package/dist-client/components/role-privilege-editor.js.map +1 -1
- package/dist-client/components/role-selector.js +2 -2
- package/dist-client/components/role-selector.js.map +1 -1
- package/dist-client/components/user-role-editor.js +54 -58
- package/dist-client/components/user-role-editor.js.map +1 -1
- package/dist-client/entries/auth/forgot-password.js +1 -1
- package/dist-client/entries/auth/forgot-password.js.map +1 -1
- package/dist-client/entries/auth/signup.js +15 -9
- package/dist-client/entries/auth/signup.js.map +1 -1
- package/dist-client/entries/oauth2/oauth2-decision-page.js +2 -2
- package/dist-client/entries/oauth2/oauth2-decision-page.js.map +1 -1
- package/dist-client/pages/role/role-management.js +0 -1
- package/dist-client/pages/role/role-management.js.map +1 -1
- package/dist-client/pages/user/user-management.js +19 -20
- package/dist-client/pages/user/user-management.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -5
|
@@ -7,7 +7,7 @@ import '@operato/i18n/ox-i18n.js'
|
|
|
7
7
|
import '@operato/i18n/ox-i18n-selector.js'
|
|
8
8
|
import '@operato/layout/ox-snack-bar.js'
|
|
9
9
|
|
|
10
|
-
import { css, html, LitElement } from 'lit'
|
|
10
|
+
import { css, html, LitElement, nothing } from 'lit'
|
|
11
11
|
import { property, query } from 'lit/decorators.js'
|
|
12
12
|
|
|
13
13
|
import { i18next, localize } from '@operato/i18n'
|
|
@@ -96,7 +96,7 @@ export abstract class AbstractAuthPage extends localize(i18next)(LitElement) {
|
|
|
96
96
|
<form
|
|
97
97
|
id="form"
|
|
98
98
|
action="${this.actionUrl}"
|
|
99
|
-
method="
|
|
99
|
+
method="post"
|
|
100
100
|
@keypress=${e => {
|
|
101
101
|
if (e.key == 'Enter') this._onSubmit(e)
|
|
102
102
|
}}
|
|
@@ -168,10 +168,10 @@ export abstract class AbstractAuthPage extends localize(i18next)(LitElement) {
|
|
|
168
168
|
<mwc-textfield
|
|
169
169
|
name="email"
|
|
170
170
|
type="email"
|
|
171
|
-
label=${i18next.t('field.email')}
|
|
171
|
+
label=${String(i18next.t('field.email'))}
|
|
172
172
|
required
|
|
173
173
|
.value=${email}
|
|
174
|
-
.validationMessage=${i18next.t('text.invalid-email')}
|
|
174
|
+
.validationMessage=${String(i18next.t('text.invalid-email'))}
|
|
175
175
|
autocomplete="username"
|
|
176
176
|
autocapitalize="off"
|
|
177
177
|
></mwc-textfield>
|
|
@@ -180,7 +180,7 @@ export abstract class AbstractAuthPage extends localize(i18next)(LitElement) {
|
|
|
180
180
|
<mwc-textfield
|
|
181
181
|
name="password"
|
|
182
182
|
type="password"
|
|
183
|
-
label=${i18next.t('field.password')}
|
|
183
|
+
label=${String(i18next.t('field.password'))}
|
|
184
184
|
autocomplete="current-password"
|
|
185
185
|
required
|
|
186
186
|
></mwc-textfield>
|
|
@@ -193,16 +193,19 @@ export abstract class AbstractAuthPage extends localize(i18next)(LitElement) {
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
get links() {
|
|
196
|
-
const ssoLinks = this.data
|
|
196
|
+
const { userSignupProcess = true, ssoLinks = [] } = this.data || {}
|
|
197
197
|
|
|
198
198
|
return html`
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
199
|
+
${userSignupProcess
|
|
200
|
+
? html`
|
|
201
|
+
<a class="link" href="/auth/signup">
|
|
202
|
+
<mwc-button icon="add_task"><ox-i18n msgid="field.sign up"></ox-i18n></mwc-button>
|
|
203
|
+
</a>
|
|
204
|
+
<a class="link" href="/auth/forgot-password">
|
|
205
|
+
<mwc-button icon="lock_open"><ox-i18n msgid="field.forgot-password"></ox-i18n></mwc-button>
|
|
206
|
+
</a>
|
|
207
|
+
`
|
|
208
|
+
: nothing}
|
|
206
209
|
${ssoLinks.map(
|
|
207
210
|
sso => html`
|
|
208
211
|
<a class="link" href=${sso.link}>
|
|
@@ -6,7 +6,7 @@ import { customElement, query } from 'lit/decorators.js'
|
|
|
6
6
|
|
|
7
7
|
import { client } from '@operato/graphql'
|
|
8
8
|
import { i18next, localize } from '@operato/i18n'
|
|
9
|
-
import {
|
|
9
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
10
10
|
|
|
11
11
|
@customElement('create-domain-popup')
|
|
12
12
|
class CreateDomainPopup extends localize(i18next)(LitElement) {
|
|
@@ -118,7 +118,7 @@ class CreateDomainPopup extends localize(i18next)(LitElement) {
|
|
|
118
118
|
})
|
|
119
119
|
|
|
120
120
|
if (!response.errors) {
|
|
121
|
-
await
|
|
121
|
+
await OxPrompt.open({
|
|
122
122
|
type: 'success',
|
|
123
123
|
title: i18next.t('text.completed'),
|
|
124
124
|
text: i18next.t('text.x_created_successfully', { x: i18next.t('label.domain') }),
|
|
@@ -6,7 +6,7 @@ import { customElement, query } from 'lit/decorators.js'
|
|
|
6
6
|
|
|
7
7
|
import { client, gqlContext } from '@operato/graphql'
|
|
8
8
|
import { i18next, localize } from '@operato/i18n'
|
|
9
|
-
import {
|
|
9
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
10
10
|
|
|
11
11
|
@customElement('create-role')
|
|
12
12
|
class CreateRole extends localize(i18next)(LitElement) {
|
|
@@ -53,15 +53,19 @@ class CreateRole extends localize(i18next)(LitElement) {
|
|
|
53
53
|
<mwc-textfield
|
|
54
54
|
type="text"
|
|
55
55
|
name="name"
|
|
56
|
-
label=${i18next.t('label.x name', { x: i18next.t('label.role') })}
|
|
56
|
+
label=${String(i18next.t('label.x name', { x: i18next.t('label.role') }))}
|
|
57
57
|
></mwc-textfield>
|
|
58
58
|
<mwc-textfield
|
|
59
59
|
type="text"
|
|
60
60
|
name="description"
|
|
61
|
-
label=${i18next.t('label.x description', { x: i18next.t('label.role') })}
|
|
61
|
+
label=${String(i18next.t('label.x description', { x: i18next.t('label.role') }))}
|
|
62
62
|
></mwc-textfield>
|
|
63
63
|
|
|
64
|
-
<mwc-button
|
|
64
|
+
<mwc-button
|
|
65
|
+
@click=${this.onCreateRole.bind(this)}
|
|
66
|
+
outlined
|
|
67
|
+
label=${String(i18next.t('button.create'))}
|
|
68
|
+
></mwc-button>
|
|
65
69
|
`
|
|
66
70
|
}
|
|
67
71
|
|
|
@@ -78,39 +82,39 @@ class CreateRole extends localize(i18next)(LitElement) {
|
|
|
78
82
|
role.name = name
|
|
79
83
|
role.description = description
|
|
80
84
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
85
|
+
if (
|
|
86
|
+
await OxPrompt.open({
|
|
87
|
+
title: i18next.t('text.are_you_sure'),
|
|
88
|
+
text: i18next.t('text.do_you_want_to_create_x', { x: i18next.t('label.role') }),
|
|
89
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
90
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
91
|
+
})
|
|
92
|
+
) {
|
|
93
|
+
const response = await client.mutate({
|
|
94
|
+
mutation: gql`
|
|
95
|
+
mutation createRole($role: NewRole!) {
|
|
96
|
+
createRole(role: $role) {
|
|
97
|
+
name
|
|
98
|
+
}
|
|
95
99
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
context: gqlContext()
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
if (!response.errors) {
|
|
103
|
-
await this.dispatchEvent(new CustomEvent('fetch-roles'))
|
|
104
|
-
|
|
105
|
-
await CustomAlert({
|
|
106
|
-
type: 'success',
|
|
107
|
-
title: i18next.t('text.completed'),
|
|
108
|
-
text: i18next.t('text.data_uploaded_successfully'),
|
|
109
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
100
|
+
`,
|
|
101
|
+
variables: { role },
|
|
102
|
+
context: gqlContext()
|
|
110
103
|
})
|
|
111
104
|
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
if (!response.errors) {
|
|
106
|
+
await this.dispatchEvent(new CustomEvent('fetch-roles'))
|
|
107
|
+
|
|
108
|
+
await OxPrompt.open({
|
|
109
|
+
type: 'success',
|
|
110
|
+
title: i18next.t('text.completed'),
|
|
111
|
+
text: i18next.t('text.data_uploaded_successfully'),
|
|
112
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
this.nameInput.value = ''
|
|
116
|
+
this.descriptionInput.value = ''
|
|
117
|
+
}
|
|
114
118
|
}
|
|
115
119
|
}
|
|
116
120
|
|
|
@@ -6,83 +6,58 @@ import { i18next } from '@operato/i18n'
|
|
|
6
6
|
@customElement('create-user')
|
|
7
7
|
class CreateUser extends LitElement {
|
|
8
8
|
static styles = css`
|
|
9
|
-
|
|
9
|
+
:host {
|
|
10
|
+
--mdc-text-field-fill-color: var(--theme-white-color);
|
|
10
11
|
background-color: var(--theme-white-color);
|
|
11
12
|
margin: var(--margin-wide) 0;
|
|
12
13
|
padding: var(--padding-wide);
|
|
13
14
|
border-radius: var(--border-radius);
|
|
14
15
|
box-shadow: var(--box-shadow);
|
|
16
|
+
|
|
15
17
|
display: grid;
|
|
16
|
-
grid-template-columns: 1fr
|
|
18
|
+
grid-template-columns: 1fr 2fr auto;
|
|
17
19
|
gap: 5px 15px;
|
|
18
20
|
clear: both;
|
|
19
21
|
max-width: var(--input-container-max-width);
|
|
20
|
-
}
|
|
21
|
-
[field] {
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
padding-bottom: var(--padding-default);
|
|
25
|
-
}
|
|
26
|
-
[grid-span] {
|
|
27
|
-
grid-column: span 2;
|
|
28
|
-
}
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
border: var(--border-dark-color);
|
|
32
|
-
border-radius: var(--border-radius);
|
|
33
|
-
margin: var(--input-margin);
|
|
34
|
-
padding: var(--input-padding);
|
|
35
|
-
min-width: 250px;
|
|
36
|
-
font: var(--input-font);
|
|
23
|
+
align-items: center;
|
|
37
24
|
}
|
|
38
|
-
label {
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-direction: column;
|
|
41
25
|
|
|
42
|
-
font: var(--label-font);
|
|
43
|
-
color: var(--label-color);
|
|
44
|
-
text-transform: var(--label-text-transform);
|
|
45
|
-
}
|
|
46
26
|
mwc-button {
|
|
47
27
|
margin: var(--input-margin);
|
|
48
28
|
}
|
|
29
|
+
|
|
49
30
|
@media screen and (max-width: 480px) {
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
:host {
|
|
32
|
+
grid-template-columns: 1fr 1fr;
|
|
52
33
|
}
|
|
53
|
-
|
|
34
|
+
|
|
35
|
+
mwc-button {
|
|
54
36
|
grid-column: span 2;
|
|
37
|
+
|
|
38
|
+
margin: var(--input-margin);
|
|
55
39
|
}
|
|
56
40
|
}
|
|
57
41
|
`
|
|
58
42
|
|
|
59
|
-
@query('
|
|
60
|
-
@query('
|
|
43
|
+
@query('[name=name]') nameInput!: HTMLInputElement
|
|
44
|
+
@query('[name=email]') emailInput!: HTMLInputElement
|
|
61
45
|
|
|
62
46
|
render() {
|
|
63
47
|
return html`
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<div>
|
|
79
|
-
<mwc-button
|
|
80
|
-
@click=${this.onCreateUser.bind(this)}
|
|
81
|
-
outlined
|
|
82
|
-
label="${i18next.t('button.create')}"
|
|
83
|
-
></mwc-button>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
48
|
+
<mwc-textfield
|
|
49
|
+
type="text"
|
|
50
|
+
name="name"
|
|
51
|
+
label=${String(i18next.t('label.x name', { x: i18next.t('label.user') }))}
|
|
52
|
+
></mwc-textfield>
|
|
53
|
+
|
|
54
|
+
<mwc-textfield type="email" name="email" label=${String(i18next.t('field.email'))}></mwc-textfield>
|
|
55
|
+
|
|
56
|
+
<mwc-button
|
|
57
|
+
@click=${this.onCreateUser.bind(this)}
|
|
58
|
+
outlined
|
|
59
|
+
label=${String(i18next.t('button.create'))}
|
|
60
|
+
></mwc-button>
|
|
86
61
|
`
|
|
87
62
|
}
|
|
88
63
|
|
|
@@ -6,7 +6,7 @@ import { customElement, property, query } from 'lit/decorators.js'
|
|
|
6
6
|
|
|
7
7
|
import { client, gqlContext } from '@operato/graphql'
|
|
8
8
|
import { i18next, localize } from '@operato/i18n'
|
|
9
|
-
import {
|
|
9
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
10
10
|
|
|
11
11
|
@customElement('invite-customer')
|
|
12
12
|
class InviteCustomer extends localize(i18next)(LitElement) {
|
|
@@ -43,7 +43,7 @@ class InviteCustomer extends localize(i18next)(LitElement) {
|
|
|
43
43
|
@click=${this.invite.bind(this)}
|
|
44
44
|
outlined
|
|
45
45
|
icon="group_add"
|
|
46
|
-
label
|
|
46
|
+
label=${String(i18next.t('label.invite customer'))}
|
|
47
47
|
></mwc-button>
|
|
48
48
|
</div>
|
|
49
49
|
`
|
|
@@ -60,39 +60,39 @@ class InviteCustomer extends localize(i18next)(LitElement) {
|
|
|
60
60
|
)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
if (
|
|
64
|
+
await OxPrompt.open({
|
|
65
|
+
title: i18next.t('text.are_you_sure'),
|
|
66
|
+
text: i18next.t('text.do_you_want_to_invite_x', { x: i18next.t(`label.partner`) }),
|
|
67
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
68
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
69
|
+
})
|
|
70
|
+
) {
|
|
71
|
+
const customerDomainName = this.customerNameInput.value
|
|
69
72
|
|
|
70
|
-
|
|
73
|
+
const response = await client.mutate({
|
|
74
|
+
mutation: gql`
|
|
75
|
+
mutation inviteCustomer($customerDomainName: String!) {
|
|
76
|
+
inviteCustomer(customerDomainName: $customerDomainName)
|
|
77
|
+
}
|
|
78
|
+
`,
|
|
79
|
+
variables: { customerDomainName },
|
|
80
|
+
context: gqlContext()
|
|
81
|
+
})
|
|
71
82
|
|
|
72
|
-
|
|
83
|
+
if (!response.errors) {
|
|
84
|
+
const answer = this.dispatchEvent(new CustomEvent('invitationCompleted'))
|
|
73
85
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
if (answer) {
|
|
87
|
+
await OxPrompt.open({
|
|
88
|
+
type: 'success',
|
|
89
|
+
title: i18next.t('text.completed'),
|
|
90
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
91
|
+
})
|
|
78
92
|
}
|
|
79
|
-
`,
|
|
80
|
-
variables: { customerDomainName },
|
|
81
|
-
context: gqlContext()
|
|
82
|
-
})
|
|
83
93
|
|
|
84
|
-
|
|
85
|
-
const answer = this.dispatchEvent(new CustomEvent('invitationCompleted'))
|
|
86
|
-
|
|
87
|
-
if (answer) {
|
|
88
|
-
await CustomAlert({
|
|
89
|
-
type: 'success',
|
|
90
|
-
title: i18next.t('text.completed'),
|
|
91
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
92
|
-
})
|
|
94
|
+
this.customerNameInput.value = ''
|
|
93
95
|
}
|
|
94
|
-
|
|
95
|
-
this.customerNameInput.value = ''
|
|
96
96
|
}
|
|
97
97
|
} catch (e: any) {
|
|
98
98
|
document.dispatchEvent(
|
|
@@ -6,7 +6,7 @@ import { customElement, query } from 'lit/decorators.js'
|
|
|
6
6
|
|
|
7
7
|
import { client, gqlContext } from '@operato/graphql'
|
|
8
8
|
import { i18next, localize } from '@operato/i18n'
|
|
9
|
-
import {
|
|
9
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
10
10
|
|
|
11
11
|
@customElement('invite-user')
|
|
12
12
|
class InviteUser extends localize(i18next)(LitElement) {
|
|
@@ -40,7 +40,7 @@ class InviteUser extends localize(i18next)(LitElement) {
|
|
|
40
40
|
@click=${this.invite.bind(this)}
|
|
41
41
|
outlined
|
|
42
42
|
icon="group_add"
|
|
43
|
-
label
|
|
43
|
+
label=${String(i18next.t('label.invite user'))}
|
|
44
44
|
></mwc-button>
|
|
45
45
|
`
|
|
46
46
|
}
|
|
@@ -51,18 +51,18 @@ class InviteUser extends localize(i18next)(LitElement) {
|
|
|
51
51
|
throw new Error(i18next.t('error.not valid pattern of type', { type: 'e-mail' }))
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
await this.inviteUser(this.emailInput.value)
|
|
54
|
+
if (
|
|
55
|
+
await OxPrompt.open({
|
|
56
|
+
title: i18next.t('text.are_you_sure'),
|
|
57
|
+
text: i18next.t('text.do_you_want_to_invite_x', { x: i18next.t(`label.user`) }),
|
|
58
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
59
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
60
|
+
})
|
|
61
|
+
) {
|
|
62
|
+
await this.inviteUser(this.emailInput.value)
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
this.dispatchEvent(new CustomEvent('invitationCompleted'))
|
|
65
|
+
}
|
|
66
66
|
} catch (e: any) {
|
|
67
67
|
document.dispatchEvent(
|
|
68
68
|
new CustomEvent('notify', {
|
|
@@ -87,10 +87,11 @@ class InviteUser extends localize(i18next)(LitElement) {
|
|
|
87
87
|
})
|
|
88
88
|
|
|
89
89
|
if (!response.errors) {
|
|
90
|
-
await
|
|
90
|
+
await OxPrompt.open({
|
|
91
91
|
title: i18next.t('text.completed'),
|
|
92
92
|
confirmButton: { text: i18next.t('button.confirm') }
|
|
93
93
|
})
|
|
94
|
+
|
|
94
95
|
this.emailInput.value = ''
|
|
95
96
|
}
|
|
96
97
|
}
|
|
@@ -6,7 +6,7 @@ import { customElement, property, query } from 'lit/decorators.js'
|
|
|
6
6
|
|
|
7
7
|
import { client, gqlContext } from '@operato/graphql'
|
|
8
8
|
import { i18next, localize } from '@operato/i18n'
|
|
9
|
-
import {
|
|
9
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
10
10
|
|
|
11
11
|
@customElement('ownership-transfer-popup')
|
|
12
12
|
class OwnershipTransferPopup extends localize(i18next)(LitElement) {
|
|
@@ -65,39 +65,38 @@ class OwnershipTransferPopup extends localize(i18next)(LitElement) {
|
|
|
65
65
|
return
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
68
|
+
if (
|
|
69
|
+
await OxPrompt.open({
|
|
70
|
+
title: i18next.t('text.are_you_sure'),
|
|
71
|
+
text: i18next.t('text.are_you_sure_to_transfer_owner'),
|
|
72
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
73
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
74
|
+
})
|
|
75
|
+
) {
|
|
76
|
+
const response = await client.mutate({
|
|
77
|
+
mutation: gql`
|
|
78
|
+
mutation transferOwner($email: String!) {
|
|
79
|
+
transferOwner(email: $email)
|
|
80
|
+
}
|
|
81
|
+
`,
|
|
82
|
+
variables: { email: this.user.email },
|
|
83
|
+
context: gqlContext()
|
|
84
|
+
})
|
|
79
85
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
context: gqlContext()
|
|
88
|
-
})
|
|
86
|
+
if (!response.errors?.length) {
|
|
87
|
+
await OxPrompt.open({
|
|
88
|
+
type: 'success',
|
|
89
|
+
title: i18next.t('text.completed'),
|
|
90
|
+
text: i18next.t('text.owner_transfer_completed'),
|
|
91
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
92
|
+
})
|
|
89
93
|
|
|
90
|
-
|
|
91
|
-
await CustomAlert({
|
|
92
|
-
type: 'success',
|
|
93
|
-
title: i18next.t('text.completed'),
|
|
94
|
-
text: i18next.t('text.owner_transfer_completed'),
|
|
95
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
96
|
-
})
|
|
94
|
+
history.back()
|
|
97
95
|
|
|
96
|
+
this.dispatchEvent(new CustomEvent('ownershipTransferred', { bubbles: true, composed: true }))
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
98
99
|
history.back()
|
|
99
|
-
|
|
100
|
-
this.dispatchEvent(new CustomEvent('ownershipTransferred', { bubbles: true, composed: true }))
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
102
|
|
|
@@ -7,7 +7,7 @@ import { customElement, property, query } from 'lit/decorators.js'
|
|
|
7
7
|
|
|
8
8
|
import { client, gqlContext } from '@operato/graphql'
|
|
9
9
|
import { i18next, localize } from '@operato/i18n'
|
|
10
|
-
import {
|
|
10
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
11
11
|
|
|
12
12
|
import { RoleSelector } from './role-selector'
|
|
13
13
|
|
|
@@ -123,34 +123,34 @@ class PartnerRoleEditor extends localize(i18next)(LitElement) {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
async onTerminateContract() {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
126
|
+
if (
|
|
127
|
+
await OxPrompt.open({
|
|
128
|
+
title: i18next.t('text.are_you_sure'),
|
|
129
|
+
text: i18next.t('text.are_you_sure_to_terminate_contract'),
|
|
130
|
+
confirmButton: { text: i18next.t('button.terminate contract') },
|
|
131
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
132
|
+
})
|
|
133
|
+
) {
|
|
134
|
+
const response = await client.mutate({
|
|
135
|
+
mutation: gql`
|
|
136
|
+
mutation terminateContract($partnerName: String!) {
|
|
137
|
+
terminateContract(partnerName: $partnerName)
|
|
138
|
+
}
|
|
139
|
+
`,
|
|
140
|
+
variables: { partnerName: this.customer.name },
|
|
141
|
+
context: gqlContext()
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
if (!response.errors?.length) {
|
|
145
|
+
const answer = this.dispatchEvent(new CustomEvent('contractTerminated'))
|
|
146
|
+
|
|
147
|
+
if (answer) {
|
|
148
|
+
await OxPrompt.open({
|
|
149
|
+
type: 'success',
|
|
150
|
+
title: i18next.t('text.completed'),
|
|
151
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
152
|
+
})
|
|
139
153
|
}
|
|
140
|
-
`,
|
|
141
|
-
variables: { partnerName: this.customer.name },
|
|
142
|
-
context: gqlContext()
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
if (!response.errors?.length) {
|
|
146
|
-
const answer = this.dispatchEvent(new CustomEvent('contractTerminated'))
|
|
147
|
-
|
|
148
|
-
if (answer) {
|
|
149
|
-
await CustomAlert({
|
|
150
|
-
type: 'success',
|
|
151
|
-
title: i18next.t('text.completed'),
|
|
152
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
153
|
-
})
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}
|