lesli 5.0.1 → 5.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (213) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/lesli_manifest.js +7 -4
  3. data/app/assets/fonts/lesli/Domine/Domine-VariableFont_wght.ttf +0 -0
  4. data/app/assets/fonts/lesli/Domine/OFL.txt +2 -0
  5. data/app/assets/javascripts/lesli/users/passwords.js +776 -0
  6. data/app/assets/javascripts/lesli/users/registrations.js +776 -0
  7. data/app/assets/javascripts/lesli/users/sessions.js +776 -1
  8. data/app/assets/stylesheets/lesli/users/passwords.scss +5 -6
  9. data/app/assets/stylesheets/lesli/users/registrations.scss +5 -6
  10. data/app/assets/stylesheets/lesli/users/sessions.scss +5 -10
  11. data/app/controllers/lesli/abouts_controller.rb +66 -0
  12. data/app/controllers/lesli/application_lesli_controller.rb +0 -1
  13. data/app/controllers/lesli/interfaces/application/logger.rb +9 -9
  14. data/app/controllers/lesli/roles_controller.rb +43 -0
  15. data/{lib/sass/lesli/devise/registrations.scss.erb → app/controllers/lesli/users_controller.rb} +18 -23
  16. data/app/controllers/users/registrations_controller.rb +137 -58
  17. data/app/helpers/lesli/assets_helper.rb +2 -2
  18. data/app/helpers/lesli/general_helper.rb +1 -1
  19. data/app/helpers/lesli/navigation_helper.rb +7 -10
  20. data/app/helpers/lesli/system_helper.rb +1 -1
  21. data/app/lib/lesli/system.rb +7 -3
  22. data/app/mailers/lesli/application_lesli_mailer.rb +199 -0
  23. data/app/mailers/lesli/application_mailer.rb +7 -0
  24. data/app/mailers/lesli/devise_mailer.rb +33 -0
  25. data/app/models/concerns/user_guard.rb +3 -4
  26. data/app/models/lesli/account.rb +29 -0
  27. data/{lib/sass/lesli/pages/passes.scss → app/models/lesli/descriptor.rb} +14 -8
  28. data/app/models/lesli/role.rb +90 -0
  29. data/app/models/lesli/system_controller.rb +1 -0
  30. data/app/models/lesli/user/detail.rb +55 -0
  31. data/{lib/sass/lesli/pages/otps.scss → app/models/lesli/user/role.rb} +13 -9
  32. data/app/models/lesli/user.rb +4 -3
  33. data/app/services/lesli/role_service.rb +45 -0
  34. data/app/services/lesli/user_service.rb +69 -0
  35. data/app/views/devise/passwords/new.html.erb +72 -12
  36. data/app/views/devise/registrations/new.html.erb +146 -28
  37. data/app/views/devise/sessions/new.html.erb +11 -78
  38. data/app/views/devise/shared/_links.html.erb +96 -25
  39. data/app/views/lesli/emails/devise_mailer/confirmation_instructions.html.erb +23 -0
  40. data/app/views/lesli/emails/user_mailer/invitation.html.erb +23 -0
  41. data/app/views/lesli/layouts/application-devise.html.erb +1 -1
  42. data/app/views/lesli/layouts/application-public.html.erb +2 -2
  43. data/app/views/lesli/layouts/mailer.html.erb +13 -0
  44. data/app/views/lesli/layouts/mailer.text.erb +1 -0
  45. data/app/views/lesli/partials/_application-lesli-header.html.erb +27 -41
  46. data/app/views/lesli/partials/_application-lesli-javascript.html.erb +10 -6
  47. data/app/views/lesli/partials/_application-public-javascript.html.erb +12 -8
  48. data/{lib/sass/lesli/devise/confirmations.scss.erb → app/views/lesli/wrappers/_application-devise-simple.erb} +30 -46
  49. data/app/views/lesli/wrappers/{_application-auth.html.erb → _application-devise.html.erb} +15 -0
  50. data/config/initializers/{lesli_defaults.rb → lesli.rb} +4 -2
  51. data/config/locales/translations.en.yml +7 -0
  52. data/config/locales/translations.es.yml +7 -0
  53. data/config/routes.rb +24 -17
  54. data/db/migrate/v1.0/0010000210_create_lesli_roles.rb +1 -1
  55. data/db/{tables/0010003010_create_user_details.rb → migrate/v1.0/0010003010_create_lesli_user_details.rb} +6 -6
  56. data/db/{tables/0010003510_create_user_roles.rb → migrate/v1.0/0010003410_create_lesli_user_roles.rb} +4 -4
  57. data/db/{tables/0010005010_create_descriptors.rb → migrate/v1.0/0010005010_create_lesli_descriptors.rb} +5 -6
  58. data/db/{tables/0010005110_create_descriptor_privileges.rb → migrate/v1.0/0010005110_create_lesli_descriptor_privileges.rb} +8 -7
  59. data/db/{tables/0010005210_create_descriptor_activities.rb → migrate/v1.0/0010005210_create_lesli_descriptor_activities.rb} +6 -8
  60. data/db/seeds.rb +0 -2
  61. data/lib/lesli/engine.rb +25 -2
  62. data/lib/lesli/routing.rb +26 -0
  63. data/lib/lesli/version.rb +2 -2
  64. data/lib/lesli.rb +1 -0
  65. data/lib/{sass/lesli/pages/mfas.scss → mailer_previews/devise_mailer_preview.rb} +12 -6
  66. data/lib/sass/lesli/bulma/loader.scss +3 -0
  67. data/lib/sass/lesli/elements/header.scss +1 -1
  68. data/lib/sass/lesli/fonts/families.scss +3 -3
  69. data/lib/sass/lesli/layouts/application-container.scss +4 -0
  70. data/lib/sass/lesli/{devise/passwords.scss.erb → pages/devise-simple.scss} +38 -38
  71. data/lib/sass/lesli/{templates → pages}/devise.scss +4 -26
  72. data/lib/sass/lesli/settings/variables.scss +1 -1
  73. data/lib/sass/lesli/templates/application.scss +8 -4
  74. data/lib/sass/lesli/templates/dashboards.scss +8 -0
  75. data/lib/sass/lesli/templates/public.scss +2 -3
  76. data/lib/tasks/lesli/controllers.rake +33 -0
  77. data/lib/tasks/lesli/db.rake +88 -0
  78. data/lib/tasks/lesli/git.rake +74 -0
  79. data/lib/tasks/lesli_tasks.rake +70 -20
  80. data/lib/vue/devise/registrations.js +10 -15
  81. data/lib/vue/layouts/application-container.vue +10 -2
  82. data/lib/vue/layouts/application-header.vue +10 -3
  83. data/lib/vue/stores/account.js +113 -0
  84. data/lib/vue/stores/role.js +243 -0
  85. data/lib/vue/stores/translations.json +86 -0
  86. data/lib/vue/stores/user.js +102 -0
  87. data/lib/{sass/lesli/devise/sessions.scss → vue/translation.js} +14 -5
  88. data/lib/webpack/base.js +2 -2
  89. data/lib/webpack/core.js +2 -0
  90. data/readme.md +74 -55
  91. data/vendor/bulma/LICENSE +21 -0
  92. data/vendor/bulma/bulma.sass +10 -0
  93. data/vendor/bulma/css/bulma-rtl.css +11851 -0
  94. data/vendor/bulma/css/bulma-rtl.min.css +1 -0
  95. data/vendor/bulma/css/bulma.css +11851 -0
  96. data/vendor/bulma/css/bulma.min.css +1 -0
  97. data/vendor/bulma/sass/base/_all.sass +6 -0
  98. data/vendor/bulma/sass/base/animations.sass +5 -0
  99. data/vendor/bulma/sass/base/generic.sass +145 -0
  100. data/vendor/bulma/sass/base/helpers.sass +1 -0
  101. data/vendor/bulma/sass/base/minireset.sass +79 -0
  102. data/vendor/bulma/sass/components/_all.sass +15 -0
  103. data/vendor/bulma/sass/components/breadcrumb.sass +77 -0
  104. data/vendor/bulma/sass/components/card.sass +103 -0
  105. data/vendor/bulma/sass/components/dropdown.sass +83 -0
  106. data/vendor/bulma/sass/components/level.sass +79 -0
  107. data/vendor/bulma/sass/components/media.sass +59 -0
  108. data/vendor/bulma/sass/components/menu.sass +59 -0
  109. data/vendor/bulma/sass/components/message.sass +101 -0
  110. data/vendor/bulma/sass/components/modal.sass +117 -0
  111. data/vendor/bulma/sass/components/navbar.sass +446 -0
  112. data/vendor/bulma/sass/components/pagination.sass +167 -0
  113. data/vendor/bulma/sass/components/panel.sass +121 -0
  114. data/vendor/bulma/sass/components/tabs.sass +176 -0
  115. data/vendor/bulma/sass/elements/_all.sass +16 -0
  116. data/vendor/bulma/sass/elements/box.sass +26 -0
  117. data/vendor/bulma/sass/elements/button.sass +357 -0
  118. data/vendor/bulma/sass/elements/container.sass +29 -0
  119. data/vendor/bulma/sass/elements/content.sass +162 -0
  120. data/vendor/bulma/sass/elements/form.sass +1 -0
  121. data/vendor/bulma/sass/elements/icon.sass +46 -0
  122. data/vendor/bulma/sass/elements/image.sass +73 -0
  123. data/vendor/bulma/sass/elements/notification.sass +52 -0
  124. data/vendor/bulma/sass/elements/other.sass +31 -0
  125. data/vendor/bulma/sass/elements/progress.sass +73 -0
  126. data/vendor/bulma/sass/elements/table.sass +134 -0
  127. data/vendor/bulma/sass/elements/tag.sass +140 -0
  128. data/vendor/bulma/sass/elements/title.sass +70 -0
  129. data/vendor/bulma/sass/form/_all.sass +9 -0
  130. data/vendor/bulma/sass/form/checkbox-radio.sass +22 -0
  131. data/vendor/bulma/sass/form/file.sass +184 -0
  132. data/vendor/bulma/sass/form/input-textarea.sass +66 -0
  133. data/vendor/bulma/sass/form/select.sass +88 -0
  134. data/vendor/bulma/sass/form/shared.sass +60 -0
  135. data/vendor/bulma/sass/form/tools.sass +215 -0
  136. data/vendor/bulma/sass/grid/_all.sass +5 -0
  137. data/vendor/bulma/sass/grid/columns.sass +513 -0
  138. data/vendor/bulma/sass/grid/tiles.sass +36 -0
  139. data/vendor/bulma/sass/helpers/_all.sass +12 -0
  140. data/vendor/bulma/sass/helpers/color.sass +39 -0
  141. data/vendor/bulma/sass/helpers/flexbox.sass +35 -0
  142. data/vendor/bulma/sass/helpers/float.sass +10 -0
  143. data/vendor/bulma/sass/helpers/other.sass +14 -0
  144. data/vendor/bulma/sass/helpers/overflow.sass +2 -0
  145. data/vendor/bulma/sass/helpers/position.sass +7 -0
  146. data/vendor/bulma/sass/helpers/spacing.sass +31 -0
  147. data/vendor/bulma/sass/helpers/typography.sass +103 -0
  148. data/vendor/bulma/sass/helpers/visibility.sass +122 -0
  149. data/vendor/bulma/sass/layout/_all.sass +6 -0
  150. data/vendor/bulma/sass/layout/footer.sass +11 -0
  151. data/vendor/bulma/sass/layout/hero.sass +153 -0
  152. data/vendor/bulma/sass/layout/section.sass +17 -0
  153. data/vendor/bulma/sass/utilities/_all.sass +9 -0
  154. data/vendor/bulma/sass/utilities/animations.sass +1 -0
  155. data/vendor/bulma/sass/utilities/controls.sass +49 -0
  156. data/vendor/bulma/sass/utilities/derived-variables.sass +114 -0
  157. data/vendor/bulma/sass/utilities/extends.sass +25 -0
  158. data/vendor/bulma/sass/utilities/functions.sass +135 -0
  159. data/vendor/bulma/sass/utilities/initial-variables.sass +79 -0
  160. data/vendor/bulma/sass/utilities/mixins.sass +303 -0
  161. data/vendor/lesli-css/_index.scss +34 -0
  162. data/vendor/lesli-css/lesli.scss +51 -0
  163. data/{app/assets/stylesheets/lesli/users/devise.scss → vendor/lesli-css/license} +7 -11
  164. data/vendor/lesli-css/src/base/fonts.scss +50 -0
  165. data/vendor/lesli-css/src/base/normalize.scss +118 -0
  166. data/vendor/lesli-css/src/components/blockquote.scss +61 -0
  167. data/vendor/lesli-css/src/components/columns.scss +92 -0
  168. data/vendor/lesli-css/src/components/container.scss +47 -0
  169. data/vendor/lesli-css/src/components/grid.scss +0 -0
  170. data/vendor/lesli-css/src/components/navigation.scss +59 -0
  171. data/vendor/lesli-css/src/functions/colors.scss +184 -0
  172. data/vendor/lesli-css/src/helpers/units.scss +44 -0
  173. data/vendor/lesli-css/src/mixins/breakpoint.scss +184 -0
  174. data/vendor/lesli-css/src/mixins/flex.scss +80 -0
  175. data/vendor/lesli-css/src/mixins/scrollbar.scss +46 -0
  176. data/vendor/lesli-css/src/settings/variables.scss +26 -0
  177. data/vendor/lesli-css/tests/base/normalize.spec.scss +125 -0
  178. data/vendor/lesli-css/tests/functions/colors.spec.scss +117 -0
  179. data/vendor/lesli-css/tests/mixins/breakpoint.spec.scss +429 -0
  180. data/vendor/lesli-css/tests/mixins/scrollbar.spec.scss +82 -0
  181. data/vendor/lesli-css/vendor/normalize.scss +351 -0
  182. data/vendor/remixicon/License +201 -0
  183. data/vendor/remixicon/fonts/remixicon.css +2583 -0
  184. metadata +290 -51
  185. data/app/assets/fonts/lesli/Domine/Domine-Bold.ttf +0 -0
  186. data/app/assets/fonts/lesli/Domine/Domine-Regular.ttf +0 -0
  187. data/app/controllers/lesli/profiles_controller.rb +0 -60
  188. data/app/helpers/lesli/profiles_helper.rb +0 -4
  189. data/app/models/lesli/profile.rb +0 -4
  190. data/app/views/lesli/devise/sessions/_form.html.erb +0 -17
  191. data/app/views/lesli/devise/sessions/_session.html.erb +0 -2
  192. data/app/views/lesli/devise/sessions/edit.html.erb +0 -10
  193. data/app/views/lesli/devise/sessions/index.html.erb +0 -14
  194. data/app/views/lesli/devise/sessions/new.html.erb +0 -9
  195. data/app/views/lesli/devise/sessions/show.html.erb +0 -10
  196. data/app/views/lesli/profiles/_form.html.erb +0 -17
  197. data/app/views/lesli/profiles/_profile.html.erb +0 -2
  198. data/app/views/lesli/profiles/edit.html.erb +0 -10
  199. data/app/views/lesli/profiles/index.html.erb +0 -14
  200. data/app/views/lesli/profiles/new.html.erb +0 -9
  201. data/app/views/lesli/profiles/show.html.erb +0 -10
  202. data/lib/sass/lesli/pages/dashboards.scss +0 -57
  203. data/lib/tasks/db.rb +0 -76
  204. data/lib/vue/stores/profile.js +0 -90
  205. data/lib/vue/stores/workflow2.js +0 -345
  206. data/lib/vue/stores/workflows/actions.js +0 -327
  207. data/lib/vue/stores/workflows/associations.js +0 -130
  208. data/lib/vue/stores/workflows/checks.js +0 -210
  209. /data/lib/vue/stores/{announcements.js → entities/announcements.js} +0 -0
  210. /data/lib/vue/stores/{dashboard.js → entities/dashboard.js} +0 -0
  211. /data/lib/vue/stores/{workflow.js → entities/workflow.js} +0 -0
  212. /data/lib/vue/stores/{cloud-bell → panels}/notification.js +0 -0
  213. /data/lib/vue/stores/{firebase.js → services/firebase.js} +0 -0
@@ -1,327 +0,0 @@
1
- /*
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 · Your Smart Business Assistant.
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://lesli.tech
27
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
-
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
- // ·
31
-
32
- */
33
-
34
-
35
- // · This store is needed to make http requests, manage the reactivity
36
- // · of a workflow.
37
-
38
- import { defineStore } from "pinia"
39
-
40
- import { useWorkflow } from "Lesli/stores/shared/workflow"
41
- import { useRouter } from "vue-router"
42
-
43
- export const useActions = defineStore("core.shared.workflow.actions", {
44
- state: () => {
45
- return {
46
- storeWorkflow: useWorkflow(),
47
- actions: [],
48
- loading: false,
49
- action: {
50
- active: true,
51
- initial_status_id: null,
52
- final_status_id: null,
53
- name: '',
54
- action_type: null,
55
- execute_immediately: false,
56
- template_path: null,
57
- input_data: {},
58
- system_data: {},
59
- concerning_users: {
60
- list: [
61
- {}
62
- ],
63
- type: ""
64
- },
65
- configuration: {}
66
- },
67
- concerning_users: {
68
- type: null
69
- },
70
- options: {
71
- statuses: [],
72
- action_types: [],
73
- concerning_user_types: [],
74
- users: [],
75
- task_importances: [],
76
- task_types: []
77
- },
78
- file_options: {
79
- templates: {},
80
- file_types: []
81
- },
82
- clone_options: {},
83
- action_unavailable: false
84
- }
85
- },
86
- actions: {
87
- /**
88
- * @description This action is used to fetch the list of actions for a workflow
89
- */
90
- fetchActions() {
91
- this.loading = true
92
-
93
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/actions`, { workflowId: this.storeWorkflow.workflow.id })
94
-
95
- this.http.get(url).then(result => {
96
- this.actions = result
97
- }).catch(error => {
98
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
99
- }).finally(() => {
100
- this.loading = false
101
- })
102
- },
103
-
104
- /**
105
- * @description This action is used to reset the store
106
- */
107
- reset() {
108
- this.action = {
109
- active: true,
110
- initial_status_id: null,
111
- final_status_id: null,
112
- name: '',
113
- action_type: null,
114
- execute_immediately: false,
115
- template_path: null,
116
- input_data: {},
117
- system_data: {},
118
- concerning_users: {
119
- list: [
120
- {}
121
- ],
122
- type: ""
123
- },
124
- configuration: {},
125
- concerning_user_types: ""
126
- }
127
- },
128
- /**
129
- * @description This action is used to get the information from a action
130
- * @param {Integer} action_id id of the action to be fetched
131
- */
132
- fetchAction (action_id){
133
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/actions/:actionId`, { workflowId: this.storeWorkflow.workflow.id, actionId: action_id })
134
-
135
- this.http.get(url).then(result => {
136
- this.action = result
137
- }).catch(error => {
138
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
139
- })
140
- },
141
- /**
142
- * @description This action is used to post an action for a workflow
143
- */
144
- postAction (){
145
-
146
- let data = {
147
- workflow_action: this.action
148
- }
149
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/actions`, { workflowId: this.storeWorkflow.workflow.id })
150
-
151
- this.http.post(url, data).then(result => {
152
- this.action = {}
153
- this.actions.push(result)
154
- this.msg.success(I18n.t("core.users.messages_success_operation"))
155
- }).catch(error => {
156
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
157
- }).finally(()=>{
158
- this.loading = false
159
- })
160
- },
161
- /**
162
- * @description This action is used to update an action for a workflow
163
- */
164
- updateAction (){
165
-
166
- let data = {
167
- workflow_action: this.action
168
- }
169
-
170
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/actions/:actionId`, { workflowId: this.storeWorkflow.workflow.id, actionId: this.action.id })
171
-
172
- this.http.put(url, data).then(result => {
173
- this.action = result
174
- this.msg.success(I18n.t("core.users.messages_success_operation"))
175
- }).catch(error => {
176
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
177
- }).finally(()=>{
178
- this.loading = false
179
- })
180
- },
181
-
182
- /**
183
- * @description This action is used to translate the options for an enum
184
- * @param {Object, String, String}
185
- */
186
- translateEnum( translations, enum_prefix, value){
187
- const new_value = translations[`${enum_prefix}_${value}`]
188
- if(new_value){
189
- return new_value
190
- }
191
-
192
- return value
193
- },
194
- /**
195
- * @description This action is used to get options for check form
196
- */
197
- getOptions(){
198
- this.options = {
199
- statuses: [],
200
- action_types: [],
201
- concerning_user_types: []
202
- }
203
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/actions/options`, { workflowId: this.storeWorkflow.workflow.id })
204
-
205
- this.loading = true
206
-
207
- this.http.get(url).then(result => {
208
-
209
- Object.values(result["statuses"]).forEach((status)=>{
210
- this.options["statuses"].push({
211
- label: status.name,
212
- value: status.id
213
- })
214
- })
215
-
216
- result["action_types"].forEach((type)=>{
217
- this.options["action_types"].push({
218
- label: this.translateEnum(I18n.t('core.workflow/actions'), 'column_enum_action_type', type.text),
219
- value: type.value
220
- })
221
- })
222
-
223
- result["concerning_user_types"].forEach((type)=>{
224
- this.options["concerning_user_types"].push({
225
- label: this.translateEnum(I18n.t('core.workflow/actions'), 'column_enum_action_type', type.text),
226
- value: type.value
227
- })
228
- })
229
-
230
- }).catch(error => {
231
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
232
- }).finally(()=>{
233
- this.loading = false
234
- })
235
- },
236
- /**
237
- * @description This action is used to get options for users to assign
238
- */
239
- getUsers(){
240
- this.http.get(this.url.admin("users/list")).then(result => {
241
- this.options["users"] = result
242
- }).catch(error => {
243
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
244
- })
245
- },
246
- /**
247
- * @description This action is used to get options for the task form
248
- */
249
- getTasksOptions (){
250
- this.loading = true
251
-
252
- this.options.task_importances = []
253
- this.options.task_types = []
254
-
255
- this.http.get(this.url.focus("tasks/options")).then(result => {
256
-
257
- result["task_types"].forEach((type)=>{
258
- this.options["task_types"].push({
259
- label: type.text,
260
- value: type.value
261
- })
262
- })
263
-
264
- result["importances"].forEach((importance)=>{
265
- this.options["task_importances"].push({
266
- label: importance.text,
267
- value: importance.value
268
- })
269
- })
270
-
271
- this.loading = false
272
- }).catch(error => {
273
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
274
- })
275
-
276
- },
277
- /**
278
- * @description This action is used to get options for creating a file
279
- */
280
- getCloudObjectFileOptions(){
281
- this.loading = true
282
-
283
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/actions/resources/options_create_cloud_object_file`, { workflowId: this.storeWorkflow.workflow.id })
284
-
285
- this.http.get(url).then(result => {
286
- if(result && result.templates.length > 0){
287
- this.file_options.templates = result.templates
288
- this.file_options.file_types = result.file_types
289
- }else{
290
- this.action_unavailable = true
291
- }
292
- this.loading = false
293
- }).catch(error => {
294
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
295
- })
296
- },
297
- /**
298
- * @description This action is used to get options for the clone object form
299
- */
300
- getCloneOptions(){
301
- this.loading = true
302
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/actions/resources/options_cloud_object_clone`, { workflowId: this.storeWorkflow.workflow.id })
303
-
304
- this.http.get(url).then(result => {
305
- if(result){
306
- for(let key in result){
307
- this.clone_options[key] = result[key]
308
- }
309
- }else{
310
- this.action_unavailable = true
311
- }
312
- this.loading = false
313
- }).catch(error => {
314
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
315
- })
316
- },
317
- /**
318
- * @description This action is used to add a reference to use on backend action
319
- * @param {String, String}
320
- */
321
- addReference(reference, field){
322
- let field_value = this.action.input_data[field] || ''
323
- this.action.input_data[field] = `${field_value} %${reference}% `
324
- }
325
-
326
- }
327
- })
@@ -1,130 +0,0 @@
1
- /*
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 · Your Smart Business Assistant.
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://lesli.tech
27
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
-
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
- // ·
31
-
32
- */
33
-
34
-
35
- // · This store is needed to make http requests, manage the reactivity
36
- // · of a workflow.
37
-
38
- import { defineStore } from "pinia"
39
-
40
- import { useWorkflow } from "Lesli/stores/shared/workflow"
41
-
42
- export const useAssociations = defineStore("core.shared.workflow.associations", {
43
- state: () => {
44
- return {
45
- storeWorkflow: useWorkflow(),
46
- associations: [],
47
- loading: false,
48
- options_select: [],
49
- options: [],
50
- association_details: {},
51
- association: {},
52
- select_details: []
53
- }
54
- },
55
- actions: {
56
- /**
57
- * @description This action is used to fetch the list of options for a workflow association
58
- */
59
- getAssociationOptions(){
60
- this.loading = true
61
- this.options_select = []
62
-
63
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/associations/options`)
64
-
65
- this.http.get(url).then(result => {
66
- this.options = result
67
- result.forEach((option)=>{
68
- this.options_select.push({
69
- label: option.name,
70
- value: option.workflow_for
71
- })
72
-
73
- })
74
-
75
- this.loading = false
76
-
77
- }).catch(error => {
78
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
79
- })
80
- },
81
- /**
82
- * @description This action is used to post a new association for a workflow
83
- */
84
- postAssociation(){
85
- this.loading = true
86
-
87
- let data = {
88
- workflow_association: this.association
89
- }
90
-
91
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/${this.storeWorkflow.workflow.id}/associations`)
92
-
93
- this.http.post(url, data).then(result => {
94
- this.association = {}
95
- this.msg.success(I18n.t("core.users.messages_success_operation"))
96
- this.getAssociations()
97
- }).catch(error => {
98
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
99
- }).finally(()=>{
100
- this.loading = false
101
- })
102
- },
103
- /**
104
- * @description This action is used to get workflow associations
105
- */
106
- getAssociations () {
107
- this.loading = true
108
- this.associations = []
109
-
110
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/${this.storeWorkflow.workflow.id}/associations`)
111
-
112
- this.http.get(url).then(result => {
113
- this.associations = result
114
- this.loading = false
115
- }).catch(error => {
116
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
117
- })
118
- },
119
- deleteAssociation(association_id){
120
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/${this.storeWorkflow.workflow.id}/associations/:associationId`, {associationId: association_id})
121
-
122
- this.http.delete(url).then(result => {
123
- this.getAssociations()
124
- this.msg.success(I18n.t("core.users.messages_success_operation"))
125
- }).catch(error => {
126
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
127
- })
128
- },
129
- }
130
- })
@@ -1,210 +0,0 @@
1
- /*
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 · Your Smart Business Assistant.
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://lesli.tech
27
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
-
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
- // ·
31
-
32
- */
33
-
34
-
35
- // · This store is needed to make http requests, manage the reactivity
36
- // · of a workflow.
37
-
38
- import { defineStore } from "pinia"
39
-
40
- import { useWorkflow } from "Lesli/stores/shared/workflow"
41
-
42
- export const useChecks = defineStore("core.shared.workflow.checks", {
43
- state: () => {
44
- return {
45
- storeWorkflow: useWorkflow(),
46
- checks: [],
47
- loading: false,
48
- check: {},
49
- showPanel: false,
50
- options: {
51
- users: [],
52
- roles: [],
53
- statuses: [],
54
- user_types: []
55
- }
56
- }
57
- },
58
- actions: {
59
- /**
60
- * @description This action is used to fetch the list of checks for a workflow
61
- */
62
- fetchChecks() {
63
- this.loading = true
64
-
65
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/checks`, { workflowId: this.storeWorkflow.workflow.id })
66
-
67
- this.http.get(url).then(result => {
68
- this.checks = result
69
- }).catch(error => {
70
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
71
- }).finally(() => {
72
- this.loading = false
73
- })
74
- },
75
-
76
- /**
77
- * @description This action is used to reset the store
78
- */
79
- reset() {
80
- this.check = {
81
- initial_status_id: null,
82
- role_id: null,
83
- user_type: null
84
- }
85
- },
86
- /**
87
- * @description This action is used to get the information from a check
88
- */
89
- async fetchCheck (check_id){
90
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/checks/:checkId`, { workflowId: this.storeWorkflow.workflow.id, checkId: check_id })
91
- this.loading = true
92
- return this.http.get(url).then(result => {
93
- this.check = result
94
- this.loading = false
95
- }).catch(error => {
96
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
97
- })
98
- },
99
- /**
100
- * @description This action is used to post a check for a workflow
101
- */
102
- postCheck (){
103
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/checks`, { workflowId: this.storeWorkflow.workflow.id })
104
-
105
- this.http.post(url, {
106
- workflow_check: this.check
107
- }).then(result => {
108
- this.check = {}
109
- this.checks.push(result)
110
- this.msg.success(I18n.t("core.users.messages_success_operation"))
111
- }).catch(error => {
112
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
113
- }).finally(()=>{
114
- this.loading = false
115
- })
116
- },
117
- /**
118
- * @description This action is used to update a check for a workflow
119
- */
120
- putCheck(){
121
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/checks/:checkId`, { workflowId: this.storeWorkflow.workflow.id, checkId: this.check.id })
122
- this.loading = true
123
-
124
- this.http.put(url, {
125
- workflow_check: this.check
126
- }).then(result => {
127
- this.msg.success(I18n.t("core.users.messages_success_operation"))
128
- this.loading = false
129
- }).catch(error => {
130
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
131
- })
132
- },
133
-
134
- /**
135
- * @description This action is used to get options for check form
136
- */
137
- getCheckOptions(){
138
- this.options = {
139
- users: [],
140
- roles: [],
141
- statuses: [],
142
- user_types: []
143
- }
144
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/checks/options`, { workflowId: this.storeWorkflow.workflow.id })
145
-
146
- this.loading = true
147
-
148
- this.http.get(url).then(result => {
149
-
150
- this.options["users"] = result["users"]
151
-
152
- result["roles"].forEach((role)=>{
153
- this.options["roles"].push({
154
- label: role.name,
155
- value: role.id
156
- })
157
- })
158
-
159
- Object.values(result["statuses"]).forEach((status)=>{
160
- this.options["statuses"].push({
161
- label: status.name,
162
- value: status.id
163
- })
164
- })
165
-
166
- result["user_types"].forEach((type)=>{
167
- this.options["user_types"].push({
168
- label: type.text,
169
- value: type.value
170
- })
171
- })
172
-
173
- }).catch(error => {
174
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
175
- }).finally(()=>{
176
- this.loading = false
177
- })
178
- },
179
-
180
- /**
181
- * @description This action is used to check if the workflow check exists to create or update the chek
182
- */
183
- formSubmit() {
184
- if (this.check.id) {
185
- this.putCheck()
186
- } else {
187
- this.postCheck()
188
- }
189
- this.reset()
190
- this.fetchChecks()
191
- this.showPanel = false
192
- },
193
- /**
194
- * @description This action is used to delete a check for a workflow
195
- */
196
- deleteCheck(check_id){
197
- this.loading = true
198
- const url = this.url[this.storeWorkflow.cloudModule](`${this.storeWorkflow.cloudObject}/:workflowId/checks/:checkId`, { workflowId: this.storeWorkflow.workflow.id, checkId: check_id })
199
-
200
- this.http.delete(url).then(result => {
201
- this.checks = this.checks.filter(check => check.id != check_id)
202
- this.msg.success(I18n.t("core.users.messages_success_operation"))
203
- this.loading = false
204
- }).catch(error => {
205
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
206
- })
207
- },
208
-
209
- }
210
- })