@fishawack/lab-velocity 2.0.0-beta.2 → 2.0.0-beta.20
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/README.md +439 -37
- package/_Build/vue/components/basic/Button.vue +1 -1
- package/_Build/vue/components/form/Select.vue +2 -2
- package/_Build/vue/components/form/Spinner.vue +5 -0
- package/_Build/vue/components/layout/Alert.vue +5 -5
- package/_Build/vue/{modules/AuthModule/components/VBreadcrumbs.vue → components/layout/Breadcrumbs.vue} +5 -4
- package/_Build/vue/{modules/AuthModule/components → components/layout}/Chips.vue +2 -2
- package/_Build/vue/components/layout/Footer.vue +11 -10
- package/_Build/vue/{modules/AuthModule/components/VFormFooter.vue → components/layout/FormFooter.vue} +13 -7
- package/_Build/vue/{modules/AuthModule/components → components/layout}/FormRole.vue +9 -7
- package/_Build/vue/components/layout/Layout.vue +76 -0
- package/_Build/vue/components/layout/Navigation.vue +77 -0
- package/_Build/vue/{modules/AuthModule/components/VPageHeader.vue → components/layout/PageHeader.vue} +7 -2
- package/_Build/vue/components/layout/SideBar.vue +26 -0
- package/_Build/vue/{modules/AuthModule/components/VTable.vue → components/layout/Table.vue} +19 -17
- package/_Build/vue/{modules/AuthModule/components/VTableSorter.vue → components/layout/TableSorter.vue} +32 -22
- package/_Build/vue/components/layout/pageTitle.vue +1 -1
- package/_Build/vue/components/navigation/MenuItem.vue +7 -2
- package/_Build/vue/components/navigation/MenuItemGroup.vue +7 -2
- package/_Build/vue/modules/AuthModule/js/axios.js +19 -0
- package/_Build/vue/modules/AuthModule/js/router.js +21 -89
- package/_Build/vue/modules/AuthModule/js/store.js +15 -6
- package/_Build/vue/modules/AuthModule/{adminRoutes/PCompanies/Children/partials → routes/PCompanies}/form.vue +32 -17
- package/_Build/vue/modules/AuthModule/routes/PCompanies/resource.js +168 -0
- package/_Build/vue/modules/AuthModule/{adminRoutes/PUsers/Children/partials → routes/PUsers}/form.vue +30 -18
- package/_Build/vue/modules/AuthModule/routes/PUsers/resource.js +202 -0
- package/_Build/vue/modules/AuthModule/routes/account-exists.vue +3 -3
- package/_Build/vue/modules/AuthModule/routes/change-password.vue +23 -24
- package/_Build/vue/modules/AuthModule/routes/container.vue +2 -11
- package/_Build/vue/modules/AuthModule/routes/expired-reset.vue +6 -6
- package/_Build/vue/modules/AuthModule/routes/expired-verification.vue +11 -10
- package/_Build/vue/modules/AuthModule/routes/force-reset.vue +24 -28
- package/_Build/vue/modules/AuthModule/routes/forgot.vue +6 -6
- package/_Build/vue/modules/AuthModule/routes/login.vue +9 -13
- package/_Build/vue/modules/AuthModule/routes/logincallback.vue +2 -4
- package/_Build/vue/modules/AuthModule/routes/loginsso.vue +9 -11
- package/_Build/vue/modules/AuthModule/routes/logout.vue +1 -3
- package/_Build/vue/modules/AuthModule/routes/logoutheadless.vue +1 -3
- package/_Build/vue/modules/AuthModule/routes/register.vue +19 -21
- package/_Build/vue/modules/AuthModule/routes/reset.vue +14 -13
- package/_Build/vue/modules/AuthModule/routes/success-forgot.vue +10 -9
- package/_Build/vue/modules/AuthModule/routes/success-reset.vue +3 -3
- package/_Build/vue/modules/AuthModule/routes/success-verify.vue +2 -4
- package/_Build/vue/modules/AuthModule/routes/verify.vue +13 -16
- package/_Build/vue/modules/resource/Children/create.vue +76 -0
- package/_Build/vue/modules/resource/Children/edit.vue +110 -0
- package/_Build/vue/modules/resource/Children/index.vue +47 -0
- package/_Build/vue/modules/resource/Children/partials/form.vue +57 -0
- package/_Build/vue/modules/resource/Children/show.vue +97 -0
- package/_Build/vue/modules/resource/index.js +280 -0
- package/_Build/vue/modules/resource/parent.vue +41 -0
- package/_base.scss +0 -1
- package/_defaults.scss +2 -13
- package/_variables.scss +9 -4
- package/components/_alert.scss +5 -0
- package/components/_auth.scss +163 -0
- package/components/_basic.scss +55 -0
- package/components/_breadcrumbs.scss +39 -0
- package/components/_button.scss +304 -0
- package/components/_cascader.scss +12 -0
- package/components/_checkbox.scss +41 -0
- package/components/_chip.scss +24 -0
- package/components/_collapse.scss +24 -0
- package/components/_datepicker.scss +52 -0
- package/components/_descriptions.scss +2 -0
- package/components/_footer.scss +47 -0
- package/components/_form.scss +24 -0
- package/components/_header.scss +30 -0
- package/components/_icon.scss +25 -0
- package/components/_inputNumber.scss +22 -0
- package/components/_layout.scss +56 -0
- package/components/_link.scss +44 -0
- package/components/_loader.scss +43 -0
- package/components/_menu.scss +112 -0
- package/components/_modal.scss +24 -0
- package/components/_pageTitle.scss +8 -0
- package/components/_permissionLegend.scss +18 -0
- package/components/_select.scss +29 -0
- package/components/_sidebar.scss +41 -0
- package/components/_switch.scss +14 -0
- package/components/_table.scss +20 -0
- package/components/_tooltip.scss +4 -0
- package/components/_typography.scss +162 -0
- package/components/_upload.scss +15 -0
- package/components/_wysiwyg.scss +7 -0
- package/components/_wysiwyg2.scss +142 -0
- package/index.js +7 -1
- package/package.json +4 -2
- package/vendor.scss +0 -1
- package/_Build/vue/components/layout/sideBar.vue +0 -25
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/Upload/upload.vue +0 -251
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/create.vue +0 -62
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/edit.vue +0 -98
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/index.vue +0 -90
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/show.vue +0 -262
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/parent.vue +0 -36
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/create.vue +0 -112
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/edit.vue +0 -103
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/index.vue +0 -112
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/show.vue +0 -120
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/parent.vue +0 -36
- /package/_Build/vue/{modules/AuthModule/components → components/layout}/AuthModal.vue +0 -0
- /package/_Build/vue/{modules/AuthModule/components → components/layout}/Chip.vue +0 -0
- /package/_Build/vue/{modules/AuthModule/components/VPasswordValidation.vue → components/layout/PasswordValidation.vue} +0 -0
- /package/_Build/vue/{modules/AuthModule/components/VRoleLegend.vue → components/layout/RoleLegend.vue} +0 -0
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { merge } from "lodash";
|
|
4
|
+
|
|
3
5
|
import { h } from "vue";
|
|
4
6
|
import { RouterView } from "vue-router";
|
|
5
7
|
|
|
8
|
+
import { routes as resourceRoutes } from "../../resource/index.js";
|
|
9
|
+
|
|
10
|
+
import userResource from "../routes/PUsers/resource.js";
|
|
11
|
+
import companyResource from "../routes/PCompanies/resource.js";
|
|
12
|
+
|
|
6
13
|
// Admin routes export - minimal auth flow (headless login only)
|
|
7
|
-
export function adminRoutes(node) {
|
|
14
|
+
export function adminRoutes(node, overrides = {}) {
|
|
15
|
+
const {
|
|
16
|
+
userResource: overrideUserResource = {},
|
|
17
|
+
companyResource: overrideCompanyResource = {},
|
|
18
|
+
} = overrides;
|
|
19
|
+
|
|
8
20
|
return [
|
|
9
21
|
{
|
|
10
22
|
path: "/auth",
|
|
@@ -39,94 +51,14 @@ export function adminRoutes(node) {
|
|
|
39
51
|
},
|
|
40
52
|
],
|
|
41
53
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
component: node
|
|
51
|
-
? ""
|
|
52
|
-
: require("../adminRoutes/PUsers/Children/index.vue")
|
|
53
|
-
.default,
|
|
54
|
-
name: "users.index",
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
path: "create",
|
|
58
|
-
component: node
|
|
59
|
-
? ""
|
|
60
|
-
: require("../adminRoutes/PUsers/Children/create.vue")
|
|
61
|
-
.default,
|
|
62
|
-
name: "users.create",
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
path: ":id",
|
|
66
|
-
component: node
|
|
67
|
-
? ""
|
|
68
|
-
: require("../adminRoutes/PUsers/Children/show.vue")
|
|
69
|
-
.default,
|
|
70
|
-
name: "users.show",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
path: ":id/edit",
|
|
74
|
-
component: node
|
|
75
|
-
? ""
|
|
76
|
-
: require("../adminRoutes/PUsers/Children/edit.vue")
|
|
77
|
-
.default,
|
|
78
|
-
name: "users.edit",
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
path: "/companies",
|
|
84
|
-
component: node
|
|
85
|
-
? ""
|
|
86
|
-
: require("../adminRoutes/PCompanies/parent.vue").default,
|
|
87
|
-
children: [
|
|
88
|
-
{
|
|
89
|
-
path: "",
|
|
90
|
-
component: node
|
|
91
|
-
? ""
|
|
92
|
-
: require("../adminRoutes/PCompanies/Children/index.vue")
|
|
93
|
-
.default,
|
|
94
|
-
name: "companies.index",
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
path: "create",
|
|
98
|
-
component: node
|
|
99
|
-
? ""
|
|
100
|
-
: require("../adminRoutes/PCompanies/Children/create.vue")
|
|
101
|
-
.default,
|
|
102
|
-
name: "companies.create",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
path: ":id",
|
|
106
|
-
component: node
|
|
107
|
-
? ""
|
|
108
|
-
: require("../adminRoutes/PCompanies/Children/show.vue")
|
|
109
|
-
.default,
|
|
110
|
-
name: "companies.show",
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
path: ":id/edit",
|
|
114
|
-
component: node
|
|
115
|
-
? ""
|
|
116
|
-
: require("../adminRoutes/PCompanies/Children/edit.vue")
|
|
117
|
-
.default,
|
|
118
|
-
name: "companies.edit",
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
path: ":id/upload",
|
|
122
|
-
component: node
|
|
123
|
-
? ""
|
|
124
|
-
: require("../adminRoutes/PCompanies/Children/Upload/upload.vue")
|
|
125
|
-
.default,
|
|
126
|
-
name: "companies.upload",
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
},
|
|
54
|
+
...resourceRoutes(
|
|
55
|
+
node,
|
|
56
|
+
...merge(userResource, [undefined, overrideUserResource]),
|
|
57
|
+
),
|
|
58
|
+
...resourceRoutes(
|
|
59
|
+
node,
|
|
60
|
+
...merge(companyResource, [undefined, overrideCompanyResource]),
|
|
61
|
+
),
|
|
130
62
|
];
|
|
131
63
|
}
|
|
132
64
|
|
|
@@ -7,6 +7,9 @@ const store = {
|
|
|
7
7
|
intended: null,
|
|
8
8
|
user: null,
|
|
9
9
|
redirect: process.env.HYDRATE_REDIRECT ?? "index",
|
|
10
|
+
logo: process.env.HYDRATE_LOGO ?? "example-logo",
|
|
11
|
+
logoReverse:
|
|
12
|
+
process.env.HYDRATE_LOGO_REVERSE ?? process.env.HYDRATE_LOGO,
|
|
10
13
|
contact:
|
|
11
14
|
process.env.HYDRATE_CONTACT ?? "mailto:det@avalerehealth.com",
|
|
12
15
|
};
|
|
@@ -15,12 +18,18 @@ const store = {
|
|
|
15
18
|
getters: {
|
|
16
19
|
authenticated: (state) => !!state.user,
|
|
17
20
|
can: (state) => (permission) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
const arr = Array.isArray(permission) ? permission : [permission];
|
|
22
|
+
const userPermissions = state.user?.permissions.map(
|
|
23
|
+
({ name }) => name,
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return arr.every((name) => userPermissions?.includes(name));
|
|
21
27
|
},
|
|
22
28
|
hasRole: (state) => (role) => {
|
|
23
|
-
|
|
29
|
+
const arr = Array.isArray(role) ? role : [role];
|
|
30
|
+
const userRoles = state.user?.roles.map(({ name }) => name);
|
|
31
|
+
|
|
32
|
+
return arr.every((name) => userRoles?.includes(name));
|
|
24
33
|
},
|
|
25
34
|
},
|
|
26
35
|
|
|
@@ -38,7 +47,7 @@ const store = {
|
|
|
38
47
|
},
|
|
39
48
|
|
|
40
49
|
actions: {
|
|
41
|
-
getUser({ commit }, { errors, query = "", params }) {
|
|
50
|
+
getUser({ commit }, { errors = console.log, query = "", params } = {}) {
|
|
42
51
|
return axios
|
|
43
52
|
.get(`/api/users/self${query}`, {
|
|
44
53
|
params,
|
|
@@ -51,7 +60,7 @@ const store = {
|
|
|
51
60
|
.catch(errors);
|
|
52
61
|
},
|
|
53
62
|
|
|
54
|
-
logout({ commit }
|
|
63
|
+
logout({ commit }) {
|
|
55
64
|
commit("setUser", null);
|
|
56
65
|
|
|
57
66
|
return axios.post("/logout");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- eslint-disable vue/no-mutating-props -->
|
|
2
2
|
<template>
|
|
3
3
|
<form class="" @submit.prevent="submit">
|
|
4
|
-
<
|
|
4
|
+
<VelBasic
|
|
5
5
|
v-model="form.name"
|
|
6
6
|
name="name"
|
|
7
7
|
:error="form.errors"
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
<template #label>
|
|
13
13
|
Company name <sup class="color-status-red-100">*</sup>
|
|
14
14
|
</template>
|
|
15
|
-
</
|
|
15
|
+
</VelBasic>
|
|
16
16
|
|
|
17
|
-
<
|
|
17
|
+
<VelSelect
|
|
18
18
|
v-if="method === 'patch'"
|
|
19
19
|
v-model="form.primary_contact"
|
|
20
20
|
name="primary_contact"
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
>
|
|
46
46
|
<template #prepend>@</template>
|
|
47
47
|
<template #append>
|
|
48
|
-
<
|
|
48
|
+
<VelButton
|
|
49
49
|
type="danger"
|
|
50
50
|
@click="form.domains.splice(index, 1)"
|
|
51
51
|
>
|
|
52
52
|
<GSvg class="vel-icon" name="trash" />
|
|
53
|
-
</
|
|
53
|
+
</VelButton>
|
|
54
54
|
</template>
|
|
55
55
|
</el-input>
|
|
56
56
|
|
|
@@ -63,17 +63,22 @@
|
|
|
63
63
|
</ul>
|
|
64
64
|
|
|
65
65
|
<div>
|
|
66
|
-
<
|
|
66
|
+
<VelButton @click="form.domains.push('')">
|
|
67
67
|
Add Domain
|
|
68
68
|
|
|
69
|
-
<GIcon
|
|
70
|
-
|
|
69
|
+
<GIcon
|
|
70
|
+
name="icon-plus"
|
|
71
|
+
embed
|
|
72
|
+
asis
|
|
73
|
+
class="fill-0 icon--0.5 ml"
|
|
74
|
+
/>
|
|
75
|
+
</VelButton>
|
|
71
76
|
</div>
|
|
72
77
|
|
|
73
78
|
<hr class="my-5 hr-muted" />
|
|
74
79
|
|
|
75
80
|
<template v-if="$store.getters.can('edit roles')">
|
|
76
|
-
<
|
|
81
|
+
<VelFormRole :form="form" />
|
|
77
82
|
|
|
78
83
|
<hr class="my-5 hr-muted" />
|
|
79
84
|
</template>
|
|
@@ -81,7 +86,7 @@
|
|
|
81
86
|
<template v-if="$store.getters.can('edit sso')">
|
|
82
87
|
<h3 class="h3 mb-2">SSO Settings</h3>
|
|
83
88
|
|
|
84
|
-
<
|
|
89
|
+
<VelSelect
|
|
85
90
|
v-model="form.sso_type"
|
|
86
91
|
name="sso_type"
|
|
87
92
|
:error="form.errors"
|
|
@@ -99,7 +104,7 @@
|
|
|
99
104
|
},
|
|
100
105
|
]"
|
|
101
106
|
/>
|
|
102
|
-
<
|
|
107
|
+
<VelBasic
|
|
103
108
|
v-model="form.sso_client_id"
|
|
104
109
|
name="sso_client_id"
|
|
105
110
|
:error="form.errors"
|
|
@@ -107,7 +112,7 @@
|
|
|
107
112
|
placeholder="Key"
|
|
108
113
|
label="Key"
|
|
109
114
|
/>
|
|
110
|
-
<
|
|
115
|
+
<VelBasic
|
|
111
116
|
v-model="form.sso_tenant"
|
|
112
117
|
name="sso_tenant"
|
|
113
118
|
:error="form.errors"
|
|
@@ -115,7 +120,7 @@
|
|
|
115
120
|
placeholder="Tenant"
|
|
116
121
|
label="Tenant"
|
|
117
122
|
/>
|
|
118
|
-
<
|
|
123
|
+
<VelBasic
|
|
119
124
|
v-model="form.sso_client_secret"
|
|
120
125
|
name="sso_client_secret"
|
|
121
126
|
:error="form.errors"
|
|
@@ -127,18 +132,28 @@
|
|
|
127
132
|
<hr class="my-3 hr-muted" />
|
|
128
133
|
</template>
|
|
129
134
|
|
|
130
|
-
<
|
|
135
|
+
<VelFormFooter :form="form" />
|
|
131
136
|
</form>
|
|
132
137
|
</template>
|
|
133
138
|
|
|
134
139
|
<!-- eslint-disable vue/no-mutating-props -->
|
|
135
140
|
<script>
|
|
136
141
|
import axios from "axios";
|
|
142
|
+
import VelButton from "../../../../components/basic/Button.vue";
|
|
143
|
+
import VelSelect from "../../../../components/form/Select.vue";
|
|
144
|
+
import VelBasic from "../../../../components/form/basic.vue";
|
|
145
|
+
import VelFormRole from "../../../../components/layout/FormRole.vue";
|
|
146
|
+
import VelFormFooter from "../../../../components/layout/FormFooter.vue";
|
|
147
|
+
import { ElInput } from "element-plus";
|
|
137
148
|
|
|
138
149
|
export default {
|
|
139
150
|
components: {
|
|
140
|
-
|
|
141
|
-
|
|
151
|
+
VelFormFooter,
|
|
152
|
+
VelFormRole,
|
|
153
|
+
VelButton,
|
|
154
|
+
VelSelect,
|
|
155
|
+
VelBasic,
|
|
156
|
+
ElInput,
|
|
142
157
|
},
|
|
143
158
|
|
|
144
159
|
props: {
|
|
@@ -151,8 +166,8 @@ export default {
|
|
|
151
166
|
type: Function,
|
|
152
167
|
},
|
|
153
168
|
method: {
|
|
154
|
-
required: true,
|
|
155
169
|
type: String,
|
|
170
|
+
default: "post",
|
|
156
171
|
},
|
|
157
172
|
},
|
|
158
173
|
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import VelFormRole from "../../../../components/layout/FormRole.vue";
|
|
2
|
+
import VelButton from "../../../../components/basic/Button.vue";
|
|
3
|
+
import Chip from "../../../../components/layout/Chip.vue";
|
|
4
|
+
import Chips from "../../../../components/layout/Chips.vue";
|
|
5
|
+
import VelTableSorter from "../../../../components/layout/TableSorter.vue";
|
|
6
|
+
import VelRoleLegend from "../../../../components/layout/RoleLegend.vue";
|
|
7
|
+
import component from "./form.vue";
|
|
8
|
+
import userResource from "../PUsers/resource.js";
|
|
9
|
+
import { defaultResource, meta } from "../../../resource/index.js";
|
|
10
|
+
|
|
11
|
+
import { ElNotification } from "element-plus";
|
|
12
|
+
import { h } from "vue";
|
|
13
|
+
import axios from "axios";
|
|
14
|
+
|
|
15
|
+
export default [
|
|
16
|
+
"companies",
|
|
17
|
+
{
|
|
18
|
+
defaults: "include=primary_contact",
|
|
19
|
+
permissions: {
|
|
20
|
+
create: ({ $store }) => $store.getters.can("write companies"),
|
|
21
|
+
edit: ({ $store }) => $store.getters.can("write companies"),
|
|
22
|
+
delete: ({ $store }) => $store.getters.can("delete companies"),
|
|
23
|
+
},
|
|
24
|
+
singular: "company",
|
|
25
|
+
icon: "icon-cases",
|
|
26
|
+
form: {
|
|
27
|
+
component,
|
|
28
|
+
fields: ({ model }) => ({
|
|
29
|
+
name: model?.name || null,
|
|
30
|
+
primary_contact: model?.primary_contact?.id || null,
|
|
31
|
+
domains: model?.domains || [],
|
|
32
|
+
roles: model?.roles.map((val) => val.id) || [],
|
|
33
|
+
sso_client_id: model?.sso_client_id || undefined,
|
|
34
|
+
sso_tenant: model?.sso_tenant || undefined,
|
|
35
|
+
sso_client_secret: model?.sso_client_secret || undefined,
|
|
36
|
+
sso_type: model?.sso_type || undefined,
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
table: {
|
|
40
|
+
structure: [
|
|
41
|
+
{
|
|
42
|
+
key: "name",
|
|
43
|
+
sortable: true,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: "user_count",
|
|
47
|
+
label: "Total users",
|
|
48
|
+
width: "150",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: "role",
|
|
52
|
+
render: ({ model }) =>
|
|
53
|
+
h(
|
|
54
|
+
model.roles.length === 1 ? Chip : Chips,
|
|
55
|
+
model.roles.length === 1
|
|
56
|
+
? {
|
|
57
|
+
name: model.roles[0].name,
|
|
58
|
+
label: model.roles[0].label,
|
|
59
|
+
}
|
|
60
|
+
: { array: model.roles },
|
|
61
|
+
),
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
description: {
|
|
66
|
+
structure: [
|
|
67
|
+
{
|
|
68
|
+
key: "domains",
|
|
69
|
+
render: ({ model }) => h("span", model.domains.join(", ")),
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
key: "sso_enabled",
|
|
73
|
+
label: "SSO Enabled",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: "primary_contact",
|
|
77
|
+
label: "Primary Contact",
|
|
78
|
+
render: ({ model }) =>
|
|
79
|
+
h("span", model.primary_contact?.name),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
key: "primary_contact_email",
|
|
83
|
+
label: "Primary Contact Email",
|
|
84
|
+
render: ({ model }) =>
|
|
85
|
+
h("span", model.primary_contact?.email),
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
key: "primary_contact_contacted",
|
|
89
|
+
label: "Primary Contact Contacted",
|
|
90
|
+
render: ({ model }) =>
|
|
91
|
+
h("span", !!model.primary_contact_contacted),
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: "Total users",
|
|
95
|
+
key: "user_count",
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
index: {
|
|
100
|
+
layout: [
|
|
101
|
+
...defaultResource.index.layout,
|
|
102
|
+
() =>
|
|
103
|
+
h(VelRoleLegend, {
|
|
104
|
+
class: "mt-5",
|
|
105
|
+
}),
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
show: {
|
|
109
|
+
actions: [
|
|
110
|
+
({ model }) =>
|
|
111
|
+
model.primary_contact &&
|
|
112
|
+
h(
|
|
113
|
+
VelButton,
|
|
114
|
+
{
|
|
115
|
+
type: "primary",
|
|
116
|
+
async onClick() {
|
|
117
|
+
try {
|
|
118
|
+
const res = await axios.post(
|
|
119
|
+
`/api/companies/${model.id}/welcome`,
|
|
120
|
+
);
|
|
121
|
+
ElNotification({
|
|
122
|
+
title: "Success",
|
|
123
|
+
message: res.data.message,
|
|
124
|
+
type: "success",
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
model.primary_contact_contacted = true;
|
|
128
|
+
} catch (e) {
|
|
129
|
+
ElNotification({
|
|
130
|
+
title: "Warning",
|
|
131
|
+
message:
|
|
132
|
+
e.response?.data?.message ||
|
|
133
|
+
e.message,
|
|
134
|
+
type: "warning",
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
"Send welcome email",
|
|
140
|
+
),
|
|
141
|
+
...defaultResource.show.actions,
|
|
142
|
+
],
|
|
143
|
+
layout: [
|
|
144
|
+
...defaultResource.show.layout,
|
|
145
|
+
({ model }) =>
|
|
146
|
+
h(VelFormRole, {
|
|
147
|
+
overrides: model.overrides_roles_and_permissions,
|
|
148
|
+
form: { roles: model.roles.map((d) => d.id) },
|
|
149
|
+
readonly: true,
|
|
150
|
+
}),
|
|
151
|
+
({ model, $store }) => {
|
|
152
|
+
const resource = meta(...userResource);
|
|
153
|
+
return h(VelTableSorter, {
|
|
154
|
+
key: "PIndex",
|
|
155
|
+
"json-data": {
|
|
156
|
+
...resource,
|
|
157
|
+
tableStructure: resource.table.structure,
|
|
158
|
+
},
|
|
159
|
+
defaults: `include=company&filter[company_id]=${model.id}`,
|
|
160
|
+
"fixed-height": false,
|
|
161
|
+
"display-edit-action":
|
|
162
|
+
$store.getters.can("write users"),
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<template>
|
|
3
3
|
<form class="" @submit.prevent="submit">
|
|
4
4
|
<template v-if="method !== 'patch'">
|
|
5
|
-
<
|
|
5
|
+
<VelBasic
|
|
6
6
|
v-model="form.name"
|
|
7
7
|
name="name"
|
|
8
8
|
:error="form.errors"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
label="Name"
|
|
12
12
|
/>
|
|
13
13
|
|
|
14
|
-
<
|
|
14
|
+
<VelBasic
|
|
15
15
|
v-model="form.email"
|
|
16
16
|
placeholder="Email"
|
|
17
17
|
label="Email"
|
|
@@ -24,26 +24,26 @@
|
|
|
24
24
|
|
|
25
25
|
<hr class="my-3 hr-muted" />
|
|
26
26
|
|
|
27
|
-
<
|
|
27
|
+
<VelCheckbox
|
|
28
28
|
v-model="form.notify_user"
|
|
29
29
|
name="notify_user"
|
|
30
30
|
:error="form.errors"
|
|
31
31
|
label="Send email to notify user of account and password"
|
|
32
32
|
/>
|
|
33
|
-
<
|
|
33
|
+
<VelCheckbox
|
|
34
34
|
v-model="form.force_password_change"
|
|
35
35
|
name="force_password_change"
|
|
36
36
|
:error="form.errors"
|
|
37
37
|
label="Force password change on first login"
|
|
38
38
|
/>
|
|
39
|
-
<
|
|
39
|
+
<VelCheckbox
|
|
40
40
|
v-model="form.set_password"
|
|
41
41
|
name="set_password"
|
|
42
42
|
:error="form.errors"
|
|
43
43
|
label="Auto generate password"
|
|
44
44
|
/>
|
|
45
45
|
<template v-if="!form.set_password">
|
|
46
|
-
<
|
|
46
|
+
<VelBasic
|
|
47
47
|
v-model="form.password"
|
|
48
48
|
name="password"
|
|
49
49
|
:error="form.errors"
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
placeholder="Password"
|
|
52
52
|
label="Password"
|
|
53
53
|
/>
|
|
54
|
-
<
|
|
54
|
+
<VelBasic
|
|
55
55
|
v-model="form.password_confirmation"
|
|
56
56
|
name="password_confirmation"
|
|
57
57
|
:error="form.errors"
|
|
@@ -66,22 +66,26 @@
|
|
|
66
66
|
|
|
67
67
|
<template v-if="$store.getters.can('edit roles')">
|
|
68
68
|
<template v-if="enableRoles">
|
|
69
|
-
<
|
|
70
|
-
type="secondary"
|
|
69
|
+
<VelButton
|
|
71
70
|
@click="
|
|
72
71
|
form.roles = [];
|
|
73
72
|
enableRoles = false;
|
|
74
73
|
"
|
|
75
74
|
>
|
|
76
75
|
Reset roles
|
|
77
|
-
</
|
|
78
|
-
<
|
|
76
|
+
</VelButton>
|
|
77
|
+
<VelFormRole :form="form" />
|
|
79
78
|
</template>
|
|
80
79
|
<template v-else>
|
|
81
|
-
<
|
|
82
|
-
<GIcon
|
|
80
|
+
<VelButton @click="enableRoles = true">
|
|
81
|
+
<GIcon
|
|
82
|
+
name="icon-plus"
|
|
83
|
+
embed
|
|
84
|
+
asis
|
|
85
|
+
class="fill-0 icon--0.5 mr"
|
|
86
|
+
/>
|
|
83
87
|
Override roles
|
|
84
|
-
</
|
|
88
|
+
</VelButton>
|
|
85
89
|
<p class="mt-2">
|
|
86
90
|
Roles will be inherited from the company level.
|
|
87
91
|
</p>
|
|
@@ -89,18 +93,26 @@
|
|
|
89
93
|
<hr class="my-5 hr-muted" />
|
|
90
94
|
</template>
|
|
91
95
|
|
|
92
|
-
<
|
|
96
|
+
<VelFormFooter :loading="form.processing" />
|
|
93
97
|
</form>
|
|
94
98
|
</template>
|
|
95
99
|
|
|
96
100
|
<script>
|
|
97
101
|
import axios from "axios";
|
|
98
102
|
import { debounce } from "lodash";
|
|
103
|
+
import VelButton from "../../../../components/basic/Button.vue";
|
|
104
|
+
import VelCheckbox from "../../../../components/form/Checkbox.vue";
|
|
105
|
+
import VelBasic from "../../../../components/form/basic.vue";
|
|
106
|
+
import VelFormRole from "../../../../components/layout/FormRole.vue";
|
|
107
|
+
import VelFormFooter from "../../../../components/layout/FormFooter.vue";
|
|
99
108
|
|
|
100
109
|
export default {
|
|
101
110
|
components: {
|
|
102
|
-
|
|
103
|
-
|
|
111
|
+
VelFormFooter,
|
|
112
|
+
VelFormRole,
|
|
113
|
+
VelCheckbox,
|
|
114
|
+
VelButton,
|
|
115
|
+
VelBasic,
|
|
104
116
|
},
|
|
105
117
|
props: {
|
|
106
118
|
form: {
|
|
@@ -112,8 +124,8 @@ export default {
|
|
|
112
124
|
type: Function,
|
|
113
125
|
},
|
|
114
126
|
method: {
|
|
115
|
-
required: true,
|
|
116
127
|
type: String,
|
|
128
|
+
default: "post",
|
|
117
129
|
},
|
|
118
130
|
},
|
|
119
131
|
|