@fishawack/lab-velocity 2.0.0-beta.1 → 2.0.0-beta.3
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/_Build/vue/components/Icon.vue +33 -0
- package/_Build/vue/components/Svg.vue +45 -0
- package/_Build/vue/components/basic/Button.vue +109 -0
- package/_Build/vue/components/basic/link.vue +64 -0
- package/_Build/vue/components/form/Cascader.vue +85 -0
- package/_Build/vue/components/form/Checkbox.vue +39 -0
- package/_Build/vue/components/form/CheckboxGroup.vue +91 -0
- package/_Build/vue/components/form/DatePicker.vue +116 -0
- package/_Build/vue/components/form/InputNumber.vue +89 -0
- package/_Build/vue/components/form/Select.vue +109 -0
- package/_Build/vue/components/form/Switch.vue +63 -0
- package/_Build/vue/components/form/Upload.vue +101 -0
- package/_Build/vue/components/form/Wysiwyg.vue +127 -0
- package/_Build/vue/components/form/Wysiwyg2.vue +577 -0
- package/_Build/vue/components/form/basic.vue +106 -0
- package/_Build/vue/components/form/color.vue +22 -0
- package/_Build/vue/components/form/file.vue +89 -0
- package/_Build/vue/components/form/input.js +79 -0
- package/_Build/vue/components/form/input.vue +105 -0
- package/_Build/vue/components/layout/Alert.vue +38 -0
- package/_Build/vue/components/layout/Footer.vue +50 -0
- package/_Build/vue/components/layout/Header.vue +13 -0
- package/_Build/vue/components/layout/Loader.vue +59 -0
- package/_Build/vue/components/layout/Tooltip.vue +46 -0
- package/_Build/vue/components/layout/pageTitle.vue +18 -0
- package/_Build/vue/components/layout/sideBar.vue +25 -0
- package/_Build/vue/components/navigation/Breadcrumbs.vue +37 -0
- package/_Build/vue/components/navigation/BreadcrumbsItem.vue +19 -0
- package/_Build/vue/components/navigation/Menu.vue +14 -0
- package/_Build/vue/components/navigation/MenuItem.vue +20 -0
- package/_Build/vue/components/navigation/MenuItemGroup.vue +20 -0
- package/_Build/vue/components/navigation/SubMenu.vue +20 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/Upload/upload.vue +251 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/create.vue +62 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/edit.vue +98 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/index.vue +90 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/partials/form.vue +173 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/show.vue +262 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/parent.vue +36 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/create.vue +112 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/edit.vue +103 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/index.vue +112 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/partials/form.vue +169 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/show.vue +120 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/parent.vue +36 -0
- package/_Build/vue/modules/AuthModule/components/AuthModal.vue +105 -0
- package/_Build/vue/modules/AuthModule/components/Chip.vue +70 -0
- package/_Build/vue/modules/AuthModule/components/Chips.vue +26 -0
- package/_Build/vue/modules/AuthModule/components/FormRole.vue +115 -0
- package/_Build/vue/modules/AuthModule/components/VBreadcrumbs.vue +33 -0
- package/_Build/vue/modules/AuthModule/components/VFormFooter.vue +46 -0
- package/_Build/vue/modules/AuthModule/components/VPageHeader.vue +38 -0
- package/_Build/vue/modules/AuthModule/components/VPasswordValidation.vue +106 -0
- package/_Build/vue/modules/AuthModule/components/VRoleLegend.vue +43 -0
- package/_Build/vue/modules/AuthModule/components/VTable.vue +127 -0
- package/_Build/vue/modules/AuthModule/components/VTableSorter.vue +240 -0
- package/_Build/vue/modules/AuthModule/js/FakeAPI.js +78 -0
- package/_Build/vue/modules/AuthModule/js/axios.js +62 -0
- package/_Build/vue/modules/AuthModule/js/router.js +295 -0
- package/_Build/vue/modules/AuthModule/js/store.js +62 -0
- package/_Build/vue/modules/AuthModule/routes/account-exists.vue +33 -0
- package/_Build/vue/modules/AuthModule/routes/change-password.vue +165 -0
- package/_Build/vue/modules/AuthModule/routes/container.vue +34 -0
- package/_Build/vue/modules/AuthModule/routes/expired-reset.vue +78 -0
- package/_Build/vue/modules/AuthModule/routes/expired-verification.vue +100 -0
- package/_Build/vue/modules/AuthModule/routes/force-reset.vue +152 -0
- package/_Build/vue/modules/AuthModule/routes/forgot.vue +91 -0
- package/_Build/vue/modules/AuthModule/routes/login.vue +143 -0
- package/_Build/vue/modules/AuthModule/routes/logincallback.vue +41 -0
- package/_Build/vue/modules/AuthModule/routes/loginheadless.vue +21 -0
- package/_Build/vue/modules/AuthModule/routes/loginsso.vue +134 -0
- package/_Build/vue/modules/AuthModule/routes/logout.vue +21 -0
- package/_Build/vue/modules/AuthModule/routes/logoutheadless.vue +27 -0
- package/_Build/vue/modules/AuthModule/routes/register.vue +174 -0
- package/_Build/vue/modules/AuthModule/routes/reset.vue +133 -0
- package/_Build/vue/modules/AuthModule/routes/success-forgot.vue +119 -0
- package/_Build/vue/modules/AuthModule/routes/success-reset.vue +35 -0
- package/_Build/vue/modules/AuthModule/routes/success-verify.vue +32 -0
- package/_Build/vue/modules/AuthModule/routes/verify.vue +113 -0
- package/package.json +3 -9
- package/components/_alert.scss +0 -5
- package/components/_basic.scss +0 -55
- package/components/_breadcrumbs.scss +0 -39
- package/components/_button.scss +0 -304
- package/components/_cascader.scss +0 -12
- package/components/_checkbox.scss +0 -41
- package/components/_chip.scss +0 -24
- package/components/_collapse.scss +0 -24
- package/components/_datepicker.scss +0 -52
- package/components/_footer.scss +0 -46
- package/components/_form.scss +0 -24
- package/components/_header.scss +0 -54
- package/components/_icon.scss +0 -25
- package/components/_input.scss +0 -0
- package/components/_inputNumber.scss +0 -22
- package/components/_link.scss +0 -44
- package/components/_loader.scss +0 -43
- package/components/_menu.scss +0 -112
- package/components/_pageTitle.scss +0 -8
- package/components/_permissionLegend.scss +0 -18
- package/components/_select.scss +0 -29
- package/components/_sidebar.scss +0 -56
- package/components/_switch.scss +0 -14
- package/components/_table.scss +0 -20
- package/components/_tooltip.scss +0 -4
- package/components/_typography.scss +0 -162
- package/components/_upload.scss +0 -15
- package/components/_wysiwyg.scss +0 -7
- package/components/_wysiwyg2.scss +0 -142
- package/modules/_AuthModule.scss +0 -212
- package/modules/_AuthVariables.scss +0 -7
- package/modules/_modal.scss +0 -24
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="grid items-center my-4">
|
|
3
|
+
<slot>
|
|
4
|
+
<el-button type="primary" native-type="submit" :loading="loading">
|
|
5
|
+
Save changes
|
|
6
|
+
</el-button>
|
|
7
|
+
|
|
8
|
+
<el-button tag="a" class="ml-2" @click="$router.go(-1)">
|
|
9
|
+
Discard changes
|
|
10
|
+
</el-button>
|
|
11
|
+
|
|
12
|
+
<el-button
|
|
13
|
+
v-if="method === 'patch' && preview"
|
|
14
|
+
class="ml-2"
|
|
15
|
+
tag="a"
|
|
16
|
+
:href="preview"
|
|
17
|
+
target="_blank"
|
|
18
|
+
link
|
|
19
|
+
>
|
|
20
|
+
<span v-text="`Preview`" />
|
|
21
|
+
</el-button>
|
|
22
|
+
</slot>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
export default {
|
|
28
|
+
name: "VFormFooter",
|
|
29
|
+
|
|
30
|
+
props: {
|
|
31
|
+
loading: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false,
|
|
34
|
+
},
|
|
35
|
+
method: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "post",
|
|
38
|
+
},
|
|
39
|
+
preview: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: false,
|
|
42
|
+
default: "",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="grid justify-between">
|
|
3
|
+
<div class="grid__4/6 flex justify-start">
|
|
4
|
+
<span v-if="icon">
|
|
5
|
+
<div
|
|
6
|
+
class="p-1.5 mr-2 border-radius border border-solid border-muted flex items-center justify-center"
|
|
7
|
+
>
|
|
8
|
+
<GIcon class="icon--3 fill-1" :name="icon" embed artboard />
|
|
9
|
+
</div>
|
|
10
|
+
</span>
|
|
11
|
+
|
|
12
|
+
<h2 class="m-0 font-500 text-secondary">{{ title }}</h2>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="grid__2/6 flex gap justify-end items-start">
|
|
16
|
+
<div class="flex gap items-center">
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
export default {
|
|
25
|
+
name: "VShowPageHeader",
|
|
26
|
+
|
|
27
|
+
props: {
|
|
28
|
+
icon: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: null,
|
|
31
|
+
},
|
|
32
|
+
title: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="">
|
|
3
|
+
<p class="font-700 AM-mb-0.5">Your password must contain:</p>
|
|
4
|
+
<p class="flex m-0">
|
|
5
|
+
<GSvg
|
|
6
|
+
name="icon-list-tick"
|
|
7
|
+
embed
|
|
8
|
+
artboard
|
|
9
|
+
class="mr-0.5 icon icon--0.4 fill-7"
|
|
10
|
+
v-if="passwordLengthValid"
|
|
11
|
+
/>
|
|
12
|
+
<GSvg
|
|
13
|
+
name="icon-list-tick"
|
|
14
|
+
embed
|
|
15
|
+
artboard
|
|
16
|
+
class="mr-0.5 icon icon--0.4 fill-3"
|
|
17
|
+
v-else
|
|
18
|
+
/>
|
|
19
|
+
At least 8 characters
|
|
20
|
+
</p>
|
|
21
|
+
<p class="flex m-0">
|
|
22
|
+
<GSvg
|
|
23
|
+
name="icon-list-tick"
|
|
24
|
+
embed
|
|
25
|
+
artboard
|
|
26
|
+
class="mr-0.5 icon icon--0.4 fill-7"
|
|
27
|
+
v-if="hasLetter"
|
|
28
|
+
/>
|
|
29
|
+
<GSvg
|
|
30
|
+
name="icon-list-tick"
|
|
31
|
+
embed
|
|
32
|
+
artboard
|
|
33
|
+
class="mr-0.5 icon icon--0.4 fill-3"
|
|
34
|
+
v-else
|
|
35
|
+
/>
|
|
36
|
+
At least one letter
|
|
37
|
+
</p>
|
|
38
|
+
<p class="flex AM-mt-0 ml-0 mr-0 AM-mb-3">
|
|
39
|
+
<GSvg
|
|
40
|
+
name="icon-list-tick"
|
|
41
|
+
embed
|
|
42
|
+
artboard
|
|
43
|
+
class="mr-0.5 icon icon--0.4 fill-7"
|
|
44
|
+
v-if="hasNumberOrSymbol"
|
|
45
|
+
/>
|
|
46
|
+
<GSvg
|
|
47
|
+
name="icon-list-tick"
|
|
48
|
+
embed
|
|
49
|
+
artboard
|
|
50
|
+
class="mr-0.5 icon icon--0.4 fill-3"
|
|
51
|
+
v-else
|
|
52
|
+
/>
|
|
53
|
+
At least one number or symbol
|
|
54
|
+
</p>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script>
|
|
59
|
+
export default {
|
|
60
|
+
props: {
|
|
61
|
+
password: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
computed: {
|
|
67
|
+
passwordLengthValid() {
|
|
68
|
+
return this.password?.length >= 8;
|
|
69
|
+
},
|
|
70
|
+
hasLetter() {
|
|
71
|
+
return this.tests.letter.test(this.password);
|
|
72
|
+
},
|
|
73
|
+
hasNumberOrSymbol() {
|
|
74
|
+
return (
|
|
75
|
+
this.tests.number.test(this.password) ||
|
|
76
|
+
this.tests.symbol.test(this.password)
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
passwordValid() {
|
|
80
|
+
return (
|
|
81
|
+
this.passwordLengthValid &&
|
|
82
|
+
this.hasLetter &&
|
|
83
|
+
this.hasNumberOrSymbol
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
data() {
|
|
88
|
+
return {
|
|
89
|
+
tests: {
|
|
90
|
+
letter: /[a-zA-Z]+/,
|
|
91
|
+
number: /[0-9]+/,
|
|
92
|
+
symbol: /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]+/,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
watch: {
|
|
97
|
+
password(newPassword) {
|
|
98
|
+
this.$emit("passwordValid", this.passwordValid);
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
methods: {},
|
|
102
|
+
mounted() {
|
|
103
|
+
this.$emit("passwordValid", this.passwordValid);
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
</script>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="permission-legend">
|
|
3
|
+
<p class="font-700 text-18 mb-1.5">Legend</p>
|
|
4
|
+
<p class="font-700 text-16 mb-1.5">Roles</p>
|
|
5
|
+
|
|
6
|
+
<ul class="permission-legend__list">
|
|
7
|
+
<li v-for="role in roles" :key="role.name">
|
|
8
|
+
<VChip :name="role.name" :label="role.label" />
|
|
9
|
+
<span class="permission-legend__description">{{
|
|
10
|
+
role.description
|
|
11
|
+
}}</span>
|
|
12
|
+
</li>
|
|
13
|
+
</ul>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import axios from "axios";
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
components: {
|
|
22
|
+
VChip: require("./Chip.vue").default,
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
roles: null,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
mounted() {
|
|
32
|
+
axios.get("/api/roles").then((res) => {
|
|
33
|
+
this.roles = [
|
|
34
|
+
{
|
|
35
|
+
name: "inherited",
|
|
36
|
+
label: "Inherited",
|
|
37
|
+
description: "Roles are inherited from the parent company.",
|
|
38
|
+
},
|
|
39
|
+
].concat(res.data.data);
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-table
|
|
3
|
+
:data="$props.data"
|
|
4
|
+
:height="fixedHeight ? 762 : false"
|
|
5
|
+
style="width: 100%"
|
|
6
|
+
@sort-change="handleSort"
|
|
7
|
+
>
|
|
8
|
+
<slot v-bind="$props">
|
|
9
|
+
<template
|
|
10
|
+
v-for="(item, index) in $props.structure"
|
|
11
|
+
:key="'d' + index"
|
|
12
|
+
>
|
|
13
|
+
<el-table-column
|
|
14
|
+
:width="item.width ?? 'auto'"
|
|
15
|
+
:sortable="!!item.sortable ? 'custom' : false"
|
|
16
|
+
:label="item.label"
|
|
17
|
+
:prop="item.key"
|
|
18
|
+
:show-overflow-tooltip="true"
|
|
19
|
+
>
|
|
20
|
+
<!-- Support a custom render function -->
|
|
21
|
+
<template v-if="item.render" #default="scope">
|
|
22
|
+
{{ item.render(scope.row) }}
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<!-- Support module passed (as a raw component or :is property) -->
|
|
26
|
+
<template v-else-if="item.component" #default="scope">
|
|
27
|
+
<component
|
|
28
|
+
:is="
|
|
29
|
+
item.component.is
|
|
30
|
+
? item.component.is(scope.row)
|
|
31
|
+
: item.component.module(scope.row)
|
|
32
|
+
"
|
|
33
|
+
v-bind="item.component.props(scope.row)"
|
|
34
|
+
/>
|
|
35
|
+
</template>
|
|
36
|
+
</el-table-column>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<el-table-column
|
|
40
|
+
v-if="$props.displayActions"
|
|
41
|
+
label="Action"
|
|
42
|
+
align="center"
|
|
43
|
+
:width="155"
|
|
44
|
+
>
|
|
45
|
+
<template #default="scope">
|
|
46
|
+
<router-link
|
|
47
|
+
v-if="$props.displayShowAction"
|
|
48
|
+
:to="$props.targetAction($props.data[scope.$index])"
|
|
49
|
+
>
|
|
50
|
+
<el-button size="small" type="primary">
|
|
51
|
+
{{ `View` }}
|
|
52
|
+
</el-button>
|
|
53
|
+
</router-link>
|
|
54
|
+
<router-link
|
|
55
|
+
v-if="$props.displayEditAction"
|
|
56
|
+
class="ml"
|
|
57
|
+
:to="$props.editAction($props.data[scope.$index])"
|
|
58
|
+
>
|
|
59
|
+
<el-button size="small">
|
|
60
|
+
{{ `Edit` }}
|
|
61
|
+
</el-button>
|
|
62
|
+
</router-link>
|
|
63
|
+
</template>
|
|
64
|
+
</el-table-column>
|
|
65
|
+
</slot>
|
|
66
|
+
</el-table>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script>
|
|
70
|
+
export default {
|
|
71
|
+
name: "VTable",
|
|
72
|
+
|
|
73
|
+
props: {
|
|
74
|
+
data: {
|
|
75
|
+
type: [Array, Object],
|
|
76
|
+
default() {
|
|
77
|
+
return [];
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
structure: {
|
|
81
|
+
type: Array,
|
|
82
|
+
default() {
|
|
83
|
+
return [];
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
label: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: "record",
|
|
89
|
+
},
|
|
90
|
+
targetAction: {
|
|
91
|
+
type: Function,
|
|
92
|
+
default: () => {
|
|
93
|
+
return "";
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
editAction: {
|
|
97
|
+
type: Function,
|
|
98
|
+
default: () => {
|
|
99
|
+
return "";
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
fixedHeight: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: true,
|
|
105
|
+
},
|
|
106
|
+
displayActions: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: true,
|
|
109
|
+
},
|
|
110
|
+
displayShowAction: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: true,
|
|
113
|
+
},
|
|
114
|
+
displayEditAction: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: true,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
emits: ["sort"],
|
|
120
|
+
|
|
121
|
+
methods: {
|
|
122
|
+
handleSort(data) {
|
|
123
|
+
this.$emit("sort", data);
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
</script>
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="table_meta" class="mt-3 mb-3">
|
|
3
|
+
<div class="grid mt mb-2">
|
|
4
|
+
<slot name="table-info">
|
|
5
|
+
<div
|
|
6
|
+
v-if="!jsonData.forceHide"
|
|
7
|
+
class="grid__1/3 flex items-center"
|
|
8
|
+
>
|
|
9
|
+
<p class="color-11">
|
|
10
|
+
Showing {{ getPaginationLabel("current") }} to
|
|
11
|
+
{{ getPaginationLabel("max") }} of
|
|
12
|
+
{{ table_meta.total }} {{ jsonData.multiLabel }}
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="flex justify-end items-end grid__2/3">
|
|
16
|
+
<el-basic
|
|
17
|
+
v-if="jsonData.searchable"
|
|
18
|
+
ref="search"
|
|
19
|
+
v-model="search"
|
|
20
|
+
name="search"
|
|
21
|
+
:placeholder="`Search ${jsonData.multiLabel}`"
|
|
22
|
+
:data-key="jsonData.searchable.value"
|
|
23
|
+
class="mb-0"
|
|
24
|
+
prepend="true"
|
|
25
|
+
@update:model-value="handleSearch"
|
|
26
|
+
>
|
|
27
|
+
<template #prepend
|
|
28
|
+
><GIcon embed asis name="icon-search"
|
|
29
|
+
/></template>
|
|
30
|
+
</el-basic>
|
|
31
|
+
<slot v-if="displayActions" name="table-action">
|
|
32
|
+
<el-button
|
|
33
|
+
v-if="displayEditAction"
|
|
34
|
+
size="large"
|
|
35
|
+
type="primary"
|
|
36
|
+
tag="a"
|
|
37
|
+
class="ml-2"
|
|
38
|
+
@click="
|
|
39
|
+
$router.push({
|
|
40
|
+
name: `${jsonData.pageLink}.create`,
|
|
41
|
+
})
|
|
42
|
+
"
|
|
43
|
+
>
|
|
44
|
+
<GIcon
|
|
45
|
+
name="icon-plus"
|
|
46
|
+
embed
|
|
47
|
+
asis
|
|
48
|
+
class="fill-0 mr-0.5"
|
|
49
|
+
/>
|
|
50
|
+
Create new {{ jsonData.label }}
|
|
51
|
+
</el-button>
|
|
52
|
+
</slot>
|
|
53
|
+
</div>
|
|
54
|
+
</slot>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="bg-0 p-0.5 box-shadow-1 border-r-4">
|
|
57
|
+
<VTable
|
|
58
|
+
:data="table_data"
|
|
59
|
+
:structure="jsonData.tableStructure"
|
|
60
|
+
:label="jsonData.label"
|
|
61
|
+
:over-write-id="jsonData.overWriteId"
|
|
62
|
+
:fixed-height="fixedHeight"
|
|
63
|
+
:target-action="
|
|
64
|
+
(item) => ({
|
|
65
|
+
name: `${jsonData.pageLink}.show`,
|
|
66
|
+
params: { id: item.id },
|
|
67
|
+
})
|
|
68
|
+
"
|
|
69
|
+
:edit-action="
|
|
70
|
+
(item) => ({
|
|
71
|
+
name: `${jsonData.pageLink}.edit`,
|
|
72
|
+
params: { id: item.id },
|
|
73
|
+
})
|
|
74
|
+
"
|
|
75
|
+
:display-actions="displayActions"
|
|
76
|
+
:display-show-action="displayShowAction"
|
|
77
|
+
:display-edit-action="displayEditAction"
|
|
78
|
+
@sort="handleSort"
|
|
79
|
+
>
|
|
80
|
+
<slot name="table-content"></slot>
|
|
81
|
+
</VTable>
|
|
82
|
+
|
|
83
|
+
<div class="flex justify-center items-center py-2">
|
|
84
|
+
<el-pagination
|
|
85
|
+
v-if="table_meta.current_page"
|
|
86
|
+
v-model:current-page="table_meta.current_page"
|
|
87
|
+
layout="prev, pager, next"
|
|
88
|
+
:total="table_meta.total"
|
|
89
|
+
:page-size="table_meta.per_page"
|
|
90
|
+
@update:current-page="handleCurrentPageChange"
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
<div v-else class="absolute transform-center text-center">
|
|
96
|
+
<GSpinner class="fill-5" />
|
|
97
|
+
<p v-text="`Loading...`" />
|
|
98
|
+
</div>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<script>
|
|
102
|
+
export default {
|
|
103
|
+
name: "VTableSorter",
|
|
104
|
+
|
|
105
|
+
components: {
|
|
106
|
+
VTable: require("./VTable.vue").default,
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
props: {
|
|
110
|
+
jsonData: {
|
|
111
|
+
required: true,
|
|
112
|
+
type: Array,
|
|
113
|
+
},
|
|
114
|
+
fixedHeight: {
|
|
115
|
+
default: true,
|
|
116
|
+
type: Boolean,
|
|
117
|
+
},
|
|
118
|
+
api: {
|
|
119
|
+
required: true,
|
|
120
|
+
type: String,
|
|
121
|
+
},
|
|
122
|
+
defaults: {
|
|
123
|
+
required: false,
|
|
124
|
+
type: String,
|
|
125
|
+
default: "",
|
|
126
|
+
},
|
|
127
|
+
displayActions: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: true,
|
|
130
|
+
},
|
|
131
|
+
displayShowAction: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: true,
|
|
134
|
+
},
|
|
135
|
+
displayEditAction: {
|
|
136
|
+
type: Boolean,
|
|
137
|
+
default: true,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
data() {
|
|
142
|
+
return {
|
|
143
|
+
search: null,
|
|
144
|
+
sort: "-id",
|
|
145
|
+
query: [],
|
|
146
|
+
table_data: [],
|
|
147
|
+
table_meta: null,
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
mounted() {
|
|
152
|
+
this.sort = this.jsonData.defaultSort || "-id";
|
|
153
|
+
this.fetchData({ page: 1 }).then((data) => {
|
|
154
|
+
this.table_data = data.data;
|
|
155
|
+
this.table_meta = data.meta;
|
|
156
|
+
|
|
157
|
+
this.table_curr_page = this.table_meta.current_page;
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
methods: {
|
|
162
|
+
handleSearch(data) {
|
|
163
|
+
if (data === null || data.length < 3) {
|
|
164
|
+
this.query = [];
|
|
165
|
+
} else {
|
|
166
|
+
this.query = [
|
|
167
|
+
`filter[${this.$refs.search.$el.dataset.key}]=${data}`,
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
this.fetchData({}).then((data) => {
|
|
171
|
+
this.table_data = data.data;
|
|
172
|
+
this.table_meta = data.meta;
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
handleSort(data) {
|
|
176
|
+
if (data.order === null) {
|
|
177
|
+
this.sort = this.jsonData.defaultSort || "-id";
|
|
178
|
+
} else {
|
|
179
|
+
this.sort =
|
|
180
|
+
data.order === "ascending" ? data.prop : "-" + data.prop;
|
|
181
|
+
}
|
|
182
|
+
this.fetchData({}).then((data) => {
|
|
183
|
+
this.table_data = data.data;
|
|
184
|
+
this.table_meta = data.meta;
|
|
185
|
+
});
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
fetchData: function ({ page = "1" }) {
|
|
189
|
+
const mergedQuery = [
|
|
190
|
+
...this.query,
|
|
191
|
+
this.defaults,
|
|
192
|
+
`sort=${this.sort}`,
|
|
193
|
+
`page=${page}`,
|
|
194
|
+
];
|
|
195
|
+
|
|
196
|
+
return this.$store.dispatch("getEntity", {
|
|
197
|
+
entity: this.$props.api,
|
|
198
|
+
query: mergedQuery.join("&"),
|
|
199
|
+
errors: this.$root.errors,
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
getStatusLabel(status) {
|
|
204
|
+
switch (status) {
|
|
205
|
+
case 0:
|
|
206
|
+
return "Inactive";
|
|
207
|
+
case 1:
|
|
208
|
+
return "Active";
|
|
209
|
+
case 2:
|
|
210
|
+
return "Draft";
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
handleCurrentPageChange(val) {
|
|
215
|
+
this.fetchData({ page: val }).then((data) => {
|
|
216
|
+
this.table_data = data.data;
|
|
217
|
+
this.table_meta = data.meta;
|
|
218
|
+
});
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
getPaginationLabel(action) {
|
|
222
|
+
switch (action) {
|
|
223
|
+
case "current":
|
|
224
|
+
return (
|
|
225
|
+
(this.table_meta.current_page - 1) *
|
|
226
|
+
this.table_meta.per_page +
|
|
227
|
+
1
|
|
228
|
+
);
|
|
229
|
+
case "max": {
|
|
230
|
+
const potentialMax =
|
|
231
|
+
this.table_meta.current_page * this.table_meta.per_page;
|
|
232
|
+
return potentialMax > this.table_meta.total
|
|
233
|
+
? this.table_meta.total
|
|
234
|
+
: potentialMax;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
</script>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
axios.interceptors.request.use(
|
|
4
|
+
(request) => {
|
|
5
|
+
throw { isLocal: true, data: retrieveResponse(request) };
|
|
6
|
+
},
|
|
7
|
+
(error) => {
|
|
8
|
+
return Promise.resolve(error);
|
|
9
|
+
},
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
axios.interceptors.response.use(
|
|
13
|
+
(response) => {
|
|
14
|
+
return response;
|
|
15
|
+
},
|
|
16
|
+
(error) => {
|
|
17
|
+
return Promise.resolve(error);
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
function retrieveResponse(request) {
|
|
22
|
+
return fakes[request.url][request.method];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const fakes = {
|
|
26
|
+
"/api/users/self": {
|
|
27
|
+
get: {
|
|
28
|
+
data: {
|
|
29
|
+
id: 2,
|
|
30
|
+
company_id: 1,
|
|
31
|
+
created_at: "2025-04-14T15:11:11.000000Z",
|
|
32
|
+
updated_at: "2025-04-16T16:45:55.000000Z",
|
|
33
|
+
newsletter: null,
|
|
34
|
+
admin: 1,
|
|
35
|
+
name: "Jeremy Viner",
|
|
36
|
+
email: "jeremy.viner@avalerehealth.com",
|
|
37
|
+
email_verified_at: "2025-04-16T16:45:55.000000Z",
|
|
38
|
+
brands: [],
|
|
39
|
+
company: {
|
|
40
|
+
id: 1,
|
|
41
|
+
name: "Company 0",
|
|
42
|
+
created_at: "2025-04-14T15:08:50.000000Z",
|
|
43
|
+
updated_at: "2025-04-14T15:08:50.000000Z",
|
|
44
|
+
domains: [
|
|
45
|
+
"okuneva.com",
|
|
46
|
+
"bogisich.info",
|
|
47
|
+
"avalerehealth.com",
|
|
48
|
+
],
|
|
49
|
+
brands: [1],
|
|
50
|
+
events: [],
|
|
51
|
+
therapy_areas: [],
|
|
52
|
+
event_therapy_areas: [],
|
|
53
|
+
event_therapy_area_media_types: [],
|
|
54
|
+
users_count: null,
|
|
55
|
+
sso_client_id: "5ea409fc-8dcf-423e-b7fa-867422859ea4",
|
|
56
|
+
sso_client_secret:
|
|
57
|
+
"aSS8Q~ss0r-uh.fPLHUXVXp2kIs5IfwTjzomrb_I",
|
|
58
|
+
sso_tenant: "4a33c544-865e-44a4-836f-bc51800f6c5e",
|
|
59
|
+
sso_type: "azure",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
"/user/password": {
|
|
65
|
+
put: {},
|
|
66
|
+
},
|
|
67
|
+
"/logged-in": {
|
|
68
|
+
get: { "logged-in": true },
|
|
69
|
+
},
|
|
70
|
+
"/logout": {
|
|
71
|
+
post: {},
|
|
72
|
+
},
|
|
73
|
+
"/login": {
|
|
74
|
+
post: {
|
|
75
|
+
two_factor: false,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|