lesli_admin 0.1.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 (72) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +5 -0
  3. data/app/assets/config/lesli_admin_manifest.js +38 -0
  4. data/app/assets/javascripts/lesli_admin/application.js +3713 -0
  5. data/app/assets/stylesheets/lesli_admin/application.css +15 -0
  6. data/app/controllers/lesli_admin/accounts_controller.rb +125 -0
  7. data/app/controllers/lesli_admin/application_controller.rb +4 -0
  8. data/app/controllers/lesli_admin/dashboards_controller.rb +60 -0
  9. data/app/controllers/lesli_admin/users_controller.rb +244 -0
  10. data/app/helpers/lesli_admin/application_helper.rb +4 -0
  11. data/app/helpers/lesli_admin/dashboards_helper.rb +4 -0
  12. data/app/jobs/lesli_admin/application_job.rb +4 -0
  13. data/app/mailers/lesli_admin/application_mailer.rb +6 -0
  14. data/app/models/lesli_admin/account.rb +66 -0
  15. data/app/models/lesli_admin/application_record.rb +5 -0
  16. data/app/models/lesli_admin/dashboard.rb +4 -0
  17. data/app/models/lesli_admin/user.rb +4 -0
  18. data/app/services/lesli_admin/user_service.rb +300 -0
  19. data/app/views/layouts/lesli_admin/application.html.erb +15 -0
  20. data/app/views/lesli_admin/accounts/_account.html.erb +2 -0
  21. data/app/views/lesli_admin/accounts/_form.html.erb +17 -0
  22. data/app/views/lesli_admin/accounts/edit.html.erb +10 -0
  23. data/app/views/lesli_admin/accounts/index.html.erb +34 -0
  24. data/app/views/lesli_admin/accounts/new.html.erb +9 -0
  25. data/app/views/lesli_admin/accounts/show.html.erb +34 -0
  26. data/app/views/lesli_admin/dashboards/_dashboard.html.erb +2 -0
  27. data/app/views/lesli_admin/dashboards/_form.html.erb +17 -0
  28. data/app/views/lesli_admin/dashboards/edit.html.erb +10 -0
  29. data/app/views/lesli_admin/dashboards/index.html.erb +14 -0
  30. data/app/views/lesli_admin/dashboards/new.html.erb +9 -0
  31. data/app/views/lesli_admin/dashboards/show.html.erb +1 -0
  32. data/app/views/lesli_admin/partials/_engine-navigation.html.erb +52 -0
  33. data/app/views/lesli_admin/users/edit.html.erb +10 -0
  34. data/app/views/lesli_admin/users/index.html.erb +34 -0
  35. data/app/views/lesli_admin/users/new.html.erb +34 -0
  36. data/app/views/lesli_admin/users/show.html.erb +10 -0
  37. data/config/routes.rb +13 -0
  38. data/lib/lesli_admin/engine.rb +18 -0
  39. data/lib/lesli_admin/version.rb +3 -0
  40. data/lib/lesli_admin.rb +6 -0
  41. data/lib/tasks/lesli_admin_tasks.rake +4 -0
  42. data/lib/vue/application.js +153 -0
  43. data/lib/vue/apps/account/components/address-form.vue +134 -0
  44. data/lib/vue/apps/account/components/contact-form.vue +162 -0
  45. data/lib/vue/apps/account/components/form-information.vue +107 -0
  46. data/lib/vue/apps/account/show.vue +89 -0
  47. data/lib/vue/apps/dashboard/show.vue +33 -0
  48. data/lib/vue/apps/profile/components/change-email.vue +38 -0
  49. data/lib/vue/apps/profile/components/subscriptions.vue +94 -0
  50. data/lib/vue/apps/profile/show.vue +141 -0
  51. data/lib/vue/apps/users/components/information-card.vue +119 -0
  52. data/lib/vue/apps/users/components/information-form.vue +180 -0
  53. data/lib/vue/apps/users/components/integrations-information.vue +61 -0
  54. data/lib/vue/apps/users/components/management-roles.vue +109 -0
  55. data/lib/vue/apps/users/components/management-security.vue +113 -0
  56. data/lib/vue/apps/users/components/management-sessions.vue +106 -0
  57. data/lib/vue/apps/users/components/management-settings.vue +94 -0
  58. data/lib/vue/apps/users/index.vue +201 -0
  59. data/lib/vue/apps/users/new.vue +181 -0
  60. data/lib/vue/apps/users/show.vue +101 -0
  61. data/lib/vue/stores/account.js +113 -0
  62. data/lib/vue/stores/accountSettings.js +342 -0
  63. data/lib/vue/stores/descriptor.js +116 -0
  64. data/lib/vue/stores/descriptors.js +167 -0
  65. data/lib/vue/stores/integration.js +103 -0
  66. data/lib/vue/stores/role.js +243 -0
  67. data/lib/vue/stores/roles.js +89 -0
  68. data/lib/vue/stores/systemController.js +67 -0
  69. data/lib/vue/stores/user.js +319 -0
  70. data/lib/vue/stores/users.js +150 -0
  71. data/readme.md +28 -0
  72. metadata +130 -0
@@ -0,0 +1,342 @@
1
+ /*
2
+ Lesli
3
+
4
+ Copyright (c) 2023, Lesli Technologies, S. A.
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see http://www.gnu.org/licenses/.
18
+
19
+ Lesli · Ruby on Rails Development Platform.
20
+
21
+ Made with ♥ by https://www.lesli.tech
22
+ Building a better future, one line of code at a time.
23
+
24
+ @contact hello@lesli.tech
25
+ @website https://www.lesli.tech
26
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
27
+
28
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
+ // ·
30
+ */
31
+
32
+ // ·
33
+ import { defineStore } from "pinia";
34
+ import axios from "axios";
35
+
36
+ // ·
37
+ export const useAccountSettings = defineStore("account_settings", {
38
+ state: () => {
39
+ return {
40
+ view: 0,
41
+ submitting_form : false,
42
+ settings: {
43
+ datetime_format_date: null,
44
+ datetime_format_time: null,
45
+ datetime_format_date_words: null,
46
+ datetime_format_date_time: null,
47
+ datetime_format_date_time_words: null,
48
+ datetime_time_zone: null,
49
+ password_enforce_complexity: null,
50
+ password_minimum_length: null,
51
+ password_expiration_time_days: null,
52
+ password_special_char_count: null,
53
+ password_uppercase_count: null,
54
+ password_lowercase_count: null,
55
+ password_digit_count: null,
56
+ lesli_theme_color_primary: null,
57
+ lesli_theme_color_secondary: null,
58
+ lesli_theme_header_color: null,
59
+ lesli_theme_sidebar_color: null,
60
+ lesli_theme_color_background: null,
61
+ lesli_theme_font_color: null,
62
+ lesli_theme_font_size: null,
63
+ default_role_id: null,
64
+ },
65
+ old_settings: {
66
+ lesli_theme_color_primary: null,
67
+ lesli_theme_color_secondary: null,
68
+ lesli_theme_header_color: null,
69
+ lesli_theme_sidebar_color: null,
70
+ lesli_theme_color_background: null,
71
+ lesli_theme_font_color: null,
72
+ lesli_theme_font_size: null
73
+ },
74
+ options: {
75
+ time_zones: []
76
+ },
77
+ roles: {},
78
+ branding_logos: {},
79
+ record_files: [],
80
+ new_file: {
81
+ url: null
82
+ },
83
+ loading: false,
84
+ }
85
+ },
86
+ actions: {
87
+ /**
88
+ * @description This action is used to fetch the list of options for time zone.
89
+ */
90
+ getOptions (){
91
+ this.loading = true
92
+ this.http.get(this.url.admin("account/options")).then(result => {
93
+ this.options.time_zones = result.time_zones.map((time_zone)=> {
94
+ return {
95
+ label: time_zone.text,
96
+ value: time_zone.value
97
+ }
98
+ } )
99
+ }).catch(error => {
100
+ this.msg.danger(I18n.t("core.shared").messages_danger_internal_error)
101
+ }).finally(() => {
102
+ this.loading = false
103
+ })
104
+ },
105
+
106
+ /**
107
+ * @description This action is used to post the selected settings
108
+ */
109
+ postSettings() {
110
+ this.submitting_form = true
111
+ this.http.post(this.url.admin("account/settings"), {
112
+ settings: this.settings
113
+ }).then(result => {
114
+ this.msg.success(I18n.t("core.account/settings").messages_success_settings_saved_successfully)
115
+ }).catch(error => {
116
+ console.log(error)
117
+ this.msg.danger(I18n.t("core.shared").messages_danger_internal_error)
118
+ }).finally(() => {
119
+ this.submitting_form = false
120
+ this.getSettings()
121
+ })
122
+ },
123
+
124
+ /**
125
+ * @description This action is used to fetch the user's roles
126
+ */
127
+ getRoles(){
128
+ this.loading = true
129
+ this.http.get(this.url.admin("roles/list")).then(result => {
130
+ this.roles = result.map(record =>{
131
+ return {
132
+ label: record.name,
133
+ value: record.id,
134
+ };
135
+ })
136
+ }).catch(error => {
137
+ this.msg.danger(I18n.t("core.shared").messages_danger_internal_error)
138
+ }).finally(() => {
139
+ this.loading = false
140
+ })
141
+ },
142
+
143
+ /**
144
+ * @description This action is used to fetch the currently configured settings
145
+ */
146
+ getSettings (){
147
+ this.loading = true
148
+ this.http.get(this.url.admin("account/settings")).then(result => {
149
+ result.forEach(setting => {
150
+ if (setting.name in this.settings){
151
+ this.settings[setting.name] = setting.value
152
+ }
153
+ })
154
+ }).catch(error => {
155
+ this.msg.danger(I18n.t("core.shared").messages_danger_internal_error)
156
+ }).finally(() => {
157
+ this.loading = false
158
+ })
159
+ },
160
+
161
+ /**
162
+ * @description This action is used to replace the new settings with the old settings
163
+ * @param {Object} setting_name The setting that is going to be replaced
164
+ */
165
+ clearSetting(setting_name){
166
+ this.settings[setting_name] = this.old_settings[setting_name]
167
+ },
168
+
169
+ /**
170
+ * @description Initializing branding logos properties
171
+ */
172
+ initializeBrandingLogos(){
173
+ this.branding_logos = {
174
+ app_icon: {
175
+ identifier: 'app_icon',
176
+ name: I18n.t('core.account/files').column_enum_file_type_app_icon,
177
+ description: I18n.t('core.account/files').view_text_app_icon_description,
178
+ format: I18n.t('core.account/files').view_text_svg_png_formats,
179
+ accept: ".svg, .png",
180
+ submitting: false,
181
+ file: null
182
+ },
183
+ app_logo: {
184
+ identifier: 'app_logo',
185
+ name: I18n.t('core.account/files').column_enum_file_type_app_logo,
186
+ description: I18n.t('core.account/files').view_text_file_type_app_logo_description,
187
+ format: I18n.t('core.account/files').view_text_svg_png_formats,
188
+ accept: ".svg, .png",
189
+ submitting: false,
190
+ file: null
191
+ },
192
+ favicon: {
193
+ identifier: 'favicon',
194
+ name: I18n.t('core.account/files').column_enum_file_type_favicon,
195
+ description: I18n.t('core.account/files').view_text_file_favicon_svg_description,
196
+ format: I18n.t('core.account/files').view_text_svg_png_ico_formats,
197
+ accept: ".svg, .png, .ico",
198
+ submitting: false,
199
+ file: null
200
+ }
201
+ }
202
+ this.record_files = []
203
+ },
204
+
205
+ /**
206
+ * @description Get account logos files
207
+ */
208
+ getAccountLogos(){
209
+ this.loading = true
210
+ this.http.get(this.url.admin('account/files')).then(result => {
211
+ this.parseLogos(result)
212
+ }).catch(error => {
213
+ console.log(error)
214
+ this.msg.danger(I18n.t("core.shared").messages_danger_internal_error)
215
+ }).finally(() => {
216
+ this.loading = false
217
+ })
218
+ },
219
+
220
+ /**
221
+ * @description Parse logos to display the records in a table
222
+ */
223
+ parseLogos(files){
224
+ for(let i = 0; i < files.length; i++){
225
+ let file = files[i]
226
+ let branding_logo = this.branding_logos[file.file_type]
227
+ if(branding_logo){
228
+ this.branding_logos[file.file_type].file = file
229
+ }
230
+ }
231
+ this.record_files = this.branding_logos
232
+ },
233
+
234
+ /**
235
+ *
236
+ * @param {string} id
237
+ * @description This method is used to get the url of a file
238
+ * @returns {string} file url
239
+ */
240
+ getUrl(id) {
241
+ // · url to fetch file types that are allowed to upload
242
+ const url = this.url.admin('account/files/:id', id)
243
+ return url.toString()
244
+ },
245
+
246
+ /**
247
+ *
248
+ * @param {string} logo the logo to be deleted
249
+ * @description this action is used to delete a file from a cloud object.
250
+ */
251
+ deleteFile(logo) {
252
+ this.loading = true
253
+
254
+ // · url to delete file
255
+ const url = this.url.admin('account/files/:id', logo.id)
256
+ this.http.delete(url).then(() => {
257
+ // · fetch files after delete a file
258
+ this.getAccountLogos()
259
+ this.initializeBrandingLogos()
260
+ this.msg.success(I18n.t("core.shared").messages_success_files_deleted)
261
+ }).catch(error => {
262
+ console.log(error)
263
+ this.msg.danger(I18n.t("core.shared").messages_danger_files_deleted)
264
+ }).finally(() => {
265
+ this.loading = false
266
+ })
267
+ },
268
+
269
+ /**
270
+ *
271
+ * @param {string} logo the logo that is being uploaded
272
+ * @param {string} event
273
+ * @description this action is used to process a file that is going to be uploaded
274
+ */
275
+ processFile(event, logo) {
276
+
277
+ /*
278
+ const formData = new FormData();
279
+ formData.append('account_file[name]', "test")
280
+ formData.append('account_file[file_type]', "app_logo")
281
+ formData.append('account_file[attachment]', event.target.files[0]);
282
+ var headers = { 'Content-Type': 'multipart/form-data' };
283
+
284
+ this.http.post(this.url.admin('account/files'), formData, { headers }).then((res) => {
285
+ res.data.files; // binary representation of the file
286
+ res.status; // HTTP status
287
+ });
288
+
289
+ return
290
+ */
291
+ this.new_file = event.target.files[0]
292
+ //this.new_file.url = URL.createObjectURL(this.new_file)
293
+ this.postFile(logo)
294
+ },
295
+
296
+ /**
297
+ *
298
+ * @param {string} logo the logo to be deleted
299
+ * @description this action is used to post a file into account files
300
+ */
301
+ postFile(logo) {
302
+
303
+ const formData = new FormData()
304
+ formData.append('account_file[name]', logo.identifier)
305
+ formData.append('account_file[category]', logo.identifier)
306
+ formData.append('account_file[attachment]', this.new_file)
307
+ var headers = { 'Content-Type': 'multipart/form-data' };
308
+
309
+ this.http.postFile(this.url.admin('account/files'), formData).then((res) => {
310
+ //this.http.post(this.url.admin('account/files'), formData, { headers }).then((res) => {
311
+ this.msg.success(I18n.t("core.account/settings").messages_success_image_uploaded_successfully)
312
+ }).catch(error => {
313
+ console.log(error)
314
+ this.msg.danger(I18n.t("core.shared").messages_danger_files_deleted)
315
+ }).finally(()=>{
316
+ this.initializeBrandingLogos()
317
+ this.getAccountLogos()
318
+ })
319
+
320
+ },
321
+ /**
322
+ *
323
+ * @param {string} logo the logo to be deleted
324
+ * @description this action is used to show a dialog message to confirm the deletion
325
+ */
326
+ confirmFileDeletion(logo){
327
+ this.dialog
328
+ .confirmation({
329
+ title: `${I18n.t('core.account/files').messages_danger_delete_confirmation_title}: ${logo.name}`,
330
+ text: I18n.t('core.account/files').messages_danger_delete_confirmation_body,
331
+ confirmText: I18n.t("core.shared").view_btn_accept,
332
+ cancelText: I18n.t("core.shared").view_btn_cancel
333
+ })
334
+ .then(({ isConfirmed }) => {
335
+ if (isConfirmed) {
336
+ this.deleteFile(logo)
337
+ }
338
+ })
339
+ }
340
+
341
+ },
342
+ });
@@ -0,0 +1,116 @@
1
+ /*
2
+ Lesli
3
+
4
+ Copyright (c) 2023, Lesli Technologies, S. A.
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see http://www.gnu.org/licenses/.
18
+
19
+ All the information provided by this platform is protected by international laws related to
20
+ industrial property, intellectual property, copyright and relative international laws.
21
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
22
+ pictures and any other information belongs to the owner of this platform.
23
+
24
+ Made with ♥ by https://www.lesli.tech
25
+ Building a better future, one line of code at a time.
26
+
27
+ @contact hello@lesli.tech
28
+ @website https://www.lesli.tech
29
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
30
+
31
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
32
+ // ·
33
+ */
34
+
35
+
36
+ // ·
37
+ import { defineStore } from "pinia"
38
+
39
+
40
+ // ·
41
+ export const useDescriptor = defineStore("administration.descriptor", {
42
+ state: () => {
43
+ return {
44
+ list: [],
45
+ descriptor: {},
46
+ privileges: [],
47
+ privilegesLoading: false
48
+ }
49
+ },
50
+ actions: {
51
+
52
+ fetchDescriptor(id) {
53
+ if (this.descriptor.id != null) {
54
+ return
55
+ }
56
+
57
+ this.getDescriptor(id)
58
+ },
59
+
60
+ getDescriptor(id) {
61
+ this.http.get(this.url.admin("descriptors/:id", id)).then(result => {
62
+ this.descriptor = result
63
+ this.getDescriptorPrivileges()
64
+ }).catch(error => {
65
+ this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
66
+ }).finally(() => {
67
+
68
+ })
69
+ },
70
+
71
+ resetDescriptor() {
72
+ this.descriptor = {}
73
+ this.privileges = []
74
+ },
75
+
76
+ getDescriptorPrivileges() {
77
+ this.privilegesLoading = true
78
+ this.http.get(this.url.admin("descriptors/:id/privileges", this.descriptor.id)).then(result => {
79
+ this.privileges = result
80
+ }).catch(error => {
81
+ console.log(error)
82
+ }).finally(() => {
83
+ this.privilegesLoading = false
84
+ })
85
+ },
86
+
87
+ // Add privilege to descriptor
88
+ postDescriptorPrivilege(action) {
89
+
90
+ this.http.post(this.url.admin("descriptors/:id/privileges", this.descriptor.id), {
91
+ descriptor_privilege: {
92
+ //controller_id: action.controller_id,
93
+ action_id: action.action_id
94
+ }
95
+ }).then(result => {
96
+ console.log(result)
97
+ }).catch(error => {
98
+ console.log(error)
99
+ })
100
+ },
101
+
102
+
103
+ // Add privilege to descriptor
104
+ deleteDescriptorPrivilege(action) {
105
+ console.log(action)
106
+ this.http.delete(this.url.admin("descriptors/:descriptorId/privileges/:descriptorPrivilegeId", {
107
+ descriptorId: this.descriptor.id,
108
+ descriptorPrivilegeId: action.descriptor_privilege_id
109
+ })).then(result => {
110
+ console.log(result)
111
+ }).catch(error => {
112
+ console.log(error)
113
+ })
114
+ }
115
+ }
116
+ })
@@ -0,0 +1,167 @@
1
+ /*
2
+ Lesli
3
+
4
+ Copyright (c) 2023, Lesli Technologies, S. A.
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see http://www.gnu.org/licenses/.
18
+
19
+ Lesli · Ruby on Rails SaaS development platform.
20
+
21
+ Made with ♥ by https://www.lesli.tech
22
+ Building a better future, one line of code at a time.
23
+
24
+ @contact hello@lesli.tech
25
+ @website https://www.lesli.tech
26
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
27
+
28
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
+ // ·
30
+ */
31
+
32
+
33
+ // ·
34
+ import { defineStore } from "pinia"
35
+
36
+
37
+ // ·
38
+ export const useDescriptors = defineStore("administration.descriptors", {
39
+ state: () => {
40
+ return {
41
+ list: [],
42
+ descriptor: {},
43
+ index: {
44
+ loading: false,
45
+ pagination: {},
46
+ records: []
47
+ }
48
+ }
49
+ },
50
+ actions: {
51
+
52
+ fetchDescriptors() {
53
+ if (this.index.records.length > 0) {
54
+ return
55
+ }
56
+
57
+ this.getDescriptors()
58
+ },
59
+
60
+ getDescriptors() {
61
+ this.index.loading = true
62
+ this.http.get(this.url.admin("descriptors")).then(result => {
63
+ this.index.pagination = result.pagination
64
+ this.index.records = result.records
65
+ }).catch(error => {
66
+ this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
67
+ }).finally(() => {
68
+ this.index.loading = false
69
+ })
70
+ },
71
+
72
+ postDescriptor() {
73
+ this.loading = true
74
+ this.http.post(this.url.admin("descriptors"), { descriptor: this.descriptor }).then(result => {
75
+ this.descriptor.id = result.id
76
+ this.msg.success(I18n.t("core.users.messages_success_operation"))
77
+ this.loading = false
78
+ }).catch(error => {
79
+ this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
80
+ })
81
+ },
82
+
83
+ resetDescriptor() {
84
+ this.descriptor = {}
85
+ this.privileges = []
86
+ },
87
+
88
+ paginateIndex(page) {
89
+ console.log("store page: ", page)
90
+ this.index.pagination.page = page
91
+ //this.fetch(this.url.admin("descriptors").paginate(this.pagination.page))
92
+ },
93
+
94
+ /*
95
+ fetchDescriptorList() {
96
+ this.http.get(this.url.admin("descriptors/list")).then(result => {
97
+ this.list = result.map(descriptor => {
98
+ descriptor.active = false
99
+ return descriptor
100
+ })
101
+ })
102
+ },
103
+
104
+ /**
105
+ * @description This action is used to reset descriptor object
106
+ * /
107
+
108
+
109
+ /**
110
+ * @description This action is used to create a descriptor
111
+ * /
112
+
113
+
114
+ /**
115
+ * @description This action is used to update a descriptor
116
+ * /
117
+ updateDescriptor(){
118
+ this.loading = true
119
+ this.http.put(this.url.admin("descriptors/:id", this.descriptor.id), { descriptor: this.descriptor }).then(result => {
120
+ this.msg.success(I18n.t("core.users.messages_success_operation"))
121
+ this.loading = false
122
+ }).catch(error => {
123
+ this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
124
+ })
125
+
126
+ },
127
+ /**
128
+ * @description This action is used to sort the results
129
+ * /
130
+ sortIndex(column, direction) {
131
+ this.fetch(this.url.admin("descriptors").order(column, direction))
132
+ },
133
+ /**
134
+ * @description This action is used to search
135
+ * @param {string} search_string
136
+ * /
137
+ search(search_string) {
138
+ this.fetch(this.url.admin("descriptors").search(search_string))
139
+ },
140
+ /**
141
+ * @description This action is used to paginate index
142
+ * @param {string} page actual page
143
+ * /
144
+ paginateIndex(page) {
145
+ this.pagination.page = page
146
+ this.fetch(this.url.admin("descriptors").paginate(this.pagination.page))
147
+ },
148
+ /**
149
+ * @description This action is used to get descriptors as options
150
+ * /
151
+ getDescriptorsOptions(){
152
+ this.loading = true
153
+ this.descriptors_options = []
154
+ this.http.get(this.url.admin("descriptors/list")).then(result => {
155
+ result.forEach((descriptor)=>{
156
+ this.descriptors_options.push({
157
+ label: descriptor.name,
158
+ value: descriptor.id
159
+ })
160
+ })
161
+
162
+ this.loading = false
163
+ })
164
+ },
165
+ */
166
+ }
167
+ })