@fishawack/lab-velocity 2.0.0-beta.3 → 2.0.0-beta.30

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.
Files changed (106) hide show
  1. package/README.md +441 -37
  2. package/_Build/vue/components/basic/Button.vue +1 -1
  3. package/_Build/vue/components/form/Select.vue +2 -2
  4. package/_Build/vue/components/form/Spinner.vue +5 -0
  5. package/_Build/vue/components/layout/Alert.vue +5 -5
  6. package/_Build/vue/{modules/AuthModule/components/VBreadcrumbs.vue → components/layout/Breadcrumbs.vue} +4 -4
  7. package/_Build/vue/{modules/AuthModule/components → components/layout}/Chips.vue +2 -2
  8. package/_Build/vue/components/layout/Footer.vue +11 -10
  9. package/_Build/vue/{modules/AuthModule/components/VFormFooter.vue → components/layout/FormFooter.vue} +13 -7
  10. package/_Build/vue/{modules/AuthModule/components → components/layout}/FormRole.vue +10 -8
  11. package/_Build/vue/components/layout/Layout.vue +76 -0
  12. package/_Build/vue/components/layout/Navigation.vue +77 -0
  13. package/_Build/vue/{modules/AuthModule/components/VPageHeader.vue → components/layout/PageHeader.vue} +7 -2
  14. package/_Build/vue/components/layout/SideBar.vue +26 -0
  15. package/_Build/vue/{modules/AuthModule/components/VTable.vue → components/layout/Table.vue} +32 -16
  16. package/_Build/vue/{modules/AuthModule/components/VTableSorter.vue → components/layout/TableSorter.vue} +68 -43
  17. package/_Build/vue/components/layout/pageTitle.vue +1 -1
  18. package/_Build/vue/components/navigation/MenuItem.vue +7 -2
  19. package/_Build/vue/components/navigation/MenuItemGroup.vue +7 -2
  20. package/_Build/vue/modules/AuthModule/js/axios.js +19 -0
  21. package/_Build/vue/modules/AuthModule/js/router.js +28 -88
  22. package/_Build/vue/modules/AuthModule/js/store.js +15 -6
  23. package/_Build/vue/modules/AuthModule/{adminRoutes/PCompanies/Children/partials → routes/PCompanies}/form.vue +50 -18
  24. package/_Build/vue/modules/AuthModule/routes/PCompanies/resource.js +259 -0
  25. package/_Build/vue/modules/AuthModule/routes/PTeams/resource.js +308 -0
  26. package/_Build/vue/modules/AuthModule/{adminRoutes/PUsers/Children/partials → routes/PUsers}/form.vue +30 -18
  27. package/_Build/vue/modules/AuthModule/routes/PUsers/resource.js +215 -0
  28. package/_Build/vue/modules/AuthModule/routes/account-exists.vue +2 -2
  29. package/_Build/vue/modules/AuthModule/routes/change-password.vue +23 -24
  30. package/_Build/vue/modules/AuthModule/routes/container.vue +2 -11
  31. package/_Build/vue/modules/AuthModule/routes/expired-reset.vue +4 -4
  32. package/_Build/vue/modules/AuthModule/routes/expired-verification.vue +9 -8
  33. package/_Build/vue/modules/AuthModule/routes/force-reset.vue +24 -28
  34. package/_Build/vue/modules/AuthModule/routes/forgot.vue +4 -4
  35. package/_Build/vue/modules/AuthModule/routes/login.vue +7 -11
  36. package/_Build/vue/modules/AuthModule/routes/logincallback.vue +2 -4
  37. package/_Build/vue/modules/AuthModule/routes/loginsso.vue +7 -9
  38. package/_Build/vue/modules/AuthModule/routes/logout.vue +1 -3
  39. package/_Build/vue/modules/AuthModule/routes/logoutheadless.vue +1 -3
  40. package/_Build/vue/modules/AuthModule/routes/register.vue +19 -21
  41. package/_Build/vue/modules/AuthModule/routes/reset.vue +14 -13
  42. package/_Build/vue/modules/AuthModule/routes/success-forgot.vue +8 -7
  43. package/_Build/vue/modules/AuthModule/routes/success-reset.vue +2 -2
  44. package/_Build/vue/modules/AuthModule/routes/success-verify.vue +1 -3
  45. package/_Build/vue/modules/AuthModule/routes/verify.vue +11 -14
  46. package/_Build/vue/modules/resource/Children/create.vue +70 -0
  47. package/_Build/vue/modules/resource/Children/edit.vue +92 -0
  48. package/_Build/vue/modules/resource/Children/index.vue +42 -0
  49. package/_Build/vue/modules/resource/Children/partials/form.vue +57 -0
  50. package/_Build/vue/modules/resource/Children/show.vue +133 -0
  51. package/_Build/vue/modules/resource/index.js +486 -0
  52. package/_Build/vue/modules/resource/parent.vue +63 -0
  53. package/_base.scss +0 -1
  54. package/_defaults.scss +2 -13
  55. package/_variables.scss +9 -4
  56. package/components/_alert.scss +5 -0
  57. package/components/_auth.scss +163 -0
  58. package/components/_basic.scss +55 -0
  59. package/components/_breadcrumbs.scss +39 -0
  60. package/components/_button.scss +304 -0
  61. package/components/_cascader.scss +12 -0
  62. package/components/_checkbox.scss +41 -0
  63. package/components/_chip.scss +24 -0
  64. package/components/_collapse.scss +24 -0
  65. package/components/_datepicker.scss +52 -0
  66. package/components/_descriptions.scss +2 -0
  67. package/components/_footer.scss +47 -0
  68. package/components/_form.scss +24 -0
  69. package/components/_header.scss +30 -0
  70. package/components/_icon.scss +25 -0
  71. package/components/_inputNumber.scss +22 -0
  72. package/components/_layout.scss +56 -0
  73. package/components/_link.scss +44 -0
  74. package/components/_loader.scss +43 -0
  75. package/components/_menu.scss +112 -0
  76. package/components/_modal.scss +24 -0
  77. package/components/_pageTitle.scss +8 -0
  78. package/components/_permissionLegend.scss +18 -0
  79. package/components/_select.scss +29 -0
  80. package/components/_sidebar.scss +41 -0
  81. package/components/_switch.scss +14 -0
  82. package/components/_table.scss +20 -0
  83. package/components/_tooltip.scss +4 -0
  84. package/components/_typography.scss +162 -0
  85. package/components/_upload.scss +15 -0
  86. package/components/_wysiwyg.scss +7 -0
  87. package/components/_wysiwyg2.scss +142 -0
  88. package/index.js +9 -1
  89. package/package.json +4 -2
  90. package/vendor.scss +0 -1
  91. package/_Build/vue/components/layout/sideBar.vue +0 -25
  92. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/Upload/upload.vue +0 -251
  93. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/create.vue +0 -62
  94. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/edit.vue +0 -98
  95. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/index.vue +0 -90
  96. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/show.vue +0 -262
  97. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/parent.vue +0 -36
  98. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/create.vue +0 -112
  99. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/edit.vue +0 -103
  100. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/index.vue +0 -112
  101. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/show.vue +0 -120
  102. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/parent.vue +0 -36
  103. /package/_Build/vue/{modules/AuthModule/components → components/layout}/AuthModal.vue +0 -0
  104. /package/_Build/vue/{modules/AuthModule/components → components/layout}/Chip.vue +0 -0
  105. /package/_Build/vue/{modules/AuthModule/components/VPasswordValidation.vue → components/layout/PasswordValidation.vue} +0 -0
  106. /package/_Build/vue/{modules/AuthModule/components/VRoleLegend.vue → components/layout/RoleLegend.vue} +0 -0
@@ -0,0 +1,162 @@
1
+ @import "@fishawack/lab-ui/_typography.scss";
2
+ /* Primary font
3
+ -------------------------------------------------- */
4
+ @font-face {
5
+ font-family: $primaryFont;
6
+ font-weight: 400;
7
+ font-style: normal;
8
+
9
+ src:
10
+ resolve($primaryFontRegular + ".woff2") format("woff2"),
11
+ resolve($primaryFontRegular + ".woff") format("woff");
12
+ }
13
+
14
+ @font-face {
15
+ font-family: $primaryFont;
16
+ font-weight: 100;
17
+ font-style: normal;
18
+
19
+ src:
20
+ resolve($primaryFontThin + ".woff2") format("woff2"),
21
+ resolve($primaryFontThin + ".woff") format("woff");
22
+ }
23
+
24
+ @font-face {
25
+ font-family: $primaryFont;
26
+ font-weight: 200;
27
+ font-style: normal;
28
+
29
+ src:
30
+ resolve($primaryFontExtraLight + ".woff2") format("woff2"),
31
+ resolve($primaryFontExtraLight + ".woff") format("woff");
32
+ }
33
+
34
+ @font-face {
35
+ font-family: $primaryFont;
36
+ font-weight: 300;
37
+ font-style: normal;
38
+
39
+ src:
40
+ resolve($primaryFontLight + ".woff2") format("woff2"),
41
+ resolve($primaryFontLight + ".woff") format("woff");
42
+ }
43
+
44
+ @font-face {
45
+ font-family: $primaryFont;
46
+ font-weight: 500;
47
+ font-style: normal;
48
+
49
+ src:
50
+ resolve($primaryFontMedium + ".woff2") format("woff2"),
51
+ resolve($primaryFontMedium + ".woff") format("woff");
52
+ }
53
+
54
+ @font-face {
55
+ font-family: $primaryFont;
56
+ font-weight: 600;
57
+ font-style: normal;
58
+
59
+ src:
60
+ resolve($primaryFontSemiBold + ".woff2") format("woff2"),
61
+ resolve($primaryFontSemiBold + ".woff") format("woff");
62
+ }
63
+
64
+ @font-face {
65
+ font-family: $primaryFont;
66
+ font-weight: 700;
67
+ font-style: normal;
68
+
69
+ src:
70
+ resolve($primaryFontBold + ".woff2") format("woff2"),
71
+ resolve($primaryFontBold + ".woff2") format("woff2");
72
+ }
73
+
74
+ @font-face {
75
+ font-family: $secondaryFont;
76
+ font-weight: 500;
77
+ font-style: normal;
78
+
79
+ src: resolve($secondaryFontMedium + ".ttf") format("truetype");
80
+ }
81
+
82
+ h1,
83
+ .h1 {
84
+ font-size: get-ratio(48px);
85
+ line-height: get-ratio(56px);
86
+ font-family: $primaryFont;
87
+ }
88
+
89
+ h2,
90
+ .h2 {
91
+ font-size: get-ratio(36px);
92
+ line-height: get-ratio(48px);
93
+ font-family: $secondaryFont;
94
+ }
95
+
96
+ h3,
97
+ .h3 {
98
+ font-size: get-ratio(32px);
99
+ line-height: get-ratio(42px);
100
+ font-family: $primaryFont;
101
+ }
102
+
103
+ h4,
104
+ .h4 {
105
+ font-size: get-ratio(24px);
106
+ line-height: get-ratio(32px);
107
+ font-family: $primaryFont;
108
+ }
109
+
110
+ h5,
111
+ .h5 {
112
+ font-size: get-ratio(20px);
113
+ line-height: get-ratio(24px);
114
+ font-weight: 700;
115
+ font-family: $primaryFont;
116
+ }
117
+ h1,
118
+ .h1,
119
+ h2,
120
+ .h2,
121
+ h3,
122
+ .h3,
123
+ h4,
124
+ .h4,
125
+ h5,
126
+ .h5 {
127
+ font-weight: 500;
128
+ }
129
+
130
+ // may be project specific
131
+
132
+ .font-secondary {
133
+ font-family: $secondaryFont;
134
+ }
135
+
136
+ .font-primary {
137
+ font-family: $primaryFont;
138
+ }
139
+
140
+ .text-10 {
141
+ font-size: get-ratio(10px);
142
+ line-height: get-ratio(16px);
143
+ }
144
+ .text-12 {
145
+ font-size: get-ratio(12px);
146
+ line-height: get-ratio(18px);
147
+ }
148
+ .text-14 {
149
+ font-size: get-ratio(14px);
150
+ line-height: get-ratio(20px);
151
+ }
152
+ .font-16 {
153
+ font-size: get-ratio(16px);
154
+ line-height: get-ratio(24px);
155
+ }
156
+
157
+ .text-60 {
158
+ font-size: get-ratio(60px);
159
+ line-height: get-ratio(68px);
160
+ font-weight: 500;
161
+ font-family: $primaryFont;
162
+ }
@@ -0,0 +1,15 @@
1
+ @import "element-plus/theme-chalk/el-upload";
2
+
3
+ .vel-upload {
4
+ .el-upload__tip {
5
+ color: $color11;
6
+ }
7
+ &.form__group--error {
8
+ .el-upload__tip {
9
+ color: $colorAlert;
10
+ }
11
+ }
12
+ &__error {
13
+ color: $colorAlert;
14
+ }
15
+ }
@@ -0,0 +1,7 @@
1
+ @import "quill/dist/quill.snow";
2
+ @import "quill/dist/quill.core";
3
+
4
+ .ql-container,
5
+ .ql-toolbar {
6
+ background-color: $color0;
7
+ }
@@ -0,0 +1,142 @@
1
+ @import "element-plus/theme-chalk/el-dropdown";
2
+ @import "element-plus/theme-chalk/el-dropdown-item";
3
+ @import "element-plus/theme-chalk/el-dialog";
4
+ @import "./button.scss";
5
+
6
+ .vel-wysiwyg__controls {
7
+ background-color: $color0;
8
+ display: flex;
9
+ flex-grow: 1;
10
+ border: solid $color5 2px;
11
+ border-bottom: none;
12
+ // margin-bottom: .5 * $spacing;
13
+ font-size: get-ratio(14px);
14
+ padding: 0 0.5 * $spacing;
15
+ > * {
16
+ padding: 0.5 * $spacing;
17
+ padding-right: $spacing;
18
+ --el-font-size-base: get-ratio(14px);
19
+ &:not(:last-child) {
20
+ border-right: solid 1px $color5;
21
+ }
22
+ }
23
+
24
+ button {
25
+ // border: solid 1px $color1;
26
+ background-color: transparent;
27
+ cursor: pointer;
28
+ min-width: 28px;
29
+ padding: 3px 5px;
30
+ line-height: 1;
31
+ border: none;
32
+ &.is-active,
33
+ &:hover {
34
+ background-color: $color5;
35
+ }
36
+ svg {
37
+ height: 90%;
38
+ }
39
+ }
40
+ .el-dropdown {
41
+ line-height: 1.15;
42
+ }
43
+
44
+ .ql-stroke {
45
+ fill: none;
46
+ stroke: #444;
47
+ stroke-linecap: round;
48
+ stroke-linejoin: round;
49
+ stroke-width: 2;
50
+ }
51
+
52
+ .ql-stroke-miter {
53
+ fill: none;
54
+ stroke: #444;
55
+ stroke-miterlimit: 10;
56
+ stroke-width: 2;
57
+ }
58
+
59
+ .ql-fill,
60
+ .ql-stroke.ql-fill {
61
+ fill: #444;
62
+ }
63
+
64
+ .ql-empty {
65
+ fill: none;
66
+ }
67
+
68
+ .ql-even {
69
+ fill-rule: evenodd;
70
+ }
71
+
72
+ .ql-thin,
73
+ .ql-stroke.ql-thin {
74
+ stroke-width: 1;
75
+ }
76
+
77
+ .ql-transparent {
78
+ opacity: 0.4;
79
+ }
80
+
81
+ ~ div {
82
+ // margin-top: $spacing;
83
+ border: solid $color5 2px;
84
+ background-color: $color0;
85
+ > div {
86
+ padding: 2 * $spacing;
87
+ }
88
+ }
89
+ }
90
+ .vel-wysiwyg__button {
91
+ // border: solid 1px $color1;
92
+ background-color: transparent;
93
+ // cursor: pointer;
94
+
95
+ &.is-active,
96
+ &:hover {
97
+ background-color: $color5;
98
+ }
99
+ }
100
+
101
+ .vel-wysiwyg {
102
+ // border: solid $color1 1px;
103
+ // padding: $spacing * 1.5;
104
+
105
+ table,
106
+ td,
107
+ th {
108
+ border: solid 0.5px $color1;
109
+ }
110
+ th {
111
+ background-color: $color5;
112
+ }
113
+ hr {
114
+ height: 1px;
115
+ background-color: $color1;
116
+ }
117
+ a {
118
+ text-decoration: underline;
119
+ }
120
+ }
121
+
122
+ .lab-table,
123
+ .lab-table-cell,
124
+ .lab-table-header {
125
+ border: solid 0.5px $color1;
126
+ }
127
+ .lab-table-header {
128
+ background-color: $color5;
129
+ }
130
+
131
+ .lab-table {
132
+ a {
133
+ text-decoration: underline;
134
+ }
135
+ }
136
+ .lab-table-cell {
137
+ &:active,
138
+ &:focus-within,
139
+ &.selectedCell {
140
+ background-color: transparentize($color: $color5, $amount: 0.8);
141
+ }
142
+ }
package/index.js CHANGED
@@ -8,6 +8,8 @@ export const Auth = {
8
8
  Store,
9
9
  };
10
10
 
11
+ export { default as Resource } from "./_Build/vue/modules/resource/index.js";
12
+
11
13
  export { default as Button } from "./_Build/vue/components/basic/Button.vue";
12
14
  export { default as Link } from "./_Build/vue/components/basic/link.vue";
13
15
 
@@ -24,9 +26,15 @@ export { default as Wysiwyg2 } from "./_Build/vue/components/form/Wysiwyg2.vue";
24
26
  export { default as Upload } from "./_Build/vue/components/form/Upload.vue";
25
27
  export { default as InputNumber } from "./_Build/vue/components/form/InputNumber.vue";
26
28
 
27
- export { default as SideBar } from "./_Build/vue/components/layout/sideBar.vue";
29
+ export { default as RoleLegend } from "./_Build/vue/components/layout/RoleLegend.vue";
30
+ export { default as TableSorter } from "./_Build/vue/components/layout/TableSorter.vue";
31
+ export { default as Chip } from "./_Build/vue/components/layout/Chip.vue";
32
+ export { default as Chips } from "./_Build/vue/components/layout/Chips.vue";
33
+ export { default as SideBar } from "./_Build/vue/components/layout/SideBar.vue";
28
34
  export { default as Footer } from "./_Build/vue/components/layout/Footer.vue";
29
35
  export { default as Header } from "./_Build/vue/components/layout/Header.vue";
36
+ export { default as Layout } from "./_Build/vue/components/layout/Layout.vue";
37
+ export { default as Navigation } from "./_Build/vue/components/layout/Navigation.vue";
30
38
  export { default as PageTitle } from "./_Build/vue/components/layout/pageTitle.vue";
31
39
  export { default as Alert } from "./_Build/vue/components/layout/Alert.vue";
32
40
  export { default as Tooltip } from "./_Build/vue/components/layout/Tooltip.vue";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-velocity",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0-beta.30",
4
4
  "description": "Avalere Health branded style system",
5
5
  "scripts": {
6
6
  "setup": "npm ci || npm i && npm run content",
@@ -62,8 +62,10 @@
62
62
  },
63
63
  "files": [
64
64
  "*.scss",
65
+ "components",
65
66
  "_Build/vue/components",
66
- "_Build/vue/modules/AuthModule"
67
+ "_Build/vue/modules/AuthModule",
68
+ "_Build/vue/modules/resource"
67
69
  ],
68
70
  "main": "index.js",
69
71
  "release": {
package/vendor.scss CHANGED
@@ -15,7 +15,6 @@
15
15
  @import "@fishawack/lab-ui/_typography.scss";
16
16
  @import "@fishawack/lab-ui/_grid.scss";
17
17
  @import "@fishawack/lab-ui/_button.scss";
18
-
19
18
  @import "@fishawack/lab-ui/_utilities.scss";
20
19
 
21
20
  // Element-plus base style
@@ -1,25 +0,0 @@
1
- <template>
2
- <div class="vel-side-bar" :class="{ active: active }">
3
- <div>
4
- <slot name="navigation" />
5
- </div>
6
-
7
- <div class="vel-side-bar__bottom">
8
- <button class="vel-side-bar__button" @click="active = !active">
9
- <slot name="expand"> > </slot>
10
- </button>
11
- </div>
12
- </div>
13
- </template>
14
-
15
- <script>
16
- export default {
17
- name: "SideBar",
18
-
19
- data() {
20
- return {
21
- active: true,
22
- };
23
- },
24
- };
25
- </script>
@@ -1,251 +0,0 @@
1
- <template>
2
- <VBreadcrumbs :items="breadcrumbs" class="mb-8" container-classes="m-0" />
3
-
4
- <div class="container px-6 tablet:px-4 mobile:px-2 mb-8 ml-0 mr-0">
5
- <div class="grid__1/2">
6
- <div class="grid__1/1 grid justify-between mb-4 items-end">
7
- <h2 class="h1">User import</h2>
8
- <div>
9
- <el-button
10
- tag="a"
11
- type="secondary"
12
- href="/media/content/files/example.csv"
13
- download
14
- >
15
- <GIcon
16
- class="fill-1 mr-0.5"
17
- name="icon-download"
18
- embed
19
- artboard
20
- />
21
- Download example file
22
- </el-button>
23
- </div>
24
- </div>
25
- <div class="grid__1/1">
26
- <el-select
27
- v-model="form.roles"
28
- placeholder="Select"
29
- multiple
30
- name="roles"
31
- :error="form.errors"
32
- label="Roles"
33
- :options="[
34
- {
35
- label: 'Administrator',
36
- value: '1',
37
- },
38
- {
39
- label: 'Subscriber',
40
- value: '2',
41
- },
42
- ]"
43
- />
44
-
45
- <el-select
46
- v-if="form.roles && form.roles.length"
47
- v-model="form.permissions"
48
- placeholder="Select"
49
- multiple
50
- name="permissions"
51
- :error="form.errors"
52
- label="Permissions"
53
- :options="[
54
- {
55
- label: `Inherit Permissions`,
56
- value: null,
57
- },
58
- //{ // temporarily disabled as not used yet
59
- // label: &quot;Approve Content&quot;,
60
- // value: &quot;2&quot;
61
- //},
62
- {
63
- label: 'View content',
64
- value: '3',
65
- },
66
- {
67
- label: 'Write content',
68
- value: '4',
69
- disabled: !form.roles.includes(1),
70
- },
71
- {
72
- label: 'Delete content',
73
- value: '5',
74
- disabled: !form.roles.includes(1),
75
- },
76
- ]"
77
- />
78
- </div>
79
- <div class="grid__1/1">
80
- <hr class="my-3 hr-muted" />
81
-
82
- <el-upload
83
- ref="upload"
84
- v-model="form.files"
85
- name="files"
86
- label="Upload spreadsheet"
87
- :auto-upload="false"
88
- :limit="1"
89
- :on-exceed="handleExceed"
90
- >
91
- <template #trigger>
92
- <el-button
93
- class="mt"
94
- type="primary"
95
- :disabled="form.processing || form.files.length"
96
- >Select file</el-button
97
- >
98
- </template>
99
-
100
- <el-button
101
- class="ml relative button--spinner"
102
- type="success"
103
- :disabled="form.processing || !form.files.length"
104
- @click="submitUpload"
105
- >
106
- <span :class="{ active: !form.processing }"
107
- >Upload</span
108
- >
109
- <GSpinner :class="{ active: form.processing }" />
110
- </el-button>
111
-
112
- <small class="block my color-muted"
113
- >Upload one spreadsheet with a size less than
114
- 50MB</small
115
- >
116
- </el-upload>
117
- </div>
118
- </div>
119
- </div>
120
- </template>
121
-
122
- <script>
123
- "use strict";
124
-
125
- import Form from "form-backend-validation";
126
- import { ElMessageBox, genFileId } from "element-plus";
127
-
128
- export default {
129
- name: "Create",
130
-
131
- components: {
132
- VBreadcrumbs: require("../../../../components/VBreadcrumbs.vue")
133
- .default,
134
- },
135
-
136
- data() {
137
- return {
138
- id: null,
139
- breadcrumbs: [
140
- {
141
- href: {
142
- name: "index",
143
- },
144
- text: "Home",
145
- },
146
- ],
147
- form: new Form(
148
- {
149
- step: 0,
150
- files: [],
151
- roles: [2],
152
- permissions: [null],
153
- company_id: null,
154
- },
155
- {
156
- http: window.axios,
157
- },
158
- ),
159
- };
160
- },
161
-
162
- watch: {
163
- "form.roles": {
164
- handler(newVal) {
165
- const subscriptions = [
166
- 3, // view content
167
- 4, // write content
168
- 5, // delete content
169
- ];
170
-
171
- if (!newVal.includes(1)) {
172
- this.form.permissions = this.form.permissions.filter(
173
- (item) => subscriptions.includes(item),
174
- );
175
-
176
- if (!newVal.includes(2)) {
177
- this.form.permissions = this.form.permissions.filter(
178
- (item) => !subscriptions.includes(item),
179
- );
180
- }
181
- }
182
- },
183
- },
184
- },
185
-
186
- async mounted() {
187
- this.id = this.$route.params.id;
188
- this.form.company_id = this.id;
189
- window.axios.get(`/api/companies/${this.id}`).then((res) => {
190
- const company = res.data.data;
191
- this.breadcrumbs.push(
192
- {
193
- href: {
194
- name: "companies.show",
195
- param: this.id,
196
- },
197
- text: company.name,
198
- },
199
- {
200
- href: {
201
- name: "companies.pload",
202
- },
203
- text: "User upload",
204
- },
205
- );
206
- });
207
- },
208
-
209
- methods: {
210
- submitUpload() {
211
- this.form.post(`/api/users/import`).then(({ data }) => {
212
- this.open(data);
213
- });
214
- },
215
-
216
- handleExceed(files) {
217
- this.$refs.upload.clearFiles();
218
-
219
- const file = files[0];
220
- file.uid = genFileId();
221
-
222
- this.$refs.upload.handleStart(file);
223
- },
224
-
225
- open(data) {
226
- let html = "Succesfully imported all users";
227
-
228
- if (data.length > 0) {
229
- html =
230
- "Errors detected on upload following emails were not added to the system<table>";
231
- for (let x = 0; x < data.length; x++) {
232
- html += `<tr><td>${data[x].email}</td></tr>`;
233
- }
234
- html += "</table>";
235
- }
236
-
237
- ElMessageBox.alert(html, {
238
- confirmButtonText: "Ok",
239
- dangerouslyUseHTMLString: true,
240
- })
241
- .then(() => {
242
- this.$router.replace({
243
- name: "companies.show",
244
- params: { id: this.id },
245
- });
246
- })
247
- .catch(() => {});
248
- },
249
- },
250
- };
251
- </script>