lesli_admin 0.3.0 → 0.5.0

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/lesli_admin/application.js +1698 -4027
  3. data/app/assets/stylesheets/lesli_admin/application.scss +1 -1
  4. data/app/controllers/lesli_admin/accounts_controller.rb +3 -5
  5. data/app/controllers/lesli_admin/dashboard/components_controller.rb +60 -0
  6. data/app/controllers/lesli_admin/dashboards_controller.rb +26 -50
  7. data/app/controllers/lesli_admin/profiles_controller.rb +8 -16
  8. data/app/models/lesli_admin/account.rb +6 -0
  9. data/{lib/vue/apps/users/components/integrations-information.vue → app/models/lesli_admin/dashboard/component.rb} +24 -35
  10. data/app/models/lesli_admin/dashboard.rb +58 -0
  11. data/app/services/lesli_admin/account_service.rb +39 -0
  12. data/app/views/lesli_admin/dashboards/edit.html.erb +29 -7
  13. data/app/views/lesli_admin/dashboards/index.html.erb +29 -11
  14. data/app/views/lesli_admin/dashboards/new.html.erb +29 -6
  15. data/app/views/lesli_admin/dashboards/show.html.erb +31 -0
  16. data/app/views/lesli_admin/partials/_engine-navigation.html.erb +0 -1
  17. data/config/locales/translations.en.yml +33 -0
  18. data/config/locales/translations.es.yml +33 -0
  19. data/config/routes.rb +47 -4
  20. data/db/migrate/0101050110_create_lesli_admin_dashboards.rb +51 -0
  21. data/db/migrate/0101050210_create_lesli_admin_dashboard_components.rb +53 -0
  22. data/lib/lesli_admin/engine.rb +1 -0
  23. data/lib/lesli_admin/version.rb +1 -1
  24. data/lib/vue/application.js +37 -16
  25. data/lib/vue/apps/account/components/{address-form.vue → form-address.vue} +27 -42
  26. data/lib/vue/apps/account/components/form-contact.vue +122 -0
  27. data/lib/vue/apps/account/components/form-information.vue +12 -30
  28. data/lib/vue/apps/account/show.vue +13 -12
  29. data/{app/assets/stylesheets/lesli_admin/users.scss → lib/vue/apps/dashboards/components/lesli-version.vue} +38 -34
  30. data/lib/vue/apps/{profile/components/change-email.vue → dashboards/show.vue} +9 -6
  31. data/lib/vue/stores/translations.json +68 -18
  32. metadata +17 -30
  33. data/app/controllers/lesli_admin/users_controller.rb +0 -238
  34. data/app/services/lesli_admin/user_service.rb +0 -265
  35. data/app/views/lesli_admin/dashboards/_dashboard.html.erb +0 -2
  36. data/app/views/lesli_admin/dashboards/_form.html.erb +0 -17
  37. data/lib/vue/apps/account/components/contact-form.vue +0 -162
  38. data/lib/vue/apps/dashboard/show.vue +0 -30
  39. data/lib/vue/apps/profile/components/subscriptions.vue +0 -94
  40. data/lib/vue/apps/profile/show.vue +0 -152
  41. data/lib/vue/apps/users/components/information-card.vue +0 -116
  42. data/lib/vue/apps/users/components/information-form.vue +0 -177
  43. data/lib/vue/apps/users/components/management-roles.vue +0 -109
  44. data/lib/vue/apps/users/components/management-security.vue +0 -113
  45. data/lib/vue/apps/users/components/management-sessions.vue +0 -106
  46. data/lib/vue/apps/users/components/management-settings.vue +0 -94
  47. data/lib/vue/apps/users/index.vue +0 -206
  48. data/lib/vue/apps/users/new.vue +0 -181
  49. data/lib/vue/apps/users/show.vue +0 -116
  50. data/lib/vue/stores/user.js +0 -331
  51. data/lib/vue/stores/users.js +0 -175
@@ -1,106 +0,0 @@
1
- <script setup>
2
- /*
3
-
4
- Lesli
5
-
6
- Copyright (c) 2023, Lesli Technologies, S. A.
7
-
8
- This program is free software: you can redistribute it and/or modify
9
- it under the terms of the GNU General Public License as published by
10
- the Free Software Foundation, either version 3 of the License, or
11
- (at your option) any later version.
12
-
13
- This program is distributed in the hope that it will be useful,
14
- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- GNU General Public License for more details.
17
-
18
- You should have received a copy of the GNU General Public License
19
- along with this program. If not, see http://www.gnu.org/licenses/.
20
-
21
- Lesli · Your Smart Business Assistant.
22
-
23
- Made with ♥ by https://www.lesli.tech
24
- Building a better future, one line of code at a time.
25
-
26
- @contact hello@lesli.tech
27
- @website https://lesli.tech
28
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
-
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
- // ·
32
-
33
- */
34
-
35
-
36
-
37
- // · import vue tools
38
- import { ref, reactive, onMounted, watch, computed } from "vue"
39
-
40
-
41
- // · import vue router composable
42
- import { useRoute } from "vue-router"
43
-
44
-
45
- // · import lesli stores
46
- import { useUser } from "LesliApp/administration/stores/user"
47
-
48
-
49
- // · implement stores
50
- const storeUser = useUser()
51
-
52
-
53
- // · initialize/inject plugins
54
- const route = useRoute()
55
-
56
-
57
- // ·
58
- const translations = {
59
- users: I18n.t("core.users"),
60
- shared: I18n.t("core.shared")
61
- }
62
-
63
-
64
- // ·
65
- const columns = [{
66
- field: 'id',
67
- label: 'ID'
68
- }, {
69
- field: 'user_agent',
70
- label: 'Device'
71
- }, {
72
- field: 'session_source',
73
- label: 'Source'
74
- }, {
75
- field: 'created_at_date',
76
- label: 'Created at'
77
- }, {
78
- field: 'last_used_at_string',
79
- label: 'Last used at'
80
- }]
81
-
82
-
83
- // ·
84
- onMounted(() => {
85
- storeUser.fetchSessions()
86
- })
87
-
88
- </script>
89
- <template>
90
- <lesli-card>
91
- <lesli-toolbar>
92
- <lesli-button icon="refresh">
93
- Reload
94
- </lesli-button>
95
- </lesli-toolbar>
96
- <lesli-table
97
- :columns="columns"
98
- :records="storeUser.sessions.records">
99
- <template #buttons="{ record, value }">
100
- <lesli-button danger icon="delete" @click="storeUser.deleteSession(record.id)">
101
- {{ translations.users.view_btn_logout }}
102
- </lesli-button>
103
- </template>
104
- </lesli-table>
105
- </lesli-card>
106
- </template>
@@ -1,94 +0,0 @@
1
- <script setup>
2
- /*
3
-
4
- Lesli
5
-
6
- Copyright (c) 2023, Lesli Technologies, S. A.
7
-
8
- This program is free software: you can redistribute it and/or modify
9
- it under the terms of the GNU General Public License as published by
10
- the Free Software Foundation, either version 3 of the License, or
11
- (at your option) any later version.
12
-
13
- This program is distributed in the hope that it will be useful,
14
- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- GNU General Public License for more details.
17
-
18
- You should have received a copy of the GNU General Public License
19
- along with this program. If not, see http://www.gnu.org/licenses/.
20
-
21
- Lesli · Your Smart Business Assistant.
22
-
23
- Made with ♥ by https://www.lesli.tech
24
- Building a better future, one line of code at a time.
25
-
26
- @contact hello@lesli.tech
27
- @website https://lesli.tech
28
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
-
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
- // ·
32
-
33
- */
34
-
35
-
36
- // · import vue tools
37
- import { ref, reactive, onMounted, watch, computed } from "vue"
38
-
39
-
40
- // · import lesli stores
41
- import { useUser } from "LesliApp/administration/stores/user"
42
-
43
-
44
- // · implement stores
45
- const storeUser = useUser()
46
-
47
-
48
- // · translations
49
- const translations = {
50
- users: I18n.t("core.users"),
51
- shared: I18n.t("core.shared")
52
- }
53
-
54
-
55
- // · initializing
56
- onMounted(() => {
57
- storeUser.getOptions()
58
- })
59
- </script>
60
- <template>
61
- <lesli-form @submit="storeUser.postLanguage">
62
- <div class="field is-horizontal">
63
- <div class="field-label">
64
- <label class="label">Select preferred language </label>
65
- </div>
66
- <div class="field-body">
67
- <div class="field is-narrow">
68
- <div class="control">
69
- <div class="select">
70
- <lesli-select
71
- icon="language"
72
- v-model="storeUser.user.locale.value"
73
- :options="storeUser.options.locales">
74
- </lesli-select>
75
- </div>
76
- </div>
77
- </div>
78
- </div>
79
- </div>
80
- <div class="field is-horizontal">
81
- <div class="field-label is-normal">
82
- </div>
83
- <div class="field-body">
84
- <div class="field">
85
- <div class="control">
86
- <lesli-button icon="save">
87
- {{ translations.shared.view_btn_save }}
88
- </lesli-button>
89
- </div>
90
- </div>
91
- </div>
92
- </div>
93
- </lesli-form>
94
- </template>
@@ -1,206 +0,0 @@
1
- <script setup>
2
- /*
3
- Lesli
4
-
5
- Copyright (c) 2023, Lesli Technologies, S. A.
6
-
7
- This program is free software: you can redistribute it and/or modify
8
- it under the terms of the GNU General Public License as published by
9
- the Free Software Foundation, either version 3 of the License, or
10
- (at your option) any later version.
11
-
12
- This program is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU General Public License for more details.
16
-
17
- You should have received a copy of the GNU General Public License
18
- along with this program. If not, see http://www.gnu.org/licenses/.
19
-
20
- Lesli · Ruby on Rails SaaS Development Framework.
21
-
22
- Made with ♥ by https://www.lesli.tech
23
- Building a better future, one line of code at a time.
24
-
25
- @contact hello@lesli.tech
26
- @website https://www.lesli.tech
27
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
-
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
- // ·
31
- */
32
-
33
-
34
- // · import vue tools
35
- import { ref, reactive, onMounted, watch, computed, inject } from "vue"
36
- import { useRouter, useRoute } from "vue-router"
37
-
38
-
39
- // · import lesli stores
40
- import { useUsers } from "LesliAdmin/stores/users"
41
-
42
-
43
- // · initialize/inject plugins
44
- const router = useRouter()
45
- const msg = inject("msg")
46
- const url = inject("url")
47
-
48
-
49
- // · implement stores
50
- const storeUsers = useUsers()
51
-
52
-
53
- // · translations
54
- const translations = {
55
- core: {
56
- roles: I18n.t("core.roles"),
57
- users: {
58
- view_text_title_users: i18n.t('lesli_admin.users.title_users')
59
- },
60
- shared: I18n.t("core.shared")
61
- }
62
- }
63
-
64
-
65
- // ·
66
- const columns = [{
67
- field: "id",
68
- label: "ID",
69
- sort: true
70
- }, {
71
- field: "name",
72
- label: translations.core.users.view_table_header_name,
73
- sort: true
74
- }, {
75
- field: "email",
76
- label: translations.core.users.view_table_header_email,
77
- sort: true
78
- }, {
79
- field: "rolenames",
80
- label: translations.core.users.view_table_header_role,
81
- sort: true
82
- }, {
83
- field: "active",
84
- label: translations.core.users.view_table_header_status,
85
- sort: true,
86
- custom: true
87
- }, {
88
- field: "current_sign_in_at_string",
89
- label: translations.core.users.view_table_header_last_sign_in,
90
- sort: true
91
- }, {
92
- field: "last_action_performed_at_string",
93
- label: translations.core.users.view_text_last_activity_at,
94
- sort: true
95
- }]
96
-
97
-
98
- // ·
99
- const selection = ref()
100
-
101
-
102
- // · defining props
103
- const props = defineProps({
104
- appMountPath: {
105
- type: String,
106
- required: false,
107
- default: "lesli/users",
108
- },
109
- defaultRole: {
110
- type: String,
111
- required: false,
112
- default: "",
113
- }
114
- })
115
-
116
-
117
- // · initializing
118
- onMounted(() => {
119
- storeUsers.fetchUsers()
120
- })
121
-
122
-
123
- //
124
- function showUser(user) {
125
- router.push(url.root(props.appMountPath+`/${user.id}`).s)
126
- }
127
- </script>
128
- <template>
129
- <lesli-application-container>
130
- <lesli-header :title="translations.core.users.view_text_title_users + ' (' +storeUsers.index.pagination.total+ ')' ">
131
- <lesli-button icon="add" :to="url.root(props.appMountPath+`/new`)">
132
- {{ translations.core.users.view_text_add_user }}
133
- </lesli-button>
134
- <lesli-button
135
- icon="refresh"
136
- :loading="storeUsers.loading"
137
- @click="storeUsers.getUsers()">
138
- {{ translations.core.shared.view_text_btn_reload }}
139
- </lesli-button>
140
- </lesli-header>
141
-
142
- <lesli-toolbar>
143
- </lesli-toolbar>
144
- <!--
145
- <lesli-toolbar
146
- @search="storeUsers.search"
147
- :search-placeholder="translations.core.users.view_toolbar_filter_placeholder_search">
148
- <lesli-select :options="[{
149
- label: translations.core.users.view_toolbar_filter_placeholder_all_users,
150
- value: null
151
- }, {
152
- label: translations.core.users.view_toolbar_filter_placeholder_active_users,
153
- value: 'active'
154
- }, {
155
- label: translations.core.users.view_toolbar_filter_placeholder_inactive_users,
156
- value: 'inactive'
157
- }]"
158
- v-model="storeUsers.filters.status"
159
- @change="storeUsers.fetchIndex()">
160
- </lesli-select>
161
- <lesli-select :options="storeUsers.roles_options"
162
- v-model="storeUsers.filters.role"
163
- @change="storeUsers.fetchIndex()">
164
- </lesli-select>
165
- </lesli-toolbar>
166
- -->
167
-
168
- <lesli-table
169
- :loading="storeUsers.loading"
170
- :columns="columns"
171
- :records="storeUsers.index.records"
172
- :pagination="storeUsers.index.pagination"
173
- :link="(user) => url.admin('users/:id', user.id)"
174
- @paginate="storeUsers.paginateIndex"
175
- @sort="storeUsers.sortIndex">
176
-
177
- <template #active="{ value }">
178
- <span class="tag is-success" v-if="value">
179
- {{ translations.core.shared.view_text_active }}
180
- </span>
181
- <span class="tag is-warning" v-if="!value">
182
- {{ translations.core.shared.view_text_inactive }}
183
- </span>
184
- </template>
185
-
186
- <template #options="{ record, value }">
187
- <a class="dropdown-item" @click="storeUsers.doLogout(record.id)">
188
- <span class="material-icons">
189
- logout
190
- </span>
191
- <span>
192
- {{ translations.core.users.view_btn_logout }}
193
- </span>
194
- </a>
195
- <a class="dropdown-item" @click="storeUsers.doLock(record.id)">
196
- <span class="material-icons">
197
- lock
198
- </span>
199
- <span>
200
- {{ translations.core.users.view_btn_revoke_access }}
201
- </span>
202
- </a>
203
- </template>
204
- </lesli-table>
205
- </lesli-application-container>
206
- </template>
@@ -1,181 +0,0 @@
1
- <script setup>
2
- /*
3
- Lesli
4
-
5
- Copyright (c) 2023, Lesli Technologies, S. A.
6
-
7
- This program is free software: you can redistribute it and/or modify
8
- it under the terms of the GNU General Public License as published by
9
- the Free Software Foundation, either version 3 of the License, or
10
- (at your option) any later version.
11
-
12
- This program is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU General Public License for more details.
16
-
17
- You should have received a copy of the GNU General Public License
18
- along with this program. If not, see http://www.gnu.org/licenses/.
19
-
20
- Lesli · Ruby on Rails Development Platform.
21
-
22
- Made with ♥ by https://www.lesli.tech
23
- Building a better future, one line of code at a time.
24
-
25
- @contact hello@lesli.tech
26
- @website https://www.lesli.tech
27
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
-
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
- // ·
31
- */
32
-
33
-
34
- // · import vue tools
35
- import { onMounted, inject } from "vue"
36
- import { useRouter, useRoute } from 'vue-router'
37
-
38
-
39
- // · import lesli stores
40
- import { useUsers } from "LesliAdmin/stores/users"
41
- import { useRoles } from "LesliAdmin/stores/roles"
42
-
43
-
44
- // · implement stores
45
- const storeUsers = useUsers()
46
- const storeRoles = useRoles()
47
- const router = useRouter()
48
- const route = useRoute()
49
-
50
-
51
- // · implement composables
52
- const url = inject("url")
53
- const msg = inject("msg")
54
-
55
-
56
- // · translations
57
- const translations = {
58
- users: I18n.t("core.users"),
59
- shared: I18n.t("core.shared")
60
- }
61
-
62
-
63
- // ·
64
- const onCreate = () => {
65
- storeUsers.postUsers().then(result => {
66
- storeUsers.user = {}
67
- msg.success(I18n.t("core.users.messages_success_operation"))
68
- router.push(url.admin("users/:id", result.id).toString())
69
- }).catch(error => {
70
- msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
71
- })
72
- }
73
-
74
-
75
- // ·
76
- onMounted(() => {
77
- console.log("works")
78
- storeRoles.fetchList()
79
- })
80
- </script>
81
- <template>
82
- <lesli-application>
83
- <lesli-header title="Create User">
84
- <lesli-button icon="list" :to="url.admin('users')">
85
- All users
86
- </lesli-button>
87
- </lesli-header>
88
-
89
- <lesli-form @submit="onCreate()">
90
- <p>User information</p>
91
- <div class="field is-horizontal">
92
- <div class="field-label is-normal">
93
- <label class="label">
94
- {{translations.shared.view_text_email}}
95
- <span class="is-danger">*</span>
96
- </label>
97
- </div>
98
- <div class="field-body">
99
- <div class="field">
100
- <div class="control">
101
- <input name="user_email" v-model="storeUsers.user.email" required="required" type="email" class="input">
102
- </div>
103
- </div>
104
- </div>
105
- </div>
106
-
107
- <div class="field is-horizontal">
108
- <div class="field-label is-normal">
109
- <label class="label">
110
- {{ translations.shared.view_text_first_name }}
111
- </label>
112
- </div>
113
- <div class="field-body">
114
- <div class="field">
115
- <div class="control">
116
- <input name="first_name" v-model="storeUsers.user.first_name" type="text" class="input">
117
- </div>
118
- </div>
119
- </div>
120
- </div>
121
-
122
- <div class="field is-horizontal">
123
- <div class="field-label is-normal">
124
- <label class="label"> {{ translations.shared.view_text_last_name }} </label>
125
- </div>
126
- <div class="field-body">
127
- <div class="field">
128
- <div class="control">
129
- <input name="last_name" v-model="storeUsers.user.last_name" class="input">
130
- </div>
131
- </div>
132
- </div>
133
- </div>
134
-
135
- <div class="field is-horizontal">
136
- <div class="field-label is-normal">
137
- <label class="label"> {{ translations.shared.view_text_telephone }} </label>
138
- </div>
139
- <div class="field-body">
140
- <div class="field">
141
- <div class="control">
142
- <input name="user_number" v-model="storeUsers.user.telephone" class="input">
143
- </div>
144
- </div>
145
- </div>
146
- </div>
147
-
148
- <div class="field is-horizontal">
149
- <div class="field-label is-normal">
150
- <label class="label"> {{ translations.users.view_text_role }} </label>
151
- </div>
152
- <div class="field-body">
153
- <div class="field is-narrow">
154
- <div class="control">
155
- <div class="select is-fullwidth">
156
- <lesli-select
157
- :options="storeRoles.listOptions"
158
- v-model="storeUsers.user.roles_id">
159
- </lesli-select>
160
- </div>
161
- </div>
162
- </div>
163
- </div>
164
- </div>
165
-
166
- <div class="field is-horizontal">
167
- <div class="field-label is-normal">
168
- </div>
169
- <div class="field-body">
170
- <div class="field">
171
- <div class="control">
172
- <lesli-button icon="save">
173
- {{ translations.shared.view_btn_save }}
174
- </lesli-button>
175
- </div>
176
- </div>
177
- </div>
178
- </div>
179
- </lesli-form>
180
- </lesli-application>
181
- </template>