lesli 5.0.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 (398) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +3 -0
  3. data/app/assets/config/lesli_manifest.js +53 -0
  4. data/app/assets/fonts/lesli/Domine/Domine-Bold.ttf +0 -0
  5. data/app/assets/fonts/lesli/Domine/Domine-Regular.ttf +0 -0
  6. data/app/assets/fonts/lesli/Domine/OFL.txt +95 -0
  7. data/app/assets/fonts/lesli/MaterialDesign/icons.woff2 +0 -0
  8. data/app/assets/fonts/lesli/Montserrat/Montserrat-Variable.ttf +0 -0
  9. data/app/assets/fonts/lesli/OpenSans/OpenSans-Variable.ttf +0 -0
  10. data/app/assets/fonts/lesli/Remix/remixicon.eot +0 -0
  11. data/app/assets/fonts/lesli/Remix/remixicon.glyph.json +1 -0
  12. data/app/assets/fonts/lesli/Remix/remixicon.svg +7633 -0
  13. data/app/assets/fonts/lesli/Remix/remixicon.symbol.svg +11 -0
  14. data/app/assets/fonts/lesli/Remix/remixicon.ttf +0 -0
  15. data/app/assets/fonts/lesli/Remix/remixicon.woff +0 -0
  16. data/app/assets/fonts/lesli/Remix/remixicon.woff2 +0 -0
  17. data/app/assets/fonts/lesli/Roboto/LICENSE.txt +202 -0
  18. data/app/assets/fonts/lesli/Roboto/Roboto-Black.ttf +0 -0
  19. data/app/assets/fonts/lesli/Roboto/Roboto-BlackItalic.ttf +0 -0
  20. data/app/assets/fonts/lesli/Roboto/Roboto-Bold.ttf +0 -0
  21. data/app/assets/fonts/lesli/Roboto/Roboto-BoldItalic.ttf +0 -0
  22. data/app/assets/fonts/lesli/Roboto/Roboto-Italic.ttf +0 -0
  23. data/app/assets/fonts/lesli/Roboto/Roboto-Light.ttf +0 -0
  24. data/app/assets/fonts/lesli/Roboto/Roboto-LightItalic.ttf +0 -0
  25. data/app/assets/fonts/lesli/Roboto/Roboto-Medium.ttf +0 -0
  26. data/app/assets/fonts/lesli/Roboto/Roboto-MediumItalic.ttf +0 -0
  27. data/app/assets/fonts/lesli/Roboto/Roboto-Regular.ttf +0 -0
  28. data/app/assets/fonts/lesli/Roboto/Roboto-Thin.ttf +0 -0
  29. data/app/assets/fonts/lesli/Roboto/Roboto-ThinItalic.ttf +0 -0
  30. data/app/assets/icons/lesli/cloud-admin.svg +1 -0
  31. data/app/assets/icons/lesli/cloud-audit.svg +1 -0
  32. data/app/assets/icons/lesli/cloud-babel.svg +1 -0
  33. data/app/assets/icons/lesli/cloud-bell.svg +1 -0
  34. data/app/assets/icons/lesli/cloud-books.svg +1 -0
  35. data/app/assets/icons/lesli/cloud-development.svg +1 -0
  36. data/app/assets/icons/lesli/cloud-dispatcher.svg +1 -0
  37. data/app/assets/icons/lesli/cloud-driver.svg +1 -0
  38. data/app/assets/icons/lesli/cloud-focus.svg +1 -0
  39. data/app/assets/icons/lesli/cloud-help.svg +1 -0
  40. data/app/assets/icons/lesli/cloud-kb.svg +1 -0
  41. data/app/assets/icons/lesli/cloud-leaf.svg +1 -0
  42. data/app/assets/icons/lesli/cloud-lesli.svg +1 -0
  43. data/app/assets/icons/lesli/cloud-mailer.svg +1 -0
  44. data/app/assets/icons/lesli/cloud-one.svg +1 -0
  45. data/app/assets/icons/lesli/cloud-profile.svg +1 -0
  46. data/app/assets/icons/lesli/cloud-proposal.svg +1 -0
  47. data/app/assets/icons/lesli/cloud-scraper.svg +1 -0
  48. data/app/assets/icons/lesli/cloud-shared.svg +1 -0
  49. data/app/assets/icons/lesli/cloud-storage.svg +1 -0
  50. data/app/assets/icons/lesli/cloud-talk.svg +1 -0
  51. data/app/assets/icons/lesli/cloud-team.svg +1 -0
  52. data/app/assets/icons/lesli/cloud-time.svg +1 -0
  53. data/app/assets/icons/lesli/cloud-vault.svg +1 -0
  54. data/app/assets/icons/lesli/cloud-word.svg +1 -0
  55. data/app/assets/icons/lesli/icon-module.svg +1 -0
  56. data/app/assets/icons/lesli/logo-android.svg +1 -0
  57. data/app/assets/icons/lesli/logo-bulma.svg +1 -0
  58. data/app/assets/icons/lesli/logo-ios.svg +1 -0
  59. data/app/assets/icons/lesli/logo-linux.svg +1 -0
  60. data/app/assets/icons/lesli/logo-mac.svg +1 -0
  61. data/app/assets/icons/lesli/logo-module.svg +1 -0
  62. data/app/assets/icons/lesli/logo-postgresql.svg +1 -0
  63. data/app/assets/icons/lesli/logo-rails.svg +1 -0
  64. data/app/assets/icons/lesli/logo-ruby.svg +1 -0
  65. data/app/assets/icons/lesli/logo-sass.svg +1 -0
  66. data/app/assets/icons/lesli/logo-vue.svg +1 -0
  67. data/app/assets/icons/lesli/logo-web.svg +1 -0
  68. data/app/assets/icons/lesli/logo-windows.svg +1 -0
  69. data/app/assets/icons/readme.md +10 -0
  70. data/app/assets/images/lesli/brand/app-auth.svg +9 -0
  71. data/app/assets/images/lesli/brand/app-icon.svg +42 -0
  72. data/app/assets/images/lesli/brand/app-logo.svg +4 -0
  73. data/app/assets/images/lesli/brand/favicon.png +0 -0
  74. data/app/assets/images/lesli/brand/favicon.svg +61 -0
  75. data/app/assets/images/lesli/brand/login-background.jpg +0 -0
  76. data/app/assets/javascripts/lesli/users/sessions.js +786 -0
  77. data/app/assets/stylesheets/lesli/users/confirmations.scss +34 -0
  78. data/app/assets/stylesheets/lesli/users/devise.scss +32 -0
  79. data/app/assets/stylesheets/lesli/users/oauth.scss +34 -0
  80. data/app/assets/stylesheets/lesli/users/passwords.scss +34 -0
  81. data/app/assets/stylesheets/lesli/users/registrations.scss +34 -0
  82. data/app/assets/stylesheets/lesli/users/sessions.scss +38 -0
  83. data/app/controllers/lesli/application_controller.rb +108 -0
  84. data/app/controllers/lesli/application_devise_controller.rb +54 -0
  85. data/app/controllers/lesli/application_lesli_controller.rb +61 -0
  86. data/app/controllers/lesli/interfaces/application/authorization.rb +107 -0
  87. data/app/controllers/lesli/interfaces/application/customization.rb +46 -0
  88. data/app/controllers/lesli/interfaces/application/logger.rb +133 -0
  89. data/app/controllers/lesli/interfaces/application/requester.rb +84 -0
  90. data/app/controllers/lesli/interfaces/application/responder.rb +132 -0
  91. data/app/controllers/lesli/profiles_controller.rb +60 -0
  92. data/app/controllers/users/confirmations_controller.rb +30 -0
  93. data/app/controllers/users/omniauth_callbacks_controller.rb +30 -0
  94. data/app/controllers/users/passwords_controller.rb +34 -0
  95. data/app/controllers/users/registrations_controller.rb +62 -0
  96. data/app/controllers/users/sessions_controller.rb +142 -0
  97. data/app/controllers/users/unlocks_controller.rb +30 -0
  98. data/app/helpers/lesli/assets_helper.rb +92 -0
  99. data/app/helpers/lesli/customization_helper.rb +84 -0
  100. data/app/helpers/lesli/general_helper.rb +83 -0
  101. data/app/helpers/lesli/navigation_helper.rb +349 -0
  102. data/app/helpers/lesli/profiles_helper.rb +4 -0
  103. data/app/helpers/lesli/system_helper.rb +57 -0
  104. data/app/lib/date2.rb +192 -0
  105. data/app/lib/lesli/system.rb +80 -0
  106. data/app/models/concerns/account_engines.rb +249 -0
  107. data/app/models/concerns/user_activities.rb +163 -0
  108. data/app/models/concerns/user_extensions.rb +129 -0
  109. data/app/models/concerns/user_guard.rb +278 -0
  110. data/app/models/concerns/user_polyfill.rb +134 -0
  111. data/app/models/lesli/account/log.rb +57 -0
  112. data/app/models/lesli/account.rb +76 -0
  113. data/app/models/lesli/application_lesli_record.rb +37 -0
  114. data/app/models/lesli/profile.rb +4 -0
  115. data/app/models/lesli/system_controller/action.rb +37 -0
  116. data/app/models/lesli/system_controller.rb +37 -0
  117. data/app/models/lesli/user/agent.rb +37 -0
  118. data/app/models/lesli/user/log.rb +38 -0
  119. data/app/models/lesli/user/request.rb +37 -0
  120. data/app/models/lesli/user/session.rb +105 -0
  121. data/app/models/lesli/user.rb +162 -0
  122. data/app/services/lesli/application_lesli_service.rb +168 -0
  123. data/app/services/lesli/user/session_service.rb +62 -0
  124. data/app/validators/lesli/application_lesli_validator.rb +67 -0
  125. data/app/validators/lesli/users_validator.rb +217 -0
  126. data/app/views/devise/confirmations/new.html.erb +16 -0
  127. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  128. data/app/views/devise/mailer/email_changed.html.erb +7 -0
  129. data/app/views/devise/mailer/password_change.html.erb +3 -0
  130. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  131. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  132. data/app/views/devise/passwords/edit.html.erb +25 -0
  133. data/app/views/devise/passwords/new.html.erb +16 -0
  134. data/app/views/devise/registrations/edit.html.erb +43 -0
  135. data/app/views/devise/registrations/new.html.erb +29 -0
  136. data/app/views/devise/sessions/new.html.erb +178 -0
  137. data/app/views/devise/shared/_error_messages.html.erb +15 -0
  138. data/app/views/devise/shared/_links.html.erb +25 -0
  139. data/app/views/devise/unlocks/new.html.erb +16 -0
  140. data/app/views/lesli/devise/sessions/_form.html.erb +17 -0
  141. data/app/views/lesli/devise/sessions/_session.html.erb +2 -0
  142. data/app/views/lesli/devise/sessions/edit.html.erb +10 -0
  143. data/app/views/lesli/devise/sessions/index.html.erb +14 -0
  144. data/app/views/lesli/devise/sessions/new.html.erb +9 -0
  145. data/app/views/lesli/devise/sessions/show.html.erb +10 -0
  146. data/app/views/lesli/layouts/application-devise.html.erb +58 -0
  147. data/app/views/lesli/layouts/application-lesli.html.erb +57 -0
  148. data/app/views/lesli/layouts/application-public.html.erb +59 -0
  149. data/app/views/lesli/partials/_application-analytics.html.erb +71 -0
  150. data/app/views/lesli/partials/_application-data.html.erb +102 -0
  151. data/app/views/lesli/partials/_application-head.html.erb +56 -0
  152. data/app/views/lesli/partials/_application-lesli-chatbox.html.erb +35 -0
  153. data/app/views/lesli/partials/_application-lesli-content.html.erb +35 -0
  154. data/app/views/lesli/partials/_application-lesli-engines.html.erb +83 -0
  155. data/app/views/lesli/partials/_application-lesli-footer.html.erb +82 -0
  156. data/app/views/lesli/partials/_application-lesli-header.html.erb +79 -0
  157. data/app/views/lesli/partials/_application-lesli-icons.html.erb +1 -0
  158. data/app/views/lesli/partials/_application-lesli-javascript.html.erb +57 -0
  159. data/app/views/lesli/partials/_application-lesli-navigation.html.erb +52 -0
  160. data/app/views/lesli/partials/_application-lesli-notices.html.erb +43 -0
  161. data/app/views/lesli/partials/_application-lesli-panels.html.erb +58 -0
  162. data/app/views/lesli/partials/_application-lesli-scss.html.erb +60 -0
  163. data/app/views/lesli/partials/_application-lesli-sidebar.html.erb +50 -0
  164. data/app/views/lesli/partials/_application-public-footer.html.erb +51 -0
  165. data/app/views/lesli/partials/_application-public-javascript.html.erb +51 -0
  166. data/app/views/lesli/partials/_application-public-scss.html.erb +35 -0
  167. data/app/views/lesli/profiles/_form.html.erb +17 -0
  168. data/app/views/lesli/profiles/_profile.html.erb +2 -0
  169. data/app/views/lesli/profiles/edit.html.erb +10 -0
  170. data/app/views/lesli/profiles/index.html.erb +14 -0
  171. data/app/views/lesli/profiles/new.html.erb +9 -0
  172. data/app/views/lesli/profiles/show.html.erb +10 -0
  173. data/app/views/lesli/wrappers/_application-auth.html.erb +65 -0
  174. data/config/initializers/devise.rb +334 -0
  175. data/config/initializers/lesli_defaults.rb +100 -0
  176. data/config/locales/devise.en.yml +65 -0
  177. data/config/routes.rb +52 -0
  178. data/db/migrate/v1.0/0010000110_create_lesli_accounts.rb +70 -0
  179. data/db/migrate/v1.0/0010000210_create_lesli_roles.rb +59 -0
  180. data/db/migrate/v1.0/0010000310_create_lesli_users.rb +97 -0
  181. data/db/migrate/v1.0/0010000610_create_lesli_system_controllers.rb +44 -0
  182. data/db/migrate/v1.0/0010000710_create_lesli_system_controller_actions.rb +43 -0
  183. data/db/migrate/v1.0/0010001210_create_lesli_account_activities.rb +50 -0
  184. data/db/migrate/v1.0/0010001310_create_lesli_account_logs.rb +45 -0
  185. data/db/migrate/v1.0/0010003210_create_lesli_user_sessions.rb +51 -0
  186. data/db/migrate/v1.0/0010003310_create_lesli_user_requests.rb +48 -0
  187. data/db/migrate/v1.0/0010003610_create_lesli_user_logs.rb +45 -0
  188. data/db/migrate/v1.0/0010004010_create_lesli_user_agents.rb +46 -0
  189. data/db/seed/development/accounts.rb +47 -0
  190. data/db/seed/development/users.rb +53 -0
  191. data/db/seed/development.rb +35 -0
  192. data/db/seed/production.rb +35 -0
  193. data/db/seed/test.rb +35 -0
  194. data/db/seed/tools.rb +60 -0
  195. data/db/seeds.rb +64 -0
  196. data/db/structure/00000000_locations.json +32 -0
  197. data/db/structure/00000000_people.json +34 -0
  198. data/db/structure/00000003_actions.json +14 -0
  199. data/db/structure/00000004_activities.json +20 -0
  200. data/db/structure/00000005_discussions.json +8 -0
  201. data/db/structure/00000006_files.json +32 -0
  202. data/db/structure/00000007_subscribers.json +11 -0
  203. data/db/structure/00000008_custom_fields.json +8 -0
  204. data/db/structure/00000201_workflows.json +17 -0
  205. data/db/structure/00000202_workflow_statuses.json +24 -0
  206. data/db/structure/00000203_workflow_associations.json +14 -0
  207. data/db/structure/00000204_workflow_actions.json +39 -0
  208. data/db/structure/00000205_workflow_checks.json +27 -0
  209. data/db/structure/00000301_custom_fields.json +38 -0
  210. data/db/structure/00000401_custom_validations.json +14 -0
  211. data/db/structure/00000402_custom_validation_rules.json +23 -0
  212. data/db/structure/00000403_custom_validation_fields.json +14 -0
  213. data/db/structure/00000501_dashboards.json +14 -0
  214. data/db/structure/00000502_dashboard_components.json +23 -0
  215. data/db/tables/0010001010_create_account_settings.rb +42 -0
  216. data/db/tables/0010001110_create_account_locations.rb +64 -0
  217. data/db/tables/0010001410_create_account_files.rb +52 -0
  218. data/db/tables/0010001510_create_account_currencies.rb +48 -0
  219. data/db/tables/0010001610_create_account_currency_exchange_rates.rb +54 -0
  220. data/db/tables/0010003010_create_user_details.rb +49 -0
  221. data/db/tables/0010003110_create_user_settings.rb +44 -0
  222. data/db/tables/0010003410_create_user_activities.rb +51 -0
  223. data/db/tables/0010003510_create_user_roles.rb +43 -0
  224. data/db/tables/0010003710_create_user_codes.rb +43 -0
  225. data/db/tables/0010003810_create_user_shortcuts.rb +46 -0
  226. data/db/tables/0010004110_create_user_tokens.rb +45 -0
  227. data/db/tables/0010005010_create_descriptors.rb +45 -0
  228. data/db/tables/0010005110_create_descriptor_privileges.rb +44 -0
  229. data/db/tables/0010005210_create_descriptor_activities.rb +51 -0
  230. data/db/tables/0010005510_create_role_descriptors.rb +44 -0
  231. data/db/tables/0010005610_create_role_activities.rb +50 -0
  232. data/db/tables/0010005710_create_role_privileges.rb +45 -0
  233. data/db/tables/0010009010_create_feedbacks.rb +56 -0
  234. data/lib/assets/javascripts/lesli/i18n.js +1095 -0
  235. data/lib/assets/javascripts/lesli/translations.js +15 -0
  236. data/lib/lesli/configuration.rb +45 -0
  237. data/lib/lesli/engine.rb +62 -0
  238. data/lib/lesli/version.rb +34 -0
  239. data/lib/lesli.rb +6 -0
  240. data/lib/sass/lesli/bulma/loader.scss +84 -0
  241. data/lib/sass/lesli/cloud-objects/discussion.scss +77 -0
  242. data/lib/sass/lesli/cloud-objects/file.scss +138 -0
  243. data/lib/sass/lesli/components/editor-richtext.scss +78 -0
  244. data/lib/sass/lesli/components/keypad.scss +109 -0
  245. data/lib/sass/lesli/devise/confirmations.scss.erb +75 -0
  246. data/lib/sass/lesli/devise/passwords.scss.erb +86 -0
  247. data/lib/sass/lesli/devise/registrations.scss.erb +50 -0
  248. data/lib/sass/lesli/devise/sessions.scss +36 -0
  249. data/lib/sass/lesli/elements/autocomplete.scss +72 -0
  250. data/lib/sass/lesli/elements/avatar.scss +48 -0
  251. data/lib/sass/lesli/elements/calendar.scss +47 -0
  252. data/lib/sass/lesli/elements/card.scss +37 -0
  253. data/lib/sass/lesli/elements/content.scss +37 -0
  254. data/lib/sass/lesli/elements/empty.scss +43 -0
  255. data/lib/sass/lesli/elements/file-uploader.scss +74 -0
  256. data/lib/sass/lesli/elements/form.scss +43 -0
  257. data/lib/sass/lesli/elements/gallery.scss +98 -0
  258. data/lib/sass/lesli/elements/header.scss +44 -0
  259. data/lib/sass/lesli/elements/input-tag.scss +73 -0
  260. data/lib/sass/lesli/elements/loading.scss +63 -0
  261. data/lib/sass/lesli/elements/map.scss +107 -0
  262. data/lib/sass/lesli/elements/msg.scss +77 -0
  263. data/lib/sass/lesli/elements/navbar.scss +115 -0
  264. data/lib/sass/lesli/elements/panel.scss +65 -0
  265. data/lib/sass/lesli/elements/tab.scss +48 -0
  266. data/lib/sass/lesli/elements/table.scss +118 -0
  267. data/lib/sass/lesli/elements/toggle.scss +102 -0
  268. data/lib/sass/lesli/elements/toolbar.scss +66 -0
  269. data/lib/sass/lesli/fonts/families.scss +47 -0
  270. data/lib/sass/lesli/fonts/mdicons.scss +84 -0
  271. data/lib/sass/lesli/fonts/remixicons.scss +2602 -0
  272. data/lib/sass/lesli/helpers/display.scss +44 -0
  273. data/lib/sass/lesli/helpers/tooltip.scss +91 -0
  274. data/lib/sass/lesli/layouts/application-announcements.scss +40 -0
  275. data/lib/sass/lesli/layouts/application-component.scss +50 -0
  276. data/lib/sass/lesli/layouts/application-engines.scss +155 -0
  277. data/lib/sass/lesli/layouts/application-footer.scss +102 -0
  278. data/lib/sass/lesli/layouts/application-header.scss +152 -0
  279. data/lib/sass/lesli/layouts/application-navbar.scss +61 -0
  280. data/lib/sass/lesli/layouts/application-search.scss +71 -0
  281. data/lib/sass/lesli/layouts/application-sidebar.scss +219 -0
  282. data/lib/sass/lesli/overrides/sweetalert.scss +106 -0
  283. data/lib/sass/lesli/pages/dashboards.scss +57 -0
  284. data/lib/sass/lesli/pages/invites.scss +81 -0
  285. data/lib/sass/lesli/pages/mfas.scss +36 -0
  286. data/lib/sass/lesli/pages/otps.scss +36 -0
  287. data/lib/sass/lesli/pages/passes.scss +35 -0
  288. data/lib/sass/lesli/panels/panel-announcements.scss +56 -0
  289. data/lib/sass/lesli/panels/panel-notification.scss +67 -0
  290. data/lib/sass/lesli/panels/panel-profile.scss +62 -0
  291. data/lib/sass/lesli/panels/panel-tasks.scss +41 -0
  292. data/lib/sass/lesli/panels/panel-ticket.scss +57 -0
  293. data/lib/sass/lesli/settings/variables.scss +148 -0
  294. data/lib/sass/lesli/shared/workflow-status-progress.scss +135 -0
  295. data/lib/sass/lesli/templates/application.scss +141 -0
  296. data/lib/sass/lesli/templates/dashboards.scss +32 -0
  297. data/lib/sass/lesli/templates/devise.scss +185 -0
  298. data/lib/sass/lesli/templates/empty.scss +42 -0
  299. data/lib/sass/lesli/templates/pdf.scss +45 -0
  300. data/lib/sass/lesli/templates/public.scss +71 -0
  301. data/lib/tasks/db.rb +75 -0
  302. data/lib/tasks/lesli/controllers.rake +103 -0
  303. data/lib/tasks/lesli_tasks.rake +23 -0
  304. data/lib/vue/application.js +269 -0
  305. data/lib/vue/apps/cloudobjects/action.vue +193 -0
  306. data/lib/vue/apps/cloudobjects/discussion/content.vue +60 -0
  307. data/lib/vue/apps/cloudobjects/discussion/element.vue +132 -0
  308. data/lib/vue/apps/cloudobjects/discussion/filters.vue +108 -0
  309. data/lib/vue/apps/cloudobjects/discussion/new.vue +130 -0
  310. data/lib/vue/apps/cloudobjects/discussion.vue +98 -0
  311. data/lib/vue/apps/cloudobjects/file/grid.vue +215 -0
  312. data/lib/vue/apps/cloudobjects/file/list.vue +106 -0
  313. data/lib/vue/apps/cloudobjects/file.vue +145 -0
  314. data/lib/vue/apps/dashboards/apps/edit.vue +105 -0
  315. data/lib/vue/apps/dashboards/apps/index.vue +114 -0
  316. data/lib/vue/apps/dashboards/apps/new.vue +89 -0
  317. data/lib/vue/apps/dashboards/apps/show.vue +76 -0
  318. data/lib/vue/apps/dashboards/components/form.vue +267 -0
  319. data/lib/vue/apps/dashboards/components/preview.vue +172 -0
  320. data/lib/vue/apps/workflows2/apps/actions/form.vue +232 -0
  321. data/lib/vue/apps/workflows2/apps/actions/forms/chatroom-form.vue +103 -0
  322. data/lib/vue/apps/workflows2/apps/actions/forms/cloud-object-clone-form.vue +125 -0
  323. data/lib/vue/apps/workflows2/apps/actions/forms/cloud-object-file-form.vue +102 -0
  324. data/lib/vue/apps/workflows2/apps/actions/forms/email-form.vue +190 -0
  325. data/lib/vue/apps/workflows2/apps/actions/forms/notification-form.vue +124 -0
  326. data/lib/vue/apps/workflows2/apps/actions/forms/send-cloud-object-file.vue +170 -0
  327. data/lib/vue/apps/workflows2/apps/actions/forms/task-form.vue +258 -0
  328. data/lib/vue/apps/workflows2/apps/actions/index.vue +146 -0
  329. data/lib/vue/apps/workflows2/apps/checks/form.vue +200 -0
  330. data/lib/vue/apps/workflows2/apps/checks/index.vue +160 -0
  331. data/lib/vue/apps/workflows2/apps/index.vue +177 -0
  332. data/lib/vue/apps/workflows2/apps/new.vue +97 -0
  333. data/lib/vue/apps/workflows2/apps/show.vue +146 -0
  334. data/lib/vue/apps/workflows2/components/associations.vue +215 -0
  335. data/lib/vue/apps/workflows2/components/chart.vue +91 -0
  336. data/lib/vue/apps/workflows2/components/workflow-form.vue +466 -0
  337. data/lib/vue/apps/workflows2/components/workflow-status-dropdown.vue +129 -0
  338. data/lib/vue/devise/confirmations.js +33 -0
  339. data/lib/vue/devise/passwords.js +137 -0
  340. data/lib/vue/devise/registrations.js +162 -0
  341. data/lib/vue/devise/sessions.js +143 -0
  342. data/lib/vue/layouts/application-announcements.vue +78 -0
  343. data/lib/vue/layouts/application-engines.vue +66 -0
  344. data/lib/vue/layouts/application-footer.vue +123 -0
  345. data/lib/vue/layouts/application-header.vue +213 -0
  346. data/lib/vue/layouts/application-navbar.vue +110 -0
  347. data/lib/vue/layouts/application-search.vue +86 -0
  348. data/lib/vue/layouts/application-sidebar.vue +63 -0
  349. data/lib/vue/layouts/dashboard-component.vue +62 -0
  350. data/lib/vue/pages/errors/app.js +32 -0
  351. data/lib/vue/pages/invites/app.js +76 -0
  352. data/lib/vue/pages/mfas/application.js +77 -0
  353. data/lib/vue/pages/onboarding/application.js +45 -0
  354. data/lib/vue/pages/onboarding/components/address.vue +120 -0
  355. data/lib/vue/pages/onboarding/components/buttons.vue +67 -0
  356. data/lib/vue/pages/onboarding/components/contact.vue +148 -0
  357. data/lib/vue/pages/onboarding/components/date-time.vue +265 -0
  358. data/lib/vue/pages/onboarding/components/finish.vue +62 -0
  359. data/lib/vue/pages/onboarding/components/general-info.vue +93 -0
  360. data/lib/vue/pages/onboarding/components/indicators.vue +78 -0
  361. data/lib/vue/pages/onboarding/components/welcome.vue +66 -0
  362. data/lib/vue/pages/onboarding/show.vue +67 -0
  363. data/lib/vue/pages/onboarding/store.js +165 -0
  364. data/lib/vue/pages/otps/application.js +90 -0
  365. data/lib/vue/pages/passes/application.js +80 -0
  366. data/lib/vue/pages/websites/application.js +34 -0
  367. data/lib/vue/panels/panel-announcements.vue +248 -0
  368. data/lib/vue/panels/panel-files.vue +281 -0
  369. data/lib/vue/panels/panel-notifications.vue +106 -0
  370. data/lib/vue/panels/panel-profile.vue +76 -0
  371. data/lib/vue/panels/panel-tasks.vue +124 -0
  372. data/lib/vue/panels/panel-tickets.vue +181 -0
  373. data/lib/vue/public.js +85 -0
  374. data/lib/vue/stores/announcements.js +75 -0
  375. data/lib/vue/stores/cloud-bell/notification.js +114 -0
  376. data/lib/vue/stores/cloudobjects/action.js +181 -0
  377. data/lib/vue/stores/cloudobjects/discussion.js +221 -0
  378. data/lib/vue/stores/cloudobjects/file.js +205 -0
  379. data/lib/vue/stores/dashboard.js +251 -0
  380. data/lib/vue/stores/firebase.js +163 -0
  381. data/lib/vue/stores/layout.js +60 -0
  382. data/lib/vue/stores/panels/announcements.js +153 -0
  383. data/lib/vue/stores/panels/task.js +66 -0
  384. data/lib/vue/stores/panels/tickets.js +129 -0
  385. data/lib/vue/stores/profile.js +90 -0
  386. data/lib/vue/stores/search.js +154 -0
  387. data/lib/vue/stores/services/translator.js +87 -0
  388. data/lib/vue/stores/workflow.js +185 -0
  389. data/lib/vue/stores/workflow2.js +345 -0
  390. data/lib/vue/stores/workflows/actions.js +327 -0
  391. data/lib/vue/stores/workflows/associations.js +130 -0
  392. data/lib/vue/stores/workflows/checks.js +210 -0
  393. data/lib/webpack/base.js +182 -0
  394. data/lib/webpack/core.js +80 -0
  395. data/lib/webpack/engines.js +162 -0
  396. data/license +674 -0
  397. data/readme.md +120 -0
  398. metadata +554 -0
@@ -0,0 +1,269 @@
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 Framework.
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
+ // · Loading core framework and libraries
34
+ import { createPinia } from "pinia"
35
+ import { createApp, nextTick } from "vue"
36
+ import { createWebHistory, createRouter } from "vue-router";
37
+ import debug from "lesli-js/debug/browser"
38
+
39
+
40
+ // custom console.log implementation for Lesli
41
+ window.debug = debug
42
+
43
+
44
+ // · Loading application layout components
45
+ import componentApplicationHeader from "Lesli/layouts/application-header.vue"
46
+ import componentApplicationEngines from "Lesli/layouts/application-engines.vue"
47
+ /*
48
+ import componentApplicationFooter from "Lesli/layouts/application-footer.vue"
49
+ import componentApplicationSearch from "Lesli/layouts/application-search.vue"
50
+ import componentApplicationSidebar from "Lesli/layouts/application-sidebar.vue"
51
+
52
+ import componentApplicationAnnouncement from "Lesli/layouts/application-announcements.vue"
53
+
54
+ import componentApplicationPanelTasks from "Lesli/panels/panel-tasks.vue"
55
+ import componentApplicationPanelFiles from "Lesli/panels/panel-files.vue"
56
+ import componentApplicationPanelTickets from "Lesli/panels/panel-tickets.vue"
57
+ import componentApplicationPanelProfile from "Lesli/panels/panel-profile.vue"
58
+ import componentApplicationPanelNotifications from "Lesli/panels/panel-notifications.vue"
59
+ import componentApplicationPanelAnnouncements from "Lesli/panels/panel-announcements.vue"
60
+ */
61
+
62
+ // · Loading global layout components
63
+ import {
64
+ lesliElementApplication,
65
+ lesliElementAutocomplete,
66
+ lesliElementAvatar,
67
+ lesliElementButton,
68
+ lesliElementCalendar,
69
+ lesliElementCard,
70
+ lesliElementCollapse,
71
+ lesliElementContent,
72
+ lesliElementControl,
73
+ lesliElementDropdown,
74
+ lesliElementEmpty,
75
+ lesliElementForm,
76
+ lesliElementHeader,
77
+ lesliElementIcon,
78
+ lesliElementInput,
79
+ lesliElementInputTag,
80
+ lesliElementLink,
81
+ lesliElementLoading,
82
+ lesliElementMap,
83
+ lesliElementNavbar,
84
+ lesliElementFileUploader,
85
+ lesliElementNavigationList,
86
+ lesliElementPagination,
87
+ lesliElementPanel,
88
+ lesliElementSelect,
89
+ lesliElementTable,
90
+ lesliElementTabs,
91
+ lesliElementTabItem,
92
+ lesliElementToggle,
93
+ lesliElementToolbar
94
+ } from "lesli-vue/elements"
95
+
96
+
97
+
98
+ // · Loading vue/pinia plugins as composables
99
+ import {
100
+ useLesliMsg,
101
+ useLesliUrl,
102
+ useLesliDate,
103
+ useLesliHttp,
104
+ useLesliUtils,
105
+ useLesliDialog
106
+ } from "lesli-vue/composables"
107
+
108
+
109
+
110
+
111
+ // · engine: List of controllers apps loaded
112
+ // · routes: Array of routes for Vue
113
+ // · example: app("CloudAudit", [])
114
+ export default (engine, routes=[]) => {
115
+
116
+ // · Base path for the engines/core url's
117
+ const base_path = "/";
118
+
119
+
120
+ // · Vue app configuration container
121
+ let appbuilder = { }
122
+
123
+
124
+ // · Loading Lesli local layout components
125
+ appbuilder["components"] = {
126
+ "application-component-header": componentApplicationHeader,
127
+ "application-component-engines": componentApplicationEngines,
128
+ /*
129
+ "application-component-footer": componentApplicationFooter,
130
+ "application-component-search": componentApplicationSearch,
131
+ "application-component-sidebar": componentApplicationSidebar,
132
+ "application-component-announcements": componentApplicationAnnouncement,
133
+ "application-component-panel-tasks": componentApplicationPanelTasks,
134
+ "application-component-panel-files": componentApplicationPanelFiles,
135
+ "application-component-panel-tickets": componentApplicationPanelTickets,
136
+ "application-component-panel-profile": componentApplicationPanelProfile,
137
+ "application-component-panel-announcements": componentApplicationPanelAnnouncements,
138
+ "application-component-panel-notifications": componentApplicationPanelNotifications
139
+ */
140
+ }
141
+
142
+
143
+ // · Use pinia as app state management
144
+ const pinia = createPinia()
145
+
146
+
147
+ // · Loading pinia handmade plugins
148
+ pinia.use(() => ({ msg: useLesliMsg() }))
149
+ pinia.use(() => ({ url: useLesliUrl() }))
150
+ pinia.use(() => ({ http: useLesliHttp() }))
151
+ pinia.use(() => ({ date: useLesliDate() }))
152
+ pinia.use(() => ({ utils: useLesliUtils() }))
153
+ pinia.use(() => ({ dialog: useLesliDialog() }))
154
+
155
+
156
+ // · Global vue router
157
+ var router = createRouter({
158
+ history: createWebHistory(base_path),
159
+ routes: routes.map(route => {
160
+ // concat the base path to all routes
161
+ // this allow to use the rails route constants
162
+ // example: projects_path is equal to /crm/projects
163
+ route.path = base_path.concat(lesli.engine_paths[engine]).concat(route.path)
164
+ return route
165
+ })
166
+ })
167
+
168
+
169
+ // ·
170
+ router.afterEach((to, from) => {
171
+
172
+ // Use next tick to handle router history correctly
173
+ nextTick(() => {
174
+
175
+ // update the page title according to the working app
176
+ document.title = `${lesli?.company?.name} · ${(to.path.substring(1) || 'Dashboard')}`;
177
+
178
+ // default class for the specific instance
179
+ document.body.className = lesli?.instance
180
+
181
+ // using the path as class id for the body
182
+ // the class will be: "engine-controller"
183
+ var cssclass = to.path
184
+ .substring(1) // remove the first slash
185
+ .split("/") // create an array splited by slashes
186
+ .filter(e => e != "") // remove empty strings
187
+ .slice(0, 2) // get the first two items of the array
188
+ .join("-"); // create a string joined by dashes
189
+
190
+ // add the css class to the body
191
+ if (cssclass) { document.body.classList.add("cloud_".concat(cssclass)) }
192
+
193
+ })
194
+ })
195
+
196
+
197
+ // · Create a beautiful Vue 3 app
198
+ let app = createApp(appbuilder)
199
+
200
+
201
+ // · Provide composables to make them available in all the components
202
+ app.provide('msg', useLesliMsg())
203
+ app.provide('url', useLesliUrl())
204
+ app.provide('http', useLesliHttp())
205
+ app.provide('date', useLesliDate())
206
+ app.provide('date', useLesliDate())
207
+ app.provide('utils', useLesliUtils())
208
+ app.provide('dialog', useLesliDialog())
209
+
210
+
211
+ // · Extending vue
212
+ app.use(pinia)
213
+ app.use(router)
214
+
215
+
216
+ // · Loading Lesli handmade global components
217
+ app.component("lesli-application", lesliElementApplication)
218
+ app.component("lesli-icon", lesliElementIcon)
219
+ app.component("lesli-empty", lesliElementEmpty)
220
+ app.component("lesli-header", lesliElementHeader)
221
+ app.component("lesli-select", lesliElementSelect)
222
+ app.component("lesli-toolbar", lesliElementToolbar)
223
+ app.component("lesli-loading", lesliElementLoading)
224
+ app.component("lesli-table", lesliElementTable)
225
+ app.component("lesli-collapse", lesliElementCollapse)
226
+ app.component("lesli-tab-item", lesliElementTabItem)
227
+ app.component("lesli-tabs", lesliElementTabs)
228
+ app.component("lesli-panel", lesliElementPanel)
229
+ app.component("lesli-button", lesliElementButton)
230
+ app.component("lesli-calendar", lesliElementCalendar)
231
+ app.component("lesli-input-tag", lesliElementInputTag)
232
+ app.component("lesli-file-uploader", lesliElementFileUploader)
233
+ app.component("lesli-navigation-list", lesliElementNavigationList)
234
+ app.component("lesli-avatar", lesliElementAvatar)
235
+ app.component("lesli-toggle", lesliElementToggle)
236
+ app.component("lesli-dropdown", lesliElementDropdown)
237
+ app.component("lesli-map", lesliElementMap)
238
+ //app.component("lesli-gallery", lesliElementGallery)
239
+ app.component("lesli-autocomplete", lesliElementAutocomplete)
240
+ app.component("lesli-pagination", lesliElementPagination)
241
+ app.component("lesli-form", lesliElementForm)
242
+ app.component("lesli-input", lesliElementInput)
243
+ app.component("lesli-control", lesliElementControl)
244
+ app.component("lesli-card", lesliElementCard)
245
+ app.component("lesli-content", lesliElementContent)
246
+
247
+
248
+ // · Mount app once DOM is ready
249
+ document.addEventListener("DOMContentLoaded", () => {
250
+
251
+ // · mount the app on the main html tag
252
+ app.mount("#lesli-application")
253
+
254
+ // · development message about vue app loaded
255
+ if (lesli_application_development) {
256
+ debug.info(`${engine} --> ${lesli.engine_paths[engine]}`, "vue/application")
257
+ }
258
+
259
+ // · console production message
260
+ if (lesli_application_production) {
261
+ console.clear()
262
+ debug.lesli_message_warning(lesli?.company?.name)
263
+ debug.info("Lesli application", lesli_application_version)
264
+ }
265
+
266
+ });
267
+
268
+ return app;
269
+ }
@@ -0,0 +1,193 @@
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 { onMounted } from "vue"
38
+
39
+ // · import store
40
+ import { useCloudObjectAction } from "Lesli/stores/cloud-objects/action"
41
+
42
+ // · import components
43
+
44
+
45
+ // · defining translations
46
+ const translations = {
47
+ core: I18n.t('core.shared')
48
+ }
49
+
50
+ // · implement store
51
+ const actionStore = useCloudObjectAction()
52
+
53
+ // · defining props
54
+ const props = defineProps({
55
+ // · prop that indicates the cloud module that will be used for interacting with the backend.
56
+ cloudModule: {
57
+ type: String,
58
+ required: true,
59
+ },
60
+ // · prop that indicates the resource that you need to interact with.
61
+ cloudObject: {
62
+ type: String,
63
+ required: true,
64
+ },
65
+ // · prop that indicates the object id of the resource that you need to interact with.
66
+ cloudObjectId: {
67
+ type: String,
68
+ required: true,
69
+ }
70
+ })
71
+
72
+ actionStore.cloudModule = props.cloudModule
73
+ actionStore.cloudObject = props.cloudObject
74
+ actionStore.cloudObjectId = props.cloudObjectId
75
+
76
+ function completedActions(group){
77
+ return group.actions.filter(action => action.complete).length
78
+ }
79
+
80
+
81
+ onMounted(() => {
82
+ actionStore.getActions()
83
+ })
84
+
85
+ </script>
86
+
87
+ <template>
88
+ <h2 class=" title is-4">
89
+ {{ translations.core.view_text_quick_actions }}
90
+ </h2>
91
+
92
+ <form @submit.prevent="actionStore.createGroup">
93
+ <fieldset>
94
+ <div class="columns">
95
+ <div class="column is-10">
96
+ <div class="field">
97
+ <label class="label">{{ translations.core.view_text_cloud_object_actions_add_new_group }}<sup class="has-text-danger">*</sup></label>
98
+ <div class="control">
99
+ <input class="input" type="text" v-model="actionStore.new_group_name" required>
100
+ </div>
101
+ </div>
102
+ </div>
103
+
104
+ <div class="column is-2">
105
+ <div class="field">
106
+ <label class="label">&nbsp;</label>
107
+ <div class="control">
108
+ <lesli-button icon="add">
109
+ {{ translations.core.view_btn_add }}
110
+ </lesli-button>
111
+ </div>
112
+ </div>
113
+ </div>
114
+
115
+ </div>
116
+ </fieldset>
117
+ </form>
118
+
119
+ <hr>
120
+
121
+ <div class="columns is-multiline">
122
+
123
+ <div class="column is-6" v-for="(group, name, index) in actionStore.actions_groups" :key="name">
124
+
125
+ <div class="card">
126
+ <div
127
+ :class="['card-header', {'has-text-success': completedActions(group) == group.actions.length}]"
128
+ role="button"
129
+ :aria-controls="`action-group-${index}`"
130
+ >
131
+ <p class="card-header-title">
132
+ {{name}}
133
+ </p>
134
+ <a class="card-header-icon">
135
+ <span>{{completedActions(group)}}/{{group.actions.length}}</span>
136
+ &nbsp;
137
+ <span class="icon">
138
+ <span class="material-icons">check_box</span>
139
+ </span>
140
+ </a>
141
+ </div>
142
+
143
+ <div class="card-content">
144
+ <div class="content">
145
+ <form @submit.prevent="actionStore.createAction(name)">
146
+ <fieldset>
147
+ <div class="columns">
148
+ <div class="column is-10">
149
+ <div class="field">
150
+ <label class="label">{{ translations.core.view_text_cloud_object_actions_add_new }}<sup class="has-text-danger">*</sup></label>
151
+ <div class="control">
152
+ <input class="input" type="text" required v-model="group.new_action.instructions">
153
+ </div>
154
+ </div>
155
+ </div>
156
+
157
+ <div class="column is-2">
158
+ <div class="field">
159
+ <label class="label">&nbsp;</label>
160
+ <div class="control">
161
+ <lesli-button icon="add">
162
+ {{ translations.core.view_btn_add }}
163
+ </lesli-button>
164
+ </div>
165
+ </div>
166
+ </div>
167
+
168
+ </div>
169
+ </fieldset>
170
+ </form>
171
+ <hr>
172
+
173
+ <div class="panel-block is-justify-content-space-between" v-for="(action, index) in group.actions" :key="index">
174
+ <div class="is-pulled-left">
175
+
176
+ <input type="checkbox" v-model="action.complete" @input="actionStore.putAction(action)">{{action.instructions}}
177
+ <br>
178
+ <sub><small>{{action.user_creator_name}} - {{action.created_at_text}}</small></sub>
179
+ </div>
180
+ <div class="is-pulled-right">
181
+ <button v-if="! action.submitting" class="delete is-small" @click="actionStore.deleteAction(name, action)"></button>
182
+ </div>
183
+ </div>
184
+
185
+ </div>
186
+ </div>
187
+ </div>
188
+
189
+ </div>
190
+ </div>
191
+
192
+
193
+ </template>
@@ -0,0 +1,60 @@
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 store
37
+ import { useCloudObjectDiscussionStore } from "Lesli/cloudobjects/stores/discussion"
38
+
39
+ import DiscussionElement from "Lesli/cloudobjects/components/discussion/element.vue"
40
+
41
+ const discussionStore = useCloudObjectDiscussionStore()
42
+
43
+ </script>
44
+
45
+ <template>
46
+ <div class="discussion-content mt-6">
47
+ <discussion-element v-for="discussion in discussionStore.mergedArray" :key="discussion.id" :discussion="discussion">
48
+ <template v-slot:replies>
49
+ <!-- Discussion responses -->
50
+ <div class="pl-2 pb-4" v-if="discussion.type === 'discussion'">
51
+ <discussion-element v-for="response in discussion.responses" :key="response.id" :discussion="response" is-reply></discussion-element>
52
+ </div>
53
+ </template>
54
+ </discussion-element>
55
+ <lesli-pagination
56
+ :pagination="discussionStore.pagination"
57
+ @paginate="discussionStore.paginateDiscussions">
58
+ </lesli-pagination>
59
+ </div>
60
+ </template>
@@ -0,0 +1,132 @@
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 { computed, ref } from "vue"
38
+
39
+ // · import components
40
+ import NewComment from "Lesli/cloudobjects/components/discussion/new.vue"
41
+
42
+ // · import store
43
+ import { useCloudObjectDiscussionStore } from "Lesli/cloudobjects/stores/discussion"
44
+
45
+ const props = defineProps({
46
+ // · the discussion or activity log that will be displayed.
47
+ discussion: {
48
+ type: Object,
49
+ required: true,
50
+ },
51
+ isReply: {
52
+ type: Boolean,
53
+ default: false,
54
+ },
55
+ });
56
+
57
+ const translations = {
58
+ core: {
59
+ shared: I18n.t("core.shared"),
60
+ }
61
+ }
62
+
63
+ // · this variable is used to show the reply form.
64
+ const isReplyActive = ref(false)
65
+
66
+ // · implement store
67
+ const discussionStore = useCloudObjectDiscussionStore()
68
+
69
+ // · computed property that returns the discussion or activity log content that will be displayed in the component's element.
70
+ const getDiscussionContent = computed(() => {
71
+
72
+ if (props.discussion.type === 'activityLog' && props.discussion?.category == 'action_create_notification') return `${props.discussion.description}`
73
+
74
+ if (props.discussion.type === 'activityLog') return `${props.discussion.field_name}: (${props.discussion.value_from}) - (${props.discussion.value_to})`
75
+
76
+ if (props.discussion.type === 'discussion' || props.isReply) return props.discussion.content
77
+ })
78
+
79
+ /**
80
+ * @description This function is called when user clicks on discussion's delete button.
81
+ */
82
+ const onDeleteDiscussion = () => {
83
+ discussionStore.deleteDiscussion(props.discussion.id)
84
+ }
85
+
86
+ /**
87
+ * @description This function shows and hides the reply form.
88
+ */
89
+ const showReply = () => {
90
+ isReplyActive.value = !isReplyActive.value
91
+ }
92
+ </script>
93
+
94
+ <template>
95
+ <div class="discussion-content">
96
+ <div class="discussion-content-item pt-4 px-4">
97
+ <div class="avatar mr-4">
98
+ <lesli-avatar :name="props.discussion.user_name"/>
99
+ </div>
100
+ <div class="info mt-2">
101
+ <!-- Discussion's header -->
102
+ <p>
103
+ <span class="has-text-weight-bold">{{ props.discussion.user_name }}</span>
104
+ <span v-if="props.discussion.type !== 'discussion'" class="ml-4">{{ props.discussion.category }}</span>
105
+ </p>
106
+
107
+
108
+ <!-- Discussion's content -->
109
+ <p class="mt-2 has-text-weight-bold">{{ getDiscussionContent }}</p>
110
+
111
+ <!-- Discussion's footer -->
112
+ <div class="mt-4 pb-2 is-flex is-align-items-center">
113
+ <span class="mr-6">{{ props.discussion.created_at }}</span>
114
+ <template v-if="props.discussion.type === 'discussion' || props.isReply">
115
+ <button @click="onDeleteDiscussion" v-if="discussionStore.currentUserId === discussion.users_id" class="is-transparent button mr-4 has-text-weight-bold has-text-danger">
116
+ {{ translations.core.shared.view_btn_delete }}
117
+ </button>
118
+ <button @click="showReply" v-if="!props.isReply" class="is-transparent button has-text-weight-bold has-text-primary">
119
+ {{ translations.core.shared.view_btn_reply }}
120
+ </button>
121
+ </template>
122
+ </div>
123
+
124
+ <!-- Reply component to answer a discussion -->
125
+ <new-comment is-reply v-if="isReplyActive" :main-discussion="props.discussion" @on-add-comment="showReply"></new-comment>
126
+
127
+ <!-- Replies are defined in the content component -->
128
+ <slot name="replies"></slot>
129
+ </div>
130
+ </div>
131
+ </div>
132
+ </template>