@fishawack/lab-velocity 2.0.0-beta.4 → 2.0.0-beta.40
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 +441 -37
- package/_Build/vue/components/basic/Button.vue +1 -1
- package/_Build/vue/components/form/Checkbox.vue +10 -0
- package/_Build/vue/components/form/Select.vue +223 -33
- package/_Build/vue/components/form/Spinner.vue +5 -0
- package/_Build/vue/components/layout/Alert.vue +5 -5
- package/_Build/vue/components/layout/Audit.vue +75 -0
- package/_Build/vue/{modules/AuthModule/components/VBreadcrumbs.vue → components/layout/Breadcrumbs.vue} +4 -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 +10 -8
- 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} +32 -16
- package/_Build/vue/{modules/AuthModule/components/VTableSorter.vue → components/layout/TableSorter.vue} +68 -43
- 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 +42 -88
- package/_Build/vue/modules/AuthModule/js/store.js +15 -6
- package/_Build/vue/modules/AuthModule/{adminRoutes/PCompanies/Children/partials → routes/PCompanies}/form.vue +51 -19
- package/_Build/vue/modules/AuthModule/routes/PCompanies/resource.js +273 -0
- package/_Build/vue/modules/AuthModule/routes/PTeams/resource.js +334 -0
- package/_Build/vue/modules/AuthModule/{adminRoutes/PUsers/Children/partials → routes/PUsers}/form.vue +68 -44
- package/_Build/vue/modules/AuthModule/routes/PUsers/resource.js +322 -0
- package/_Build/vue/modules/AuthModule/routes/account-exists.vue +2 -2
- 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 +4 -4
- package/_Build/vue/modules/AuthModule/routes/expired-verification.vue +9 -8
- package/_Build/vue/modules/AuthModule/routes/force-reset.vue +39 -50
- package/_Build/vue/modules/AuthModule/routes/forgot.vue +4 -4
- package/_Build/vue/modules/AuthModule/routes/login.vue +7 -11
- package/_Build/vue/modules/AuthModule/routes/logincallback.vue +1 -3
- package/_Build/vue/modules/AuthModule/routes/loginsso.vue +7 -9
- 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 +8 -7
- package/_Build/vue/modules/AuthModule/routes/success-reset.vue +2 -2
- package/_Build/vue/modules/AuthModule/routes/success-verify.vue +1 -3
- package/_Build/vue/modules/AuthModule/routes/verify.vue +11 -14
- package/_Build/vue/modules/resource/Children/create.vue +81 -0
- package/_Build/vue/modules/resource/Children/edit.vue +106 -0
- package/_Build/vue/modules/resource/Children/index.vue +42 -0
- package/_Build/vue/modules/resource/Children/partials/form.vue +61 -0
- package/_Build/vue/modules/resource/Children/show.vue +144 -0
- package/_Build/vue/modules/resource/index.js +545 -0
- package/_Build/vue/modules/resource/parent.vue +63 -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 +53 -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 +10 -1
- package/package.json +5 -3
- 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
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
<h1 class="h2 h2--small">Verify your email address</h1>
|
|
3
3
|
|
|
4
4
|
<form class="form" @submit.prevent="submit">
|
|
5
|
-
<p class="
|
|
5
|
+
<p class="mt-2 mb-0 color-highlight">
|
|
6
6
|
<strong class="">Email: {{ user?.email }}</strong>
|
|
7
7
|
</p>
|
|
8
|
-
<p class="
|
|
8
|
+
<p class="mt-0.5">
|
|
9
9
|
<strong>Please check your inbox</strong> for a Verification email
|
|
10
10
|
from {{ $root.appName }}. Click the link in that email to verify
|
|
11
11
|
your email address and complete your registration.
|
|
12
12
|
</p>
|
|
13
|
-
<p class="
|
|
14
|
-
Haven’t received the email after 10 minutes?
|
|
15
|
-
</p>
|
|
13
|
+
<p class="mt-0.5 mb-0">Haven’t received the email after 10 minutes?</p>
|
|
16
14
|
|
|
17
15
|
<el-input
|
|
18
16
|
class="hidden"
|
|
@@ -26,7 +24,7 @@
|
|
|
26
24
|
/>
|
|
27
25
|
|
|
28
26
|
<elButton
|
|
29
|
-
class="
|
|
27
|
+
class="mt mb-3"
|
|
30
28
|
native-type="submit"
|
|
31
29
|
type="primary"
|
|
32
30
|
:disabled="form.processing"
|
|
@@ -36,7 +34,7 @@
|
|
|
36
34
|
Re-send verification link
|
|
37
35
|
</elButton>
|
|
38
36
|
|
|
39
|
-
<p class="disclaimer
|
|
37
|
+
<p class="disclaimer mt-1.5">
|
|
40
38
|
Having trouble singing in?
|
|
41
39
|
<a :href="$store.state.auth.contact" class="underline"
|
|
42
40
|
>Contact us</a
|
|
@@ -47,6 +45,7 @@
|
|
|
47
45
|
|
|
48
46
|
<script>
|
|
49
47
|
import Form from "form-backend-validation";
|
|
48
|
+
import { ElNotification } from "element-plus";
|
|
50
49
|
|
|
51
50
|
export default {
|
|
52
51
|
components: {
|
|
@@ -74,7 +73,7 @@ export default {
|
|
|
74
73
|
|
|
75
74
|
await this.form.post("/email/verification-notification");
|
|
76
75
|
|
|
77
|
-
|
|
76
|
+
ElNotification({
|
|
78
77
|
type: "success",
|
|
79
78
|
message: "Email has been re-sent",
|
|
80
79
|
duration: 10000,
|
|
@@ -82,30 +81,28 @@ export default {
|
|
|
82
81
|
});
|
|
83
82
|
} catch (e) {
|
|
84
83
|
if (e.response && e.response.status === 429) {
|
|
85
|
-
this.notification =
|
|
84
|
+
this.notification = ElNotification({
|
|
86
85
|
type: "warning",
|
|
87
86
|
message: "Please allow 10 minutes before re-requesting",
|
|
88
87
|
duration: 0,
|
|
89
88
|
class: "el-notification--warning el-notification--right-override",
|
|
90
89
|
});
|
|
91
90
|
} else if (e.response && e.response.status === 422) {
|
|
92
|
-
this.notification =
|
|
91
|
+
this.notification = ElNotification({
|
|
93
92
|
type: "error",
|
|
94
93
|
message: e.response.data.message,
|
|
95
94
|
duration: 0,
|
|
96
95
|
class: "el-notification--error el-notification--right-override",
|
|
97
96
|
});
|
|
98
97
|
} else {
|
|
99
|
-
|
|
98
|
+
console.log(e);
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
},
|
|
103
102
|
},
|
|
104
103
|
|
|
105
104
|
async mounted() {
|
|
106
|
-
this.user = await this.$store.dispatch("getUser"
|
|
107
|
-
errors: this.$root.errors,
|
|
108
|
-
});
|
|
105
|
+
this.user = await this.$store.dispatch("getUser");
|
|
109
106
|
|
|
110
107
|
this.form.email = this.user.email;
|
|
111
108
|
},
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="container px-6 tablet:px-4 mobile:px-2 mb-8 ml-0 mr-0">
|
|
3
|
+
<div class="grid__1/1">
|
|
4
|
+
<div class="grid__1/1 mb-4">
|
|
5
|
+
<h2 class="h1">Create {{ resource.singular }}</h2>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="mt grid__1/2">
|
|
8
|
+
<component
|
|
9
|
+
:is="resource.form.component ?? 'XForm'"
|
|
10
|
+
ref="form"
|
|
11
|
+
:form="form"
|
|
12
|
+
:submit="submit"
|
|
13
|
+
:method="method"
|
|
14
|
+
:resource="resource"
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import Form from "form-backend-validation";
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
components: {
|
|
26
|
+
XForm: require("./partials/form.vue").default,
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
props: {
|
|
30
|
+
resource: {
|
|
31
|
+
type: Object,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
data() {
|
|
37
|
+
return {
|
|
38
|
+
form: null,
|
|
39
|
+
method: "post",
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
beforeMount() {
|
|
44
|
+
this.form = new Form(this.resource.form.fields(this), {
|
|
45
|
+
resetOnSuccess: false,
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
methods: {
|
|
50
|
+
async submit() {
|
|
51
|
+
if (this.resource.form.submit) {
|
|
52
|
+
await this.resource.form.submit(this);
|
|
53
|
+
} else {
|
|
54
|
+
const hold = JSON.parse(JSON.stringify(this.form.data()));
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
this.form.populate(this.resource.form.preparation(this));
|
|
58
|
+
|
|
59
|
+
let res = await this.form.post(
|
|
60
|
+
`${this.resource.api.endpoint(this)}`,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
this.$router.replace({
|
|
64
|
+
name: `${this.resource.routeName}.show`,
|
|
65
|
+
params: { [this.resource.id]: res.data.id },
|
|
66
|
+
});
|
|
67
|
+
} catch (e) {
|
|
68
|
+
console.log(e);
|
|
69
|
+
} finally {
|
|
70
|
+
if (
|
|
71
|
+
!this.form.successful ||
|
|
72
|
+
!this.form.__options.resetOnSuccess
|
|
73
|
+
) {
|
|
74
|
+
this.form.populate(hold);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
</script>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="container px-6 tablet:px-4 mobile:px-2 mb-8 ml-0 mr-0">
|
|
3
|
+
<div class="grid__1/1">
|
|
4
|
+
<div class="grid__1/1 mb-4">
|
|
5
|
+
<h2 class="h1">Edit {{ resource.singular }}</h2>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="grid__1/2">
|
|
8
|
+
<component
|
|
9
|
+
:is="resource.form.component ?? 'XForm'"
|
|
10
|
+
ref="form"
|
|
11
|
+
:form="form"
|
|
12
|
+
:submit="submit"
|
|
13
|
+
:method="method"
|
|
14
|
+
:resource="resource"
|
|
15
|
+
:model="model"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import Form from "form-backend-validation";
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
components: {
|
|
27
|
+
XForm: require("./partials/form.vue").default,
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
props: {
|
|
31
|
+
resource: {
|
|
32
|
+
type: Object,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
data() {
|
|
38
|
+
return {
|
|
39
|
+
form: null,
|
|
40
|
+
model: null,
|
|
41
|
+
method: "patch",
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
beforeMount() {
|
|
46
|
+
this.form = new Form(
|
|
47
|
+
{ _method: "PATCH", ...this.resource.form.fields(this) },
|
|
48
|
+
{
|
|
49
|
+
resetOnSuccess: false,
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
async mounted() {
|
|
55
|
+
window.axios
|
|
56
|
+
.get(
|
|
57
|
+
`${this.resource.api.endpoint(this)}/${this.$route.params[this.resource.id]}`,
|
|
58
|
+
{
|
|
59
|
+
params: this.resource.api.params.show(this),
|
|
60
|
+
},
|
|
61
|
+
)
|
|
62
|
+
.then((res) => {
|
|
63
|
+
this.model = res.data.data;
|
|
64
|
+
|
|
65
|
+
// Set initial form data
|
|
66
|
+
Object.entries(this.resource.form.fields(this)).forEach(
|
|
67
|
+
([key, value]) => {
|
|
68
|
+
this.form[key] = value;
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
methods: {
|
|
75
|
+
async submit() {
|
|
76
|
+
if (this.resource.form.submit) {
|
|
77
|
+
await this.resource.form.submit(this);
|
|
78
|
+
} else {
|
|
79
|
+
const hold = JSON.parse(JSON.stringify(this.form.data()));
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
this.form.populate(this.resource.form.preparation(this));
|
|
83
|
+
|
|
84
|
+
let res = await this.form.post(
|
|
85
|
+
`${this.resource.api.endpoint(this)}/${this.model.id}`,
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
this.$router.replace({
|
|
89
|
+
name: `${this.resource.routeName}.show`,
|
|
90
|
+
params: { [this.resource.id]: res.data.id },
|
|
91
|
+
});
|
|
92
|
+
} catch (e) {
|
|
93
|
+
console.log(e);
|
|
94
|
+
} finally {
|
|
95
|
+
if (
|
|
96
|
+
!this.form.successful ||
|
|
97
|
+
!this.form.__options.resetOnSuccess
|
|
98
|
+
) {
|
|
99
|
+
this.form.populate(hold);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="container px-6 tablet:px-4 mobile:px-2 mb-8 ml-0 mr-0">
|
|
3
|
+
<div class="grid__1/1">
|
|
4
|
+
<div class="flex gap items-center justify-end">
|
|
5
|
+
<template
|
|
6
|
+
v-for="(render, index) in resource.index.actions"
|
|
7
|
+
:key="index"
|
|
8
|
+
>
|
|
9
|
+
<component :is="render(this)" />
|
|
10
|
+
</template>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<template
|
|
14
|
+
v-for="(render, index) in resource.index.layout"
|
|
15
|
+
:key="index"
|
|
16
|
+
>
|
|
17
|
+
<component :is="render(this)" />
|
|
18
|
+
</template>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
export default {
|
|
25
|
+
provide() {
|
|
26
|
+
return {
|
|
27
|
+
additionalInfo: { resource: this.resource },
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
props: {
|
|
32
|
+
resource: {
|
|
33
|
+
type: Object,
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
depth: {
|
|
37
|
+
type: Number,
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!-- eslint-disable vue/no-mutating-props -->
|
|
2
|
+
<template>
|
|
3
|
+
<form @submit.prevent="submit">
|
|
4
|
+
<template
|
|
5
|
+
v-for="(item, index) in resource.form.structure(this)"
|
|
6
|
+
:key="index"
|
|
7
|
+
>
|
|
8
|
+
<component
|
|
9
|
+
:is="item.render ? item.render(this) : 'VelBasic'"
|
|
10
|
+
v-model="form[item.key]"
|
|
11
|
+
:type="item.type || 'text'"
|
|
12
|
+
:error="form.errors"
|
|
13
|
+
:name="item.key"
|
|
14
|
+
:placeholder="
|
|
15
|
+
item.placeholder ||
|
|
16
|
+
item.label ||
|
|
17
|
+
item.key[0].toUpperCase() + item.key.slice(1)
|
|
18
|
+
"
|
|
19
|
+
:label="
|
|
20
|
+
item.label || item.key[0].toUpperCase() + item.key.slice(1)
|
|
21
|
+
"
|
|
22
|
+
v-bind="item"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<VelFormFooter :loading="form.processing" />
|
|
27
|
+
</form>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
export default {
|
|
32
|
+
components: {
|
|
33
|
+
VelFormFooter: require("../../../../components/layout/FormFooter.vue")
|
|
34
|
+
.default,
|
|
35
|
+
VelBasic: require("../../../../components/form/basic.vue").default,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
props: {
|
|
39
|
+
form: {
|
|
40
|
+
required: true,
|
|
41
|
+
type: Object,
|
|
42
|
+
},
|
|
43
|
+
submit: {
|
|
44
|
+
required: true,
|
|
45
|
+
type: Function,
|
|
46
|
+
},
|
|
47
|
+
method: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "post",
|
|
50
|
+
},
|
|
51
|
+
resource: {
|
|
52
|
+
required: true,
|
|
53
|
+
type: Object,
|
|
54
|
+
},
|
|
55
|
+
model: {
|
|
56
|
+
type: Object,
|
|
57
|
+
default: null,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
</script>
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- Render nested router view if this isn't the deepest route -->
|
|
3
|
+
<router-view v-if="!deepestRoute" v-slot="{ Component }">
|
|
4
|
+
<component :is="Component" :depth="depth + 1" />
|
|
5
|
+
</router-view>
|
|
6
|
+
|
|
7
|
+
<template v-else>
|
|
8
|
+
<div class="container px-6 tablet:px-4 mobile:px-2 mb-8 ml-0 mr-0">
|
|
9
|
+
<div class="grid__1/1">
|
|
10
|
+
<template v-if="model">
|
|
11
|
+
<div class="bg-0 p-3 box-shadow-1 border-r-4 mb-6">
|
|
12
|
+
<VelPageHeader
|
|
13
|
+
:icon="resource.icon"
|
|
14
|
+
:title="
|
|
15
|
+
resource.modelTitle
|
|
16
|
+
? resource.modelTitle(this)
|
|
17
|
+
: `${model.name ?? model.id} ${model.last_name ?? ''}`
|
|
18
|
+
"
|
|
19
|
+
>
|
|
20
|
+
<template
|
|
21
|
+
v-for="(rendered, index) in renderedActions"
|
|
22
|
+
:key="index"
|
|
23
|
+
>
|
|
24
|
+
<component :is="rendered" />
|
|
25
|
+
</template>
|
|
26
|
+
</VelPageHeader>
|
|
27
|
+
|
|
28
|
+
<hr class="my-3 hr-muted" />
|
|
29
|
+
|
|
30
|
+
<el-tabs v-model="active" type="card">
|
|
31
|
+
<template
|
|
32
|
+
v-for="(rendered, index) in renderedTabs"
|
|
33
|
+
:key="index"
|
|
34
|
+
>
|
|
35
|
+
<el-tab-pane :name="index">
|
|
36
|
+
<template #label>
|
|
37
|
+
<span class="align-middle-dive">
|
|
38
|
+
<GIcon
|
|
39
|
+
v-if="rendered.icon"
|
|
40
|
+
class="icon icon--text mr"
|
|
41
|
+
:name="rendered.icon"
|
|
42
|
+
/>
|
|
43
|
+
<span>{{
|
|
44
|
+
rendered.label ||
|
|
45
|
+
`Tab ${index + 1}`
|
|
46
|
+
}}</span>
|
|
47
|
+
</span>
|
|
48
|
+
</template>
|
|
49
|
+
<component
|
|
50
|
+
:is="rendered.component || rendered"
|
|
51
|
+
/>
|
|
52
|
+
</el-tab-pane>
|
|
53
|
+
</template>
|
|
54
|
+
</el-tabs>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
<div v-else class="absolute transform-center text-center">
|
|
58
|
+
<VelSpinner />
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script>
|
|
66
|
+
import axios from "axios";
|
|
67
|
+
import VelSpinner from "../../../components/form/Spinner.vue";
|
|
68
|
+
import VelButton from "../../../components/basic/Button.vue";
|
|
69
|
+
import { ElTabs, ElTabPane } from "element-plus";
|
|
70
|
+
|
|
71
|
+
export default {
|
|
72
|
+
components: {
|
|
73
|
+
VelPageHeader: require("../../../components/layout/PageHeader.vue")
|
|
74
|
+
.default,
|
|
75
|
+
VelSpinner,
|
|
76
|
+
VelButton,
|
|
77
|
+
ElTabs,
|
|
78
|
+
ElTabPane,
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
props: {
|
|
82
|
+
breadcrumbs: {
|
|
83
|
+
type: Array,
|
|
84
|
+
required: true,
|
|
85
|
+
},
|
|
86
|
+
resource: {
|
|
87
|
+
type: Object,
|
|
88
|
+
required: true,
|
|
89
|
+
},
|
|
90
|
+
depth: {
|
|
91
|
+
type: Number,
|
|
92
|
+
required: true,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
data() {
|
|
97
|
+
return {
|
|
98
|
+
model: null,
|
|
99
|
+
active: 0,
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
computed: {
|
|
104
|
+
// This boolean helps determine if we are the final depth of route being rendered
|
|
105
|
+
deepestRoute() {
|
|
106
|
+
return (
|
|
107
|
+
this.depth ===
|
|
108
|
+
this.$route.matched.filter((d) => d.components).length
|
|
109
|
+
);
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
// Compute rendered layout once
|
|
113
|
+
renderedTabs() {
|
|
114
|
+
return this.resource.show.tabs
|
|
115
|
+
.map((render) => render(this))
|
|
116
|
+
.filter((d) => d);
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
// Compute rendered actions once
|
|
120
|
+
renderedActions() {
|
|
121
|
+
return this.resource.show.actions
|
|
122
|
+
.map((render) => render(this))
|
|
123
|
+
.filter((d) => d);
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
mounted() {
|
|
128
|
+
if (!this.deepestRoute) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
axios
|
|
133
|
+
.get(
|
|
134
|
+
`${this.resource.api.endpoint(this)}/${this.$route.params[`${this.resource.id}`]}`,
|
|
135
|
+
{
|
|
136
|
+
params: this.resource.api.params.show(this),
|
|
137
|
+
},
|
|
138
|
+
)
|
|
139
|
+
.then((res) => {
|
|
140
|
+
this.model = res.data.data;
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
</script>
|